From 19f5949491976905f3cd3fd53407ff4898080a46 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 12 三月 2024 17:07:58 +0800
Subject: [PATCH] bug修复

---
 src/views/purchaseManage/purchase/components/AddPurchase.vue |   26 ++++++++++---
 src/views/purchaseManage/purchase/index.vue                  |   17 ++++++--
 src/api/data.js                                              |   56 ++++++++++++++--------------
 3 files changed, 61 insertions(+), 38 deletions(-)

diff --git a/src/api/data.js b/src/api/data.js
index 9678b60..5936ae6 100644
--- a/src/api/data.js
+++ b/src/api/data.js
@@ -1,48 +1,48 @@
 // 閲囪喘鐘舵��
-const purchaseStatus=[
-  {id:1,name:"寰呯‘璁�"},
-  {id:2,name:"寰呭叆搴�"},
-  {id:3,name:"宸插叆搴�"},
-  {id:4,name:"宸插畬鎴�"},
-  {id:5,name:"宸插彇娑�"}
+const purchaseStatus = [
+  { id: 1, name: "寰呯‘璁�" },
+  { id: 2, name: "寰呭叆搴�" },
+  { id: 3, name: "灏辩华" },
+  { id: 4, name: "宸插畬鎴�" },
+  { id: 5, name: "宸插彇娑�" }
 ]
 // 璐ㄦ鍗曠姸鎬�
-const qualityStatus=[
+const qualityStatus = [
   {
-    name:'寰呰川妫�',
-    id:1,
+    name: "寰呰川妫�",
+    id: 1
   },
   {
-    name:'宸插畬鎴�',
-    id:2,
+    name: "宸插畬鎴�",
+    id: 2
   }
 ]
 // 閫�璐у崟鐘舵��
-const returnedStatus=[
+const returnedStatus = [
   {
-    name:'寰呭彂璐�',
-    id:1,
+    name: "寰呭彂璐�",
+    id: 1
   },
   {
-    name:'寰呯鏀�',
-    id:2,
+    name: "寰呯鏀�",
+    id: 2
   },
   {
-    name:'寰呭彂璐�',
-    id:3,
+    name: "寰呭彂璐�",
+    id: 3
   },
   {
-    name:'宸插畬鎴�',
-    id:4,
-  },
+    name: "宸插畬鎴�",
+    id: 4
+  }
 ]
 
-export const getDataByType = type => {
-  if(type =='purchaseStatus'){
-    return purchaseStatus;
-  }else if(type=='qualityStatus'){
-    return qualityStatus;
-  }else if(type=='returnedStatus'){
-    return returnedStatus;
+export const getDataByType = (type) => {
+  if (type == "purchaseStatus") {
+    return purchaseStatus
+  } else if (type == "qualityStatus") {
+    return qualityStatus
+  } else if (type == "returnedStatus") {
+    return returnedStatus
   }
 }
diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index 34a32d7..653cca7 100644
--- a/src/views/purchaseManage/purchase/components/AddPurchase.vue
+++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -51,6 +51,7 @@
                     v-model="editConfig.infomation.purchaseTypeId"
                     clearable
                     style="width: calc(100% - 30px)"
+                    @visible-change="selPurchaseChange"
                   >
                     <el-option
                       v-for="ele in plcBrandList"
@@ -370,7 +371,7 @@
       editConfig: this.editCommonConfig,
       rules: {
         purchaseTypeId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-        supplierName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+        supplierName: [{ required: true, message: "璇烽�夋嫨渚涘簲鍟嗗悕绉�", trigger: "change" }],
         phone: [
           {
             required: false,
@@ -396,7 +397,9 @@
           { validator: this.validatorNumThree, trigger: "change" }
         ],
         number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }],
-        warehouse: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
+        warehouse: [{ required: true, message: "璇烽�夋嫨鏀惰揣浠撳簱", trigger: "change" }],
+        signingDate: [{ required: true, message: "璇烽�夋嫨绛剧害鏃ユ湡", trigger: "change" }],
+        deliveryDate: [{ required: true, message: "璇烽�夋嫨浜や粯鏃ユ湡", trigger: "change" }]
       },
       productTableList: {},
       showSummary: {
@@ -404,7 +407,7 @@
         total: false,
         sumProp: ["price", "total"],
         multiply: ["amount", "price"],
-        titleProp: ["缂栧彿", "浜у搧鍚嶇О", "浜у搧缂栧彿", "璁¢噺鍗曚綅", "瑙勬牸鍨嬪彿", "閲囪喘鍗曚环", "鎻忚堪"],
+        titleProp: ["缂栧彿", "浜у搧鍚嶇О", "浜у搧缂栧彿", "璁¢噺鍗曚綅", "瑙勬牸", "鍨嬪彿", "閲囪喘鍗曚环", "鎻忚堪"],
         mergeNumber: 4,
         totalName: "灏忚"
       },
@@ -432,7 +435,9 @@
   },
   created() {
     console.log(this.editConfig, "鍙傛暟")
-    this.handleGetBomKindDictList()
+    if (this.editConfig.title == "鏂板缓") {
+      this.handleGetBomKindDictList()
+    }
     this.getWarehouseInfo()
     this.$store.dispatch("getSupplier")
     this.formInfo()
@@ -446,7 +451,9 @@
     "editCommonConfig.visible": {
       immediate: true,
       handler: function () {
-        this.handleGetBomKindDictList(true)
+        if (this.editConfig.title == "鏂板缓") {
+          this.handleGetBomKindDictList(true)
+        }
       }
     }
   },
@@ -520,6 +527,12 @@
           }
         }
       })
+    },
+    // 閫夋嫨閲囪喘绫诲瀷涓嬫媺鏂规硶
+    selPurchaseChange(val) {
+      if (val) {
+        this.handleGetBomKindDictList()
+      }
     },
     handleConfirmSave(data) {
       console.log(data, "data")
@@ -830,7 +843,8 @@
           },
           { label: "浜у搧缂栧彿", prop: "number", min: 150 },
           { label: "璁¢噺鍗曚綅", prop: "unit" },
-          { label: "瑙勬牸鍨嬪彿", prop: "specifications" },
+          { label: "瑙勬牸", prop: "specifications" },
+          { label: "鍨嬪彿", prop: "modelNumber" },
           { label: "鏁伴噺", prop: "amount", inputNumber: true, disabled: this.editConfig.isDisabled },
           {
             label: "閲囪喘鍗曚环",
diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue
index 48c106e..c67ed91 100644
--- a/src/views/purchaseManage/purchase/index.vue
+++ b/src/views/purchaseManage/purchase/index.vue
@@ -347,7 +347,7 @@
         number: "",
         contact: "",
         phone: "",
-        signingDate: "",
+        signingDate: this.getCurrentDate(),
         deliveryDate: "",
         remark: "",
         wholeDiscountType: null,
@@ -357,7 +357,14 @@
         realTotalPrice: 0
       }
     },
-
+    // 鑾峰彇褰撳墠鏃ユ湡
+    getCurrentDate() {
+      let now = new Date()
+      let year = now.getFullYear()
+      let month = now.getMonth() + 1
+      let day = now.getDate()
+      return year + "-" + month + "-" + day
+    },
     // 缂栬緫
     btnEdit(row) {
       this.editConfig.detailEnter = false
@@ -374,7 +381,8 @@
           this.editConfig.infomation = {
             productList: res.data.productList,
             supplierName: res.data.purchase.supplier.name,
-            ...res.data.purchase
+            ...res.data.purchase,
+            purchaseTypeId: res.data.purchase.purchaseTypeId == "0" ? "" : res.data.purchase.purchaseTypeId
           }
         } else {
           this.$message.error(res.msg ? res.msg + "," : "" + "鑾峰彇淇℃伅澶辫触锛�")
@@ -475,7 +483,8 @@
           this.editConfig.infomation = {
             productList: res.data.productList,
             supplierName: res.data.purchase.supplier.name,
-            ...res.data.purchase
+            ...res.data.purchase,
+            purchaseTypeId: res.data.purchase.purchaseTypeId == "0" ? "" : res.data.purchase.purchaseTypeId
           }
         } else {
           this.$message.error(res.msg ? res.msg + "," : "" + "鑾峰彇淇℃伅澶辫触锛�")

--
Gitblit v1.8.0