From 16e7e2adfe501accdb1ae72205d6ff5d64b3869d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B8=85?= Date: Mon, 24 Nov 2025 18:31:46 +0800 Subject: [PATCH] =?UTF-8?q?1.BUG=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/business/materialPutaway/index.vue | 46 ++++++++++++++----- .../views/business/materialReturns/index.vue | 4 +- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/maintain-ui/src/views/business/materialPutaway/index.vue b/maintain-ui/src/views/business/materialPutaway/index.vue index 4df03f1..dfde300 100644 --- a/maintain-ui/src/views/business/materialPutaway/index.vue +++ b/maintain-ui/src/views/business/materialPutaway/index.vue @@ -326,7 +326,7 @@ - + @@ -555,6 +555,7 @@ export default { this.selectedMaterialMap.clear() this.form.putawayInfoList.forEach(item => { const materialId = item.materialId || item.id + console.log('item' , item) if (materialId) { this.selectedMaterialMap.set(materialId, item) } @@ -580,12 +581,28 @@ export default { /** 恢复物料选择状态 */ restoreMaterialSelection() { - if (this.$refs.selectionTable) { + if (!this.$refs.selectionTable || !this.materialList.length) return; + + // 先清空所有选择 + this.$refs.selectionTable.clearSelection(); + + // 获取所有需要选择的物料ID + const selectedIds = new Set(); + this.form.putawayInfoList.forEach(item => { + const materialId = item.materialId || item.id; + if (materialId) { + selectedIds.add(materialId); + } + }); + + // 批量设置选择状态 + this.$nextTick(() => { this.materialList.forEach(row => { - const isSelected = this.selectedMaterialMap.has(row.id); - this.$refs.selectionTable.toggleRowSelection(row, isSelected); + if (selectedIds.has(row.id)) { + this.$refs.selectionTable.toggleRowSelection(row, true); + } }); - } + }); }, // 多选框选中数据 @@ -594,8 +611,12 @@ export default { // 更新已选数据的Map const currentPageIds = new Set(this.materialList.map(row => row.id)); // 移除当前页中取消选择的行 + console.log('currentPageIds--------->',currentPageIds); + console.log('this.selectedMaterialMap--------->',this.selectedMaterialMap); + console.log('selection--------->',selection); for (let id of this.selectedMaterialMap.keys()) { if (currentPageIds.has(id) && !selection.some(row => row.id === id)) { + console.log('delete-------->', id) this.selectedMaterialMap.delete(id); } } @@ -607,9 +628,9 @@ export default { // 保留入库数量、单价等编辑过的数据 this.selectedMaterialMap.set(row.id, { ...row, - putawayNumber: existingItem.putawayNumber || 0, - putawayPrice: existingItem.putawayPrice || 0, - putawayMoney: existingItem.putawayMoney || 0, + putawayNumber: existingItem.putawayNumber || 0.01, + putawayPrice: existingItem.putawayPrice || 0.01, + putawayMoney: existingItem.putawayMoney || 0.01, vendorId: existingItem.vendorId, vendorName: existingItem.vendorName }); @@ -618,9 +639,9 @@ export default { this.selectedMaterialMap.set(row.id, { ...row, materialId: row.id, - putawayNumber: 0, - putawayPrice: 0, - putawayMoney: 0, + putawayNumber: 0.01, + putawayPrice: 0.01, + putawayMoney: 0.01, vendorId: row.vendorId, vendorName: row.vendorName }); @@ -727,6 +748,9 @@ export default { this.title = "添加物料入库"; this.getWarehouseList() this.getVendorList() + console.log('this.selectedMaterialMap', this.selectedMaterialMap) + console.log('this.form.putawayInfoList', this.form.putawayInfoList) + console.log('this.this.tempSelection', this.tempSelection) }, /** 详情按钮操作 */ handleDetail(row) { diff --git a/maintain-ui/src/views/business/materialReturns/index.vue b/maintain-ui/src/views/business/materialReturns/index.vue index 8022aaf..93d43c5 100644 --- a/maintain-ui/src/views/business/materialReturns/index.vue +++ b/maintain-ui/src/views/business/materialReturns/index.vue @@ -513,12 +513,12 @@ export default { this.form.returnsInfoBoList = this.materialList let isTrue = false; this.form.returnsInfoBoList.forEach(item => { - if (item.returnsNumber < 0.1) { + if (item.returnsNumber < 0.01) { isTrue = true; } }) if (isTrue) { - this.$modal.msgError('退货数量不能小于0.1') + this.$modal.msgError('退货数量不能小于0.01') this.buttonLoading = false; return } -- 2.22.0