getPk() ?: 'id'); $value = $edata[$field] ?? input($field); if ($this->app->request->isGet()) { if ($value !== null) { $exist = $query->where([$field => $value])->where($where)->find(); if ($exist instanceof Model) $exist = $exist->toArray(); $edata = array_merge($edata, $exist ?: []); } if (false !== $this->class->callback('_form_filter', $edata)) { $this->class->fetch($template, ['vo' => $edata]); } else { return $edata; } } if ($this->app->request->isPost()) { $edata = array_merge($this->app->request->post(), $edata); if (false !== $this->class->callback('_form_filter', $edata, $where)) { $result = SystemService::save($query, $edata, $field, $where) !== false; if (false !== $this->class->callback('_form_result', $result, $edata)) { if ($result !== false) { $this->class->success('数据保存成功!'); } else { $this->class->error('数据保存失败!'); } } return $result; } } } }