From 6fb3f0b8303a59bc9c50f6651f07d419d52f717d Mon Sep 17 00:00:00 2001 From: meimei <102865034@qq.com> Date: Wed, 16 Apr 2025 16:58:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=AE=A1=E7=90=86=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=A8=A1=E5=9D=97=E5=92=8C=E5=9B=9E=E8=AE=BF=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/Firmcustomerfollowuprecord.php | 76 ++++++- .../admin/controller/Firmstoreprojectsone.php | 7 +- .../admin/controller/Firmstoreprojectstwo.php | 2 +- .../admin/controller/Mattertemplate.php | 37 ++++ .../Mattertemplatecategorization.php | 96 +++++++++ .../Mattertemplatecategorizedcontent.php | 186 +++++++++++++++++ .../admin/lang/zh-cn/mattertemplate.php | 8 + .../zh-cn/mattertemplatecategorization.php | 14 ++ .../mattertemplatecategorizedcontent.php | 12 ++ .../admin/model/Mattertemplate.php | 40 ++++ .../model/Mattertemplatecategorization.php | 62 ++++++ .../Mattertemplatecategorizedcontent.php | 44 ++++ .../admin/validate/Mattertemplate.php | 27 +++ .../validate/Mattertemplatecategorization.php | 27 +++ .../Mattertemplatecategorizedcontent.php | 27 +++ .../firmcustomerfollowuprecord/newadd.html | 146 +++++++++++++ .../admin/view/mattertemplate/add.html | 27 +++ .../admin/view/mattertemplate/edit.html | 27 +++ .../admin/view/mattertemplate/index.html | 29 +++ .../mattertemplatecategorization/add.html | 50 +++++ .../mattertemplatecategorization/edit.html | 50 +++++ .../mattertemplatecategorization/index.html | 29 +++ .../mattertemplatecategorizedcontent/add.html | 108 ++++++++++ .../edit.html | 111 ++++++++++ .../index.html | 29 +++ .../application/common/controller/Backend.php | 136 ++++++++++++ .../public/assets/js/backend/firmcustomer.js | 17 +- .../js/backend/firmcustomerfollowuprecord.js | 195 ++++++++++++++++-- .../assets/js/backend/mattertemplate.js | 53 +++++ .../backend/mattertemplatecategorization.js | 67 ++++++ .../mattertemplatecategorizedcontent.js | 126 +++++++++++ 31 files changed, 1842 insertions(+), 23 deletions(-) create mode 100644 admin/application/admin/controller/Mattertemplate.php create mode 100644 admin/application/admin/controller/Mattertemplatecategorization.php create mode 100644 admin/application/admin/controller/Mattertemplatecategorizedcontent.php create mode 100644 admin/application/admin/lang/zh-cn/mattertemplate.php create mode 100644 admin/application/admin/lang/zh-cn/mattertemplatecategorization.php create mode 100644 admin/application/admin/lang/zh-cn/mattertemplatecategorizedcontent.php create mode 100644 admin/application/admin/model/Mattertemplate.php create mode 100644 admin/application/admin/model/Mattertemplatecategorization.php create mode 100644 admin/application/admin/model/Mattertemplatecategorizedcontent.php create mode 100644 admin/application/admin/validate/Mattertemplate.php create mode 100644 admin/application/admin/validate/Mattertemplatecategorization.php create mode 100644 admin/application/admin/validate/Mattertemplatecategorizedcontent.php create mode 100644 admin/application/admin/view/firmcustomerfollowuprecord/newadd.html create mode 100644 admin/application/admin/view/mattertemplate/add.html create mode 100644 admin/application/admin/view/mattertemplate/edit.html create mode 100644 admin/application/admin/view/mattertemplate/index.html create mode 100644 admin/application/admin/view/mattertemplatecategorization/add.html create mode 100644 admin/application/admin/view/mattertemplatecategorization/edit.html create mode 100644 admin/application/admin/view/mattertemplatecategorization/index.html create mode 100644 admin/application/admin/view/mattertemplatecategorizedcontent/add.html create mode 100644 admin/application/admin/view/mattertemplatecategorizedcontent/edit.html create mode 100644 admin/application/admin/view/mattertemplatecategorizedcontent/index.html create mode 100644 admin/public/assets/js/backend/mattertemplate.js create mode 100644 admin/public/assets/js/backend/mattertemplatecategorization.js create mode 100644 admin/public/assets/js/backend/mattertemplatecategorizedcontent.js diff --git a/admin/application/admin/controller/Firmcustomerfollowuprecord.php b/admin/application/admin/controller/Firmcustomerfollowuprecord.php index b59a82b..e65a6f8 100755 --- a/admin/application/admin/controller/Firmcustomerfollowuprecord.php +++ b/admin/application/admin/controller/Firmcustomerfollowuprecord.php @@ -22,7 +22,7 @@ class Firmcustomerfollowuprecord extends Backend * @var \app\admin\model\Firmcustomerfollowuprecord */ protected $model = null; - + protected $noNeedRight = ['newadd']; public function _initialize() { parent::_initialize(); @@ -199,4 +199,78 @@ class Firmcustomerfollowuprecord extends Backend } $this->success(); } + public function newadd() + { + if (false === $this->request->isPost()) { + $customer_id = input('ids'); + $customer = Db::table('fa_firmcustomer')->where('id',$customer_id)->find(); + $this->view->assign('customer',$customer); + return $this->view->fetch(); + } + $params = $this->request->post(); + if (empty($params)) { + $this->error(__('Parameter %s can not be empty', '')); + } + $params = $this->preExcludeFields($params); + + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { + $params[$this->dataLimitField] = $this->auth->id; + } + $title_one = Db::table('fa_firmstoreprojectsone') + ->where('id',$params['firmstoreprojectsone_id']) + ->value('name'); + $title_two = Db::table('fa_firmstoreprojectstwo') + ->where('id',$params['firmstoreprojectstwo_id']) + ->value('name'); + $params['store_project_name'] = $title_one . ' - ' .$title_two; + $customerData = Db::table('fa_firmcustomer')->where('id',$params['firmcustomer_id'])->find(); + $dataList = []; + foreach ($params['visit_info'] as $value){ + $data = $params; + unset($data['visit_info']); + $data['rel_wx'] = $customerData['rel_wx']; + $data['rel_group'] = $customerData['rel_group']; + $data['visit_msg'] = $value['visit_msg']; + $data['day'] = $value['day']; + $data['followup_time'] = $value['times']; + $dataList[] = $data; + + } + $result = false; + //todo 需要增加一个有注意事项就需要立即发送内容 + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; + $this->model->validateFailException()->validate($validate); + } + $fields = Db::table('fa_firmcustomerfollowuprecord')->getTableFields(); + + foreach ($dataList as $value){ + $validData = array_intersect_key($value, array_flip($fields)); + $result = Db::table('fa_firmcustomerfollowuprecord')->insertGetId($validData); + if ($result){ + $firmcustomerfollowuptimelist = []; + $firmcustomerfollowuptimelist['firmcustomerfollowuprecord_id']=$result; + $firmcustomerfollowuptimelist['day']=$value['day']; + $firmcustomerfollowuptimelist['followup_time']=$value['followup_time']; + Db::table('fa_firmcustomerfollowuptimelist')->insert($firmcustomerfollowuptimelist); + }else{ + Db::rollback(); + $this->error('添加失败,请重新操作'); + } + } + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result === false) { + $this->error(__('No rows were inserted')); + } + $this->success(); + } + } diff --git a/admin/application/admin/controller/Firmstoreprojectsone.php b/admin/application/admin/controller/Firmstoreprojectsone.php index a37dd7d..36b06b9 100755 --- a/admin/application/admin/controller/Firmstoreprojectsone.php +++ b/admin/application/admin/controller/Firmstoreprojectsone.php @@ -17,7 +17,7 @@ class Firmstoreprojectsone extends Backend * @var \app\admin\model\Firmstoreprojectsone */ protected $model = null; - + protected $noNeedRight = ['index']; public function _initialize() { parent::_initialize(); @@ -48,12 +48,10 @@ class Firmstoreprojectsone extends Backend if ($this->request->isAjax()) { //如果发送的来源是Selectpage,则转发到Selectpage if ($this->request->request('keyField')) { - return $this->selectpage(); + return $this->selectpageNew(['firm_id'=>session_admin_firm_id()]); } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); - $list = $this->model - ->where($where) ->order($sort, $order) ->paginate($limit); @@ -62,7 +60,6 @@ class Firmstoreprojectsone extends Backend $row->visible(['id','name']); } - $result = array("total" => $list->total(), "rows" => $list->items()); return json($result); diff --git a/admin/application/admin/controller/Firmstoreprojectstwo.php b/admin/application/admin/controller/Firmstoreprojectstwo.php index 8072913..bdd05c7 100755 --- a/admin/application/admin/controller/Firmstoreprojectstwo.php +++ b/admin/application/admin/controller/Firmstoreprojectstwo.php @@ -48,7 +48,7 @@ class Firmstoreprojectstwo extends Backend if ($this->request->isAjax()) { //如果发送的来源是Selectpage,则转发到Selectpage if ($this->request->request('keyField')) { - return $this->selectpage(); + return $this->selectpageNew(['firm_id'=>session_admin_firm_id()]); } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); diff --git a/admin/application/admin/controller/Mattertemplate.php b/admin/application/admin/controller/Mattertemplate.php new file mode 100644 index 0000000..a4f14e5 --- /dev/null +++ b/admin/application/admin/controller/Mattertemplate.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\Mattertemplate; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/admin/application/admin/controller/Mattertemplatecategorization.php b/admin/application/admin/controller/Mattertemplatecategorization.php new file mode 100644 index 0000000..5b11a85 --- /dev/null +++ b/admin/application/admin/controller/Mattertemplatecategorization.php @@ -0,0 +1,96 @@ +model = new \app\admin\model\Mattertemplatecategorization; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + $this->model->where('fa_mattertemplatecategorization.firm_id',session_admin_firm_id()); + $list = $this->model + ->with(['mattertemplate','firmstoreprojectsone','firmstoreprojectstwo','firm']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + $row->visible(['id','name','create_time','update_time','firmstoreprojectsone_id','firmstoreprojectstwo_id','firm_id']); + $row->visible(['mattertemplate']); + $row->getRelation('mattertemplate')->visible(['name']); + $row->visible(['firmstoreprojectsone']); + $row->getRelation('firmstoreprojectsone')->visible(['name']); + $row->visible(['firmstoreprojectstwo']); + $row->getRelation('firmstoreprojectstwo')->visible(['name']); + $row->visible(['firm']); + $row->getRelation('firm')->visible(['full_name']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + public function getPrecautions(){ + $firmstoreprojectsone_id = input('firmstoreprojectsone_id'); + $firmstoreprojectstwo_id = input('firmstoreprojectstwo_id'); + $model = $this->model->where('mattertemplate_id',1); + $visitmodel = Db::table('fa_mattertemplatecategorization')->where('mattertemplate_id',2); + if (!empty($firmstoreprojectsone_id)){ + $model = $model->where('firmstoreprojectsone_id',$firmstoreprojectsone_id); + $visitmodel = $visitmodel->where('firmstoreprojectsone_id',$firmstoreprojectsone_id); + } + if (!empty($firmstoreprojectstwo_id)){ + $model = $model->where('firmstoreprojectstwo_id',$firmstoreprojectstwo_id); + $visitmodel = $visitmodel->where('firmstoreprojectstwo_id',$firmstoreprojectstwo_id); + } + $data = $model->select(); + $visitdata = $visitmodel->select(); + return json(['data'=>$data,'visit_data'=>$visitdata]); + } + +} diff --git a/admin/application/admin/controller/Mattertemplatecategorizedcontent.php b/admin/application/admin/controller/Mattertemplatecategorizedcontent.php new file mode 100644 index 0000000..20e6fba --- /dev/null +++ b/admin/application/admin/controller/Mattertemplatecategorizedcontent.php @@ -0,0 +1,186 @@ +model = new \app\admin\model\Mattertemplatecategorizedcontent; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['mattertemplatecategorization']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + $row->visible(['id','content','day','times']); + $row->visible(['mattertemplatecategorization']); + $row->getRelation('mattertemplatecategorization')->visible(['name']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + public function add() + { + if (false === $this->request->isPost()) { + $ids = input('ids'); + $name = Db::table('fa_mattertemplatecategorization')->where('id',$ids)->find(); + $data = $this->model->where('mattertemplatecategorization_id',$ids)->select(); + $this->view->assign('name',$name); + if (count($data) >0 ){ + $this->view->assign('row',$data); + return $this->view->fetch('edit'); + } + return $this->view->fetch(); + } + $params = $this->request->post(); + if (empty($params)) { + $this->error(__('Parameter %s can not be empty', '')); + } + $params = $this->preExcludeFields($params); + + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { + $params[$this->dataLimitField] = $this->auth->id; + } + $dataList = []; + $inputInfo = []; + foreach($params['inputInfo'] as $key=>$value){ + if (!empty($value['name'])){ + $inputInfo[$value['name']] = $value['value']; + } + $inputInfo['mattertemplatecategorization_id'] = $params['mattertemplatecategorization_id']; + $inputInfo['create_time'] = $params['create_time']; + $inputInfo['update_time'] = $params['update_time']; + if (($key+1)%4==0){ + $dataList[] = $inputInfo; + $inputInfo = []; + } + } + $result = false; + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; + $this->model->validateFailException()->validate($validate); + } + $result = $this->model->allowField(true)->insertAll($dataList); + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result === false) { + $this->error(__('No rows were inserted')); + } + $this->success(); + } + + public function newEdit(){ + $params = $this->request->post(); + if (empty($params)) { + $this->error(__('Parameter %s can not be empty', '')); + } + $params = $this->preExcludeFields($params); + + $dataList = []; + $inputInfo = []; + foreach($params['inputInfo'] as $key=>$value){ + $inputInfo['mattertemplatecategorization_id'] = $params['mattertemplatecategorization_id']; + $inputInfo['create_time'] = $params['create_time']; + $inputInfo['update_time'] = date('Y-m-d H:i:s'); + if (!empty($value['name'])){ + $inputInfo[$value['name']] = $value['value']; + if ($value['name'] == 'id'){ + unset($inputInfo['id']); + } + } + if (($key+1)%5==0){ + $dataList[] = $inputInfo; + $inputInfo = []; + } + } + $result = false; + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; + $this->model->validateFailException()->validate($validate); + } + $this->model->where('mattertemplatecategorization_id',$params['mattertemplatecategorization_id'])->delete(); + $result = $this->model->allowField(true)->insertAll($dataList); + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if (false === $result) { + $this->error(__('No rows were updated')); + } + $this->success(); + } + public function getAllContent(){ + $mattertemplatecategorization_id = $this->request->post('id'); + $type = $this->request->post('type'); + $data = $this->model->where('mattertemplatecategorization_id',$mattertemplatecategorization_id) + ->order('id desc'); + if ($type==1){ + $data = $data->find(); + }else{ + $data = $data->select(); + } + return json(['data'=>$data]); + } +} diff --git a/admin/application/admin/lang/zh-cn/mattertemplate.php b/admin/application/admin/lang/zh-cn/mattertemplate.php new file mode 100644 index 0000000..3c0646d --- /dev/null +++ b/admin/application/admin/lang/zh-cn/mattertemplate.php @@ -0,0 +1,8 @@ + '主键ID', + 'Name' => '事项模板名称', + 'Create_time' => '创建时间', + 'Update_time' => '更新时间' +]; diff --git a/admin/application/admin/lang/zh-cn/mattertemplatecategorization.php b/admin/application/admin/lang/zh-cn/mattertemplatecategorization.php new file mode 100644 index 0000000..0e166bd --- /dev/null +++ b/admin/application/admin/lang/zh-cn/mattertemplatecategorization.php @@ -0,0 +1,14 @@ + '序号', + 'Mattertemplate_id' => '事项模板ID', + 'Name' => '模板名称', + 'Firmstoreprojectsone_id' => '到店项目', + 'Firmstoreprojectstwo_id' => '详细项目', + 'Create_time' => '创建时间', + 'Update_time' => '更新时间', + 'Mattertemplate.name' => '事项模板名称', + 'Firmstoreprojectsone.name' => '到店项目', + 'Firmstoreprojectstwo.name' => '详细项目' +]; diff --git a/admin/application/admin/lang/zh-cn/mattertemplatecategorizedcontent.php b/admin/application/admin/lang/zh-cn/mattertemplatecategorizedcontent.php new file mode 100644 index 0000000..e6266e1 --- /dev/null +++ b/admin/application/admin/lang/zh-cn/mattertemplatecategorizedcontent.php @@ -0,0 +1,12 @@ + '主键ID', + 'Mattertemplatecategorization_id' => '事项模版分类ID', + 'Content' => '内容', + 'Day' => 'N天后回访', + 'Times' => '回访时间', + 'Create_time' => '创建时间', + 'Update_time' => '更新时间', + 'Mattertemplatecategorization.name' => '模板名称' +]; diff --git a/admin/application/admin/model/Mattertemplate.php b/admin/application/admin/model/Mattertemplate.php new file mode 100644 index 0000000..350b305 --- /dev/null +++ b/admin/application/admin/model/Mattertemplate.php @@ -0,0 +1,40 @@ +belongsTo('Mattertemplate', 'mattertemplate_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function firmstoreprojectsone() + { + return $this->belongsTo('Firmstoreprojectsone', 'firmstoreprojectsone_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function firmstoreprojectstwo() + { + return $this->belongsTo('Firmstoreprojectstwo', 'firmstoreprojectstwo_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function firm() + { + return $this->belongsTo('Firm', 'firm_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/admin/application/admin/model/Mattertemplatecategorizedcontent.php b/admin/application/admin/model/Mattertemplatecategorizedcontent.php new file mode 100644 index 0000000..1259c82 --- /dev/null +++ b/admin/application/admin/model/Mattertemplatecategorizedcontent.php @@ -0,0 +1,44 @@ +belongsTo('Mattertemplatecategorization', 'mattertemplatecategorization_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/admin/application/admin/validate/Mattertemplate.php b/admin/application/admin/validate/Mattertemplate.php new file mode 100644 index 0000000..c6223e0 --- /dev/null +++ b/admin/application/admin/validate/Mattertemplate.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/admin/application/admin/validate/Mattertemplatecategorization.php b/admin/application/admin/validate/Mattertemplatecategorization.php new file mode 100644 index 0000000..d91a527 --- /dev/null +++ b/admin/application/admin/validate/Mattertemplatecategorization.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/admin/application/admin/validate/Mattertemplatecategorizedcontent.php b/admin/application/admin/validate/Mattertemplatecategorizedcontent.php new file mode 100644 index 0000000..ac1abd6 --- /dev/null +++ b/admin/application/admin/validate/Mattertemplatecategorizedcontent.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/admin/application/admin/view/firmcustomerfollowuprecord/newadd.html b/admin/application/admin/view/firmcustomerfollowuprecord/newadd.html new file mode 100644 index 0000000..4af4dbe --- /dev/null +++ b/admin/application/admin/view/firmcustomerfollowuprecord/newadd.html @@ -0,0 +1,146 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ + + +
diff --git a/admin/application/admin/view/mattertemplate/add.html b/admin/application/admin/view/mattertemplate/add.html new file mode 100644 index 0000000..6260941 --- /dev/null +++ b/admin/application/admin/view/mattertemplate/add.html @@ -0,0 +1,27 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/admin/application/admin/view/mattertemplate/edit.html b/admin/application/admin/view/mattertemplate/edit.html new file mode 100644 index 0000000..e207ef0 --- /dev/null +++ b/admin/application/admin/view/mattertemplate/edit.html @@ -0,0 +1,27 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/admin/application/admin/view/mattertemplate/index.html b/admin/application/admin/view/mattertemplate/index.html new file mode 100644 index 0000000..b842f5f --- /dev/null +++ b/admin/application/admin/view/mattertemplate/index.html @@ -0,0 +1,29 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/admin/application/admin/view/mattertemplatecategorization/add.html b/admin/application/admin/view/mattertemplatecategorization/add.html new file mode 100644 index 0000000..f1b1458 --- /dev/null +++ b/admin/application/admin/view/mattertemplatecategorization/add.html @@ -0,0 +1,50 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/admin/application/admin/view/mattertemplatecategorization/edit.html b/admin/application/admin/view/mattertemplatecategorization/edit.html new file mode 100644 index 0000000..d641fa5 --- /dev/null +++ b/admin/application/admin/view/mattertemplatecategorization/edit.html @@ -0,0 +1,50 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/admin/application/admin/view/mattertemplatecategorization/index.html b/admin/application/admin/view/mattertemplatecategorization/index.html new file mode 100644 index 0000000..174593a --- /dev/null +++ b/admin/application/admin/view/mattertemplatecategorization/index.html @@ -0,0 +1,29 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/admin/application/admin/view/mattertemplatecategorizedcontent/add.html b/admin/application/admin/view/mattertemplatecategorizedcontent/add.html new file mode 100644 index 0000000..03f927f --- /dev/null +++ b/admin/application/admin/view/mattertemplatecategorizedcontent/add.html @@ -0,0 +1,108 @@ +
+ +
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
diff --git a/admin/application/admin/view/mattertemplatecategorizedcontent/edit.html b/admin/application/admin/view/mattertemplatecategorizedcontent/edit.html new file mode 100644 index 0000000..0103c8b --- /dev/null +++ b/admin/application/admin/view/mattertemplatecategorizedcontent/edit.html @@ -0,0 +1,111 @@ +
+ +
+ +
+ +
+
+ {foreach($row as $value)} +
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ {/foreach} +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
diff --git a/admin/application/admin/view/mattertemplatecategorizedcontent/index.html b/admin/application/admin/view/mattertemplatecategorizedcontent/index.html new file mode 100644 index 0000000..0726d85 --- /dev/null +++ b/admin/application/admin/view/mattertemplatecategorizedcontent/index.html @@ -0,0 +1,29 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/admin/application/common/controller/Backend.php b/admin/application/common/controller/Backend.php index e7924a0..20b6c0e 100755 --- a/admin/application/common/controller/Backend.php +++ b/admin/application/common/controller/Backend.php @@ -594,7 +594,143 @@ class Backend extends Controller //这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮 return json(['list' => $list, 'total' => $total]); } + protected function selectpageNew($newWhere=[]) + { + //设置过滤方法 + $this->request->filter(['trim', 'strip_tags', 'htmlspecialchars']); + //搜索关键词,客户端输入以空格分开,这里接收为数组 + $word = (array)$this->request->request("q_word/a"); + //当前页 + $page = $this->request->request("pageNumber"); + //分页大小 + $pagesize = $this->request->request("pageSize"); + //搜索条件 + $andor = $this->request->request("andOr", "and", "strtoupper"); + //排序方式 + $orderby = (array)$this->request->request("orderBy/a"); + //显示的字段 + $field = $this->request->request("showField"); + //主键 + $primarykey = $this->request->request("keyField"); + //主键值 + $primaryvalue = $this->request->request("keyValue"); + //搜索字段 + $searchfield = (array)$this->request->request("searchField/a"); + //自定义搜索条件 + $custom = (array)$this->request->request("custom/a"); + //是否返回树形结构 + $istree = $this->request->request("isTree", 0); + $ishtml = $this->request->request("isHtml", 0); + if ($istree) { + $word = []; + $pagesize = 999999; + } + $order = []; + foreach ($orderby as $k => $v) { + $order[$v[0]] = $v[1]; + } + $field = $field ? $field : 'name'; + + //如果有primaryvalue,说明当前是初始化传值 + if ($primaryvalue !== null) { + $where = [$primarykey => ['in', $primaryvalue]]; + $pagesize = 999999; + } else { + $where = function ($query) use ($word, $andor, $field, $searchfield, $custom) { + $logic = $andor == 'AND' ? '&' : '|'; + $searchfield = is_array($searchfield) ? implode($logic, $searchfield) : $searchfield; + $searchfield = str_replace(',', $logic, $searchfield); + $word = array_filter(array_unique($word)); + if (count($word) == 1) { + $query->where($searchfield, "like", "%" . reset($word) . "%"); + } else { + $query->where(function ($query) use ($word, $searchfield) { + foreach ($word as $index => $item) { + $query->whereOr(function ($query) use ($item, $searchfield) { + $query->where($searchfield, "like", "%{$item}%"); + }); + } + }); + } + if ($custom && is_array($custom)) { + foreach ($custom as $k => $v) { + if (is_array($v) && 2 == count($v)) { + $query->where($k, trim($v[0]), $v[1]); + } else { + $query->where($k, '=', $v); + } + } + } + }; + } + //新增条件 + if (!empty($newWhere)){ + $this->model->where($newWhere); + } + $adminIds = $this->getDataLimitAdminIds(); + if (is_array($adminIds)) { + $this->model->where($this->dataLimitField, 'in', $adminIds); + } + $list = []; + $total = $this->model->where($where)->count(); + if ($total > 0) { + if (!empty($newWhere)){ + $this->model->where($newWhere); + } + if (is_array($adminIds)) { + $this->model->where($this->dataLimitField, 'in', $adminIds); + } + + $fields = is_array($this->selectpageFields) ? $this->selectpageFields : ($this->selectpageFields && $this->selectpageFields != '*' ? explode(',', $this->selectpageFields) : []); + + //如果有primaryvalue,说明当前是初始化传值,按照选择顺序排序 + if ($primaryvalue !== null && preg_match("/^[a-z0-9_\-]+$/i", $primarykey)) { + $primaryvalue = array_unique(is_array($primaryvalue) ? $primaryvalue : explode(',', $primaryvalue)); + //修复自定义data-primary-key为字符串内容时,给排序字段添加上引号 + $primaryvalue = array_map(function ($value) { + return '\'' . $value . '\''; + }, $primaryvalue); + + $primaryvalue = implode(',', $primaryvalue); + + $this->model->orderRaw("FIELD(`{$primarykey}`, {$primaryvalue})"); + } else { + $this->model->order($order); + } + + $datalist = $this->model->where($where) + ->page($page, $pagesize) + ->select(); + + foreach ($datalist as $index => $item) { + unset($item['password'], $item['salt']); + if ($this->selectpageFields == '*') { + $result = [ + $primarykey => $item[$primarykey] ?? '', + $field => $item[$field] ?? '', + ]; + } else { + $result = array_intersect_key(($item instanceof Model ? $item->toArray() : (array)$item), array_flip($fields)); + } + $result['pid'] = isset($item['pid']) ? $item['pid'] : (isset($item['parent_id']) ? $item['parent_id'] : 0); + $list[] = $result; + } + if ($istree && !$primaryvalue) { + $tree = Tree::instance(); + $tree->init(collection($list)->toArray(), 'pid'); + $list = $tree->getTreeList($tree->getTreeArray(0), $field); + if (!$ishtml) { + foreach ($list as &$item) { + $item = str_replace(' ', ' ', $item); + } + unset($item); + } + } + } + //这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮 + return json(['list' => $list, 'total' => $total]); + } /** * 刷新Token */ diff --git a/admin/public/assets/js/backend/firmcustomer.js b/admin/public/assets/js/backend/firmcustomer.js index 84b38c8..5d80bd0 100755 --- a/admin/public/assets/js/backend/firmcustomer.js +++ b/admin/public/assets/js/backend/firmcustomer.js @@ -51,7 +51,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin title: __('新增回访'), classname: 'btn btn-xs btn-primary btn-dialog', icon: 'fa fa-magic', - url: 'firmcustomerfollowuprecord/add', + url: 'firmcustomerfollowuprecord/newadd', callback: function (data) { Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); }, @@ -60,6 +60,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin return true; } }, + // { + // name: 'addFollwup', + // text: __('新增回访'), + // title: __('新增回访'), + // classname: 'btn btn-xs btn-primary btn-dialog', + // icon: 'fa fa-magic', + // url: 'firmcustomerfollowuprecord/add', + // callback: function (data) { + // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); + // }, + // visible: function (row) { + // //返回true时按钮显示,返回false隐藏 + // return true; + // } + // }, { name: 'follwuplist', text: __('回访列表'), diff --git a/admin/public/assets/js/backend/firmcustomerfollowuprecord.js b/admin/public/assets/js/backend/firmcustomerfollowuprecord.js index e67b42a..0805de4 100755 --- a/admin/public/assets/js/backend/firmcustomerfollowuprecord.js +++ b/admin/public/assets/js/backend/firmcustomerfollowuprecord.js @@ -57,21 +57,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // return true; // } // }, - { - name: 'setFollwupPlan', - text: __('设置回访计划'), - title: __('设置回访计划'), - classname: 'btn btn-xs btn-danger btn-dialog', - icon: 'fa fa-plus', - url: 'firmcustomerfollowuptimelist/add', - callback: function (data) { - Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); - }, - visible: function (row) { - //返回true时按钮显示,返回false隐藏 - return true; - } - }, + // { + // name: 'setFollwupPlan', + // text: __('设置回访计划'), + // title: __('设置回访计划'), + // classname: 'btn btn-xs btn-danger btn-dialog', + // icon: 'fa fa-plus', + // url: 'firmcustomerfollowuptimelist/add', + // callback: function (data) { + // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); + // }, + // visible: function (row) { + // //返回true时按钮显示,返回false隐藏 + // return true; + // } + // }, { name: 'planList', text: __('计划列表'), @@ -163,6 +163,171 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin edit: function () { Controller.api.bindevent(); }, + newadd:function (){ + $("#c-firmstoreprojectsone_id").on("change", function (obj) { + let firmstoreprojectsone_id = $('#c-firmstoreprojectsone_id').val(); + let firmstoreprojectstwo_id = $('#c-firmstoreprojectstwo_id').val(); + $.post('mattertemplatecategorization/getPrecautions', + {firmstoreprojectsone_id:firmstoreprojectsone_id,firmstoreprojectstwo_id:firmstoreprojectstwo_id},function (res) { + $('#c-firmnotespoints_id').selectPageData(res.data); + $('#c-visit_id').selectPageData(res.visit_data); + },'json'); + }); + $("#c-firmstoreprojectstwo_id").on("change", function (obj) { + let firmstoreprojectsone_id = $('#c-firmstoreprojectsone_id').val(); + let firmstoreprojectstwo_id = $('#c-firmstoreprojectstwo_id').val(); + $.post('mattertemplatecategorization/getPrecautions', + {firmstoreprojectsone_id:firmstoreprojectsone_id,firmstoreprojectstwo_id:firmstoreprojectstwo_id},function (res) { + // layer.close(load_index); + //回显 + $('#c-firmnotespoints_id').selectPageData(res.data); + $('#c-visit_id').selectPageData(res.visit_data); + },'json'); + }); + $('#firmnotespoints_template').on('click', '.shili_huashu_btn', function () { + var that = $(this); + let txt = that.closest('#firmnotespoints_template').find('.c-hui-fang-yao-dian'); + $.post('ai/talk_skill',{txt:txt.val()},function (res) { + // layer.close(load_index); + //回显 + that.closest('#firmnotespoints_template').find('.c-content').val(res.data); + },'json'); + }); + $('#visit_template').on('click', '.shili_huashu_btn', function () { + var that = $(this); + let txt = that.closest('#visit_template').find('.c-hui-fang-yao-dian'); + $.post('ai/talk_skill',{txt:txt.val()},function (res) { + // layer.close(load_index); + //回显 + that.closest('#visit_template').find('.c-content').val(res.data); + },'json'); + }); + $("#c-firmnotespoints_id").on("change", function (obj) { + let firmnotespoints_id = $('#c-firmnotespoints_id').val(); + $.post('Mattertemplatecategorizedcontent/getAllContent',{id:firmnotespoints_id,type:1},function (res) { + // layer.close(load_index); + //回显 + console.log(res); + // $('#firmnotespoints_template .c-day').val(res.data.day); + // $('#firmnotespoints_template .c-times').val(res.data.times); + $('#firmnotespoints_template .c-hui-fang-yao-dian').val(res.data.points); + $('#firmnotespoints_template .c-content').val(res.data.content); + },'json'); + }); + $("#c-visit_id").on("change", function (obj) { + let visit_id = $('#c-visit_id').val(); + $.post('Mattertemplatecategorizedcontent/getAllContent',{id:visit_id,type:2},function (res) { + // layer.close(load_index); + //回显 + var html =''; + $.each(res.data, function (key, value) { + html = html + "
\n" + + "
\n" + + " \n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + "
\n" + + " \n" + + "
\n" + + "
\n" + + "
\n" + + " \n" + + "
\n" + + " \n" + + " \n" + + " \n" + + "
\n" + + "
\n" + + "
"; + }); + $('#visit_template').empty(); + $('#visit_template').append(html); + },'json'); + }); + $('#visit_template').on('click', '.deleteButton', function () { + // 获取当前删除按钮所在的大 div 并移除 + var number = $('.add-group').length; + if (number == 1){layer.msg('至少保留一个')}else + $(this).closest('.add-group').remove(); + }); + $('#c-add_group_content').on('click',function (res){ + res.preventDefault(); + var html = $('.form_group_add_noshow').html(); + + html = "
"+html+"
"; + $('#visit_template').append(html); + }); + $('#submit-button-add').on('click',function (res){ + var firm_id=$('#c-firm_id').val(); + var firmstore_id=$('#c-firmstore_id').val(); + var name=$('#c-name').val(); + var firmcustomer_id=$('#c-customer-id').val(); + var firmstoreprojectsone_id=$('#c-firmstoreprojectsone_id').val(); + var firmstoreprojectstwo_id=$('#c-firmstoreprojectstwo_id').val(); + var remark=$('#c-remark').val(); + var feedback=$('#c-feedback').val(); + var firmnotespoints_id=$('#c-firmnotespoints_id').val(); + // var firmnotespoints_day=$('#firmnotespoints_day').val(); + // var firmnotespoints_times=$('#firmnotespoints_times').val(); + var firmnotespoints_points=$('#firmnotespoints_points').val(); + var firmnotespoints_content=$('#firmnotespoints_content').val(); + var visit_id=$('#c-visit_id').val(); + var visit_info = []; + $('#visit_template .add-group').each(function (res) { + var day = $(this).find('.c-day').val(); + var times = $(this).find('.c-times').val(); + var points = $(this).find('.c-hui-fang-yao-dian').val(); + var content = $(this).find('.c-content').val(); + visit_info.push({ day: day, times: times,points:points,visit_msg:content }); + }); + $.post('Firmcustomerfollowuprecord/newadd', + { + firm_id:firm_id, + firmstore_id:firmstore_id, + name:name, + firmcustomer_id:firmcustomer_id, + firmstoreprojectsone_id:firmstoreprojectsone_id, + firmstoreprojectstwo_id:firmstoreprojectstwo_id, + remark:remark, + feedback:feedback, + firmnotespoints_id:firmnotespoints_id, + // firmnotespoints_day:firmnotespoints_day, + // firmnotespoints_times:firmnotespoints_times, + firmnotespoints_points:firmnotespoints_points, + notes:firmnotespoints_content, + visit_id:visit_id, + visit_info:visit_info, + },function (res) { + // layer.close(load_index); + //回显 + if (res.code == 1){ + layer.msg('添加成功'); + }else { + layer.msg('添加失败'); + } + },'json'); + }); + Controller.api.bindevent(); + }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); diff --git a/admin/public/assets/js/backend/mattertemplate.js b/admin/public/assets/js/backend/mattertemplate.js new file mode 100644 index 0000000..0a6cd96 --- /dev/null +++ b/admin/public/assets/js/backend/mattertemplate.js @@ -0,0 +1,53 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'mattertemplate/index' + location.search, + add_url: 'mattertemplate/add', + edit_url: 'mattertemplate/edit', + del_url: 'mattertemplate/del', + multi_url: 'mattertemplate/multi', + import_url: 'mattertemplate/import', + table: 'mattertemplate', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/admin/public/assets/js/backend/mattertemplatecategorization.js b/admin/public/assets/js/backend/mattertemplatecategorization.js new file mode 100644 index 0000000..22ccadc --- /dev/null +++ b/admin/public/assets/js/backend/mattertemplatecategorization.js @@ -0,0 +1,67 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'mattertemplatecategorization/index' + location.search, + add_url: 'mattertemplatecategorization/add', + edit_url: 'mattertemplatecategorization/edit', + del_url: 'mattertemplatecategorization/del', + multi_url: 'mattertemplatecategorization/multi', + import_url: 'mattertemplatecategorization/import', + table: 'mattertemplatecategorization', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'mattertemplate.name', title: __('Mattertemplate.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'firm.full_name', title: '企业名称', operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'firmstoreprojectsone.name', title: __('Firmstoreprojectsone.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'firmstoreprojectstwo.name', title: __('Firmstoreprojectstwo.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, + buttons: [ + { + name: 'addUpdata', + text: __('编辑具体内容'), + title: __('编辑具体内容'), + classname: 'btn btn-xs btn-primary btn-dialog', + icon: 'fa fa-magic', + url: 'mattertemplatecategorizedcontent/add', + },] + } + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/admin/public/assets/js/backend/mattertemplatecategorizedcontent.js b/admin/public/assets/js/backend/mattertemplatecategorizedcontent.js new file mode 100644 index 0000000..dc737cb --- /dev/null +++ b/admin/public/assets/js/backend/mattertemplatecategorizedcontent.js @@ -0,0 +1,126 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'mattertemplatecategorizedcontent/index' + location.search, + add_url: 'mattertemplatecategorizedcontent/add', + edit_url: 'mattertemplatecategorizedcontent/edit', + del_url: 'mattertemplatecategorizedcontent/del', + multi_url: 'mattertemplatecategorizedcontent/multi', + import_url: 'mattertemplatecategorizedcontent/import', + table: 'mattertemplatecategorizedcontent', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'day', title: __('Day')}, + {field: 'times', title: __('Times')}, + {field: 'mattertemplatecategorization.name', title: __('Mattertemplatecategorization.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + $('#add-form,#edit-form').on('click', '.shili_huashu_btn', function () { + var that = $(this); + let txt = that.closest('.form_group_add').find('.c-hui-fang-yao-dian'); + + $.post('ai/talk_skill',{txt:txt.val()},function (res) { + // layer.close(load_index); + //回显 + that.closest('.form_group_add').find('.c-content').val(res.data); + },'json'); + }); + $('#c-add_group_content').on('click',function (res){ + res.preventDefault(); + var html = $('.form_group_add_noshow').html(); + + html = "
"+html+"
"; + $('#c-add_group_last_div').before(html); + }); + $('#add-form').on('click', '.deleteButton', function () { + // 获取当前删除按钮所在的大 div 并移除 + var number = $('.form_group_add').length; + if (number == 1){layer.msg('至少保留一个')}else + $(this).closest('.form_group_add').remove(); + }); + $('#edit-form').on('click', '.deleteButton', function () { + // 获取当前删除按钮所在的大 div 并移除 + var number = $('.form_group_add').length; + if (number == 1){layer.msg('至少保留一个')}else + $(this).closest('.form_group_add').remove(); + }); + $('#submit-button').on('click',function (res){ + var inputInfo = []; + $('.form_group_add input , .form_group_add textarea ').each(function () { + var value = $(this).val(); + var valueName = $(this).attr('name'); + inputInfo.push({ name: valueName, value: value }); + }); + var mattertemplatecategorization_id=$('#c-mattertemplatecategorization_id').val(); + var create_time=$('#c-create_time').val(); + var update_time=$('#c-update_time').val(); + $.post('Mattertemplatecategorizedcontent/add', + {inputInfo:inputInfo,mattertemplatecategorization_id:mattertemplatecategorization_id, + create_time:create_time,update_time:update_time},function (res) { + // layer.close(load_index); + //回显 + if (res.code == 1){ + layer.msg('添加成功'); + }else { + layer.msg('添加失败'); + } + },'json'); + }); + $('#submit-button-edit').on('click',function (res){ + var inputInfo = []; + $('.form_group_add input , .form_group_add textarea ').each(function () { + var value = $(this).val(); + var valueName = $(this).attr('name'); + inputInfo.push({ name: valueName, value: value }); + }); + var mattertemplatecategorization_id=$('#c-mattertemplatecategorization_id').val(); + var create_time=$('#c-create_time').val(); + var update_time=$('#c-update_time').val(); + $.post('Mattertemplatecategorizedcontent/newEdit', + {inputInfo:inputInfo,mattertemplatecategorization_id:mattertemplatecategorization_id, + create_time:create_time,update_time:update_time},function (res) { + // layer.close(load_index); + //回显 + if (res.code == 1){ + layer.msg('修改成功'); + }else { + layer.msg('修改失败'); + } + },'json'); + }); + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +});