From 583f5b77640b5dbf7e593e89a0d660f4cacacbe9 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期四, 02 十一月 2023 11:58:16 +0800
Subject: [PATCH] 添加供应商接口联调、相关供应商页面修改、产品页面修改

---
 src/views/purchaseManage/purchase/index.vue |   77 ++++++++++++++++++++++++++------------
 1 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue
index 8625999..4a12b42 100644
--- a/src/views/purchaseManage/purchase/index.vue
+++ b/src/views/purchaseManage/purchase/index.vue
@@ -22,6 +22,7 @@
               ref="tableListRef"
               :table-list="tableList"
               @selCommonClick="selCommonClick"
+              @selTableCol="selTableCol"
           >
             <template slot="tableButton">
               <el-table-column  label="鐘舵��" width="120">
@@ -34,7 +35,7 @@
                   <el-button type="text" size="small" @click="editClick(scope.row)" style="margin-right: 5px"
                   >缂栬緫</el-button
                   >
-                  <el-button @click="submitClick(scope.row)" type="text" size="small">鎻愪氦</el-button>
+                  <el-button v-if="scope.row.status< 4" @click="submitClick(scope.row)" type="text" size="small">鎻愪氦</el-button>
                 </template>
               </el-table-column>
             </template>
@@ -62,6 +63,7 @@
 import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
 import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
 import { getDataByType } from "@/api/data"
+import { getSupplierList } from "@/api/supplierManage/supplier"
 export default {
   name: "SupplierManage",
   props: {},
@@ -82,14 +84,28 @@
       editConfig: {
         visible: false,
         title: "鍒涘缓",
-        infomation: {}
+        infomation: {
+          supplierList:[]
+        }
       },
-      purchaseStatusList: getDataByType("purchaseStatus")
+      purchaseStatusList: getDataByType("purchaseStatus"),
+      tableColumn: [
+        { label: "閲囪喘鍗曞彿", prop: "number", min: 150, isCommonClick: true ,default:true},
+        { label: "閲囪喘鍗曞悕绉�", prop: "name", min: 130, isCommonClick: true },
+        { label: "鍗曟嵁绫诲瀷", prop: "orderType", min: 130 },
+        { label: "渚涘簲鍟嗗悕绉�", prop: "contact", min: 130 },
+        { label: "閲囪喘鏁伴噺", prop: "quantity", min: 130 },
+        { label: "鏀惰揣浠撳簱", prop: "warehouse", min: 130 },
+        { label: "缁忓姙浜�", prop: "handledBy", min: 130 },
+        { label: "鍒跺崟浜�", prop: "creator", min: 130 }
+      ],
+      showCol: ['閲囪喘鍗曞彿', '閲囪喘鍗曞悕绉�', '鍗曟嵁绫诲瀷', '渚涘簲鍟嗗悕绉�', '閲囪喘鏁伴噺', '鏀惰揣浠撳簱']
     }
   },
   created() {
     this.setTable()
     this.getData()
+    this.getSupplierData()
   },
   methods: {
     getpurchaseStatus(val) {
@@ -103,21 +119,27 @@
         return "--"
       }
     },
+    setColumnVisible(showCol){
+      return  this.tableColumn.map(ele=>{
+        return {
+          ...ele,
+          isShowColumn:showCol.includes(ele.label)
+        }
+      })
+    },
     setTable() {
       this.tableList = {
         tableInfomation: [],
         selectIndex: true,
-        tableColumn: [
-          { label: "閲囪喘鍗曞彿", prop: "number", min: 150, isCommonClick: true },
-          { label: "閲囪喘鍗曞悕绉�", prop: "name", min: 130, isCommonClick: true },
-          { label: "鍗曟嵁绫诲瀷", prop: "orderType", min: 130 },
-          { label: "渚涘簲鍟嗗悕绉�", prop: "contact", min: 130 },
-          { label: "閲囪喘鏁伴噺", prop: "quantity", min: 130 },
-          { label: "鏀惰揣浠撳簱", prop: "warehouse", min: 130 },
-          { label: "缁忓姙浜�", prop: "handledBy", min: 130 },
-          { label: "鍒跺崟浜�", prop: "creator", min: 130 }
-        ]
+        showcol: this.showCol,
+        allcol: [],
+        tableColumn:this.setColumnVisible(this.showCol)
       }
+      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
+    },
+    selTableCol(val) {
+      this.showcol = val;
+      this.tableList.tableColumn = this.setColumnVisible(val);
     },
     // 璇锋眰鏁版嵁
     async getData() {
@@ -137,18 +159,24 @@
           console.log(err)
         })
     },
+    // 鑾峰彇渚涘簲鍟嗘暟鎹�
+    async getSupplierData() {
+      await getSupplierList({
+        // [val]: content,
+        page:1,
+        pageSize: 10
+      })
+      .then((res) => {
+        if (res.data.code == 200) {
+          this.editConfig.infomation.supplierList=res.data.data.list
+          
+        }
+      })
+    },
     // 鎼滅储
-    searchClick(val, content) {
-      console.log(val, content)
-      this.search = content
-      this.getData()
-    },
-    resetClick() {
-      this.search = ""
-      this.getData()
-    },
     onFilterSearch(searchText){
-      this.search = searchText
+      this.search = searchText ?? ''
+      this.pagerOptions.currPage = 1
       this.getData()
     },
     // 鏂板缓
@@ -217,8 +245,9 @@
               this.$message.warning("鎻愪氦澶辫触")
             }
           })
+        },(e)=>{
+          console.error(e)
         })
-        .catch(() => {})
     },
 
     // 璇︽儏

--
Gitblit v1.8.0