From f4ed5ae8873f65c36b5cf37be264f6ec1e154647 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 20 三月 2024 19:36:58 +0800
Subject: [PATCH] 合并分支冲突解决

---
 src/views/purchaseManage/purchase/components/AddPurchase.vue |  178 ++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 140 insertions(+), 38 deletions(-)

diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index 541e76c..ed08a9b 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>
@@ -97,11 +97,11 @@
                   </div>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <!-- <el-col :span="12">
                 <el-form-item label="鍗曟嵁鏉ユ簮" prop="orderSource">
                   <el-input v-model="editConfig.infomation.orderSource" disabled placeholder="璇峰~鍐�"></el-input>
                 </el-form-item>
-              </el-col>
+              </el-col> -->
               <el-col :span="12">
                 <el-form-item label="閲囪喘鍗曞悕绉�" prop="name">
                   <el-input
@@ -144,6 +144,7 @@
                     clearable
                     placeholder="閫夋嫨鏃ユ湡"
                     value-format="yyyy-MM-dd"
+                    :picker-options="pickerOptionsBefore"
                   >
                   </el-date-picker>
                 </el-form-item>
@@ -158,8 +159,57 @@
                     clearable
                     placeholder="閫夋嫨鏃ユ湡"
                     value-format="yyyy-MM-dd"
+                    :picker-options="pickerOptions"
                   >
                   </el-date-picker>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="鏀惰揣浠撳簱" prop="warehouse">
+                  <el-select
+                    placeholder="璇烽�夋嫨鏀惰揣浠撳簱"
+                    v-model="editConfig.infomation.warehouse"
+                    clearable
+                    style="width: calc(100% - 0px)"
+                    :disabled="editConfig.isDisabled"
+                  >
+                    <el-option
+                      v-for="(ele, index) in receiveWhouseList"
+                      :key="index"
+                      :label="ele.name"
+                      :value="ele.name"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="鍦板潃" prop="warehouseAddress">
+                  <el-input
+                    :disabled="editConfig.isDisabled"
+                    v-model="editConfig.infomation.warehouseAddress"
+                    placeholder="璇峰~鍐�"
+                    clearable
+                  ></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="鎺ユ敹浜�" prop="principal">
+                  <el-input
+                    :disabled="editConfig.isDisabled"
+                    v-model="editConfig.infomation.principal"
+                    placeholder="璇峰~鍐�"
+                    clearable
+                  ></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="鏉ユ簮鍗曟嵁" prop="sourceOrder">
+                  <el-input
+                    :disabled="editConfig.isDisabled"
+                    v-model="editConfig.infomation.sourceOrder"
+                    placeholder="璇峰~鍐�"
+                    clearable
+                  ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="24">
@@ -183,11 +233,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"
@@ -287,7 +339,13 @@
 import CommonFormTableView from "@/components/makepager/CommonFormTableView"
 import BomDialog from "@/components/makepager/BomDialog"
 import { getProductList } from "@/api/productManage/product"
-import { addPurchase, updatePurchase, savePurchaseType, getPurchaseType } from "@/api/purchaseManage/purchase"
+import {
+  addPurchase,
+  updatePurchase,
+  savePurchaseType,
+  getPurchaseType,
+  getWarehouseInfo
+} from "@/api/purchaseManage/purchase"
 import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog"
 // import { formToJSON } from "axios";
 import codeMixin from "@/components/mixin/codeMixin"
@@ -314,7 +372,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,
@@ -339,7 +397,10 @@
           },
           { 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" }],
+        signingDate: [{ required: true, message: "璇烽�夋嫨绛剧害鏃ユ湡", trigger: "change" }],
+        deliveryDate: [{ required: true, message: "璇烽�夋嫨浜や粯鏃ユ湡", trigger: "change" }],
       },
       productTableList: {},
       showSummary: {
@@ -347,7 +408,7 @@
         total: false,
         sumProp: ["price", "total"],
         multiply: ["amount", "price"],
-        titleProp: ["缂栧彿", "浜у搧鍚嶇О", "浜у搧缂栧彿", "璁¢噺鍗曚綅", "瑙勬牸鍨嬪彿", "閲囪喘鍗曚环", "鎻忚堪"],
+        titleProp: ["缂栧彿", "浜у搧鍚嶇О", "浜у搧缂栧彿", "璁¢噺鍗曚綅", "瑙勬牸", "鍨嬪彿", "閲囪喘鍗曚环", "鎻忚堪"],
         mergeNumber: 4,
         totalName: "灏忚"
       },
@@ -369,11 +430,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()
+        }
+      },
+      receiveWhouseList: [] // 鏀惰揣浠撳簱鍒楄〃
     }
   },
   created() {
     this.handleGetBomKindDictList()
+    this.getWarehouseInfo()
     this.$store.dispatch("getSupplier")
     this.formInfo()
   },
@@ -452,7 +525,6 @@
                 ? this.editConfig.infomation.purchaseTypeId
                 : this.plcBrandList[i].id
               this.$set(this.editConfig.infomation, "purchaseTypeId", this.editConfig.infomation.purchaseTypeId)
-
               break
             }
           }
@@ -557,6 +629,8 @@
                   if (res.code === 200) {
                     this.$message.success("鍒涘缓鎴愬姛")
                     this.$parent.getData()
+                  } else {
+                    this.$message.error(res.msg)
                   }
                 })
               }
@@ -648,11 +722,15 @@
           realTotalPrice: this.total ? Number(this.total) : 0,
           totalPrice: this.totalTwo ? Number(this.totalTwo) : 0,
           status: data.status,
-          quantity: data.quantity // 閲囪喘鏁伴噺
+          quantity: data.quantity, // 閲囪喘鏁伴噺
+          warehouse: data.warehouse || "", // 鏀惰揣浠撳簱
+          warehouseAddress: data.warehouseAddress || "", // 鏀惰揣浠撳簱鍦板潃
+          principal: data.principal || "", // 浠撳簱璐熻矗浜�
+          sourceOrder: data.sourceOrder || "" //  鏉ユ簮鍗曟嵁
         }
       }
-      if (data.ID) {
-        params.purchase.id = data.ID
+      if (data.id) {
+        params.purchase.id = data.id
       }
       return params
     },
@@ -676,13 +754,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 +775,7 @@
     },
     async selClient(row) {
       await getProductList({
-        supplierId: row.ID,
+        supplierId: row.id,
         page: 1,
         pageSize: 100
       }).then((res) => {
@@ -708,7 +786,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,13 +797,13 @@
       }
     },
     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,
+            amount: 1,
             name: "",
             number: "",
             price: 0,
@@ -750,6 +828,7 @@
         supplierId: undefined,
         tableData: this.tableData,
         disabled: this.editConfig.isDisabled,
+        isReturn: true,
         tableColumn: [
           {
             label: "浜у搧鍚嶇О",
@@ -761,11 +840,12 @@
           },
           { 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: "閲囪喘鍗曚环",
-            prop: "price",
+            prop: "purchasePrice",
             inputFloat: true,
             isRequird: true,
             disabled: this.editConfig.isDisabled
@@ -778,12 +858,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
         }
       })
@@ -817,18 +895,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
     },
     //  浜у搧娓呯┖
@@ -860,8 +955,15 @@
     },
     //閫変腑浜у搧
     handleProduct(item) {
-      this.tableData[this.productListIdx].productId = item.ID
+      this.tableData[this.productListIdx].productId = Number(item.id)
       console.log(item, "閫変腑浜у搧", this.tableData)
+    },
+    // 鑾峰彇鏀惰揣浠撳簱鍒楄〃
+    async getWarehouseInfo() {
+      await getWarehouseInfo().then((res) => {
+        console.log(res)
+        this.receiveWhouseList = res.data.info
+      })
     }
   }
 }

--
Gitblit v1.8.0