优化
This commit is contained in:
@@ -954,9 +954,24 @@ function addData() {
|
||||
outTempData.value = data
|
||||
}
|
||||
|
||||
const generateSimpleUniqueStr = () => {
|
||||
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
|
||||
// 兼容旧版浏览器/Node.js(crypto API 降级)
|
||||
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
|
||||
(c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16)
|
||||
);
|
||||
}
|
||||
|
||||
// 查看所有的出库数据
|
||||
const viewData = () => {
|
||||
planList.value = JSON.parse(JSON.stringify(outTempData.value));
|
||||
let arr = JSON.parse(JSON.stringify(outTempData.value));
|
||||
planList.value = arr.map(item => ({
|
||||
...item,
|
||||
uniqueId: generateSimpleUniqueStr() // 新增随机唯一值
|
||||
}));
|
||||
}
|
||||
|
||||
// 删除选中的出库数据
|
||||
@@ -966,11 +981,11 @@ const deleteData = () => {
|
||||
return;
|
||||
}
|
||||
proxy.$modal.confirm("确认删除选中的出库数据吗?").then(() => {
|
||||
const ids = checkPlanList.value.map(item => item.id);
|
||||
console.log(ids)
|
||||
const uniqueIds = checkPlanList.value.map(item => item.uniqueId);
|
||||
console.log(uniqueIds)
|
||||
planList.value = planList.value.filter(item => {
|
||||
// 无id的元素默认保留(如果想删除无id的,可改为 item?.id && !arr2Ids.has(item.id))
|
||||
return !ids.includes(item?.id);
|
||||
return !uniqueIds.includes(item?.uniqueId);
|
||||
});
|
||||
outTempData.value = planList.value
|
||||
});
|
||||
@@ -978,7 +993,7 @@ const deleteData = () => {
|
||||
|
||||
|
||||
//新增入库 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
function handleSelectionChange(selection, $event) {
|
||||
checkPlanList.value = selection;
|
||||
}
|
||||
|
||||
@@ -1416,6 +1431,7 @@ function handleUpdate(row) {
|
||||
];
|
||||
pcodeList(storeData.value.warehouseCode);
|
||||
open.value = true;
|
||||
outTempData.value = []
|
||||
title.value = "修改库存单据";
|
||||
}
|
||||
// 取消按钮
|
||||
|
||||
Reference in New Issue
Block a user