From ff4ae0c26eb77d9ae3028fb5bc02e20b7480d38d Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 20 三月 2024 19:33:53 +0800
Subject: [PATCH] 采购单签约日期交付日期限制选择范围,添加校验

---
 src/views/purchaseManage/purchase/components/AddPurchase.vue |   47 +++++++++++++++++++++++++++++++++--------------
 1 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index 541e76c..35aeba2 100644
--- a/src/views/purchaseManage/purchase/components/AddPurchase.vue
+++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -54,7 +54,7 @@
                   >
                     <el-option
                       v-for="ele in plcBrandList"
-                      :key="ele.name"
+                      :key="ele.purchaseTypeId"
                       :label="ele.name"
                       :value="ele.id"
                     ></el-option>
@@ -144,6 +144,7 @@
                     clearable
                     placeholder="閫夋嫨鏃ユ湡"
                     value-format="yyyy-MM-dd"
+                    :picker-options="pickerOptionsBefore"
                   >
                   </el-date-picker>
                 </el-form-item>
@@ -158,6 +159,7 @@
                     clearable
                     placeholder="閫夋嫨鏃ユ湡"
                     value-format="yyyy-MM-dd"
+                    :picker-options="pickerOptions"
                   >
                   </el-date-picker>
                 </el-form-item>
@@ -339,7 +341,9 @@
           },
           { validator: this.validatorNumThree, trigger: "change" }
         ],
-        number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }]
+        number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }],
+        signingDate: [{ required: true, message: "璇烽�夋嫨绛剧害鏃ユ湡", trigger: "change" }],
+        deliveryDate: [{ required: true, message: "璇烽�夋嫨浜や粯鏃ユ湡", trigger: "change" }],
       },
       productTableList: {},
       showSummary: {
@@ -369,10 +373,23 @@
       total: 0,
       totalTwo: 0,
       productListIdx: 0,
-      lacks: []
+      lacks: [],
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() < Date.now() - 8.64e7
+        }
+      },
+      pickerOptionsBefore: {
+        disabledDate(time) {
+          return time.getTime() > Date.now()
+        }
+      },
     }
   },
   created() {
+    let date= new Date() 
+    this.editConfig.infomation.signingDate=date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate()) 
+    console.log(this.editConfig,"鍙傛暟")
     this.handleGetBomKindDictList()
     this.$store.dispatch("getSupplier")
     this.formInfo()
@@ -446,13 +463,15 @@
         this.plcBrandList = res.data
         this.setTableForm()
         if (val) {
+          // this.plcBrandList.map((item)=>{
+          //   item.purchaseTypeId=item.id
+          // })
           for (let i in this.plcBrandList) {
             if (this.plcBrandList[i][this.editRow.isDefault]) {
               this.editConfig.infomation.purchaseTypeId = this.editConfig.infomation.purchaseTypeId
                 ? this.editConfig.infomation.purchaseTypeId
                 : this.plcBrandList[i].id
               this.$set(this.editConfig.infomation, "purchaseTypeId", this.editConfig.infomation.purchaseTypeId)
-
               break
             }
           }
@@ -651,8 +670,8 @@
           quantity: data.quantity // 閲囪喘鏁伴噺
         }
       }
-      if (data.ID) {
-        params.purchase.id = data.ID
+      if (data.id) {
+        params.purchase.id = data.id
       }
       return params
     },
@@ -676,13 +695,13 @@
     },
     // 閫夋嫨渚涘簲鍟�
     async handleSelectClient(value, item) {
-      this.productTableList.supplierId = item.ID
+      this.productTableList.supplierId = item.id
       if (value === "client") {
         this.supplierId = item.id
-        this.editConfig.infomation.supplierId = item.ID
+        this.editConfig.infomation.supplierId = item.id
       }
       await getProductList({
-        supplierId: item.ID,
+        supplierId: item.id,
         page: 1,
         pageSize: 100
       }).then((res) => {
@@ -697,7 +716,7 @@
     },
     async selClient(row) {
       await getProductList({
-        supplierId: row.ID,
+        supplierId: row.id,
         page: 1,
         pageSize: 100
       }).then((res) => {
@@ -708,7 +727,7 @@
       this.$set(this.editConfig.infomation, "supplierName", row.name)
       this.editConfig.infomation.contact = row.contact
       this.editConfig.infomation.phone = row.phone
-      this.editConfig.infomation.supplierId = row.ID
+      this.editConfig.infomation.supplierId = row.id
     },
     // 娓呴櫎宸查�夋嫨鐢ㄦ埛
     clearupClient(value) {
@@ -719,11 +738,11 @@
       }
     },
     setTableForm() {
-      if (!this.editConfig.infomation.ID || this.editConfig.infomation.productList.length === 0) {
+      if (!this.editConfig.infomation.id || this.editConfig.infomation.productList.length === 0) {
         this.tableData = [
           {
             purchaseId: 0,
-            productId: this.productId,
+            productId:Number(this.productId),
             productIndex: this.productIndex,
             amount: 0,
             name: "",
@@ -860,7 +879,7 @@
     },
     //閫変腑浜у搧
     handleProduct(item) {
-      this.tableData[this.productListIdx].productId = item.ID
+      this.tableData[this.productListIdx].productId = Number(item.id)
       console.log(item, "閫変腑浜у搧", this.tableData)
     }
   }

--
Gitblit v1.8.0