From 22d4441a8c669185c13d2b6856c51ad550c50ae2 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期五, 14 七月 2023 18:26:47 +0800
Subject: [PATCH] 编辑下拉框&网络请求封装优化

---
 src/views/custom/salesLead/index.vue |   68 ++++++++++++++++++++-------------
 1 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/src/views/custom/salesLead/index.vue b/src/views/custom/salesLead/index.vue
index 5cbb5a0..4046807 100644
--- a/src/views/custom/salesLead/index.vue
+++ b/src/views/custom/salesLead/index.vue
@@ -3,7 +3,7 @@
     <SearchCommonView ref="searchCommonView" :query-class-options="queryClassOptions" :search-options="searchOptions" />
     <div class="btn-pager">
       <PublicFunctionBtnView :operates-list="operatesList" />
-      <PagerView class="page" />
+      <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
     </div>
     <TableCommonView ref="tableListRef" :table-list="tableList">
       <template slot="tableButton">
@@ -18,26 +18,25 @@
     </TableCommonView>
     <!-- 鏂板缓/缂栬緫閿�鍞嚎绱� -->
     <AddSalesLeadDialog v-if="editSalesLeadConfig.visible" :edit-sales-lead-config="editSalesLeadConfig" />
+    <!-- 瀵煎叆鏂囦欢 -->
+    <ImportFileDialog v-if="importConfig.visible" :import-file-config="importConfig" />
   </div>
 </template>
 
 <script>
-import SearchCommonView from "@/components/makepager/SearchCommonView"
-import PublicFunctionBtnView from "@/components/makepager/PublicFunctionBtnView"
-import PagerView from "@/components/makepager/PagerView"
-import TableCommonView from "@/components/makepager/TableCommonView"
 import AddSalesLeadDialog from "@/views/custom/salesLead/AddSalesLeadDialog"
+import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import ImportFileDialog from "@/views/other/commonDialog/ImportFileDialog"
+import { getSalesLeadsList } from "@/api/custom/salesLead"
 
 export default {
   name: "SalesLead",
   props: {},
   components: {
-    SearchCommonView,
-    PublicFunctionBtnView,
-    PagerView,
-    TableCommonView,
-    AddSalesLeadDialog
+    AddSalesLeadDialog,
+    ImportFileDialog
   },
+  mixins: [pageMixin],
   computed: {},
   data() {
     return {
@@ -63,33 +62,28 @@
         visible: false,
         title: "鏂板缓",
         infomation: {}
+      },
+      importConfig: {
+        visible: false,
+        title: "鏂板缓",
+        infomation: {}
       }
     }
   },
   created() {
     this.setTable()
+    this.getData()
   },
   methods: {
     setTable() {
       this.tableList = {
-        tableInfomation: [
-          {
-            customName: "涓婃捣閫氱敤鏈烘鏈夐檺鍏徃",
-            saleLeadNumber: "LEA110",
-            contactName: "钁e浼�",
-            phoneNumber: "15988887777",
-            businessSource: "鏈嬪弸浠嬬粛",
-            province: "姹熻嫃鐪�",
-            city: "杩炰簯娓競",
-            owner: "閿�鍞�荤洃"
-          }
-        ],
+        tableInfomation: [],
         tableColumn: [
-          { label: "瀹㈡埛鍚嶇О", prop: "customName", min: 190 }, // 瀹㈡埛鍚嶇О
-          { label: "閿�鍞嚎绱㈢紪鍙�", prop: "saleLeadNumber", min: 190 }, // 閿�鍞嚎绱㈢紪鍙�
-          { label: "鑱旂郴浜哄鍚�", prop: "contactName", min: 190 }, // 鑱旂郴浜哄鍚�
-          { label: "鎵嬫満鍙风爜", prop: "phoneNumber", min: 190 }, // 鎵嬫満鍙风爜
-          { label: "鍟嗘満鏉ユ簮", prop: "businessSource", min: 190 }, // 鍟嗘満鏉ユ簮
+          { label: "瀹㈡埛鍚嶇О", prop: "name", min: 190 }, // 瀹㈡埛鍚嶇О
+          { label: "閿�鍞嚎绱㈢紪鍙�", prop: "number", min: 190 }, // 閿�鍞嚎绱㈢紪鍙�
+          { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 190 }, // 鑱旂郴浜哄鍚�
+          { label: "鎵嬫満鍙风爜", prop: "contact_phone", min: 190 }, // 鎵嬫満鍙风爜
+          { label: "鍟嗘満鏉ユ簮", prop: "sales_sources_id", min: 190 }, // 鍟嗘満鏉ユ簮
           { label: "鐪佷唤", prop: "province", min: 190 }, // 鐪佷唤
           { label: "鍩庡競", prop: "city", min: 190 }, // 鍩庡競
           { label: "璐熻矗浜�", prop: "owner", min: 190 } // 璐熻矗浜�
@@ -100,6 +94,21 @@
         const label = this.tableList.tableColumn[i].label
         this.searchOptions.push({ value: (i + 1).toString(), label: label })
       }
+    },
+    // 璇锋眰鏁版嵁
+    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
+          })
+        })
+        .catch((err) => {
+          console.log(err)
+        })
     },
     // 鏂板缓
     addBtnClick() {
@@ -145,6 +154,11 @@
         region: "1",
         address: ""
       }
+    },
+    // 瀵煎叆
+    importClitk() {
+      this.importConfig.visible = true
+      this.importConfig.title = "閿�鍞嚎绱�"
     }
   }
 }

--
Gitblit v1.8.0