From 01fe9929805fc9e73b72033f9717fc3f32005b03 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 29 十一月 2023 16:47:38 +0800
Subject: [PATCH] 销售管理模块整体新建增加默认负责人

---
 src/views/service/serviceContract/index.vue |  193 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 124 insertions(+), 69 deletions(-)

diff --git a/src/views/service/serviceContract/index.vue b/src/views/service/serviceContract/index.vue
index aa48f5a..d56d3d6 100644
--- a/src/views/service/serviceContract/index.vue
+++ b/src/views/service/serviceContract/index.vue
@@ -14,8 +14,8 @@
           @searchClick="onFilterSearch"
         >
           <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" type="primary" @click="addBtnClick">鏂板缓</el-button>
+            <!-- <el-button size="small"  @click="delClick">鍒犻櫎</el-button> -->
           </template>
         </CommonSearch>
       </div>
@@ -25,26 +25,26 @@
       <div class="body-card">
         <div class="list-view">
           <TableCommonView
-              ref="tableListRef"
-              :table-list="tableList"
-              :select-box="!isDetail"
-              @selClientClick="selClientClick"
-              @selCommonClick="selCommonClick"
-              @getSelectArray="getSelectArray"
+            ref="tableListRef"
+            :table-list="tableList"
+            @selClientClick="selClientClick"
+            @selCommonClick="selCommonClick"
+            @getSelectArray="getSelectArray"
+            @selTableCol="selTableCol"
           >
             <template slot="tableButton">
-              <el-table-column label="鎿嶄綔" width="60">
+              <el-table-column label="鎿嶄綔" width="100">
                 <template slot-scope="scope">
                   <el-button @click="handleClick(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>
           </TableCommonView>
         </div>
-          <div class="btn-pager">
-            <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
-          </div>
+        <div class="btn-pager">
+          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
+        </div>
       </div>
     </div>
     <!-- 鏂板缓/缂栬緫 -->
@@ -128,7 +128,31 @@
       },
       selValueList: [],
       keyword: "",
-      keywordType: ""
+      keywordType: "",
+      tableColumn: [
+        { label: "鏈嶅姟鍚堝悓缂栧彿", prop: "number", isCommonClick: true, default: true }, // 鏈嶅姟鍚堝悓缂栧彿
+        { label: "瀹㈡埛鍚嶇О", prop: "client_name", isClientClick: true }, // 瀹㈡埛鍚嶇О
+        { label: "绛剧害鏃ユ湡", prop: "signTime" }, // 绛剧害鏃ユ湡
+        { label: "鍚堝悓绫诲瀷", prop: "serviceContractType" }, // 鍚堝悓绫诲瀷
+        { label: "鍚堝悓鐘舵��", prop: "serviceContractStatus" }, // 鍚堝悓鐘舵��
+        { label: "璐熻矗浜�", prop: "member_name" }, // 璐熻矗浜�
+        { label: "浜у搧鍚嶇О", prop: "productName", isProductName: true }, // 浜у搧鍚嶇О
+        { label: "鏈嶅姟寮�濮嬫棩", prop: "startTime" }, // 鏈嶅姟寮�濮嬫棩
+        { label: "鏈嶅姟鍒版湡鏃�", prop: "endTime" }, // 鏈嶅姟鍒版湡鏃�
+        { label: "浠风◣鍚堣", prop: "amountTotal" } // 浠风◣鍚堣
+      ],
+      showCol: [
+        "鏈嶅姟鍚堝悓缂栧彿",
+        "瀹㈡埛鍚嶇О",
+        "绛剧害鏃ユ湡",
+        "鍚堝悓绫诲瀷",
+        "鍚堝悓鐘舵��",
+        "璐熻矗浜�",
+        "浜у搧鍚嶇О",
+        "鏈嶅姟寮�濮嬫棩",
+        "鏈嶅姟鍒版湡鏃�",
+        "浠风◣鍚堣"
+      ]
     }
   },
   created() {
@@ -145,20 +169,13 @@
   methods: {
     setTable() {
       this.tableList = {
+        selectIndex: true,
         tableInfomation: [],
-        tableColumn: [
-          { label: "鏈嶅姟鍚堝悓缂栧彿", prop: "number", isCommonClick: true }, // 鏈嶅姟鍚堝悓缂栧彿
-          { label: "瀹㈡埛鍚嶇О", prop: "client_name", isClientClick: true }, // 瀹㈡埛鍚嶇О
-          { label: "绛剧害鏃ユ湡", prop: "signTime" }, // 绛剧害鏃ユ湡
-          { label: "鍚堝悓绫诲瀷", prop: "serviceContractType" }, // 鍚堝悓绫诲瀷
-          { label: "鍚堝悓鐘舵��", prop: "serviceContractStatus" }, // 鍚堝悓鐘舵��
-          { label: "璐熻矗浜�", prop: "member_name" }, // 璐熻矗浜�
-          { label: "浜у搧鍚嶇О", prop: "productName", isProductName: true }, // 浜у搧鍚嶇О
-          { label: "鏈嶅姟寮�濮嬫棩", prop: "startTime" }, // 鏈嶅姟寮�濮嬫棩
-          { label: "鏈嶅姟鍒版湡鏃�", prop: "endTime" }, // 鏈嶅姟鍒版湡鏃�
-          { label: "浠风◣鍚堣", prop: "amountTotal" } // 浠风◣鍚堣
-        ]
+        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
@@ -166,15 +183,51 @@
         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() {
       this.loading = true
-      await getServiceContractList({
-        keyword: this.keyword,
-        keywordType: this.keywordType,
-        page: this.pagerOptions.currPage,
-        pageSize: this.pagerOptions.pageSize
-      })
+      let params = {}
+      console.log(this.addConfig)
+      if (this.addConfig.id && this.addConfig.keywordType === "閿�鍞満浼�") {
+        params = {
+          saleChanceId: this.addConfig.id,
+          page: this.pagerOptions.currPage,
+          pageSize: this.pagerOptions.pageSize
+        }
+      } else if (this.addConfig.id && this.addConfig.keywordType === "閿�鍞槑缁嗗崟") {
+        params = {
+          salesDetailsId: this.addConfig.id,
+          page: this.pagerOptions.currPage,
+          pageSize: this.pagerOptions.pageSize
+        }
+      } else if (this.addConfig.id && this.addConfig.keywordType === "鎶ヤ环鍗�") {
+        params = {
+          quotationId: this.addConfig.id,
+          page: this.pagerOptions.currPage,
+          pageSize: this.pagerOptions.pageSize
+        }
+      } else {
+        params = {
+          keyword: this.keyword,
+          keywordType: this.keywordType,
+          page: this.pagerOptions.currPage,
+          pageSize: this.pagerOptions.pageSize,
+          contactId: this.addConfig.client_id
+        }
+      }
+      await getServiceContractList(params)
         .then((res) => {
           console.log(res)
           if (res.code === 200) {
@@ -205,17 +258,7 @@
         })
     },
     // 鎼滅储
-    searchClick(val, content) {
-      this.keyword = content
-      this.keywordType = val.label
-      this.getData()
-    },
-    resetClick() {
-      this.keyword = ""
-      this.keywordType = ""
-      this.getData()
-    },
-    onFilterSearch(searchText){
+    onFilterSearch(searchText) {
       this.keyword = searchText ?? ""
       this.keywordType = "鏈嶅姟鍚堝悓缂栧彿"
       this.pagerOptions.currPage = 1
@@ -225,7 +268,15 @@
     addBtnClick() {
       this.editConfig.visible = true
       this.editConfig.title = "鏂板缓"
-      this.editConfig.infomation = { ...this.addConfig, currency: "浜烘皯甯�" }
+      this.editConfig.infomation = {
+        ...this.addConfig,
+        currency: "浜烘皯甯�",
+        client_name: Object.keys(this.addConfig).length === 0 ? "" : this.addConfig.client_name,
+        contact_name: "",
+        sale_chance_name: Object.keys(this.addConfig).length === 0 ? "" : this.addConfig.sale_chance_name,
+        contract_number: "",
+        quotation_number: ""
+      }
     },
     // 缂栬緫
     handleClick(row) {
@@ -236,31 +287,35 @@
         ...row,
         contract_number: row.salesDetails.number,
         quotation_number: row.quotation.number,
-        currency: "浜烘皯甯�"
+        currency: "浜烘皯甯�",
+        sale_chance_name: row.SaleChance.name,
+        contact_name: row.contact.name,
+        serviceContractTypeId: row.serviceContractTypeId === 0 ? null : row.serviceContractTypeId,
+        serviceContractStatusId: row.serviceContractStatusId === 0 ? null : row.serviceContractStatusId
       }
     },
     // 鍒犻櫎
-    delClick() {
-      if (this.selValueList && this.selValueList.length > 0) {
-        this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
-          confirmButtonText: "纭畾",
-          cancelButtonText: "鍙栨秷",
-          type: "warning"
-        })
-          .then(() => {
-            getDelServiceContract({ ids: this.selValueList }).then((response) => {
-              if (response.code === 200) {
-                this.$message.success("鍒犻櫎鎴愬姛")
-                this.getData()
-              } else {
-                this.$message.warning("鍒犻櫎澶辫触")
-              }
-            })
+    delClick(id) {
+      // if (this.selValueList && this.selValueList.length > 0) {
+      this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          getDelServiceContract({ ids: [id] }).then((response) => {
+            if (response.code === 200) {
+              this.$message.success("鍒犻櫎鎴愬姛")
+              this.getData()
+            } else {
+              this.$message.warning("鍒犻櫎澶辫触")
+            }
           })
-          .catch(() => {})
-      } else {
-        this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉¤褰�")
-      }
+        })
+        .catch(() => {})
+      // } else {
+      //   this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉¤褰�")
+      // }
     },
     getSelectArray(val) {
       console.log(val)
@@ -294,15 +349,15 @@
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style lang="scss" scoped>
-.service-contract{
+.service-contract {
   height: 100%;
   overflow: hidden;
-  .filter{
+  .filter {
     height: 80px;
     display: flex;
     align-items: center;
     padding: 12px 20px 0 20px;
-    &-card{
+    &-card {
       height: 80px;
       display: flex;
       align-items: center;
@@ -313,7 +368,7 @@
       background-color: #fff;
     }
   }
-  .body{
+  .body {
     box-sizing: border-box;
     padding: 10px 20px;
     border-radius: 12px;

--
Gitblit v1.8.0