From acdff03246ce648082192dfb069c3a006a7fbee6 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 09 八月 2023 18:46:06 +0800
Subject: [PATCH] 客户管理模块 批量删除、推进、跟进接口联调

---
 src/views/client/client/index.vue |  135 +++++++++++++++++++++++++++++++-------------
 1 files changed, 94 insertions(+), 41 deletions(-)

diff --git a/src/views/client/client/index.vue b/src/views/client/client/index.vue
index c6688f2..63111a9 100644
--- a/src/views/client/client/index.vue
+++ b/src/views/client/client/index.vue
@@ -2,14 +2,14 @@
   <div class="custom-manage">
     <div class="tab-view">
       <el-tabs v-model="activeName" @tab-click="tabsClick">
-        <el-tab-pane label="鍏ㄩ儴(鍚墍鏈夊叕娴�)" name="first"></el-tab-pane>
-        <el-tab-pane label="鍏ㄩ儴(鍚叕娴�)" name="second"></el-tab-pane>
-        <el-tab-pane label="鍏ㄩ儴(涓嶅惈鍏捣)" name="third"></el-tab-pane>
-        <el-tab-pane label="鍏捣宸插垎閰�" name="fourth"></el-tab-pane>
-        <el-tab-pane label="鍏湭鍒嗛厤" name="aaa"></el-tab-pane>
+        <el-tab-pane label="鍏ㄩ儴(鍚墍鏈夊叕娴�)" name="first" disabled></el-tab-pane>
+        <el-tab-pane label="鍏ㄩ儴(鍚叕娴�)" name="second" disabled></el-tab-pane>
+        <el-tab-pane label="鍏ㄩ儴(涓嶅惈鍏捣)" name="third" disabled></el-tab-pane>
+        <el-tab-pane label="鍏捣宸插垎閰�" name="fourth" disabled></el-tab-pane>
+        <el-tab-pane label="鍏湭鍒嗛厤" name="aaa" disabled></el-tab-pane>
       </el-tabs>
       <div class="sel-gonghai">
-        <el-select v-model="gonghaiValue" placeholder="璇烽�夋嫨" class="query-class-sel" size="mini">
+        <el-select v-model="gonghaiValue" placeholder="璇烽�夋嫨" class="query-class-sel" size="mini" disabled>
           <el-option v-for="item in gonghaiOptions" :key="item.value" :label="item.label" :value="item.value">
           </el-option>
         </el-select>
@@ -23,6 +23,8 @@
         ref="searchCommonView"
         :query-class-options="queryClassOptions"
         :search-options="searchOptions"
+        @searchClick="searchClick"
+        @resetClick="resetClick"
       />
       <div class="btn-pager">
         <PublicFunctionBtnView
@@ -31,6 +33,7 @@
           :map-button="true"
           :statistics="true"
           :operates-list="operatesList"
+          @batchDelete="delClick"
         />
         <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
       </div>
@@ -41,14 +44,15 @@
       :table-list="tableList"
       @selClientClick="selClientClick"
       @selContactsClick="selContactsClick"
+      @getSelectArray="getSelectArray"
     >
       <template slot="tableButton">
-        <el-table-column label="鎿嶄綔" width="180">
+        <el-table-column label="鎿嶄綔" width="150">
           <template slot-scope="scope">
-            <el-button type="text" size="small">鍙樻洿鍏捣</el-button>
+            <el-button type="text" size="small" disabled>鍙樻洿鍏捣</el-button>
             <el-button @click="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button>
-            <el-button type="text" size="small">璺熻繘</el-button>
-            <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button>
+            <el-button @click="followupClick(scope.row)" type="text" size="small">璺熻繘</el-button>
+            <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> -->
           </template>
         </el-table-column>
       </template>
@@ -59,6 +63,8 @@
     <DetailClientManage v-if="clientDeail.visible" :client-manage-detail="clientDeail" />
     <!-- 鑱旂郴浜鸿鎯� -->
     <DetailContacts v-if="contactsDeail.visible" :contacts-detail="contactsDeail" />
+    <!-- 鏂板缓/缂栬緫璺熻繘璁板綍 -->
+    <AddFollowupRecordsDialog v-if="editFollowupConfig.visible" :edit-contacts-config="editFollowupConfig" />
   </div>
 </template>
 
@@ -66,6 +72,7 @@
 import AddClientManageDialog from "@/views/client/client/AddClientManageDialog"
 import { getClientList, getDeleteClient } from "@/api/client/client"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import AddFollowupRecordsDialog from "@/views/client/followupRecords/AddFollowupRecordsDialog"
 
 export default {
   name: "CustomManage",
@@ -74,13 +81,10 @@
   components: {
     AddClientManageDialog,
     DetailContacts: () => import("@/views/client/contacts/DetailContacts"),
-    DetailClientManage: () => import("@/views/client/client/DetailClientManage")
+    DetailClientManage: () => import("@/views/client/client/DetailClientManage"),
+    AddFollowupRecordsDialog
   },
-  computed: {
-    searchCommonHeight() {
-      return this.$refs.searchCommonView.offsetHeight
-    }
-  },
+  computed: {},
   data() {
     return {
       tableList: {},
@@ -119,6 +123,13 @@
       clientDeail: {
         visible: false,
         infomation: {}
+      },
+      search_map: {},
+      selValueList: [],
+      editFollowupConfig: {
+        visible: false,
+        title: "鏂板缓",
+        infomation: {}
       }
     }
   },
@@ -132,11 +143,11 @@
         tableInfomation: [],
         tableColumn: [
           { label: "瀹㈡埛鍚嶇О", prop: "name", min: 100, isClientClick: true }, // 瀹㈡埛鍚嶇О
-          { label: "閿�鍞礋璐d汉", prop: "member_id" }, // 閿�鍞礋璐d汉
-          { label: "閲嶈绾у埆", prop: "client_level_id" }, // 閲嶈绾у埆
+          { label: "閿�鍞礋璐d汉", prop: "member_name" }, // 閿�鍞礋璐d汉
+          { label: "閲嶈绾у埆", prop: "client_level" }, // 閲嶈绾у埆
           { label: "涓嬫鍥炶鏃ユ湡", prop: "next_visit_time", isTime: true, min: 90 }, // 涓嬫鍥炶鏃ユ湡
           { label: "璇︾粏鍦板潃", prop: "detail_address", min: 200 }, // 璇︾粏鍦板潃
-          { label: "瀹㈡埛鐘舵��", prop: "client_status_id" }, // 瀹㈡埛鐘舵��
+          { label: "瀹㈡埛鐘舵��", prop: "client_status" }, // 瀹㈡埛鐘舵��
           { label: "鑱旂郴浜哄鍚�", prop: "contact_name", isContactClick: true }, // 鑱旂郴浜哄鍚�
           { label: "鎵嬫満鍙风爜", prop: "contact_phone" } // 鎵嬫満鍙风爜
         ]
@@ -144,14 +155,15 @@
       this.searchOptions = []
       for (let i = 0; i < this.tableList.tableColumn.length; i++) {
         const label = this.tableList.tableColumn[i].label
-        this.searchOptions.push({ value: (i + 1).toString(), label: label })
+        const value = this.tableList.tableColumn[i].prop
+        this.searchOptions.push({ value: value, label: label })
       }
     },
     // 璇锋眰鏁版嵁
     async getData() {
       this.loading = true
       await getClientList({
-        keyword: "",
+        search_map: this.search_map,
         page: this.pagerOptions.currPage,
         pageSize: this.pagerOptions.pageSize
       })
@@ -173,7 +185,9 @@
                 return {
                   ...item,
                   contact_name: contact_name,
-                  contact_phone: contact_phone
+                  contact_phone: contact_phone,
+                  client_level: item.client_level.name,
+                  client_status: item.client_status.name
                 }
               })
               this.tableList.tableInfomation = list || []
@@ -195,6 +209,18 @@
     tabsClick(tab, event) {
       console.log(tab, event)
     },
+    // 鎼滅储
+    searchClick(val, content) {
+      console.log(val, content)
+      this.search_map = {
+        [val]: content
+      }
+      this.getData()
+    },
+    resetClick() {
+      this.search_map = {}
+      this.getData()
+    },
     // 鏂板缓
     addBtnClick() {
       this.editConfig.visible = true
@@ -214,7 +240,6 @@
           }
         })
       }
-      console.log(contactObj)
       this.editConfig.infomation = {
         ...row,
         contact_wechat: contactObj.length > 0 ? contactObj.wechat : "",
@@ -222,27 +247,35 @@
       }
     },
     // 鍒犻櫎
-    delClick(id) {
-      this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning"
-      })
-        .then(function () {
-          return getDeleteClient({ id: id })
+    delClick() {
+      if (this.selValueList && this.selValueList.length > 0) {
+        this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
         })
-        .then((response) => {
-          if (response.code === 200) {
-            this.$message.success("鍒犻櫎鎴愬姛")
-            this.getData()
-          } else {
-            this.$message.warning("鍒犻櫎澶辫触")
-          }
-        })
-        .catch(function () {})
+          .then(() => {
+            getDeleteClient({ ids: this.selValueList }).then((response) => {
+              if (response.code === 200) {
+                this.$message.success("鍒犻櫎鎴愬姛")
+                this.getData()
+              } else {
+                this.$message.warning("鍒犻櫎澶辫触")
+              }
+            })
+          })
+          .catch(() => {})
+      } else {
+        this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉¤褰�")
+      }
     },
     getSelectArray(val) {
       console.log(val)
+      this.selValueList = []
+      const list = val.map((item) => {
+        return item.id
+      })
+      this.selValueList = list
     },
     // 瀹㈡埛鍚嶇О璇︽儏
     selClientClick(row) {
@@ -254,7 +287,27 @@
     selContactsClick(row) {
       console.log(row)
       this.contactsDeail.visible = true
-      this.contactsDeail.infomation = { ...row }
+      let contact = {}
+      if (row.contacts.length !== 0) {
+        for (let i = 0; i < row.contacts.length; i++) {
+          if (row.contacts[i].is_first) {
+            contact = row.contacts[i]
+          }
+        }
+      }
+      this.contactsDeail.infomation = { ...contact, Client: { name: row.name } }
+    },
+    // 璺熻繘
+    followupClick(row) {
+      console.log(row)
+      this.editFollowupConfig.visible = true
+      this.editFollowupConfig.title = "鏂板缓"
+      this.editFollowupConfig.infomation = {
+        ...row,
+        client_name: row.name,
+        number: "",
+        next_follow_time: row.next_visit_time
+      }
     }
   }
 }

--
Gitblit v1.8.0