From 4f0d7ad64c1da7b2ecf055ba13409cbc537f2be7 Mon Sep 17 00:00:00 2001 From: x_z Date: Mon, 28 Nov 2022 18:14:05 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=AE=8C=E6=88=90=E6=96=B0=E5=A2=9E=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E5=85=BB=E6=8A=A4=E8=AE=B0=E5=BD=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/inventory/InvProducts.js | 13 +- src/views/inventory/addInvMAOrder.vue | 201 ++++++++++++++++---------- src/views/inventory/invMAOrderNew.vue | 2 + 3 files changed, 141 insertions(+), 75 deletions(-) diff --git a/src/api/inventory/InvProducts.js b/src/api/inventory/InvProducts.js index f946570..52955ac 100644 --- a/src/api/inventory/InvProducts.js +++ b/src/api/inventory/InvProducts.js @@ -53,8 +53,17 @@ export function checkCodeSpace(data) { export function getCountInvProductProduct(params) { return axios({ - url: "spms/inv/products/getCountInvProductProduct", + url: "spms/inv/products/getCountInvProduct", method: "get", params: params - }) + }); +} + +export function getMAInvProducts(params) { + return axios({ + url: "spms/inv/products/getMAInvProducts", + method: "get", + params: params + }); } + diff --git a/src/views/inventory/addInvMAOrder.vue b/src/views/inventory/addInvMAOrder.vue index 155fa22..e86cfa6 100644 --- a/src/views/inventory/addInvMAOrder.vue +++ b/src/views/inventory/addInvMAOrder.vue @@ -47,7 +47,7 @@ - @@ -70,7 +70,7 @@ - - + - + @@ -291,6 +282,7 @@ import { deleteDetail, getMAOrderDetailList } from "@/api/inventory/invMAOrder"; +import {getMAInvProducts} from "@/api/inventory/InvProducts"; import {isBlank} from "@/utils/strUtil"; export default { @@ -311,11 +303,13 @@ export default { nameCode: null, cpmctymc: null, batchNo: null, + invWarehouseCode: null, + invSpaceCode: null, page: 1, limit: 10 }, productList: [], - productTotal: null, + productTotal: 0, warehouseList: [], spaceList: [], formData: { @@ -323,13 +317,15 @@ export default { createTime: null, invWarehouseCode: null, invSpaceCode: null, + status: 0, code: null, }, detailList: [], loading: false, scanText: "扫码录入:", currentIndex: -1, - selectInvProductVisible: false + selectInvProductVisible: false, + multiProduct: [] } }, methods: { @@ -353,10 +349,14 @@ export default { }); }, selectInvProduct() { - if (isBlank(this.formData.orderId)) { - this.saveOrder(); + if (isBlank(this.formData.invWarehouseCode)) { + this.$message.error("请选择养护仓库"); + return; } - + //保存或更新养护记录仓库信息 + this.saveOrder(); + this.onReset(); + this.selectInvProductVisible = true; }, saveMAOrder() { this.saveOrder(); @@ -370,9 +370,8 @@ export default { if (!isBlank(this.formData.orderId)) { //更新单据 updateOrder(this.formData).then((res) => { - if (res.code === 20000) { - this.$message.success("更新成功!"); - } + }).catch((error) => { + this.$message.error("更新单据信息失败!"); }) } else { addOrder(this.formData).then((res) => { @@ -478,17 +477,73 @@ export default { this.currentIndex = index; }, onReset() { - this.filterQuery = {}; + this.filterQuery = { + nameCode: null, + cpmctymc: null, + batchNo: null, + invWarehouseCode: null, + invSpaceCode: null, + page: 1, + limit: 10 + }; + this.multiProduct = []; + this.queryInvProducts(); }, handleCurrentChange(val) { - this.filterQuery.page = 1; + this.filterQuery.page = val; this.queryInvProducts(); }, queryInvProducts() { - + this.filterQuery.invWarehouseCode = this.formData.invWarehouseCode; + this.filterQuery.invSpaceCode = this.formData.invSpaceCode; + getMAInvProducts(this.filterQuery).then((res) => { + if (res.code === 20000) { + this.productList = res.data.list || []; + this.productTotal = res.data.total || 0; + } else { + this.$message.error(res.message); + this.productList = []; + this.productTotal = 0; + } + }).catch((error) => { + this.$message.error(error.message); + this.productList = []; + this.productTotal = 0; + }); }, combine() { - + if (this.multiProduct.length === 0) { + this.$message.error("请选择养护产品!"); + return; + } + let invProductIds = []; + this.multiProduct.forEach(item => { + invProductIds.push(item.id); + }); + let params = { + orderIdFk: this.formData.orderId, + invProductIds: invProductIds + }; + batchAddDetail(params).then((res) => { + if (res.code === 20000) { + this.$message.success("录入成功!"); + this.selectInvProductVisible = false; + this.getList(); + } else { + this.$message.error(res.message); + } + }).catch((error) => { + this.$message.error(error.message); + }) + }, + getRowKeys(row) { + return row.id; + }, + handleSelectionChange(selectedRows) { + this.multiProduct = []; + selectedRows.forEach(item => { + this.multiProduct.push(item); + }); }, }, created() { diff --git a/src/views/inventory/invMAOrderNew.vue b/src/views/inventory/invMAOrderNew.vue index 4444c26..f9b4ebc 100644 --- a/src/views/inventory/invMAOrderNew.vue +++ b/src/views/inventory/invMAOrderNew.vue @@ -223,10 +223,12 @@ export default { }, addMAOrder() { this.maOrder = null; + this.formName = 'add'; this.formVisible = true; }, editOrder(row) { this.maOrder = row; + this.formName = 'edit'; this.formVisible = true; }, submitAudit(row) {