PerfPeriodList.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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' => Yii::t('ctx', 'numberOfPhases'), // 期数
  47. 'headerOther' => [
  48. 'width' => '140',
  49. ],
  50. ],
  51. 'USER_NAME' => [
  52. 'header' => Yii::t('ctx', 'memberCode'), // 会员编号
  53. 'headerOther' => [
  54. 'width' => '120',
  55. ],
  56. ],
  57. 'REAL_NAME' => [
  58. 'header' => Yii::t('ctx', 'memberName'), // 会员姓名
  59. 'headerOther' => [
  60. 'width' => '150',
  61. ],
  62. ],
  63. 'PV_PCS' => [
  64. 'header' => Yii::t('ctx', 'personalPerformance'), // 个人业绩
  65. 'headerOther' => [
  66. 'width' => '160',
  67. ],
  68. 'value' => function($row) {
  69. return (new Price([
  70. 'value' => $row['PV_PCS'],
  71. ]))->result();
  72. },
  73. ],
  74. 'IS_ACTIVE' => [
  75. 'header' => Yii::t('ctx', 'whetherActive'), // 是否活跃
  76. 'headerOther' => [
  77. 'width' => '120',
  78. ],
  79. 'value' => function($row) {
  80. return $row['IS_ACTIVE'] == 1 ? Yii::t('ctx', 'yes') : Yii::t('ctx', 'no');
  81. },
  82. ],
  83. 'PV_PCS_ZC' => [
  84. 'header' => Yii::t('ctx', 'declarationPerformance'), // 报单业绩
  85. 'headerOther' => [
  86. 'width' => '180',
  87. ],
  88. 'value' => function($row) {
  89. return (new Price([
  90. 'value' => $row['PV_PCS_ZC'],
  91. ]))->result();
  92. },
  93. ],
  94. 'PV_PCS_FX' => [
  95. 'header' => Yii::t('ctx', 'cancellationPerformance'), // 复消业绩
  96. 'headerOther' => [
  97. 'width' => '190',
  98. ],
  99. 'value' => function($row) {
  100. return (new Price([
  101. 'value' => $row['PV_PCS_FX'],
  102. ]))->result();
  103. },
  104. ],
  105. // 'PV_1L' => [
  106. // 'header' => Yii::t('ctx', 'LNewMarketPerformance'), // 一市场新增业绩
  107. // 'headerOther' => [
  108. // 'width' => '200',
  109. // ],
  110. // 'value' => function($row) {
  111. // return (new Price([
  112. // 'value' => $row['PV_1L'],
  113. // ]))->result();
  114. // },
  115. // ],
  116. // 'PV_1L_ZC' => [
  117. // 'header' => Yii::t('ctx', 'LNewPerformanceOfMarketEntry'), // 一市场报单新增业绩
  118. // 'headerOther' => [
  119. // 'width' => '250',
  120. // ],
  121. // 'value' => function($row) {
  122. // return (new Price([
  123. // 'value' => $row['PV_1L_ZC'],
  124. // ]))->result();
  125. // },
  126. // ],
  127. // 'PV_1L_FX' => [
  128. // 'header' => Yii::t('ctx', 'LNewPerformanceOfMarketReCancellation'), // 一市场复消新增业绩
  129. // 'headerOther' => [
  130. // 'width' => '320',
  131. // ],
  132. // 'value' => function($row) {
  133. // return (new Price([
  134. // 'value' => $row['PV_1L_FX'],
  135. // ]))->result();
  136. // },
  137. // ],
  138. // 'PV_2L' => [
  139. // 'header' => Yii::t('ctx', 'RNewMarketPerformance'), // 二市场新增业绩
  140. // 'headerOther' => [
  141. // 'width' => '200',
  142. // ],
  143. // 'value' => function($row) {
  144. // return (new Price([
  145. // 'value' => $row['PV_2L'],
  146. // ]))->result();
  147. // },
  148. // ],
  149. // 'PV_2L_ZC' => [
  150. // 'header' => Yii::t('ctx', 'RNewPerformanceOfMarketEntry'), // 二市场报单新增业绩
  151. // 'headerOther' => [
  152. // 'width' => '260',
  153. // ],
  154. // 'value' => function($row) {
  155. // return (new Price([
  156. // 'value' => $row['PV_2L_ZC'],
  157. // ]))->result();
  158. // },
  159. // ],
  160. // 'PV_2L_FX' => [
  161. // 'header' => Yii::t('ctx', 'RNewPerformanceOfMarketReCancellation'), // 二市场复消新增业绩
  162. // 'headerOther' => [
  163. // 'width' => '320',
  164. // ],
  165. // 'value' => function($row) {
  166. // return (new Price([
  167. // 'value' => $row['PV_2L_FX'],
  168. // ]))->result();
  169. // },
  170. // ],
  171. // 'SURPLUS_1L' => [
  172. // 'header' => Yii::t('ctx', 'LMarketBalancePerformance'), // 一市场结余业绩
  173. // 'value' => function($row) {
  174. // return (new Price([
  175. // 'value' => $row['SURPLUS_1L'],
  176. // ]))->result();
  177. // },
  178. // 'headerOther' => [
  179. // 'width' => '220',
  180. // 'prop'=>'SURPLUS_1L',
  181. // ],
  182. // ],
  183. // 'SURPLUS_2L' => [
  184. // 'header' => Yii::t('ctx', 'RMarketBalancePerformance'), // 二市场结余业绩
  185. // 'value' => function($row) {
  186. // return (new Price([
  187. // 'value' => $row['SURPLUS_2L'],
  188. // ]))->result();
  189. // },
  190. // 'headerOther' => [
  191. // 'width' => '220',
  192. // 'prop'=>'SURPLUS_2L',
  193. // ],
  194. // ],
  195. // 'SURPLUS_1L_ZC' => [
  196. // 'header' => Yii::t('ctx', 'LMarketEntryBalancePerformance'), // 一市场报单结余业绩
  197. // 'value' => function($row) {
  198. // return (new Price([
  199. // 'value' => $row['SURPLUS_1L_ZC'],
  200. // ]))->result();
  201. // },
  202. // 'headerOther' => [
  203. // 'width' => '260',
  204. // 'prop'=>'SURPLUS_1L_ZC',
  205. // ],
  206. // ],
  207. // 'SURPLUS_2L_ZC' => [
  208. // 'header' => Yii::t('ctx', 'RMarketEntryBalancePerformance'), // 二市场报单结余业绩
  209. // 'value' => function($row) {
  210. // return (new Price([
  211. // 'value' => $row['SURPLUS_2L_ZC'],
  212. // ]))->result();
  213. // },
  214. // 'headerOther' => [
  215. // 'width' => '260',
  216. // 'prop'=>'SURPLUS_2L_ZC',
  217. // ],
  218. // ],
  219. // 'SURPLUS_1L_FX' => [
  220. // 'header' => Yii::t('ctx', 'LMarketReconditioningBalancePerformance'), // 一市场复消结余业绩
  221. // 'value' => function($row) {
  222. // return (new Price([
  223. // 'value' => $row['SURPLUS_1L_FX'],
  224. // ]))->result();
  225. // },
  226. // 'headerOther' => [
  227. // 'width' => '320',
  228. // 'prop'=>'SURPLUS_1L_FX',
  229. // ],
  230. // ],
  231. // 'SURPLUS_2L_FX' => [
  232. // 'header' =>Yii::t('ctx', 'RMarketReCancellationBalancePerformance'), // 二市场复消结余业绩
  233. // 'value' => function($row) {
  234. // return (new Price([
  235. // 'value' => $row['SURPLUS_2L_FX'],
  236. // ]))->result();
  237. // },
  238. // 'headerOther' => [
  239. // 'width' => '330',
  240. // 'prop'=>'SURPLUS_2L_FX',
  241. // ],
  242. // ],
  243. 'PV_PSS' => [
  244. 'header' => Yii::t('ctx', 'teamPerformance'), // 团队业绩
  245. 'headerOther' => [
  246. 'width' => '150',
  247. ],
  248. 'value' => function($row) {
  249. return (new Price([
  250. 'value' => $row['PV_PSS'],
  251. ]))->result();
  252. },
  253. ],
  254. 'CREATED_AT' => [
  255. 'header' => Yii::t('ctx', 'createAt'), // 创建时间
  256. 'value' => function($row) {
  257. return (new DateTime([
  258. 'value' => $row['CREATED_AT'],
  259. ]))->result();
  260. },
  261. 'headerOther' => ['width' => '170'],
  262. ],
  263. ];
  264. }
  265. return $this->columns;
  266. }
  267. /**
  268. * 前台用于筛选的类型集合
  269. * @return mixed
  270. */
  271. public function getFilterTypes()
  272. {
  273. if(!$this->filterTypes){
  274. $this->filterTypes = [
  275. 'PERIOD_NUM'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'numberOfPhases')], // 期数
  276. 'USER_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'memberCode')], // 会员编号
  277. 'CREATED_AT'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'createAt'), 'other'=> 'date'], // 创建时间
  278. ];
  279. }
  280. return $this->filterTypes;
  281. }
  282. }