From 02b7655966b254a1c2b9f59006d52deb71aff3f4 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 14 十一月 2023 11:30:49 +0800
Subject: [PATCH] 选择供应商组件优化、列表公共组件优化、创建采购单

---
 src/views/supplierManage/supplier/index.vue |   39 ++++++++++++++++++++++++++++++++-------
 1 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/src/views/supplierManage/supplier/index.vue b/src/views/supplierManage/supplier/index.vue
index e1e85eb..8383a57 100644
--- a/src/views/supplierManage/supplier/index.vue
+++ b/src/views/supplierManage/supplier/index.vue
@@ -22,8 +22,9 @@
               ref="tableSupplier"
               :table-list="tableList"
               @selCommonClick="selCommonClick"
-              @tableRowClick="tableRowClick"
               @selTableCol="selTableCol"
+              @tableRowClick="tableRowClick"
+              :selectClassRow="selectRow"
             >
               <template slot="tableButton">
                 <el-table-column label="鎿嶄綔" width="100">
@@ -62,7 +63,7 @@
           >
             <template slot="leftButton">
               <div class="sub-title"><span class="sub-title-decorator"></span>鍙彁渚涚殑浜у搧</div>
-              <el-button type="primary" size="mini">鍒涘缓閲囪喘鍗�</el-button>
+              <el-button type="primary" size="mini" @click="creatPurchase">鍒涘缓閲囪喘鍗�</el-button>
             </template>
             <template slot="rightButton">
               <el-button type="primary" size="mini" @click="addNewProductClick">娣诲姞鏂颁骇鍝�</el-button>
@@ -110,6 +111,8 @@
     <RaleteSupplierList v-if="raleteSupplierConfig.visible" :common-config="raleteSupplierConfig" />
     <!-- 娣诲姞鏂颁骇鍝� -->
     <AddNewProduct v-if="newProductConfig.visible" :add-common-config="newProductConfig" />
+    <!-- 鏂板缓/缂栬緫 -->
+    <AddPurchase v-if="editPurchaseConfig.visible" :edit-common-config="editPurchaseConfig" />
   </div>
 </template>
 
@@ -121,11 +124,12 @@
 import RaleteSupplierList from "@/views/supplierManage/supplier/RaleteSupplierList"
 import AddNewProduct from "@/views/supplierManage/supplier/AddNewProduct"
 import { getProductList, deleteProduct } from "@/api/productManage/product"
+import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
 
 export default {
   name: "SupplierManage",
   props: {},
-  components: { DetailSupplier, AddSupplier, RaleteSupplierList, AddNewProduct },
+  components: { DetailSupplier, AddSupplier, RaleteSupplierList, AddNewProduct, AddPurchase },
   mixins: [pageMixin],
   computed: {},
   data() {
@@ -180,7 +184,16 @@
         { label: "閲囪喘浠锋牸", prop: "purchasePrice", min: 130 },
         { label: "渚涜揣鏃堕暱(澶�)", prop: "deliveryTime", min: 130 },
         { label: "鐗╂祦鏃堕暱(澶�)", prop: "shippingDuration", min: 130 }
-      ]
+      ],
+      editPurchaseConfig: {
+        // 鍒涘缓閲囪喘
+        visible: false,
+        title: "鍒涘缓",
+        infomation: {
+          supplierName: ""
+        }
+      },
+      selectRow: {}
     }
   },
   created() {
@@ -269,6 +282,7 @@
           const list = res.data.list.map((item) => {
             return {
               ...item,
+              id: item.ID,
               status_name: item.status === 0 ? "鏈惎鐢�" : "鍚敤"
             }
           })
@@ -277,12 +291,13 @@
           this.pagerOptions.totalCount = res.data.total
           if (list && list.length > 0) {
             this.supplierId = this.tableList.tableInfomation[0].ID
+            this.selectRow = this.tableList.tableInfomation.length > 0 ? this.tableList.tableInfomation[0] : {}
           } else {
             this.supplierId = 0
           }
-          this.$nextTick(() => {
-            this.$refs.tableSupplier.$refs.table.setCurrentRow(this.tableList.tableInfomation[0])
-          })
+          // this.$nextTick(() => {
+          //   this.$refs.tableSupplier.$refs.table.setCurrentRow(this.tableList.tableInfomation[0])
+          // })
 
           // 閲嶆柊鑾峰彇渚涘簲鍟嗗垪琛ㄥ悗搴旇閲嶇疆浜у搧鍒楄〃椤电爜
           this.productPagerOptions.currPage = 1
@@ -401,6 +416,7 @@
     tableRowClick(row) {
       console.log(row)
       this.productPagerOptions.currPage = 1
+      this.selectRow = row
       this.supplierId = row.ID
       this.getProductList()
     },
@@ -419,6 +435,15 @@
     currentProductHandler(val) {
       this.productPagerOptions.currPage = val
       this.getProductList()
+    },
+    // 鍒涘缓閲囪喘鍗�
+    creatPurchase() {
+      this.editPurchaseConfig.visible = true
+      this.editPurchaseConfig.title = "鍒涘缓"
+      this.editPurchaseConfig.infomation = {
+        supplierId: this.selectRow.ID,
+        supplierName: this.selectRow.name
+      }
     }
   }
 }

--
Gitblit v1.8.0