From af2b318da9d4c51b5b8afb2f4cefe86ff049bc7c Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期二, 17 十月 2023 21:16:45 +0800
Subject: [PATCH] feat: 添加缺失的请求

---
 src/views/client/salesLead/index.vue |   85 +++++++++++++++++++++++++-----------------
 1 files changed, 51 insertions(+), 34 deletions(-)

diff --git a/src/views/client/salesLead/index.vue b/src/views/client/salesLead/index.vue
index f0ce845..698a695 100644
--- a/src/views/client/salesLead/index.vue
+++ b/src/views/client/salesLead/index.vue
@@ -12,7 +12,7 @@
         >
           <template slot="leftButton">
             <el-button size="small" type="primary"  @click="addBtnClick">鏂板缓</el-button>
-            <el-button size="small"  @click="delClick">鍒犻櫎</el-button>
+            <!-- <el-button size="small"  @click="delClick">鍒犻櫎</el-button> -->
           </template>
 
         </CommonSearch>
@@ -28,14 +28,15 @@
               :table-list="tableList"
               @selSalesLeadClick="selSalesLeadClick"
               @getSelectArray="getSelectArray"
+              @selTableCol="selTableCol"
           >
             <template slot="tableButton">
-              <el-table-column label="鎿嶄綔" width="120">
+              <el-table-column label="鎿嶄綔" width="150">
                 <template slot-scope="scope">
                   <el-button @click="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button>
-                  <el-button @click="followupClick(scope.row)" type="text" size="small">璺熻繘</el-button>
+                  <!-- <el-button @click="followupClick(scope.row)" type="text" size="small">璺熻繘</el-button> -->
                   <el-button @click="advanceClick(scope.row)" type="text" size="small">鎺ㄨ繘</el-button>
-                  <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> -->
+                  <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button>
                 </template>
               </el-table-column>
             </template>
@@ -134,7 +135,18 @@
         // 鍒嗛厤
         visible: false,
         infomation: {}
-      }
+      },
+      tableColumn:[
+        { label: "瀹㈡埛鍚嶇О", prop: "name", min: 190, isSalesLeadClick: true ,default:true}, // 瀹㈡埛鍚嶇О
+        { label: "閿�鍞嚎绱㈢紪鍙�", prop: "number", min: 130 }, // 閿�鍞嚎绱㈢紪鍙�
+        { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 130 }, // 鑱旂郴浜哄鍚�
+        { label: "鎵嬫満鍙风爜", prop: "contact_phone", min: 130 }, // 鎵嬫満鍙风爜
+        { label: "鍟嗘満鏉ユ簮", prop: "sales_resources", min: 130 }, // 鍟嗘満鏉ユ簮
+        { label: "鐪佷唤", prop: "province", min: 130 }, // 鐪佷唤
+        { label: "鍩庡競", prop: "city", min: 130 }, // 鍩庡競
+        { label: "璐熻矗浜�", prop: "member_name", min: 130 } // 璐熻矗浜�
+      ],
+      showCol:["瀹㈡埛鍚嶇О","閿�鍞嚎绱㈢紪鍙�","鑱旂郴浜哄鍚�","鎵嬫満鍙风爜","鍟嗘満鏉ユ簮","鐪佷唤","鍩庡競","璐熻矗浜�"]
     }
   },
   created() {
@@ -144,24 +156,31 @@
   methods: {
     setTable() {
       this.tableList = {
+        selectIndex: true,
         tableInfomation: [],
-        tableColumn: [
-          { label: "瀹㈡埛鍚嶇О", prop: "name", min: 190, isSalesLeadClick: true }, // 瀹㈡埛鍚嶇О
-          { label: "閿�鍞嚎绱㈢紪鍙�", prop: "number", min: 130 }, // 閿�鍞嚎绱㈢紪鍙�
-          { label: "鑱旂郴浜哄鍚�", prop: "contact_name", min: 130 }, // 鑱旂郴浜哄鍚�
-          { label: "鎵嬫満鍙风爜", prop: "contact_phone", min: 130 }, // 鎵嬫満鍙风爜
-          { label: "鍟嗘満鏉ユ簮", prop: "sales_resources", min: 130 }, // 鍟嗘満鏉ユ簮
-          { label: "鐪佷唤", prop: "province", min: 130 }, // 鐪佷唤
-          { label: "鍩庡競", prop: "city", min: 130 }, // 鍩庡競
-          { label: "璐熻矗浜�", prop: "member_name", min: 130 } // 璐熻矗浜�
-        ]
+        allcol: [],
+        showcol: this.showCol,
+        tableColumn:this.setColumnVisible(this.showCol)
       }
+      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
       this.searchOptions = []
       for (let i = 0; i < this.tableList.tableColumn.length; i++) {
         const label = this.tableList.tableColumn[i].label
         const value = this.tableList.tableColumn[i].prop
         this.searchOptions.push({ value: value, label: label })
       }
+    },
+    setColumnVisible(showCol){
+      return  this.tableColumn.map(ele=>{
+        return {
+          ...ele,
+          isShowColumn:showCol.includes(ele.label)
+        }
+      })
+    },
+    selTableCol(val) {
+      this.showcol = val;
+      this.tableList.tableColumn = this.setColumnVisible(val);
     },
     // 璇锋眰鏁版嵁
     async getData() {
@@ -194,22 +213,23 @@
     },
     // 鏂板缓
     addBtnClick() {
-      this.editSalesLeadConfig.visible = true
       this.editSalesLeadConfig.title = "鏂板缓"
-      this.editSalesLeadConfig.infomation = { businessStatus: "鏂板缓", city_id: 0 }
+      this.editSalesLeadConfig.infomation = { businessStatus: "鏂板缓", city_id: 0,province_id:'' }
+      this.editSalesLeadConfig.visible = true
     },
     // 缂栬緫
     handleClick(row) {
       console.log(row)
-      this.editSalesLeadConfig.visible = true
       this.editSalesLeadConfig.title = "缂栬緫"
       this.editSalesLeadConfig.infomation = { ...row, businessStatus: "鏂板缓" }
+      this.editSalesLeadConfig.visible = true
     },
     // 璺熻繘
     followupClick(row) {
-      this.editConfig.visible = true
       this.editConfig.title = "鏂板缓"
       this.editConfig.infomation = { sales_leads_name: row.name }
+
+      this.editConfig.visible = true
     },
     // 瀵煎叆
     importClitk() {
@@ -225,8 +245,13 @@
       }
     },
     // 鍒犻櫎
-    delClick() {
-      if (this.selValueList && this.selValueList.length > 0) {
+    delClick(id) {
+      if(!id){
+        if (this.selValueList && this.selValueList.length == 0) {
+          this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉¤褰�")
+          return true;
+        }
+      }
         this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
           confirmButtonText: "纭畾",
           cancelButtonText: "鍙栨秷",
@@ -234,7 +259,11 @@
         })
           .then(() => {
             console.log("dddd")
-            getDeleteSalesLeads({ ids: this.selValueList }).then((response) => {
+            let params={ids: this.selValueList }
+            if(id){
+              params={ids: [id]}
+            }
+            getDeleteSalesLeads(params).then((response) => {
               if (response.code === 200) {
                 this.$message.success("鍒犻櫎鎴愬姛")
                 this.getData()
@@ -244,9 +273,6 @@
             })
           })
           .catch(() => {})
-      } else {
-        this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉¤褰�")
-      }
     },
     getSelectArray(val) {
       this.selValueList = []
@@ -303,15 +329,6 @@
       border-radius: 12px;
       height: 100%;
       overflow: hidden;
-    }
-
-    .supplier-search {
-      display: flex;
-      align-items: center;
-      .add-view {
-        margin-left: auto;
-        margin-right: 20px;
-      }
     }
     .list-view {
       height: calc(100% - 60px);

--
Gitblit v1.8.0