From 46ed69e3b72658140a40127f4bae16bef9a02d56 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期一, 21 八月 2023 11:23:34 +0800
Subject: [PATCH] bug修复

---
 src/views/other/commonDialog/SelectChanceDialog.vue |  124 +++++++++++++++++++---------------------
 1 files changed, 59 insertions(+), 65 deletions(-)

diff --git a/src/views/other/commonDialog/SelectChanceDialog.vue b/src/views/other/commonDialog/SelectChanceDialog.vue
index bec8e0d..9c4f799 100644
--- a/src/views/other/commonDialog/SelectChanceDialog.vue
+++ b/src/views/other/commonDialog/SelectChanceDialog.vue
@@ -10,49 +10,25 @@
     >
       <div class="bg-view">
         <div class="query-bg">
-          <el-input placeholder="璇疯緭鍏ュ唴瀹�" v-model="queryInput" size="mini" class="input-with-select">
-            <el-select v-model="select" slot="prepend" placeholder="璇烽�夋嫨">
-              <el-option label="鍏ㄩ儴瀛楁" value="1"></el-option>
-              <el-option label="閿�鍞満浼氱紪鍙�" value="2"></el-option>
-              <el-option label="鏈轰細鍚嶇О" value="3"></el-option>
-              <el-option label="閿�鍞樁娈�" value="4"></el-option>
-              <el-option label="閿�鍞礋璐d汉" value="5"></el-option>
-              <el-option label="棰勮鎴愪氦鏃ユ湡" value="6"></el-option>
-            </el-select>
-          </el-input>
+          <SearchCommonView
+            ref="searchCommonView"
+            :search-options="searchOptions"
+            @searchClick="searchClick"
+            @resetClick="resetClick"
+          />
           <div class="btn">
-            <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button>
-            <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button>
+            <!-- <el-button type="primary" size="mini" disabled>璁剧疆瀛楁</el-button>
+            <el-button type="primary" size="mini" disabled>蹇�熷垱寤�</el-button> -->
           </div>
         </div>
-        <el-table
-          :data="tableData"
-          border
-          size="mini"
+        <TableCommonView
+          ref="tableListRef"
           v-loading="loading"
-          :header-cell-style="{ background: '#f7f7f7' }"
+          :table-list="tableList"
+          :select-box="false"
+          @selCommonClick="selNameClick"
         >
-          <el-table-column label="閿�鍞満浼氱紪鍙�" prop="number"></el-table-column>
-          <el-table-column label="鏈轰細鍚嶇О" prop="name" show-overflow-tooltip>
-            <template slot-scope="scope">
-              <span class="sel-name" @click="selNameClick(scope.row)">{{ scope.row.name }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="閿�鍞樁娈�" prop="sale_stage_id"></el-table-column>
-          <el-table-column label="閿�鍞礋璐d汉" prop="member_id"></el-table-column>
-          <el-table-column label="棰勮鎴愪氦鏃ユ湡" prop="expected_time" show-overflow-tooltip>
-            <template slot-scope="scope">
-              <span>{{
-                dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.expected_time) === "1900-01-01 08:00:00"
-                  ? "--"
-                  : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.expected_time)
-              }}</span>
-            </template>
-          </el-table-column>
-          <div slot="empty">
-            <el-empty :image-size="100"></el-empty>
-          </div>
-        </el-table>
+        </TableCommonView>
         <div slot="footer" class="dialog-footer">
           <div class="remark">璇存槑锛氭敮鎸佸瀛楁妯$硦鏌ヨ锛屼粎鏄剧ず绗﹀悎鏉′欢鐨勫墠5鏉℃暟鎹�</div>
         </div>
@@ -85,43 +61,69 @@
       editConfig: this.editCommonConfig,
       queryInput: "",
       select: "1",
-      tableData: [],
+      tableList: [],
       searchSelOptions: [],
-      loading: false
+      loading: false,
+      search_map: {}
     }
   },
   created() {
+    this.setTable()
     this.getData()
   },
   methods: {
+    setTable() {
+      this.tableList = {
+        tableInfomation: [],
+        tableColumn: [
+          { label: "閿�鍞満浼氱紪鍙�", prop: "number" }, // 閿�鍞満浼氱紪鍙�
+          { label: "鏈轰細鍚嶇О", prop: "name", isCommonClick: true }, // 鏈轰細鍚嶇О
+          { label: "閿�鍞樁娈�", prop: "sale_stage_name" }, // 閿�鍞樁娈�
+          { label: "閿�鍞礋璐d汉", prop: "member_name" }, // 閿�鍞礋璐d汉
+          { label: "棰勮鎴愪氦鏃ユ湡", prop: "expected_time" } // 棰勮鎴愪氦鏃ユ湡
+        ]
+      }
+      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 })
+      }
+    },
     handleClose() {
       this.editConfig.editVisible = false
     },
     // 璇锋眰鏁版嵁
     async getData() {
       this.loading = true
-      await getSaleChanceList()
+      await getSaleChanceList({
+        search_map: this.search_map,
+        page: 0,
+        pageSize: 0
+      })
         .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 {
-                  ...item
+                  ...item,
+                  member_name: item.member.username,
+                  sale_stage_name: item.sale_stage.name
                 }
               })
-              this.tableData = list.slice(0, 5) || []
+              this.tableList.tableInfomation = list.slice(0, 5) || []
             } else {
-              this.tableData = []
+              this.tableList.tableInfomation = []
             }
           } else {
-            this.tableData = []
+            this.tableList.tableInfomation = []
           }
           this.loading = false
         })
         .catch((err) => {
           console.log(err)
-          this.tableData = []
+          this.tableList.tableInfomation = []
           this.loading = false
         })
     },
@@ -130,26 +132,17 @@
       console.log(row)
       this.$emit("selClient", row, "chance")
     },
-    // 鏃堕棿鏄剧ず
-    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() // 绉�
-        // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆
+    // 鎼滅储
+    searchClick(val, content) {
+      console.log(val, content)
+      this.search_map = {
+        [val.value]: content
       }
-      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
+      this.getData()
+    },
+    resetClick() {
+      this.search_map = {}
+      this.getData()
     }
   }
 }
@@ -160,6 +153,7 @@
 .bg-view {
   margin: 10px;
   .query-bg {
+    margin-left: -20px;
     margin-bottom: 10px;
     display: flex;
     justify-content: space-between;

--
Gitblit v1.8.0