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 | 143 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 117 insertions(+), 26 deletions(-) diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue index f782552..34a32d7 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 @@ -162,6 +162,54 @@ </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"> <el-form-item label="澶囨敞淇℃伅" prop="remark"> <el-input @@ -183,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" @@ -287,7 +337,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" @@ -339,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: { @@ -369,11 +426,14 @@ total: 0, totalTwo: 0, productListIdx: 0, - lacks: [] + lacks: [], + receiveWhouseList: [] // 鏀惰揣浠撳簱鍒楄〃 } }, created() { + console.log(this.editConfig, "鍙傛暟") this.handleGetBomKindDictList() + this.getWarehouseInfo() this.$store.dispatch("getSupplier") this.formInfo() }, @@ -446,13 +506,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 } } @@ -557,6 +619,8 @@ if (res.code === 200) { this.$message.success("鍒涘缓鎴愬姛") this.$parent.getData() + } else { + this.$message.error(res.msg) } }) } @@ -648,7 +712,11 @@ 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) { @@ -723,9 +791,9 @@ this.tableData = [ { purchaseId: 0, - productId:Number(this.productId), + productId: Number(this.productId), productIndex: this.productIndex, - amount: 0, + amount: 1, name: "", number: "", price: 0, @@ -750,6 +818,7 @@ supplierId: undefined, tableData: this.tableData, disabled: this.editConfig.isDisabled, + isReturn: true, tableColumn: [ { label: "浜у搧鍚嶇О", @@ -765,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 @@ -778,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 } }) @@ -817,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 }, // 浜у搧娓呯┖ @@ -862,6 +946,13 @@ handleProduct(item) { 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