PerfPeriodList.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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. // if ($data['list']) {
  37. // foreach ($data['list'] as $key => $value) {
  38. // $data['list'][$key]['LAST_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_DEC_LV']]['LEVEL_NAME'] ?? '';
  39. // $data['list'][$key]['LAST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['LAST_EMP_LV']]['LEVEL_NAME'] ?? '';
  40. // }
  41. // }
  42. $this->listData = $data;
  43. }
  44. /**
  45. * 要展示和导出的所有字段
  46. * @return array
  47. */
  48. public function getColumn(){
  49. if(!$this->columns){
  50. $this->columns = [
  51. 'PERIOD_NUM' => [
  52. 'header' => 'Number of periods',//期数
  53. 'headerOther' => [
  54. 'width' => '100',
  55. ],
  56. ],
  57. 'USER_NAME' => [
  58. 'header' => 'Member code',//会员编号
  59. 'headerOther' => [
  60. 'width' => '110',
  61. ],
  62. ],
  63. 'REAL_NAME' => [
  64. 'header' => 'Member name',//会员姓名
  65. 'headerOther' => [
  66. 'width' => '150',
  67. ],
  68. ],
  69. 'PV_PCS' => [
  70. 'header' => 'Personal performance',//个人业绩
  71. 'headerOther' => [
  72. 'width' => '150',
  73. ],
  74. 'value' => function($row) {
  75. return (new Price([
  76. 'value' => $row['PV_PCS'],
  77. ]))->result();
  78. },
  79. ],
  80. 'PV_PCS_ZC' => [
  81. 'header' => 'Declaration performance',//报单业绩
  82. 'headerOther' => [
  83. 'width' => '150',
  84. ],
  85. 'value' => function($row) {
  86. return (new Price([
  87. 'value' => $row['PV_PCS_ZC'],
  88. ]))->result();
  89. },
  90. ],
  91. 'PV_PCS_FX' => [
  92. 'header' => 'Cancellation performance',//复消业绩
  93. 'headerOther' => [
  94. 'width' => '150',
  95. ],
  96. 'value' => function($row) {
  97. return (new Price([
  98. 'value' => $row['PV_PCS_FX'],
  99. ]))->result();
  100. },
  101. ],
  102. 'PV_1L' => [
  103. 'header' => 'I. new market performance',//一市场新增业绩
  104. 'headerOther' => [
  105. 'width' => '150',
  106. ],
  107. 'value' => function($row) {
  108. return (new Price([
  109. 'value' => $row['PV_1L'],
  110. ]))->result();
  111. },
  112. ],
  113. 'PV_1L_ZC' => [
  114. 'header' => 'I. new performance of market entry',//一市场报单新增业绩
  115. 'headerOther' => [
  116. 'width' => '150',
  117. ],
  118. 'value' => function($row) {
  119. return (new Price([
  120. 'value' => $row['PV_1L_ZC'],
  121. ]))->result();
  122. },
  123. ],
  124. 'PV_1L_FX' => [
  125. 'header' => 'I. new performance of market re cancellation',//一市场复消新增业绩
  126. 'headerOther' => [
  127. 'width' => '150',
  128. ],
  129. 'value' => function($row) {
  130. return (new Price([
  131. 'value' => $row['PV_1L_FX'],
  132. ]))->result();
  133. },
  134. ],
  135. 'PV_2L' => [
  136. 'header' => 'II. New market performance',//二市场新增业绩
  137. 'headerOther' => [
  138. 'width' => '150',
  139. ],
  140. 'value' => function($row) {
  141. return (new Price([
  142. 'value' => $row['PV_2L'],
  143. ]))->result();
  144. },
  145. ],
  146. 'PV_2L_ZC' => [
  147. 'header' => 'II. New performance of market entry',//二市场报单新增业绩
  148. 'headerOther' => [
  149. 'width' => '150',
  150. ],
  151. 'value' => function($row) {
  152. return (new Price([
  153. 'value' => $row['PV_2L_ZC'],
  154. ]))->result();
  155. },
  156. ],
  157. 'PV_2L_FX' => [
  158. 'header' => 'II. New performance of market re cancellation',//二市场复消新增业绩
  159. 'headerOther' => [
  160. 'width' => '150',
  161. ],
  162. 'value' => function($row) {
  163. return (new Price([
  164. 'value' => $row['PV_2L_FX'],
  165. ]))->result();
  166. },
  167. ],
  168. // 'PV_3L' => [
  169. // 'header' => '三市场新增业绩',
  170. // 'headerOther' => [
  171. // 'width' => '150',
  172. // ],
  173. // 'value' => function($row) {
  174. // return (new Price([
  175. // 'value' => $row['PV_3L'],
  176. // ]))->result();
  177. // },
  178. // ],
  179. // 'PV_3L_ZC' => [
  180. // 'header' => '三市场报单新增业绩',
  181. // 'headerOther' => [
  182. // 'width' => '150',
  183. // ],
  184. // 'value' => function($row) {
  185. // return (new Price([
  186. // 'value' => $row['PV_3L_ZC'],
  187. // ]))->result();
  188. // },
  189. // ],
  190. // 'PV_3L_FX' => [
  191. // 'header' => '三市场复消新增业绩',
  192. // 'headerOther' => [
  193. // 'width' => '150',
  194. // ],
  195. // 'value' => function($row) {
  196. // return (new Price([
  197. // 'value' => $row['PV_3L_FX'],
  198. // ]))->result();
  199. // },
  200. // ],
  201. 'SURPLUS_1L' => [
  202. 'header' => 'I. market balance performance',//一市场结余业绩
  203. 'value' => function($row) {
  204. return (new Price([
  205. 'value' => $row['SURPLUS_1L'],
  206. ]))->result();
  207. },
  208. 'headerOther' => [
  209. 'width' => '120',
  210. 'prop'=>'SURPLUS_1L',
  211. ],
  212. ],
  213. 'SURPLUS_2L' => [
  214. 'header' => 'II. Market balance performance',//二市场结余业绩
  215. 'value' => function($row) {
  216. return (new Price([
  217. 'value' => $row['SURPLUS_2L'],
  218. ]))->result();
  219. },
  220. 'headerOther' => [
  221. 'width' => '120',
  222. 'prop'=>'SURPLUS_2L',
  223. ],
  224. ],
  225. // 'SURPLUS_3L' => [
  226. // 'header' => '三市场结余业绩',
  227. // 'value' => function($row) {
  228. // return (new Price([
  229. // 'value' => $row['SURPLUS_3L'],
  230. // ]))->result();
  231. // },
  232. // 'headerOther' => [
  233. // 'width' => '120',
  234. // 'prop'=>'SURPLUS_3L',
  235. // ],
  236. // ],
  237. 'SURPLUS_1L_ZC' => [
  238. 'header' => 'I. market entry balance performance',//一市场报单结余业绩
  239. 'value' => function($row) {
  240. return (new Price([
  241. 'value' => $row['SURPLUS_1L_ZC'],
  242. ]))->result();
  243. },
  244. 'headerOther' => [
  245. 'width' => '120',
  246. 'prop'=>'SURPLUS_1L_ZC',
  247. ],
  248. ],
  249. 'SURPLUS_2L_ZC' => [
  250. 'header' => 'II. Market entry balance performance',//二市场报单结余业绩
  251. 'value' => function($row) {
  252. return (new Price([
  253. 'value' => $row['SURPLUS_2L_ZC'],
  254. ]))->result();
  255. },
  256. 'headerOther' => [
  257. 'width' => '120',
  258. 'prop'=>'SURPLUS_2L_ZC',
  259. ],
  260. ],
  261. // 'SURPLUS_3L_ZC' => [
  262. // 'header' => '三市场报单结余业绩',
  263. // 'value' => function($row) {
  264. // return (new Price([
  265. // 'value' => $row['SURPLUS_3L_ZC'],
  266. // ]))->result();
  267. // },
  268. // 'headerOther' => [
  269. // 'width' => '120',
  270. // 'prop'=>'SURPLUS_3L_ZC',
  271. // ],
  272. // ],
  273. 'SURPLUS_1L_FX' => [
  274. 'header' => 'I. market reconditioning balance performance',//一市场复消结余业绩
  275. 'value' => function($row) {
  276. return (new Price([
  277. 'value' => $row['SURPLUS_1L_FX'],
  278. ]))->result();
  279. },
  280. 'headerOther' => [
  281. 'width' => '120',
  282. 'prop'=>'SURPLUS_1L_FX',
  283. ],
  284. ],
  285. 'SURPLUS_2L_FX' => [
  286. 'header' => 'II. Market re cancellation balance performance',//二市场复消结余业绩
  287. 'value' => function($row) {
  288. return (new Price([
  289. 'value' => $row['SURPLUS_2L_FX'],
  290. ]))->result();
  291. },
  292. 'headerOther' => [
  293. 'width' => '120',
  294. 'prop'=>'SURPLUS_2L_FX',
  295. ],
  296. ],
  297. // 'SURPLUS_3L_FX' => [
  298. // 'header' => '三市场复消结余业绩',
  299. // 'value' => function($row) {
  300. // return (new Price([
  301. // 'value' => $row['SURPLUS_3L_FX'],
  302. // ]))->result();
  303. // },
  304. // 'headerOther' => [
  305. // 'width' => '120',
  306. // 'prop'=>'SURPLUS_3L_FX',
  307. // ],
  308. // ],
  309. 'PV_PSS' => [
  310. 'header' => 'Team performance',//团队业绩
  311. 'headerOther' => [
  312. 'width' => '150',
  313. ],
  314. 'value' => function($row) {
  315. return (new Price([
  316. 'value' => $row['PV_PSS'],
  317. ]))->result();
  318. },
  319. ],
  320. 'CREATED_AT' => [
  321. 'header' => 'Creation time',//创建时间
  322. 'value' => function($row) {
  323. return (new DateTime([
  324. 'value' => $row['CREATED_AT'],
  325. ]))->result();
  326. },
  327. 'headerOther' => ['width' => '170'],
  328. ],
  329. ];
  330. }
  331. return $this->columns;
  332. }
  333. /**
  334. * 前台用于筛选的类型集合
  335. * @return mixed
  336. */
  337. public function getFilterTypes()
  338. {
  339. if(!$this->filterTypes){
  340. $this->filterTypes = [
  341. 'PERIOD_NUM'=> ['isUserTable'=> false, 'name'=> 'Number of periods'],//期数
  342. 'USER_NAME'=> ['isUserTable'=> false, 'name'=> 'Member code'],//会员编号
  343. 'CREATED_AT'=> ['isUserTable'=> false, 'name'=> 'Creation time', 'other'=> 'date'],//创建时间
  344. ];
  345. }
  346. return $this->filterTypes;
  347. }
  348. }