优化添加至出库

This commit is contained in:
2026-02-05 17:04:00 +08:00
parent a667d99734
commit 5cc33e4ef6

View File

@@ -731,8 +731,8 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="outTotal > 0" :total="outTotal" v-model:page="outQueryParams.pageNum" <!-- <pagination v-show="outTotal > 0" :total="outTotal" v-model:page="outQueryParams.pageNum"
v-model:limit="outQueryParams.pageSize" @pagination="searchPlan" /> v-model:limit="outQueryParams.pageSize" @pagination="searchPlan" /> -->
<!-- 审批模块 暂时注释--> <!-- 审批模块 暂时注释-->
<div class="examine" v-show="isExamine == 1"> <div class="examine" v-show="isExamine == 1">
<el-row :gutter="20"> <el-row :gutter="20">
@@ -1151,7 +1151,7 @@ const outQueryParams = ref({
cangku: "", cangku: "",
gysMc: "", gysMc: "",
pageNum: 1, pageNum: 1,
pageSize: 50, pageSize: 200,
remark: "", remark: "",
}); });
const outTotal = ref(0); const outTotal = ref(0);
@@ -1204,11 +1204,22 @@ function addOutBoundData() {
return; return;
} }
let data = outBoundData.value.concat(checkOutList.value); let data = outBoundData.value.concat(checkOutList.value);
const map = new Map(); let arr = []
// 遍历数组Map的键为id值值为数组元素自动覆盖重复键 let spaNoTotal = ''
data.forEach(item => map.set(item.id, item)); const idList = []; // 用于统计每个id出现的次数
// 把Map的值转为数组保留最后一次出现的重复项 // 第一步遍历数组统计id出现次数
outBoundData.value = Array.from(map.values()); data.forEach(item => {
if (idList.includes(item.id)) {
spaNoTotal += item.sapNo + ','
} else {
arr.push(item)
idList.push(item.id);
}
});
if (spaNoTotal) {
proxy.$modal.msgError("存在重复数据" + spaNoTotal);
}
outBoundData.value = arr
} }
// 查看所有的出库数据 // 查看所有的出库数据