Commit 16e7e2ad authored by 刘帅's avatar 刘帅

1.BUG修复

parent 93e86700
...@@ -326,7 +326,7 @@ ...@@ -326,7 +326,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" row-key="id" @selection-change="handleMaterialSelectionChange"> <el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" row-key="id" @selection-change="handleMaterialSelectionChange">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true" /> <el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />--> <!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />--> <!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" width="120px" show-overflow-tooltip /> <el-table-column label="供应商" align="center" prop="vendorName" width="120px" show-overflow-tooltip />
...@@ -555,6 +555,7 @@ export default { ...@@ -555,6 +555,7 @@ export default {
this.selectedMaterialMap.clear() this.selectedMaterialMap.clear()
this.form.putawayInfoList.forEach(item => { this.form.putawayInfoList.forEach(item => {
const materialId = item.materialId || item.id const materialId = item.materialId || item.id
console.log('item' , item)
if (materialId) { if (materialId) {
this.selectedMaterialMap.set(materialId, item) this.selectedMaterialMap.set(materialId, item)
} }
...@@ -580,12 +581,28 @@ export default { ...@@ -580,12 +581,28 @@ export default {
/** 恢复物料选择状态 */ /** 恢复物料选择状态 */
restoreMaterialSelection() { 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 => { this.materialList.forEach(row => {
const isSelected = this.selectedMaterialMap.has(row.id); if (selectedIds.has(row.id)) {
this.$refs.selectionTable.toggleRowSelection(row, isSelected); this.$refs.selectionTable.toggleRowSelection(row, true);
}
}); });
} });
}, },
// 多选框选中数据 // 多选框选中数据
...@@ -594,8 +611,12 @@ export default { ...@@ -594,8 +611,12 @@ export default {
// 更新已选数据的Map // 更新已选数据的Map
const currentPageIds = new Set(this.materialList.map(row => row.id)); 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()) { for (let id of this.selectedMaterialMap.keys()) {
if (currentPageIds.has(id) && !selection.some(row => row.id === id)) { if (currentPageIds.has(id) && !selection.some(row => row.id === id)) {
console.log('delete-------->', id)
this.selectedMaterialMap.delete(id); this.selectedMaterialMap.delete(id);
} }
} }
...@@ -607,9 +628,9 @@ export default { ...@@ -607,9 +628,9 @@ export default {
// 保留入库数量、单价等编辑过的数据 // 保留入库数量、单价等编辑过的数据
this.selectedMaterialMap.set(row.id, { this.selectedMaterialMap.set(row.id, {
...row, ...row,
putawayNumber: existingItem.putawayNumber || 0, putawayNumber: existingItem.putawayNumber || 0.01,
putawayPrice: existingItem.putawayPrice || 0, putawayPrice: existingItem.putawayPrice || 0.01,
putawayMoney: existingItem.putawayMoney || 0, putawayMoney: existingItem.putawayMoney || 0.01,
vendorId: existingItem.vendorId, vendorId: existingItem.vendorId,
vendorName: existingItem.vendorName vendorName: existingItem.vendorName
}); });
...@@ -618,9 +639,9 @@ export default { ...@@ -618,9 +639,9 @@ export default {
this.selectedMaterialMap.set(row.id, { this.selectedMaterialMap.set(row.id, {
...row, ...row,
materialId: row.id, materialId: row.id,
putawayNumber: 0, putawayNumber: 0.01,
putawayPrice: 0, putawayPrice: 0.01,
putawayMoney: 0, putawayMoney: 0.01,
vendorId: row.vendorId, vendorId: row.vendorId,
vendorName: row.vendorName vendorName: row.vendorName
}); });
...@@ -727,6 +748,9 @@ export default { ...@@ -727,6 +748,9 @@ export default {
this.title = "添加物料入库"; this.title = "添加物料入库";
this.getWarehouseList() this.getWarehouseList()
this.getVendorList() 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) { handleDetail(row) {
......
...@@ -513,12 +513,12 @@ export default { ...@@ -513,12 +513,12 @@ export default {
this.form.returnsInfoBoList = this.materialList this.form.returnsInfoBoList = this.materialList
let isTrue = false; let isTrue = false;
this.form.returnsInfoBoList.forEach(item => { this.form.returnsInfoBoList.forEach(item => {
if (item.returnsNumber < 0.1) { if (item.returnsNumber < 0.01) {
isTrue = true; isTrue = true;
} }
}) })
if (isTrue) { if (isTrue) {
this.$modal.msgError('退货数量不能小于0.1') this.$modal.msgError('退货数量不能小于0.01')
this.buttonLoading = false; this.buttonLoading = false;
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment