From ee71c2a66079c43fbaf9b23d2d2f73427d4dd76c Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 12 三月 2024 14:24:49 +0800
Subject: [PATCH] 采购订单公共组件修改和收货信息状态、收货状态必填、添加产品改为多选

---
 src/views/purchaseManage/purchase/components/AddPurchase.vue |   57 +++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index 10641ed..34a32d7 100644
--- a/src/views/purchaseManage/purchase/components/AddPurchase.vue
+++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -231,11 +231,13 @@
               :detailEnter="editCommonConfig.detailEnter"
               :show-summary="showSummary"
               :recalculateShow="false"
+              :addTypeIdMultiple="true"
               :product-table-list="productTableList"
               sign="purchase"
               @inputContent="inputContent"
               @getSummaries="getSummaries"
               @addProductClick="addProductClick"
+              @getSelectArray="getSelectArray"
               @emptyProductClick="emptyProductClick"
               @clearupProduct="clearupProduct"
               @rowClick="rowClick"
@@ -393,7 +395,8 @@
           },
           { validator: this.validatorNumThree, trigger: "change" }
         ],
-        number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }]
+        number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }],
+        warehouse: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
       },
       productTableList: {},
       showSummary: {
@@ -616,6 +619,8 @@
                   if (res.code === 200) {
                     this.$message.success("鍒涘缓鎴愬姛")
                     this.$parent.getData()
+                  } else {
+                    this.$message.error(res.msg)
                   }
                 })
               }
@@ -788,7 +793,7 @@
             purchaseId: 0,
             productId: Number(this.productId),
             productIndex: this.productIndex,
-            amount: 0,
+            amount: 1,
             name: "",
             number: "",
             price: 0,
@@ -813,6 +818,7 @@
         supplierId: undefined,
         tableData: this.tableData,
         disabled: this.editConfig.isDisabled,
+        isReturn: true,
         tableColumn: [
           {
             label: "浜у搧鍚嶇О",
@@ -828,7 +834,7 @@
           { label: "鏁伴噺", prop: "amount", inputNumber: true, disabled: this.editConfig.isDisabled },
           {
             label: "閲囪喘鍗曚环",
-            prop: "price",
+            prop: "purchasePrice",
             inputFloat: true,
             isRequird: true,
             disabled: this.editConfig.isDisabled
@@ -841,12 +847,10 @@
     },
     // 浜у搧鍒楄〃杈撳叆
     inputContent(val, prop, row) {
-      // this.productId = row.productId;
-      this.productIndex = row.productIndex
       let num = 0
       this.tableData.map((item) => {
         num += item.amount
-        if (item.productIndex === row.productIndex) {
+        if (item.number === row.number) {
           item[prop] = val
         }
       })
@@ -880,18 +884,35 @@
     },
     // 浜у搧鏂板
     addProductClick() {
-      this.productIndex++
-      this.tableData.push({
-        productIndex: this.productIndex,
-        productId: "",
-        id: 0,
-        amount: 0,
-        desc: "",
-        name: "",
-        number: "",
-        price: 0,
-        total: 0
-      })
+      // this.productIndex++
+      // this.tableData.push({
+      //   productIndex: this.productIndex,
+      //   productId: "",
+      //   id: 0,
+      //   amount: 0,
+      //   desc: "",
+      //   name: "",
+      //   number: "",
+      //   price: 0,
+      //   total: 0
+      // })
+      // this.showSummary.show = true
+    },
+    // 鏂板鏂瑰紡淇敼
+    getSelectArray(val, index) {
+      console.log(val, "ddd99999")
+      if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
+        this.tableData = []
+      }
+      if (index < this.tableData.length) {
+        this.tableData.splice(index, 1)
+        val.map((item, ind) => {
+          this.tableData.splice(index + ind, 0, item)
+        })
+      } else {
+        this.tableData = this.tableData.concat(val)
+      }
+      this.productTableList.tableData = this.tableData
       this.showSummary.show = true
     },
     //  浜у搧娓呯┖

--
Gitblit v1.8.0