123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <?php
- namespace app\admin\controller;
- use app\admin\model\Admin;
- use app\admin\model\AdminGroup;
- use app\admin\model\Depart;
- use app\admin\model\dict\Commondata;
- use app\admin\model\dict\Commontable;
- use app\admin\model\Institution;
- use app\admin\model\User;
- use app\common\controller\Backend;
- /**
- * 下拉选项
- */
- class Option extends Backend
- {
- /**
- * Institution模型对象
- * @var object
- * @phpstan-var \app\admin\model\institution\Institution
- */
- protected object $model;
- protected array|string $preExcludeFields = ['id', 'update_time'];
- protected array $withJoinTable = ['parentInstitution'];
- protected string|array $quickSearchField = ['id'];
- protected array $noNeedPermission = ['*'];
- protected array $noNeedLogin = ['getInsList','getUser'];
- public function getInsList(): void
- {
- $model = new Institution();
- $res = $model->field(['id as code','name'])->where('status', 1)->select()->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getGroupList(): void
- {
- $model = new AdminGroup();
- $res = $model->field(['id as code','name'])->where('status', 1)->select()->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getDictList(): void
- {
- $model = new Commontable();
- $res = $model
- ->field(['code','name'])
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getDictDataList(): void
- {
- $model = new Commondata();
- $type= $this->request->post('type');
- if(empty($type))
- {
- $this->error('参数错误');
- }
- $res = $model->field(['code','name'])
- ->where('status', 1)
- ->where('type', $type)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
-
- public function getGenderList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','name'])
- ->where('type', '1')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getNationList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','name'])
- ->where('type', '2')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getIdCardList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','name'])
- ->where('type', '3')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getMaritalStatusList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','name'])
- ->where('type', '4')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getClassList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','name'])
- ->where('type', '5')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
-
- public function getBodysiteCategList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','name'])
- ->where('type', '6')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getNoHrReasonList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','name'])
- ->where('type', '7')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getInsTypeList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','name'])
- ->where('type', '8')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getHrRangeList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','name'])
- ->where('type', '9')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getModalityList(): void
- {
- $model = new Commondata();
- $res = $model
- ->field(['code','code as name'])
- ->where('type', '10')
- ->where('status', 1)
- ->order('weigh asc, id asc')
- ->select()
- ->toArray();
- $this->success('', ['list' => $res]);
- }
- public function getUser():void
- {
- set_time_limit(0);
- $model = new Admin();
- $res = $model
- ->field(['id','nickname as name'])
- ->where('status',1)
- ->where('is_admin',1)
- ->select()
- ->toArray();
- foreach ($res as $k=>$v)
- {
- unset($res[$k]['group_arr']);
- unset($res[$k]['group_name_arr']);
- }
- $this->success('', ['list' => $res]);
- }
- }
|