MoveList.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?php
  2. namespace backendApi\modules\v1\models\lists\user;
  3. use backendApi\modules\v1\models\Admin;
  4. use common\helpers\Cache;
  5. use common\helpers\http\BackendToFrontendApi;
  6. use common\helpers\user\Info;
  7. use common\libs\dataList\DataListInterface;
  8. use common\models\DecRole;
  9. use common\models\OpenBank;
  10. use common\models\Region;
  11. use common\models\User;
  12. use common\models\UserInfo;
  13. use common\libs\dataList\column\DateTime;
  14. use common\libs\dataList\column\YesNo;
  15. use common\models\UserMove;
  16. use common\models\UserNetwork;
  17. use common\models\UserSystem;
  18. use Yii;
  19. class MoveList extends \common\libs\dataList\DataList implements DataListInterface
  20. {
  21. /**
  22. * 列表名称
  23. * @return string
  24. */
  25. public function getListName(){
  26. return '会员移网列表';
  27. }
  28. /**
  29. * 列表筛选到的数据
  30. */
  31. public function dataHandle()
  32. {
  33. $this->listData = User::lists($this->condition, $this->params, [
  34. 'select' => 'UM.*,
  35. CU.USER_NAME MOVE_USER_NAME,CU.REAL_NAME MOVE_REAL_NAME,FUI.USER_NAME FROM_USER_NAME,TUI.USER_NAME TO_USER_NAME,ADMC.ADMIN_NAME MOVE_ADMIN_NAME,ADMU.ADMIN_NAME AUDIT_ADMIN_NAME
  36. ',
  37. 'orderBy' => 'UM.CREATED_AT DESC, UM.ID DESC',
  38. 'from' => UserMove::tableName() . ' AS UM',
  39. 'join' => [
  40. ['LEFT JOIN', User::tableName() . ' AS CU', 'UM.USER_ID=CU.ID'],
  41. ['LEFT JOIN', UserInfo::tableName() . ' AS FUI', 'UM.FROM_UID=FUI.USER_ID'],
  42. ['LEFT JOIN', UserInfo::tableName() . ' AS TUI', 'UM.TO_UID=TUI.USER_ID'],
  43. ['LEFT JOIN', Admin::tableName() . ' AS ADMC', 'UM.MOVE_ADMIN_ID=ADMC.ID'],
  44. ['LEFT JOIN', Admin::tableName() . ' AS ADMU', 'UM.AUDIT_ADMIN_ID=ADMU.ID'],
  45. ],
  46. 'page' => $this->page,
  47. 'pageSize' => $this->pageSize,
  48. ]);
  49. }
  50. /**
  51. * 要展示和导出的所有字段
  52. * @return array
  53. */
  54. public function getColumn(){
  55. if(!$this->columns){
  56. $this->columns = [
  57. 'ID' => null,
  58. 'USER_ID' => null,
  59. 'MOVE_USER_NAME' => [
  60. 'header' => 'Mobile members',//移动的会员
  61. 'headerOther' => ['width' => '150'],
  62. ],
  63. 'MOVE_REAL_NAME' => [
  64. 'header' => 'Mobile members name',//移动的会员名字
  65. 'headerOther' => [
  66. 'width' => '150',
  67. ],
  68. 'valueOther' => [
  69. 'tag'=>['type'=>'success', 'size' => 'small', 'class'=>'no-border']
  70. ],
  71. ],
  72. 'FROM_USER_NAME' => [
  73. 'header' => 'Move front contact',//移动前接点
  74. 'headerOther' => ['width' => '150'],
  75. ],
  76. 'TO_USER_NAME' => [
  77. 'header' => 'Moving rear contact',//移动后接点
  78. 'headerOther' => ['width' => '150'],
  79. ],
  80. 'TYPE' => [
  81. 'header' => 'Network transfer type',//移网类型
  82. 'headerOther' => [
  83. 'width' => '120',
  84. ],
  85. 'value' => function($row) {
  86. return $row['TYPE'] == UserMove::TYPE_NETWORK ? 'placement network':'development network';//'安置网络' : '开拓网络'
  87. },
  88. ],
  89. 'LOCATION' => [
  90. 'header' => 'Move to position',//移动到位置
  91. 'headerOther' => ['width' => '150'],
  92. ],
  93. 'PERIOD_NUM' => 'Number of periods when moving',//移动时的期数
  94. 'IS_MOVING' => [
  95. 'header' => 'Are you moving',//是否正在移动
  96. 'headerOther' => ['width' => '100'],
  97. ],
  98. 'MOVE_PERCENT' => [
  99. 'header' => 'Movement percentage',//移动百分比
  100. ],
  101. 'MOVE_ADMIN_NAME' => [
  102. 'header' => 'Mobile administrator',//移网管理员
  103. 'headerOther' => ['width' => '120'],
  104. ],
  105. 'CREATED_AT' => [
  106. 'header' => 'Date of accession',//加入日期
  107. 'value' => function($row) {
  108. return (new DateTime([
  109. 'value' => $row['CREATED_AT'],
  110. ]))->result();
  111. },
  112. 'headerOther' => ['width' => '170'],
  113. ],
  114. 'AUDIT_STATUS' => null,
  115. 'AUDIT_STATUS_NAME' => [
  116. 'header' => 'Audit status',//审核状态
  117. 'headerOther' => ['width' => '100'],
  118. 'value' => function ($row) {
  119. return UserMove::STATUS_NAME[$row['AUDIT_STATUS']];
  120. },
  121. ],
  122. 'AUDIT_ADMIN_NAME' => [
  123. 'header' => 'Audit administrator',//审核管理员
  124. 'headerOther' => ['width' => '100'],
  125. ],
  126. 'AUDITED_AT' => [
  127. 'header' => 'Audit time',//审核时间
  128. 'value' => function ($row) {
  129. return (new DateTime([
  130. 'value' => $row['AUDITED_AT'],
  131. ]))->result();
  132. },
  133. 'headerOther' => ['width' => '150'],
  134. ],
  135. ];
  136. }
  137. return $this->columns;
  138. }
  139. /**
  140. * 前台用于筛选的类型集合
  141. * @return mixed
  142. */
  143. public function getFilterTypes()
  144. {
  145. if(!$this->filterTypes){
  146. $this->filterTypes = [
  147. 'MOVE_USER_NAME'=> ['isUserTable' => false,'name'=> 'Mobile members'],//移动的会员
  148. 'MOVE_REAL_NAME'=> ['isUserTable' => false,'name'=> 'Mobile members name'],//移动的会员姓名
  149. 'filterStatus'=> ['isUserTable' => false,'name'=> 'Audit status'],//审核状态
  150. // 'moveType'=> ['isUserTable' => false,'name'=> '移网类型', 'other'=> 'select','selectData'=>UserMove::TYPE_NAME],
  151. // 'FROM_USER_NAME'=> ['isUserTable' => false,'name'=> '移动前接点'],
  152. // 'TO_USER_NAME'=> ['isUserTable' => false,'name'=> '移动后接点', 'other'=> 'decLevel'],
  153. 'PERIOD_NUM'=> ['isUserTable' => false,'name'=> 'Number of periods when moving'],//移动时的期数
  154. 'MOVE_ADMIN_NAME'=> ['isUserTable' => false,'name'=> 'Mobile administrator'],//移网管理员
  155. 'AUDIT_ADMIN_NAME'=> ['isUserTable' => false,'name'=> 'Audit administrator'],//审核管理员
  156. // 'CREATED_AT' => ['isUserTable' => false, 'name' => '申请时间', 'other' => 'date'],
  157. 'AUDITED_AT' => ['isUserTable' => false, 'name' => 'Audit time', 'other' => 'date'],//审核时间
  158. ];
  159. }
  160. return $this->filterTypes;
  161. }
  162. }