From 960d295793f1d164e3e8e22f8d7744b7923ae24b Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期一, 17 七月 2023 18:29:17 +0800
Subject: [PATCH] 销售线索列表、新建、编辑接口联调

---
 src/api/custom/contacts.js                            |   31 ++
 src/api/custom/client.js                              |   31 ++
 src/api/custom/salesLead.js                           |   11 
 src/components/makepager/CommonSelectView.vue         |    3 
 src/common/config/index.js                            |   20 +
 src/router/custom/index.js                            |    8 
 src/views/custom/client/index.vue                     |   78 ++++--
 src/api/common/address.js                             |   75 ++++++
 src/views/custom/client/AddClientManageDialog.vue     |   12 
 src/components/makepager/TableCommonView.vue          |    2 
 src/views/custom/salesLead/index.vue                  |   77 +++--
 src/views/custom/salesLead/AddSalesLeadDialog.vue     |  180 ++++++++++----
 src/views/custom/contacts/index.vue                   |   59 +++-
 src/components/layout/components/appsidebar/index.vue |    2 
 src/api/custom/followupRecords.js                     |   22 +
 src/views/custom/followupRecords/index.vue            |   65 +++--
 16 files changed, 504 insertions(+), 172 deletions(-)

diff --git a/src/api/common/address.js b/src/api/common/address.js
new file mode 100644
index 0000000..f61d263
--- /dev/null
+++ b/src/api/common/address.js
@@ -0,0 +1,75 @@
+import request from "@/common/untils/request.js"
+
+// 鑾峰彇鍥藉鍒楄〃
+export function getCountryList() {
+  return request({
+    url: "/api/country/list",
+    method: "get"
+  })
+}
+// 娣诲姞鍥藉
+export function getAddCountry() {
+  return request({
+    url: "/api/country/add",
+    method: "post"
+  })
+}
+// 鍒犻櫎鍥藉
+export function getDeleteCountry(data) {
+  return request({
+    url: "/api/country/delete",
+    method: "delete",
+    data
+  })
+}
+// 璁剧疆鍥藉
+export function getSetCountry() {
+  return request({
+    url: "/api/country/set",
+    method: "put"
+  })
+}
+// 鏇存柊鍥藉
+export function getUpdateCountry() {
+  return request({
+    url: "/api/country/update",
+    method: "put"
+  })
+}
+
+// 鑾峰彇鐪佷唤鍒楄〃
+export function getProvinceList() {
+  return request({
+    url: "/api/province/list",
+    method: "get"
+  })
+}
+// 娣诲姞鐪佷唤
+export function getAddProvince() {
+  return request({
+    url: "/api/province/add",
+    method: "post"
+  })
+}
+// 鍒犻櫎鐪佷唤
+export function getDeleteProvince(data) {
+  return request({
+    url: "/api/province/delete",
+    method: "delete",
+    data
+  })
+}
+// 璁剧疆鐪佷唤
+export function getSetProvince() {
+  return request({
+    url: "/api/province/set",
+    method: "put"
+  })
+}
+// 鏇存柊鐪佷唤
+export function getUpdateProvince() {
+  return request({
+    url: "/api/province/update",
+    method: "put"
+  })
+}
diff --git a/src/api/custom/client.js b/src/api/custom/client.js
new file mode 100644
index 0000000..93a5be5
--- /dev/null
+++ b/src/api/custom/client.js
@@ -0,0 +1,31 @@
+import request from "@/common/untils/request.js"
+
+// 瀹㈡埛绠$悊鍒楄〃
+export function getClientList() {
+  return request({
+    url: "/api/client/list",
+    method: "get"
+  })
+}
+// 娣诲姞瀹㈡埛绠$悊
+export function getAddClient() {
+  return request({
+    url: "/api/client/add",
+    method: "post"
+  })
+}
+// 鍒犻櫎瀹㈡埛绠$悊
+export function getDeleteClient(data) {
+  return request({
+    url: "/api/client/delete",
+    method: "delete",
+    data
+  })
+}
+// 鏇存柊瀹㈡埛绠$悊
+export function getUpdateClient() {
+  return request({
+    url: "/api/client/update",
+    method: "put"
+  })
+}
diff --git a/src/api/custom/contacts.js b/src/api/custom/contacts.js
new file mode 100644
index 0000000..34a3971
--- /dev/null
+++ b/src/api/custom/contacts.js
@@ -0,0 +1,31 @@
+import request from "@/common/untils/request.js"
+
+// 鑱旂郴浜哄垪琛�
+export function getContactList() {
+  return request({
+    url: "/api/contact/list",
+    method: "get"
+  })
+}
+// 娣诲姞鑱旂郴浜�
+export function getAddContact() {
+  return request({
+    url: "/api/contact/add",
+    method: "post"
+  })
+}
+// 鍒犻櫎鑱旂郴浜�
+export function getDeleteContact(data) {
+  return request({
+    url: "/api/contact/delete",
+    method: "delete",
+    data
+  })
+}
+// 鏇存柊鑱旂郴浜�
+export function getUpdateContact() {
+  return request({
+    url: "/api/contact/update",
+    method: "put"
+  })
+}
diff --git a/src/api/custom/followupRecords.js b/src/api/custom/followupRecords.js
index 55d9fb6..581b719 100644
--- a/src/api/custom/followupRecords.js
+++ b/src/api/custom/followupRecords.js
@@ -7,3 +7,25 @@
     method: "get"
   })
 }
+// 娣诲姞璺熻繘璁板綍
+export function getAddFollowRecord() {
+  return request({
+    url: "/api/followRecord/add",
+    method: "post"
+  })
+}
+// 鍒犻櫎璺熻繘璁板綍
+export function getDeleteFollowRecord(data) {
+  return request({
+    url: "/api/followRecord/delete",
+    method: "delete",
+    data
+  })
+}
+// 鏇存柊璺熻繘璁板綍
+export function getUpdateFollowRecord() {
+  return request({
+    url: "/api/followRecord/update",
+    method: "put"
+  })
+}
diff --git a/src/api/custom/salesLead.js b/src/api/custom/salesLead.js
index 622fbc6..2c49016 100644
--- a/src/api/custom/salesLead.js
+++ b/src/api/custom/salesLead.js
@@ -8,10 +8,11 @@
   })
 }
 // 娣诲姞閿�鍞嚎绱�
-export function getAddSalesLeads() {
+export function getAddSalesLeads(data) {
   return request({
     url: "/api/salesLeads/add",
-    method: "post"
+    method: "post",
+    data
   })
 }
 // 鍒犻櫎閿�鍞嚎绱�
@@ -23,12 +24,14 @@
   })
 }
 // 鏇存柊閿�鍞嚎绱�
-export function getUpdateSalesLeads() {
+export function getUpdateSalesLeads(data) {
   return request({
     url: "/api/salesLeads/update",
-    method: "put"
+    method: "put",
+    data
   })
 }
+
 // 鍟嗘満鏉ユ簮鍒楄〃
 export function getSalesSourcesList() {
   return request({
diff --git a/src/common/config/index.js b/src/common/config/index.js
index e69de29..388b868 100644
--- a/src/common/config/index.js
+++ b/src/common/config/index.js
@@ -0,0 +1,20 @@
+export function dateFormat(fmt, date) {
+  let ret = ""
+  date = new Date(date)
+  const opt = {
+    "Y+": date.getFullYear().toString(), // 骞�
+    "m+": (date.getMonth() + 1).toString(), // 鏈�
+    "d+": date.getDate().toString(), // 鏃�
+    "H+": date.getHours().toString(), // 鏃�
+    "M+": date.getMinutes().toString(), // 鍒�
+    "S+": date.getSeconds().toString() // 绉�
+    // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆
+  }
+  for (let k in opt) {
+    ret = new RegExp("(" + k + ")").exec(fmt)
+    if (ret) {
+      fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"))
+    }
+  }
+  return fmt
+}
diff --git a/src/components/layout/components/appsidebar/index.vue b/src/components/layout/components/appsidebar/index.vue
index 74fa2a2..27af387 100644
--- a/src/components/layout/components/appsidebar/index.vue
+++ b/src/components/layout/components/appsidebar/index.vue
@@ -19,7 +19,7 @@
             <span>瀹㈡埛绠$悊</span>
           </template>
           <el-menu-item index="/custom/salesLead">閿�鍞嚎绱�</el-menu-item>
-          <el-menu-item index="/custom/customManage">瀹㈡埛绠$悊</el-menu-item>
+          <el-menu-item index="/custom/clientManage">瀹㈡埛绠$悊</el-menu-item>
           <el-menu-item index="/custom/contacts">鑱旂郴浜�</el-menu-item>
           <el-menu-item index="/custom/followupRecords">璺熻繘璁板綍</el-menu-item>
         </el-submenu>
diff --git a/src/components/makepager/CommonSelectView.vue b/src/components/makepager/CommonSelectView.vue
index 0ef9070..58060f4 100644
--- a/src/components/makepager/CommonSelectView.vue
+++ b/src/components/makepager/CommonSelectView.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="common-select">
     <el-select v-model="commonDefautValue" placeholder="璇烽�夋嫨" class="common-select-sel" size="mini">
-      <el-option v-for="item in commonOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
+      <el-option v-for="item in commonOptions" :key="item.id" :label="item.name" :value="item.name"> </el-option>
     </el-select>
     <div class="common-select-btn" @click="commonSelClick">
       <i class="el-icon-setting"></i>
@@ -29,6 +29,7 @@
   },
   methods: {
     commonSelClick() {
+      console.log("1111111")
       this.$emit("editDropdownBox")
     }
   }
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index af881ec..d002647 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -28,7 +28,7 @@
         <template slot-scope="scope">
           <span v-if="item.price">{{ "锟�" + number_format(scope.row[item.prop], 2, ".", ",") }}</span>
           <div v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div>
-          <span v-else>{{ scope.row[item.prop] }}</span>
+          <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span>
         </template>
       </el-table-column>
       <slot name="tableButton" />
diff --git a/src/router/custom/index.js b/src/router/custom/index.js
index 7657cff..1097fdc 100644
--- a/src/router/custom/index.js
+++ b/src/router/custom/index.js
@@ -1,7 +1,7 @@
 // const type from '@/router/deployCode'
 
 const salesLead = (resolve) => require(["@/views/custom/salesLead/index"], resolve) // 閿�鍞嚎绱�
-const customManage = (resolve) => require(["@/views/custom/customManage/index"], resolve) // 閿�鍞嚎绱�
+const clientManage = (resolve) => require(["@/views/custom/client/index"], resolve) // 瀹㈡埛绠$悊
 const contacts = (resolve) => require(["@/views/custom/contacts/index"], resolve) // 鑱旂郴浜�
 const followupRecords = (resolve) => require(["@/views/custom/followupRecords/index"], resolve) // 璺熻繘璁板綍
 
@@ -16,9 +16,9 @@
     }
   },
   {
-    path: "/custom/customManage",
-    name: "customManage",
-    component: customManage,
+    path: "/custom/clientManage",
+    name: "clientManage",
+    component: clientManage,
     meta: {
       title: "瀹㈡埛绠$悊",
       requireAuth: true
diff --git a/src/views/custom/customManage/AddCustomManageDialog.vue b/src/views/custom/client/AddClientManageDialog.vue
similarity index 98%
rename from src/views/custom/customManage/AddCustomManageDialog.vue
rename to src/views/custom/client/AddClientManageDialog.vue
index 964d923..cbf31f7 100644
--- a/src/views/custom/customManage/AddCustomManageDialog.vue
+++ b/src/views/custom/client/AddClientManageDialog.vue
@@ -1,7 +1,7 @@
 <template>
-  <div class="add-custom-manage">
+  <div class="add-client-manage">
     <el-dialog
-      :title="editCuntomManageConfig.title + '瀹㈡埛绠$悊'"
+      :title="editClientManageConfig.title + '瀹㈡埛绠$悊'"
       :visible.sync="editConfig.visible"
       :width="dialogWidth"
       :before-close="handleClose"
@@ -352,9 +352,9 @@
 <script>
 import CommonSelectView from "@/components/makepager/CommonSelectView"
 export default {
-  name: "AddCustomManageDialog",
+  name: "AddClientManageDialog",
   props: {
-    editCuntomManageConfig: {
+    editClientManageConfig: {
       type: Object,
       default: () => {
         return {
@@ -409,7 +409,7 @@
   data() {
     return {
       dialogWidth: "80%",
-      editConfig: this.editCuntomManageConfig,
+      editConfig: this.editClientManageConfig,
       rules: {
         customName: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }],
         customStatus: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鐘舵��", trigger: "change" }],
@@ -471,7 +471,7 @@
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style lang="scss" scoped>
-.add-custom-manage {
+.add-client-manage {
   .basic-info {
     .basic-info-title {
       background-color: #f4f8fe;
diff --git a/src/views/custom/customManage/index.vue b/src/views/custom/client/index.vue
similarity index 73%
rename from src/views/custom/customManage/index.vue
rename to src/views/custom/client/index.vue
index 4b93a52..0f5da51 100644
--- a/src/views/custom/customManage/index.vue
+++ b/src/views/custom/client/index.vue
@@ -29,7 +29,7 @@
       />
       <PagerView class="page" />
     </div>
-    <TableCommonView ref="tableListRef" :table-list="tableList">
+    <TableCommonView ref="tableListRef" v-loading="loading" :table-list="tableList">
       <template slot="tableButton">
         <el-table-column label="鎿嶄綔" width="150" fixed="right">
           <template slot-scope="scope">
@@ -41,17 +41,19 @@
       </template>
     </TableCommonView>
     <!-- 鏂板缓/缂栬緫瀹㈡埛绠$悊 -->
-    <AddCustomManageDialog v-if="editConfig.visible" :edit-cuntom-manage-config="editConfig" />
+    <AddClientManageDialog v-if="editConfig.visible" :edit-client-manage-config="editConfig" />
   </div>
 </template>
 
 <script>
-import AddCustomManageDialog from "@/views/custom/customManage/AddCustomManageDialog"
+import AddClientManageDialog from "@/views/custom/client/AddClientManageDialog"
+import { getClientList } from "@/api/custom/client"
+import { dateFormat } from "@/common/config/index"
 export default {
   name: "CustomManage",
   props: {},
   components: {
-    AddCustomManageDialog
+    AddClientManageDialog
   },
   computed: {
     searchCommonHeight() {
@@ -61,6 +63,7 @@
   data() {
     return {
       tableList: {},
+      loading: false,
       activeName: "first",
       gonghaiValue: "",
       gonghaiOptions: [],
@@ -92,33 +95,22 @@
   },
   created() {
     this.setTable()
+    this.getData()
   },
   methods: {
     setTable() {
       this.tableList = {
-        tableInfomation: [
-          {
-            customName: "涓婃捣閫氱敤鏈烘鏈夐檺鍏徃",
-            saleLeadOwner: "BOSS",
-            importantLevel: "C绫诲鎴�",
-            notContactDay: "20",
-            contactName: "钁e浼�",
-            phoneNumber: "15988887777",
-            nextFollowDate: "2023-07-26",
-            detailAddress: "涓婃捣甯傞潤瀹夊尯濞佹捣璺�115鍙�",
-            customStatus: "娼滃湪瀹㈡埛"
-          }
-        ],
+        tableInfomation: [],
         tableColumn: [
-          { label: "瀹㈡埛鍚嶇О", prop: "customName", min: 100 }, // 瀹㈡埛鍚嶇О
-          { label: "閿�鍞礋璐d汉", prop: "saleLeadOwner" }, // 閿�鍞礋璐d汉
+          { label: "瀹㈡埛鍚嶇О", prop: "name", min: 100 }, // 瀹㈡埛鍚嶇О
+          { label: "閿�鍞礋璐d汉", prop: "service_member_id" }, // 閿�鍞礋璐d汉
           { label: "閲嶈绾у埆", prop: "importantLevel" }, // 閲嶈绾у埆
-          { label: "涓嬫鍥炶鏃ユ湡", prop: "notContactDay", min: 90 }, // 鏈仈绯讳汉澶╂暟
-          { label: "鎵嬫満鍙风爜", prop: "nextFollowDate" }, // 涓嬫鍥炶鏃ユ湡
-          { label: "璇︾粏鍦板潃", prop: "detailAddress", min: 200 }, // 璇︾粏鍦板潃
-          { label: "瀹㈡埛鐘舵��", prop: "customStatus" }, // 瀹㈡埛鐘舵��
-          { label: "鑱旂郴浜哄鍚�", prop: "contactName" }, // 鑱旂郴浜哄鍚�
-          { label: "鎵嬫満", prop: "phoneNumber" } // 鎵嬫満鍙风爜
+          { label: "涓嬫鍥炶鏃ユ湡", prop: "next_visit_time", min: 90 }, // 涓嬫鍥炶鏃ユ湡
+          { label: "鎵嬫満鍙风爜", prop: "phoneNumber" }, // 鎵嬫満鍙风爜
+          { label: "璇︾粏鍦板潃", prop: "detail_address", min: 200 }, // 璇︾粏鍦板潃
+          { label: "瀹㈡埛鐘舵��", prop: "client_status_id" }, // 瀹㈡埛鐘舵��
+          { label: "鑱旂郴浜哄鍚�", prop: "contact_name" }, // 鑱旂郴浜哄鍚�
+          { label: "鎵嬫満", prop: "phone" } // 鎵嬫満鍙风爜
         ]
       }
       this.searchOptions = []
@@ -127,6 +119,42 @@
         this.searchOptions.push({ value: (i + 1).toString(), label: label })
       }
     },
+    // 璇锋眰鏁版嵁
+    async getData() {
+      this.loading = true
+      await getClientList()
+        .then((res) => {
+          console.log(res)
+          if (res.code === 200) {
+            if (res.data.list && res.data.list.length > 0) {
+              const list = res.data.list.map((item) => {
+                return {
+                  name: item.name,
+                  service_member_id: item.service_member_id,
+                  importantLevel: "",
+                  next_visit_time: dateFormat("YYYY-mm-dd HH:MM", item.next_visit_time),
+                  phoneNumber: "",
+                  detail_address: item.detail_address,
+                  client_status_id: item.client_status_id,
+                  contact_name: "",
+                  phone: ""
+                }
+              })
+              this.tableList.tableInfomation = list || []
+            } else {
+              this.tableList.tableInfomation = []
+            }
+          } else {
+            this.tableList.tableInfomation = []
+          }
+          this.loading = false
+        })
+        .catch((err) => {
+          console.log(err)
+          this.tableList.tableInfomation = []
+          this.loading = false
+        })
+    },
     tabsClick(tab, event) {
       console.log(tab, event)
     },
diff --git a/src/views/custom/contacts/index.vue b/src/views/custom/contacts/index.vue
index 001f105..871f24b 100644
--- a/src/views/custom/contacts/index.vue
+++ b/src/views/custom/contacts/index.vue
@@ -5,7 +5,7 @@
       <PublicFunctionBtnView :operates-list="operatesList" />
       <PagerView class="page" />
     </div>
-    <TableCommonView ref="tableListRef" :table-list="tableList">
+    <TableCommonView ref="tableListRef" v-loading="loading" :table-list="tableList">
       <template slot="tableButton">
         <el-table-column label="鎿嶄綔" width="120" fixed="right">
           <template slot-scope="scope">
@@ -22,6 +22,7 @@
 
 <script>
 import AddContactsDialog from "@/views/custom/contacts/AddContactsDialog"
+import { getContactList } from "@/api/custom/contacts"
 export default {
   name: "ContactsView",
   props: {},
@@ -32,6 +33,7 @@
   data() {
     return {
       tableList: {},
+      loading: false,
       queryClassOptions: [
         { value: "1", label: "鍏ㄩ儴" },
         { value: "2", label: "鏈湀鐢熸棩" }
@@ -59,29 +61,20 @@
   },
   created() {
     this.setTable()
+    this.getData()
   },
   methods: {
     setTable() {
       this.tableList = {
-        tableInfomation: [
-          {
-            contactName: "涓婃捣閫氱敤鏈烘鏈夐檺鍏徃",
-            customName: "BOSS",
-            contactNumber: "C绫诲鎴�",
-            duties: "20",
-            phoneNumber: "钁e浼�",
-            salesHead: "15988887777",
-            primaryContact: "2023-07-26"
-          }
-        ],
+        tableInfomation: [],
         tableColumn: [
           { label: "鑱旂郴浜哄鍚�", prop: "contactName", min: 100 }, // 鑱旂郴浜哄鍚�
-          { label: "瀹㈡埛鍚嶇О", prop: "customName", min: 190 }, // 瀹㈡埛鍚嶇О
-          { label: "鑱旂郴浜虹紪鍙�", prop: "contactNumber", min: 100 }, // 鑱旂郴浜虹紪鍙�
+          { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 190 }, // 瀹㈡埛鍚嶇О
+          { label: "鑱旂郴浜虹紪鍙�", prop: "number", min: 100 }, // 鑱旂郴浜虹紪鍙�
           { label: "鑱屽姟", prop: "duties", min: 120 }, // 鑱屽姟
-          { label: "鎵嬫満", prop: "phoneNumber", min: 100 }, // 鎵嬫満鍙风爜
+          { label: "鎵嬫満", prop: "phone", min: 100 }, // 鎵嬫満鍙风爜
           { label: "閿�鍞礋璐d汉", prop: "salesHead", min: 120 }, // 閿�鍞礋璐d汉
-          { label: "棣栬鑱旂郴浜�", prop: "primaryContact", min: 90 } // 棣栬鑱旂郴浜�
+          { label: "棣栬鑱旂郴浜�", prop: "name", min: 90 } // 棣栬鑱旂郴浜�
         ]
       }
       this.searchOptions = []
@@ -90,6 +83,40 @@
         this.searchOptions.push({ value: (i + 1).toString(), label: label })
       }
     },
+    // 璇锋眰鏁版嵁
+    async getData() {
+      this.loading = true
+      await getContactList()
+        .then((res) => {
+          console.log(res)
+          if (res.code === 200) {
+            if (res.data.list && res.data.list.length > 0) {
+              const list = res.data.list.map((item) => {
+                return {
+                  contactName: "",
+                  client_name: item.Client.name,
+                  number: item.number,
+                  duties: "",
+                  phone: item.phone,
+                  salesHead: "",
+                  name: item.name
+                }
+              })
+              this.tableList.tableInfomation = list || []
+            } else {
+              this.tableList.tableInfomation = []
+            }
+          } else {
+            this.tableList.tableInfomation = []
+          }
+          this.loading = false
+        })
+        .catch((err) => {
+          console.log(err)
+          this.tableList.tableInfomation = []
+          this.loading = false
+        })
+    },
     // 鏂板缓
     addBtnClick() {
       this.editConfig.visible = true
diff --git a/src/views/custom/followupRecords/index.vue b/src/views/custom/followupRecords/index.vue
index 04dd78c..a73057c 100644
--- a/src/views/custom/followupRecords/index.vue
+++ b/src/views/custom/followupRecords/index.vue
@@ -5,7 +5,7 @@
       <PublicFunctionBtnView :statistics="true" :operates-list="operatesList" />
       <PagerView class="page" />
     </div>
-    <TableCommonView ref="tableListRef" :table-list="tableList">
+    <TableCommonView ref="tableListRef" v-loading="loading" :table-list="tableList">
       <template slot="tableButton">
         <el-table-column label="鎿嶄綔" width="120" fixed="right">
           <template slot-scope="scope">
@@ -22,6 +22,7 @@
 <script>
 import AddFollowupRecordsDialog from "@/views/custom/followupRecords/AddFollowupRecordsDialog"
 import { getFollowRecordList } from "@/api/custom/followupRecords.js"
+import { dateFormat } from "@/common/config/index"
 
 export default {
   name: "FollowupRecords",
@@ -37,6 +38,7 @@
   data() {
     return {
       tableList: {},
+      loading: false,
       activeName: "second",
       queryClassOptions: [
         { value: "1", label: "鍏ㄩ儴" },
@@ -69,29 +71,17 @@
   methods: {
     setTable() {
       this.tableList = {
-        tableInfomation: [
-          {
-            theme: "涓婇棬鎷滆",
-            customName: "涓婃捣閫氱敤鏈烘鏈夐檺鍏徃",
-            contactName: "BOSS",
-            customStatus: "C绫诲鎴�",
-            phoneNumber: "15988887777",
-            contactDate: "钁e浼�",
-            nextFollowupDate: "2023-07-28",
-            owner: "2023-07-26",
-            followupRecords: "涓婃捣甯傞潤瀹夊尯濞佹捣璺�115鍙�"
-          }
-        ],
+        tableInfomation: [],
         tableColumn: [
-          { label: "涓婚", prop: "theme", min: 190 }, // 涓婚
-          { label: "瀹㈡埛鍚嶇О", prop: "customName", min: 190 }, // 瀹㈡埛鍚嶇О
-          { label: "鑱旂郴浜哄鍚�", prop: "contactName", min: 100 }, // 鑱旂郴浜哄鍚�
-          { label: "瀹㈡埛鐘舵��", prop: "customStatus", min: 100 }, // 瀹㈡埛鐘舵��
-          { label: "鑱旂郴鏂瑰紡", prop: "phoneNumber", min: 100 }, // 鑱旂郴鏂瑰紡
-          { label: "鑱旂郴浜烘棩鏈�", prop: "contactDate", min: 100 }, // 鑱旂郴浜烘棩鏈�
-          { label: "涓嬫鍥炶鏃ユ湡", prop: "nextFollowupDate", min: 130 }, // 涓嬫鍥炶鏃ユ湡
-          { label: "璐熻矗浜�", prop: "owner", min: 120 }, // 璐熻矗浜�
-          { label: "璺熻繘璁板綍", prop: "followupRecords", min: 120 } // 璺熻繘璁板綍
+          { label: "涓婚", prop: "topic", min: 190 }, // 涓婚
+          { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 190 }, // 瀹㈡埛鍚嶇О
+          { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 100 }, // 鑱旂郴浜哄鍚�
+          { label: "瀹㈡埛鐘舵��", prop: "client_status_id", min: 100 }, // 瀹㈡埛鐘舵��
+          { label: "鑱旂郴鏂瑰紡", prop: "phone", min: 100 }, // 鑱旂郴鏂瑰紡
+          { label: "鑱旂郴浜烘棩鏈�", prop: "follow_time", min: 100 }, // 鑱旂郴浜烘棩鏈�
+          { label: "涓嬫鍥炶鏃ユ湡", prop: "next_follow_time", min: 130 }, // 涓嬫鍥炶鏃ユ湡
+          { label: "璐熻矗浜�", prop: "member_id", min: 120 }, // 璐熻矗浜�
+          { label: "璺熻繘璁板綍", prop: "record", min: 120 } // 璺熻繘璁板綍
         ]
       }
       this.searchOptions = []
@@ -101,13 +91,40 @@
       }
     },
     // 璇锋眰鏁版嵁
+    // 璇锋眰鏁版嵁
     async getData() {
+      this.loading = true
       await getFollowRecordList()
         .then((res) => {
-          console.log("鎴愬姛" + res)
+          console.log(res)
+          if (res.code === 200) {
+            if (res.data.list && res.data.list.length > 0) {
+              const list = res.data.list.map((item) => {
+                return {
+                  topic: item.topic,
+                  client_name: item.client.name,
+                  contact_name: item.contact.name,
+                  client_status_id: item.client.client_status_id,
+                  phone: item.contact.phone,
+                  follow_time: dateFormat("YYYY-mm-dd HH:MM", item.follow_time),
+                  next_follow_time: dateFormat("YYYY-mm-dd HH:MM", item.next_follow_time),
+                  member_id: item.member_id,
+                  record: item.record
+                }
+              })
+              this.tableList.tableInfomation = list || []
+            } else {
+              this.tableList.tableInfomation = []
+            }
+          } else {
+            this.tableList.tableInfomation = []
+          }
+          this.loading = false
         })
         .catch((err) => {
           console.log(err)
+          this.tableList.tableInfomation = []
+          this.loading = false
         })
     },
     // 鏂板缓
diff --git a/src/views/custom/salesLead/AddSalesLeadDialog.vue b/src/views/custom/salesLead/AddSalesLeadDialog.vue
index 000c2dd..e0e9680 100644
--- a/src/views/custom/salesLead/AddSalesLeadDialog.vue
+++ b/src/views/custom/salesLead/AddSalesLeadDialog.vue
@@ -21,32 +21,32 @@
           <div class="basic-info-view">
             <el-row>
               <el-col :span="12">
-                <el-form-item label="瀹㈡埛鍚嶇О" prop="customName">
-                  <el-input v-model="editConfig.infomation.customName"></el-input>
+                <el-form-item label="瀹㈡埛鍚嶇О" prop="name">
+                  <el-input v-model="editConfig.infomation.name"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="閿�鍞嚎绱㈢紪鍙�" prop="saleLeadNumber">
-                  <el-input v-model="editConfig.infomation.saleLeadNumber"></el-input>
+                <el-form-item label="閿�鍞嚎绱㈢紪鍙�" prop="number">
+                  <el-input v-model="editConfig.infomation.number"></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
             <el-row>
               <el-col :span="12">
-                <el-form-item label="鑱旂郴浜哄鍚�" prop="contactName">
-                  <el-input v-model="editConfig.infomation.contactName"></el-input>
+                <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_name">
+                  <el-input v-model="editConfig.infomation.contact_name"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="鑱旂郴浜鸿亴鍔�" prop="contactDuties">
-                  <el-input v-model="editConfig.infomation.contactDuties"></el-input>
+                <el-form-item label="鑱旂郴浜鸿亴鍔�" prop="contact_position">
+                  <el-input v-model="editConfig.infomation.contact_position"></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
             <el-row>
               <el-col :span="12">
-                <el-form-item label="鎵嬫満鍙风爜" prop="phoneNumber">
-                  <el-input v-model="editConfig.infomation.phoneNumber"></el-input>
+                <el-form-item label="鎵嬫満鍙风爜" prop="contact_phone">
+                  <el-input v-model="editConfig.infomation.contact_phone"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -57,17 +57,31 @@
             </el-row>
             <el-row>
               <el-col :span="12">
-                <el-form-item label="鍟嗘満鏉ユ簮" prop="businessSource">
-                  <CommonSelectView
-                    :common-value="editConfig.infomation.businessSource"
-                    :common-options="businessSourceOptions"
-                    @editDropdownBox="editDropdownBox"
-                  />
+                <el-form-item label="鍟嗘満鏉ユ簮" prop="sales_sources_id">
+                  <div class="common-select">
+                    <el-select
+                      v-model="editConfig.infomation.sales_sources_id"
+                      placeholder="璇烽�夋嫨"
+                      class="common-select-sel"
+                      size="mini"
+                    >
+                      <el-option
+                        v-for="item in businessSourceOptions"
+                        :key="item.id"
+                        :label="item.name"
+                        :value="item.id"
+                      >
+                      </el-option>
+                    </el-select>
+                    <div class="common-select-btn" @click="editDropdownBox">
+                      <i class="el-icon-setting"></i>
+                    </div>
+                  </div>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="璐熻矗浜�" prop="owner">
-                  <el-select v-model="editConfig.infomation.owner" placeholder="璇烽�夋嫨" size="mini">
+                <el-form-item label="璐熻矗浜�" prop="member_id">
+                  <el-select v-model="editConfig.infomation.member_id" placeholder="璇烽�夋嫨" size="mini">
                     <el-option v-for="item in ownerOptions" :key="item.value" :label="item.label" :value="item.value">
                     </el-option>
                   </el-select>
@@ -77,8 +91,8 @@
           </div>
           <!-- 鍦板潃淇℃伅 -->
           <div v-if="isUnflod" class="basic-info-title">鍦板潃淇℃伅</div>
-          <div v-if="isUnflod" class="address-view">
-            <el-row>
+          <div v-if="isUnflod" class="basic-info-view">
+            <!-- <el-row>
               <el-col :span="24">
                 <el-form-item label="瀹氫綅" prop="position">
                   <el-input v-model="editConfig.infomation.position"></el-input>
@@ -91,7 +105,7 @@
                   <div style="height: 100px"></div>
                 </el-form-item>
               </el-col>
-            </el-row>
+            </el-row> -->
             <el-row>
               <el-col :span="12">
                 <el-form-item label="鍥藉" prop="country">
@@ -134,12 +148,12 @@
           <div v-if="isUnflod" class="basic-info-view">
             <el-row>
               <el-col :span="24">
-                <el-form-item label="鍦板潃" prop="address">
+                <el-form-item label="澶囨敞" prop="desc">
                   <el-input
                     type="textarea"
                     :autosize="{ minRows: 2, maxRows: 4 }"
                     placeholder="璇疯緭鍏ュ唴瀹�"
-                    v-model="editConfig.infomation.address"
+                    v-model="editConfig.infomation.desc"
                   ></el-input>
                 </el-form-item>
               </el-col>
@@ -166,7 +180,7 @@
 <script>
 import CommonSelectView from "@/components/makepager/CommonSelectView"
 import EditDropdownDialog from "@/views/other/commonDialog/EditDropdownDialog"
-import { getSalesSourcesList } from "@/api/custom/salesLead"
+import { getSalesSourcesList, getAddSalesLeads, getUpdateSalesLeads } from "@/api/custom/salesLead"
 
 export default {
   name: "AddSalesLeadDialog",
@@ -178,21 +192,21 @@
           visible: false,
           title: "鏂板缓",
           infomation: {
-            customName: "",
-            saleLeadNumber: "LEA50",
-            contactName: "",
-            contactDuties: "",
-            phoneNumber: "",
+            name: "",
+            number: "LEA50",
+            contact_name: "",
+            contact_position: "",
+            contact_phone: "",
             businessStatus: "",
-            businessSource: "1",
-            owner: "",
-            position: "",
-            map: "",
-            country: "1",
-            province: "1",
-            city: "1",
-            region: "1",
-            address: ""
+            sales_sources_id: "",
+            member_id: "",
+            country: "",
+            province: "",
+            city: "",
+            region: "",
+            address: "",
+            desc: "",
+            id: ""
           }
         }
       }
@@ -209,20 +223,20 @@
       dialogWidth: "80%",
       editConfig: this.editSalesLeadConfig,
       rules: {
-        customName: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }],
-        saleLeadNumber: [{ required: true, message: "璇疯緭鍏ラ攢鍞嚎绱㈢紪鍙�", trigger: "blur" }],
+        name: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }],
+        number: [{ required: true, message: "璇疯緭鍏ラ攢鍞嚎绱㈢紪鍙�", trigger: "blur" }],
         businessStatus: [{ required: true, message: "璇疯緭鍏ュ晢鏈虹姸鎬�", trigger: "blur" }],
-        businessSource: [{ required: true, message: "璇烽�夋嫨鍟嗘満鏉ユ簮", trigger: "change" }]
+        sales_sources_id: [{ required: true, message: "璇烽�夋嫨鍟嗘満鏉ユ簮", trigger: "change" }]
       },
       businessSourceOptions: [
-        { value: "1", label: "鍚庡彴娉ㄥ唽" },
-        { value: "2", label: "浠g悊鍟嗗鎴�" },
-        { value: "3", label: "鐢佃瘽闄岀敓鎷滆" },
-        { value: "4", label: "鐩存帴璁块棶" },
-        { value: "5", label: "椤圭洰鍚堜綔" },
-        { value: "6", label: "涓汉鑷壘" },
-        { value: "7", label: "浜屾閿�鍞�" },
-        { value: "8", label: "鍏徃鐢佃瘽" }
+        { id: "1", name: "鍚庡彴娉ㄥ唽" },
+        { id: "2", name: "浠g悊鍟嗗鎴�" },
+        { id: "3", name: "鐢佃瘽闄岀敓鎷滆" },
+        { id: "4", name: "鐩存帴璁块棶" },
+        { id: "5", name: "椤圭洰鍚堜綔" },
+        { id: "6", name: "涓汉鑷壘" },
+        { id: "7", name: "浜屾閿�鍞�" },
+        { id: "8", name: "鍏徃鐢佃瘽" }
       ],
       ownerOptions: [
         { value: "1", label: "BOSS" },
@@ -269,7 +283,7 @@
       getSalesSourcesList()
         .then((res) => {
           console.log(res)
-          // this.businessSourceOptions = res.data.tableList
+          this.businessSourceOptions = res.data.list
         })
         .catch((err) => {
           console.log(err)
@@ -282,7 +296,56 @@
     saveClick(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          alert("submit")
+          console.log(this.editConfig.infomation)
+          let params = {
+            city_id: 0,
+            contact_name: this.editConfig.infomation.contact_name || "",
+            contact_phone: this.editConfig.infomation.contact_phone || "",
+            contact_position: this.editConfig.infomation.contact_position || "",
+            country_id: 0,
+            id: this.editConfig.title === "鏂板缓" ? 0 : this.editConfig.infomation.id,
+            desc: this.editConfig.infomation.desc || "",
+            member_id: parseInt(this.editConfig.infomation.member_id) || 0,
+            name: this.editConfig.infomation.name || "",
+            number: this.editConfig.infomation.number || "",
+            province_id: 0,
+            region_id: 0,
+            sales_sources_id: this.editConfig.infomation.sales_sources_id || 0
+          }
+          console.log(params)
+          if (this.editConfig.title === "鏂板缓") {
+            getAddSalesLeads(params)
+              .then((res) => {
+                console.log(res)
+                this.editConfig.visible = false
+                if (res.code === 200) {
+                  this.$message({
+                    message: "娣诲姞鎴愬姛",
+                    type: "success"
+                  })
+                  this.$parent.getData()
+                }
+              })
+              .catch((err) => {
+                console.log(err)
+              })
+          } else {
+            getUpdateSalesLeads(params)
+              .then((res) => {
+                console.log(res)
+                this.editConfig.visible = false
+                if (res.code === 200) {
+                  this.$message({
+                    message: "缂栬緫鎴愬姛",
+                    type: "success"
+                  })
+                  this.$parent.getData()
+                }
+              })
+              .catch((err) => {
+                console.log(err)
+              })
+          }
         } else {
           console.log("error submit")
           return false
@@ -325,10 +388,17 @@
     .basic-info-view {
       margin-top: 10px;
       padding-right: 40px;
-    }
-    .address-view {
-      margin-top: 10px;
-      padding-right: 40px;
+      .common-select {
+        display: flex;
+        .common-select-sel {
+          width: 270px;
+        }
+        .common-select-btn {
+          margin-left: 5px;
+          font-size: 16px;
+          cursor: pointer;
+        }
+      }
     }
   }
   .unflod-collapse {
diff --git a/src/views/custom/salesLead/index.vue b/src/views/custom/salesLead/index.vue
index 4046807..e4facd7 100644
--- a/src/views/custom/salesLead/index.vue
+++ b/src/views/custom/salesLead/index.vue
@@ -86,7 +86,7 @@
           { label: "鍟嗘満鏉ユ簮", prop: "sales_sources_id", min: 190 }, // 鍟嗘満鏉ユ簮
           { label: "鐪佷唤", prop: "province", min: 190 }, // 鐪佷唤
           { label: "鍩庡競", prop: "city", min: 190 }, // 鍩庡競
-          { label: "璐熻矗浜�", prop: "owner", min: 190 } // 璐熻矗浜�
+          { label: "璐熻矗浜�", prop: "member_id", min: 190 } // 璐熻矗浜�
         ]
       }
       this.searchOptions = []
@@ -99,12 +99,20 @@
     async getData() {
       await getSalesLeadsList()
         .then((res) => {
-          console.log(res)
-          this.tableList.tableInfomation = res.data.tableList.map((item) => {
-            item.province = item.Province.name
-            item.city = item.City.name
-            return item
+          const list = res.data.list.map((item) => {
+            return {
+              id: item.id,
+              name: item.name,
+              number: item.number,
+              contact_name: item.contact_name,
+              contact_phone: item.contact_phone,
+              sales_sources_id: item.sales_sources_id,
+              province: item.Province.name,
+              city: item.City.name,
+              member_id: item.member_id
+            }
           })
+          this.tableList.tableInfomation = list || []
         })
         .catch((err) => {
           console.log(err)
@@ -115,21 +123,20 @@
       this.editSalesLeadConfig.visible = true
       this.editSalesLeadConfig.title = "鏂板缓"
       this.editSalesLeadConfig.infomation = {
-        customName: "",
-        saleLeadNumber: "LEA50",
-        contactName: "",
-        contactDuties: "",
-        phoneNumber: "",
+        name: "",
+        number: "",
+        contact_name: "",
+        contact_position: "",
+        contact_phone: "",
         businessStatus: "鏂板缓",
-        businessSource: "1",
-        owner: "",
-        position: "",
-        map: "",
-        country: "1",
-        province: "1",
-        city: "1",
-        region: "1",
-        address: ""
+        sales_sources_id: "",
+        member_id: "",
+        country: "",
+        province: "",
+        city: "",
+        region: "",
+        address: "",
+        desc: ""
       }
     },
     // 缂栬緫
@@ -138,21 +145,21 @@
       this.editSalesLeadConfig.visible = true
       this.editSalesLeadConfig.title = "缂栬緫"
       this.editSalesLeadConfig.infomation = {
-        customName: row.customName,
-        saleLeadNumber: row.saleLeadNumber,
-        contactName: row.contactName,
-        contactDuties: row.contactDuties,
-        phoneNumber: row.phoneNumber,
-        businessStatus: "鏂板缓",
-        businessSource: row.businessSource,
-        owner: row.owner,
-        position: "",
-        map: "",
-        country: "1",
-        province: "1",
-        city: "1",
-        region: "1",
-        address: ""
+        id: row.id,
+        name: row.name,
+        number: row.number,
+        contact_name: row.contact_name,
+        contact_position: row.contact_position,
+        contact_phone: row.contact_phone,
+        businessStatus: "缂栬緫",
+        sales_sources_id: row.sales_sources_id,
+        member_id: row.member_id,
+        country: "",
+        province: "",
+        city: "",
+        region: "",
+        address: "",
+        desc: row.desc
       }
     },
     // 瀵煎叆

--
Gitblit v1.8.0