PerfPeriodList.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <?php
  2. namespace backendApi\modules\v1\models\lists\bonus;
  3. use common\helpers\Cache;
  4. use common\models\PerfMonth;
  5. use common\models\PerfPeriod;
  6. use common\models\User as modelUser;
  7. use common\libs\dataList\column\Price;
  8. use common\libs\dataList\DataListInterface;
  9. use common\libs\dataList\column\DateTime;
  10. use Yii;
  11. class PerfPeriodList extends \common\libs\dataList\DataList implements DataListInterface
  12. {
  13. /**
  14. * 列表名称
  15. * @return string
  16. */
  17. public function getListName(){
  18. return '期业绩列表';
  19. }
  20. /**
  21. * 列表筛选到的数据
  22. * @throws \yii\base\Exception
  23. */
  24. public function dataHandle()
  25. {
  26. $data = PerfPeriod::lists($this->condition, $this->params, [
  27. 'select'=>'PP.*, U.USER_NAME, U.REAL_NAME',
  28. 'from' => PerfPeriod::tableName().' AS PP',
  29. 'join' => [
  30. ['LEFT JOIN', modelUser::tableName() . ' AS U', 'U.ID=PP.USER_ID'],
  31. ],
  32. 'orderBy' => 'PP.ID DESC',
  33. 'page' => $this->page,
  34. 'pageSize' => $this->pageSize,
  35. ]);
  36. $this->listData = $data;
  37. }
  38. /**
  39. * 要展示和导出的所有字段
  40. * @return array
  41. */
  42. public function getColumn(){
  43. if(!$this->columns){
  44. $this->columns = [
  45. 'PERIOD_NUM' => [
  46. 'header' => 'Number Of Periods', // 期数
  47. 'headerOther' => [
  48. 'width' => '140',
  49. ],
  50. ],
  51. 'USER_NAME' => [
  52. 'header' => 'Member Code', // 会员编号
  53. 'headerOther' => [
  54. 'width' => '110',
  55. ],
  56. ],
  57. 'REAL_NAME' => [
  58. 'header' => 'Member Name', // 会员姓名
  59. 'headerOther' => [
  60. 'width' => '150',
  61. ],
  62. ],
  63. 'PV_PCS' => [
  64. 'header' => 'Personal Performance', // 个人业绩
  65. 'headerOther' => [
  66. 'width' => '160',
  67. ],
  68. 'value' => function($row) {
  69. return (new Price([
  70. 'value' => $row['PV_PCS'],
  71. ]))->result();
  72. },
  73. ],
  74. 'PV_PCS_ZC' => [
  75. 'header' => 'Declaration Performance', // 报单业绩
  76. 'headerOther' => [
  77. 'width' => '180',
  78. ],
  79. 'value' => function($row) {
  80. return (new Price([
  81. 'value' => $row['PV_PCS_ZC'],
  82. ]))->result();
  83. },
  84. ],
  85. 'PV_PCS_FX' => [
  86. 'header' => 'Cancellation Performance', // 复消业绩
  87. 'headerOther' => [
  88. 'width' => '190',
  89. ],
  90. 'value' => function($row) {
  91. return (new Price([
  92. 'value' => $row['PV_PCS_FX'],
  93. ]))->result();
  94. },
  95. ],
  96. 'PV_1L' => [
  97. 'header' => 'L. New Market Performance', // 一市场新增业绩
  98. 'headerOther' => [
  99. 'width' => '200',
  100. ],
  101. 'value' => function($row) {
  102. return (new Price([
  103. 'value' => $row['PV_1L'],
  104. ]))->result();
  105. },
  106. ],
  107. 'PV_1L_ZC' => [
  108. 'header' => 'L. New Performance Of Market Entry', // 一市场报单新增业绩
  109. 'headerOther' => [
  110. 'width' => '250',
  111. ],
  112. 'value' => function($row) {
  113. return (new Price([
  114. 'value' => $row['PV_1L_ZC'],
  115. ]))->result();
  116. },
  117. ],
  118. 'PV_1L_FX' => [
  119. 'header' => 'L. New Performance Of Market Re Cancellation', // 一市场复消新增业绩
  120. 'headerOther' => [
  121. 'width' => '320',
  122. ],
  123. 'value' => function($row) {
  124. return (new Price([
  125. 'value' => $row['PV_1L_FX'],
  126. ]))->result();
  127. },
  128. ],
  129. 'PV_2L' => [
  130. 'header' => 'R. New Market Performance', // 二市场新增业绩
  131. 'headerOther' => [
  132. 'width' => '200',
  133. ],
  134. 'value' => function($row) {
  135. return (new Price([
  136. 'value' => $row['PV_2L'],
  137. ]))->result();
  138. },
  139. ],
  140. 'PV_2L_ZC' => [
  141. 'header' => 'R. New Performance Of Market Entry', // 二市场报单新增业绩
  142. 'headerOther' => [
  143. 'width' => '260',
  144. ],
  145. 'value' => function($row) {
  146. return (new Price([
  147. 'value' => $row['PV_2L_ZC'],
  148. ]))->result();
  149. },
  150. ],
  151. 'PV_2L_FX' => [
  152. 'header' => 'R. New Performance Of Market Re Cancellation', // 二市场复消新增业绩
  153. 'headerOther' => [
  154. 'width' => '320',
  155. ],
  156. 'value' => function($row) {
  157. return (new Price([
  158. 'value' => $row['PV_2L_FX'],
  159. ]))->result();
  160. },
  161. ],
  162. 'SURPLUS_1L' => [
  163. 'header' => 'L. Market Balance Performance', // 一市场结余业绩
  164. 'value' => function($row) {
  165. return (new Price([
  166. 'value' => $row['SURPLUS_1L'],
  167. ]))->result();
  168. },
  169. 'headerOther' => [
  170. 'width' => '220',
  171. 'prop'=>'SURPLUS_1L',
  172. ],
  173. ],
  174. 'SURPLUS_2L' => [
  175. 'header' => 'R. Market Balance Performance', // 二市场结余业绩
  176. 'value' => function($row) {
  177. return (new Price([
  178. 'value' => $row['SURPLUS_2L'],
  179. ]))->result();
  180. },
  181. 'headerOther' => [
  182. 'width' => '220',
  183. 'prop'=>'SURPLUS_2L',
  184. ],
  185. ],
  186. 'SURPLUS_1L_ZC' => [
  187. 'header' => 'L. Market Entry Balance Performance', // 一市场报单结余业绩
  188. 'value' => function($row) {
  189. return (new Price([
  190. 'value' => $row['SURPLUS_1L_ZC'],
  191. ]))->result();
  192. },
  193. 'headerOther' => [
  194. 'width' => '260',
  195. 'prop'=>'SURPLUS_1L_ZC',
  196. ],
  197. ],
  198. 'SURPLUS_2L_ZC' => [
  199. 'header' => 'R. Market Entry Balance Performance', // 二市场报单结余业绩
  200. 'value' => function($row) {
  201. return (new Price([
  202. 'value' => $row['SURPLUS_2L_ZC'],
  203. ]))->result();
  204. },
  205. 'headerOther' => [
  206. 'width' => '260',
  207. 'prop'=>'SURPLUS_2L_ZC',
  208. ],
  209. ],
  210. 'SURPLUS_1L_FX' => [
  211. 'header' => 'L. Market Reconditioning Balance Performance', // 一市场复消结余业绩
  212. 'value' => function($row) {
  213. return (new Price([
  214. 'value' => $row['SURPLUS_1L_FX'],
  215. ]))->result();
  216. },
  217. 'headerOther' => [
  218. 'width' => '320',
  219. 'prop'=>'SURPLUS_1L_FX',
  220. ],
  221. ],
  222. 'SURPLUS_2L_FX' => [
  223. 'header' => 'R. Market Re Cancellation Balance Performance', // 二市场复消结余业绩
  224. 'value' => function($row) {
  225. return (new Price([
  226. 'value' => $row['SURPLUS_2L_FX'],
  227. ]))->result();
  228. },
  229. 'headerOther' => [
  230. 'width' => '330',
  231. 'prop'=>'SURPLUS_2L_FX',
  232. ],
  233. ],
  234. 'PV_PSS' => [
  235. 'header' => 'Team Performance', // 团队业绩
  236. 'headerOther' => [
  237. 'width' => '150',
  238. ],
  239. 'value' => function($row) {
  240. return (new Price([
  241. 'value' => $row['PV_PSS'],
  242. ]))->result();
  243. },
  244. ],
  245. 'CREATED_AT' => [
  246. 'header' => 'Creation Time', // 创建时间
  247. 'value' => function($row) {
  248. return (new DateTime([
  249. 'value' => $row['CREATED_AT'],
  250. ]))->result();
  251. },
  252. 'headerOther' => ['width' => '170'],
  253. ],
  254. ];
  255. }
  256. return $this->columns;
  257. }
  258. /**
  259. * 前台用于筛选的类型集合
  260. * @return mixed
  261. */
  262. public function getFilterTypes()
  263. {
  264. if(!$this->filterTypes){
  265. $this->filterTypes = [
  266. 'PERIOD_NUM'=> ['isUserTable'=> false, 'name'=> 'Number Of Periods'], // 期数
  267. 'USER_NAME'=> ['isUserTable'=> false, 'name'=> 'Member Code'], // 会员编号
  268. 'CREATED_AT'=> ['isUserTable'=> false, 'name'=> 'Creation Time', 'other'=> 'date'], // 创建时间
  269. ];
  270. }
  271. return $this->filterTypes;
  272. }
  273. }