diff --git a/maintain-ui/src/views/business/materialPutaway/index.vue b/maintain-ui/src/views/business/materialPutaway/index.vue index 4df03f18090486509c0a636e569bf681af5df24d..dfde30037f5a183e3709b155355a25e03bed1b10 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 8022aafe09bcd4343ce1ddbee48ec9823abd7cd0..93d43c5ba77d9045fd20a6bcbf1d838c932139ba 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 }