From 478e257bced096b98359973b2e95fbab797616c7 Mon Sep 17 00:00:00 2001 From: meimei <102865034@qq.com> Date: Wed, 16 Apr 2025 10:08:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=9B=9E=E8=AE=BF=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/Firmcustomerfollowuprecord.php | 70 +++++++- .../Firmcustomerfollowuptimelist.php | 1 + .../Mattertemplatecategorization.php | 6 +- .../Mattertemplatecategorizedcontent.php | 12 ++ .../firmcustomerfollowuprecord/newadd.html | 146 +++++++++++++++ .../firmcustomerfollowuptimelist/edit.html | 2 +- .../public/assets/js/backend/firmcustomer.js | 51 ++++-- .../js/backend/firmcustomerfollowuprecord.js | 167 +++++++++++++++++- .../backend/firmcustomerfollowuptimelist.js | 2 +- .../backend/mattertemplatecategorization.js | 4 +- 10 files changed, 435 insertions(+), 26 deletions(-) create mode 100644 superadmin/application/admin/view/firmcustomerfollowuprecord/newadd.html diff --git a/superadmin/application/admin/controller/Firmcustomerfollowuprecord.php b/superadmin/application/admin/controller/Firmcustomerfollowuprecord.php index 03fcaea..2b604cd 100755 --- a/superadmin/application/admin/controller/Firmcustomerfollowuprecord.php +++ b/superadmin/application/admin/controller/Firmcustomerfollowuprecord.php @@ -3,6 +3,7 @@ namespace app\admin\controller; use app\common\controller\Backend; +use think\Db; /** * 客户回访记录 @@ -49,10 +50,9 @@ class Firmcustomerfollowuprecord extends Backend return $this->selectpage(); } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); - $list = $this->model - ->where($where) + ->where('firmcustomer_id','=',input('ids')) ->order($sort, $order) ->paginate($limit); @@ -68,4 +68,70 @@ class Firmcustomerfollowuprecord extends Backend return $this->view->fetch(); } + 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; + } + $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; + 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/superadmin/application/admin/controller/Firmcustomerfollowuptimelist.php b/superadmin/application/admin/controller/Firmcustomerfollowuptimelist.php index d15d9f6..6646c6a 100755 --- a/superadmin/application/admin/controller/Firmcustomerfollowuptimelist.php +++ b/superadmin/application/admin/controller/Firmcustomerfollowuptimelist.php @@ -53,6 +53,7 @@ class Firmcustomerfollowuptimelist extends Backend $list = $this->model ->with(['firmcustomerfollowuprecord']) ->where($where) + ->where('firmcustomerfollowuprecord_id','=',input('ids')) ->order($sort, $order) ->paginate($limit); diff --git a/superadmin/application/admin/controller/Mattertemplatecategorization.php b/superadmin/application/admin/controller/Mattertemplatecategorization.php index fd1591c..10beb66 100644 --- a/superadmin/application/admin/controller/Mattertemplatecategorization.php +++ b/superadmin/application/admin/controller/Mattertemplatecategorization.php @@ -77,14 +77,18 @@ class Mattertemplatecategorization extends Backend $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(); - return json(['total'=>count($data),'data'=>$data]); + $visitdata = $visitmodel->select(); + return json(['data'=>$data,'visit_data'=>$visitdata]); } } diff --git a/superadmin/application/admin/controller/Mattertemplatecategorizedcontent.php b/superadmin/application/admin/controller/Mattertemplatecategorizedcontent.php index 940ebd4..c690198 100644 --- a/superadmin/application/admin/controller/Mattertemplatecategorizedcontent.php +++ b/superadmin/application/admin/controller/Mattertemplatecategorizedcontent.php @@ -171,4 +171,16 @@ class Mattertemplatecategorizedcontent extends Backend } $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/superadmin/application/admin/view/firmcustomerfollowuprecord/newadd.html b/superadmin/application/admin/view/firmcustomerfollowuprecord/newadd.html new file mode 100644 index 0000000..cca68f8 --- /dev/null +++ b/superadmin/application/admin/view/firmcustomerfollowuprecord/newadd.html @@ -0,0 +1,146 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ + + +
diff --git a/superadmin/application/admin/view/firmcustomerfollowuptimelist/edit.html b/superadmin/application/admin/view/firmcustomerfollowuptimelist/edit.html index 7eaebb9..c74c5bb 100755 --- a/superadmin/application/admin/view/firmcustomerfollowuptimelist/edit.html +++ b/superadmin/application/admin/view/firmcustomerfollowuptimelist/edit.html @@ -15,7 +15,7 @@
- +