Option.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\model\Admin;
  4. use app\admin\model\AdminGroup;
  5. use app\admin\model\Depart;
  6. use app\admin\model\dict\Commondata;
  7. use app\admin\model\dict\Commontable;
  8. use app\admin\model\Institution;
  9. use app\admin\model\User;
  10. use app\common\controller\Backend;
  11. /**
  12. * 下拉选项
  13. */
  14. class Option extends Backend
  15. {
  16. /**
  17. * Institution模型对象
  18. * @var object
  19. * @phpstan-var \app\admin\model\institution\Institution
  20. */
  21. protected object $model;
  22. protected array|string $preExcludeFields = ['id', 'update_time'];
  23. protected array $withJoinTable = ['parentInstitution'];
  24. protected string|array $quickSearchField = ['id'];
  25. protected array $noNeedPermission = ['*'];
  26. protected array $noNeedLogin = ['getInsList','getUser'];
  27. public function getInsList(): void
  28. {
  29. $model = new Institution();
  30. $res = $model->field(['id as code','name'])->where('status', 1)->select()->toArray();
  31. $this->success('', ['list' => $res]);
  32. }
  33. public function getGroupList(): void
  34. {
  35. $model = new AdminGroup();
  36. $res = $model->field(['id as code','name'])->where('status', 1)->select()->toArray();
  37. $this->success('', ['list' => $res]);
  38. }
  39. public function getDictList(): void
  40. {
  41. $model = new Commontable();
  42. $res = $model
  43. ->field(['code','name'])
  44. ->where('status', 1)
  45. ->order('weigh asc, id asc')
  46. ->select()
  47. ->toArray();
  48. $this->success('', ['list' => $res]);
  49. }
  50. public function getDictDataList(): void
  51. {
  52. $model = new Commondata();
  53. $type= $this->request->post('type');
  54. if(empty($type))
  55. {
  56. $this->error('参数错误');
  57. }
  58. $res = $model->field(['code','name'])
  59. ->where('status', 1)
  60. ->where('type', $type)
  61. ->order('weigh asc, id asc')
  62. ->select()
  63. ->toArray();
  64. $this->success('', ['list' => $res]);
  65. }
  66. public function getGenderList(): void
  67. {
  68. $model = new Commondata();
  69. $res = $model
  70. ->field(['code','name'])
  71. ->where('type', '1')
  72. ->where('status', 1)
  73. ->order('weigh asc, id asc')
  74. ->select()
  75. ->toArray();
  76. $this->success('', ['list' => $res]);
  77. }
  78. public function getNationList(): void
  79. {
  80. $model = new Commondata();
  81. $res = $model
  82. ->field(['code','name'])
  83. ->where('type', '2')
  84. ->where('status', 1)
  85. ->order('weigh asc, id asc')
  86. ->select()
  87. ->toArray();
  88. $this->success('', ['list' => $res]);
  89. }
  90. public function getIdCardList(): void
  91. {
  92. $model = new Commondata();
  93. $res = $model
  94. ->field(['code','name'])
  95. ->where('type', '3')
  96. ->where('status', 1)
  97. ->order('weigh asc, id asc')
  98. ->select()
  99. ->toArray();
  100. $this->success('', ['list' => $res]);
  101. }
  102. public function getMaritalStatusList(): void
  103. {
  104. $model = new Commondata();
  105. $res = $model
  106. ->field(['code','name'])
  107. ->where('type', '4')
  108. ->where('status', 1)
  109. ->order('weigh asc, id asc')
  110. ->select()
  111. ->toArray();
  112. $this->success('', ['list' => $res]);
  113. }
  114. public function getClassList(): void
  115. {
  116. $model = new Commondata();
  117. $res = $model
  118. ->field(['code','name'])
  119. ->where('type', '5')
  120. ->where('status', 1)
  121. ->order('weigh asc, id asc')
  122. ->select()
  123. ->toArray();
  124. $this->success('', ['list' => $res]);
  125. }
  126. public function getBodysiteCategList(): void
  127. {
  128. $model = new Commondata();
  129. $res = $model
  130. ->field(['code','name'])
  131. ->where('type', '6')
  132. ->where('status', 1)
  133. ->order('weigh asc, id asc')
  134. ->select()
  135. ->toArray();
  136. $this->success('', ['list' => $res]);
  137. }
  138. public function getNoHrReasonList(): void
  139. {
  140. $model = new Commondata();
  141. $res = $model
  142. ->field(['code','name'])
  143. ->where('type', '7')
  144. ->where('status', 1)
  145. ->order('weigh asc, id asc')
  146. ->select()
  147. ->toArray();
  148. $this->success('', ['list' => $res]);
  149. }
  150. public function getInsTypeList(): void
  151. {
  152. $model = new Commondata();
  153. $res = $model
  154. ->field(['code','name'])
  155. ->where('type', '8')
  156. ->where('status', 1)
  157. ->order('weigh asc, id asc')
  158. ->select()
  159. ->toArray();
  160. $this->success('', ['list' => $res]);
  161. }
  162. public function getHrRangeList(): void
  163. {
  164. $model = new Commondata();
  165. $res = $model
  166. ->field(['code','name'])
  167. ->where('type', '9')
  168. ->where('status', 1)
  169. ->order('weigh asc, id asc')
  170. ->select()
  171. ->toArray();
  172. $this->success('', ['list' => $res]);
  173. }
  174. public function getModalityList(): void
  175. {
  176. $model = new Commondata();
  177. $res = $model
  178. ->field(['code','code as name'])
  179. ->where('type', '10')
  180. ->where('status', 1)
  181. ->order('weigh asc, id asc')
  182. ->select()
  183. ->toArray();
  184. $this->success('', ['list' => $res]);
  185. }
  186. public function getUser():void
  187. {
  188. set_time_limit(0);
  189. $model = new Admin();
  190. $res = $model
  191. ->field(['id','nickname as name'])
  192. ->where('status',1)
  193. ->where('is_admin',1)
  194. ->select()
  195. ->toArray();
  196. foreach ($res as $k=>$v)
  197. {
  198. unset($res[$k]['group_arr']);
  199. unset($res[$k]['group_name_arr']);
  200. }
  201. $this->success('', ['list' => $res]);
  202. }
  203. }