From 3286b2af0a85f46644bc09cfb16171f4d399890d Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期五, 19 四月 2024 17:13:25 +0800 Subject: [PATCH] 跟换所有页面的接口前缀 --- src/views/purchaseManage/purchase/components/AddPurchase.vue | 100 +++++++++++++++++++++++++++++++++++++------------- 1 files changed, 74 insertions(+), 26 deletions(-) diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue index 10641ed..1985dc6 100644 --- a/src/views/purchaseManage/purchase/components/AddPurchase.vue +++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue @@ -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> @@ -228,14 +230,17 @@ <div class="basic-info-title" style="display: flex">浜у搧淇℃伅</div> <div class="product-view"> <CommonFormTableView + ref="tableRef" :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" @@ -368,7 +373,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, @@ -393,7 +398,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: { @@ -401,7 +409,7 @@ total: false, sumProp: ["price", "total"], multiply: ["amount", "price"], - titleProp: ["缂栧彿", "浜у搧鍚嶇О", "浜у搧缂栧彿", "璁¢噺鍗曚綅", "瑙勬牸鍨嬪彿", "閲囪喘鍗曚环", "鎻忚堪"], + titleProp: ["缂栧彿", "浜у搧鍚嶇О", "浜у搧缂栧彿", "璁¢噺鍗曚綅", "瑙勬牸", "鍨嬪彿", "閲囪喘鍗曚环", "鎻忚堪"], mergeNumber: 4, totalName: "灏忚" }, @@ -424,11 +432,20 @@ totalTwo: 0, productListIdx: 0, lacks: [], + pickerOptions: { + disabledDate(time) { + return time.getTime() < Date.now() - 8.64e7 + } + }, + pickerOptionsBefore: { + disabledDate(time) { + return time.getTime() > Date.now() + } + }, receiveWhouseList: [] // 鏀惰揣浠撳簱鍒楄〃 } }, created() { - console.log(this.editConfig, "鍙傛暟") this.handleGetBomKindDictList() this.getWarehouseInfo() this.$store.dispatch("getSupplier") @@ -503,9 +520,6 @@ 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 @@ -616,6 +630,8 @@ if (res.code === 200) { this.$message.success("鍒涘缓鎴愬姛") this.$parent.getData() + } else { + this.$message.error(res.msg) } }) } @@ -739,6 +755,7 @@ }, // 閫夋嫨渚涘簲鍟� async handleSelectClient(value, item) { + this.$refs.tableRef.supplierId=item.id this.productTableList.supplierId = item.id if (value === "client") { this.supplierId = item.id @@ -751,6 +768,7 @@ }).then((res) => { if (res.code === 200) { this.productTableList.tableProductList = res.data.list + this.$refs.tableRef.productList=res.data.list console.log(this.productTableList.tableProductList, "pop") } }) @@ -759,12 +777,14 @@ this.editSelectSupplierConfig.editVisible = true }, async selClient(row) { + this.$refs.tableRef.supplierId=row.id await getProductList({ supplierId: row.id, page: 1, pageSize: 100 }).then((res) => { if (res.code === 200) { + this.$refs.tableRef.productList=res.data.list this.productTableList.tableProductList = res.data.list } }) @@ -774,11 +794,22 @@ this.editConfig.infomation.supplierId = row.id }, // 娓呴櫎宸查�夋嫨鐢ㄦ埛 - clearupClient(value) { + async clearupClient(value) { if (value == "client") { + this.$refs.tableRef.supplierId=null this.$set(this.editConfig.infomation, "supplierName", "") this.supplierId = null this.$forceUpdate() + await getProductList({ + page: 1, + pageSize: 100 + }).then((res) => { + if (res.code === 200) { + this.productTableList.tableProductList = res.data.list + this.$refs.tableRef.productList=res.data.list + console.log(this.productTableList.tableProductList, "pop") + } + }) } }, setTableForm() { @@ -788,7 +819,7 @@ purchaseId: 0, productId: Number(this.productId), productIndex: this.productIndex, - amount: 0, + amount: 1, name: "", number: "", price: 0, @@ -813,6 +844,7 @@ supplierId: undefined, tableData: this.tableData, disabled: this.editConfig.isDisabled, + isReturn: true, tableColumn: [ { label: "浜у搧鍚嶇О", @@ -824,11 +856,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 @@ -841,12 +874,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 +911,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