'customer_cost_adjust', 'referer' => 1, 'search' => ['by' => ''], ]); $cols = $header['cols']; $cols['actions']['options'] = [[ 'name' => '显示', 'action' => 'show', 'display' => $this->access['show'], ]]; $search = $header['search_form']; $query = $search['query']; if (Request::method() == 'POST') { $model = DB::table($header['table'])->setBy($header); foreach ($header['join'] as $join) { $model->leftJoin($join[0], $join[1], $join[2], $join[3]); } $model->orderBy($header['sort'], $header['order']); $model->where('customer_cost.type_id', 86); // 客户权限 $region = regionCustomer('customer_id_customer'); if ($region['authorise']) { foreach ($region['whereIn'] as $key => $where) { $model->whereIn($key, $where); } } foreach ($search['where'] as $where) { if ($where['active']) { $model->search($where); } } $header['select'][] = 'customer_cost_data.cost_id'; $model->select($header['select']); $rows = $model->paginate($query['limit'])->appends($query); return Grid::dataFilters($rows, $header); } $header['buttons'] = [ ['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']], ['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1], ]; $header['right_buttons'] = [ ['name' => '关闭', 'color' => 'default', 'icon' => 'fa-lock', 'action' => 'close', 'display' => $this->access['close']], ]; $header['cols'] = $cols; $header['tabs'] = Adjust::$tabs; $header['bys'] = Adjust::$bys; $header['js'] = Grid::js($header); return $this->display([ 'header' => $header, ]); } public function createAction($action = 'edit') { $id = (int)Request::get('id'); // 客户权限 $header['region'] = ['field' => 'customer_id']; $header['authorise'] = ['action' => 'index', 'field' => 'created_id']; $header['code'] = 'customer_cost_adjust'; $header['id'] = $id; $header['action'] = $action; $form = Form::make($header); return $this->display([ 'form' => $form, ], 'create'); } public function editAction() { return $this->createAction(); } public function showAction() { return $this->createAction('show'); } public function deleteAction() { if (Request::method() == 'POST') { $ids = Request::get('id'); return Form::remove(['code' => 'customer_cost_adjust', 'ids' => $ids]); } } }