['approve_dept', 'cost_type', 'pay_type'], '%like%' => ['code', 'accept_company', 'create_user'], ]; } /** * @notes 获取财务管理--用款申请单列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/03/29 09:29 */ public function lists(): array { $params = $this->request->get(); $where = []; if (!empty($params['create_time'])) { $date = explode(',', $params['create_time']); $where[] = ['create_time', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]]; } return FinancialUsingFunds::withoutField('update_time,delete_time')->where($this->searchWhere)->where($where) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($data) { $dept = Dept::field('name')->where('id', $data['approve_dept'])->findOrEmpty(); $contract = MarketingContract::field('contract_name,signed_amount')->where('id', $data['contract_id'])->findOrEmpty(); $data['approve_dept_name'] = $dept['name']; $data['contract_name'] = !$contract->isEmpty() ? $contract['contract_name'] : ''; $data['contract_money'] = !$contract->isEmpty() ? $contract['signed_amount'] : ''; $data['pay_type_text'] = $data->pay_type_text; $data['cost_type_text'] = $data->cost_type_text; }) ->toArray(); } /** * @notes 获取财务管理--用款申请单数量 * @return int * @author likeadmin * @date 2024/03/29 09:29 */ public function count(): int { $params = $this->request->get(); $where = []; if (!empty($params['create_time'])) { $date = explode(',', $params['create_time']); $where[] = ['create_time', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]]; } return FinancialUsingFunds::where($this->searchWhere)->where($where)->count(); } }