get_module_list = CommonConstant::get_module_list(); $this->get_approve_status_list = CommonConstant::get_approve_status_list(); $this->get_approve_status_list_admin = CommonConstant::get_approve_status_list_admin(); $this->get_is_who_list = CommonConstant::get_is_who_list(); $this->get_pay_type_list = ApplyConstant::get_pay_type_list(); $this->get_degree_list = OfferConstant::get_degree_list(); } /** * 列表 * @auth true * @menu true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function index() { $this->module = $module = input('module'); $status = input('status'); $create_at = input('create_at'); $order_no = input('order_no'); $reason = input('reason'); $type = input('type'); $desc = input('desc'); $create_data = []; if ($create_at) { foreach (explode(' - ', $create_at) as $key => $val) { $create_data[] = $key == 0 ? "{$val} 00:00:00" : "{$val} 23:59:59"; } } $this->title = $this->get_module_list[$this->module] . '列表'; $this->get_type_list = CommonService::get_type_list($this->module); $data = model::field('is_deleted', true) ->where('is_deleted', CommonConstant::IS_DELETED_0) ->where('module', $this->module) ->when($status > 0, function ($query) use ($status) { $query->where('status', $status); }) ->when($create_data, function ($query) use ($create_data) { $query->where('create_at', 'BETWEEN', $create_data); }) ->when($order_no, function ($query) use ($order_no) { $query->where('order_no', 'like', '%' . $order_no . '%'); }) ->when($reason, function ($query) use ($reason) { $query->where('reason', 'like', '%' . $reason . '%'); }) ->when($type > 0, function ($query) use ($type) { $query->where('type', $type); }) ->when($desc, function ($query) use ($desc, $module) { if ($module == CommonConstant::MODULE_10) { $query->where('desc', 'like', '%' . $desc . '%'); } else { $query->where('desc', $desc); } }) ->with([ 'createUser' => function ($query) { $query->field('id,userid,name,mobile'); }, ]) ->order('id desc'); self::_init($data); } /** * 编辑 * @auth true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function edit() { $this->title = '详情'; $data = ApproveInfoService::get_detail(input('id') ?: 0, [], CommonConstant::IS_WHO_0, 'detail'); if ($data) { // 维修人员 $data['maintain_user'] = $data['module'] == CommonConstant::MODULE_8 && $data['maintain_user_id'] > 0 ? ApproveMaintainUser::field('id,name')->find($data['maintain_user_id']) : null; $this->title = $this->get_module_list[$data['module']] . '详情'; $this->get_type_list = CommonService::get_type_list($data['module']); } return $this->fetch('form', ['vo' => $data]); } }