From a491fd75c3a03013b9877a937c44a926b0b02ae4 Mon Sep 17 00:00:00 2001 From: yangzifeng <2547435354@qq.com> Date: Fri, 6 Mar 2026 16:53:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wisdom/bill/index.vue | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/views/wisdom/bill/index.vue b/src/views/wisdom/bill/index.vue index 71392c4..80d8b5c 100644 --- a/src/views/wisdom/bill/index.vue +++ b/src/views/wisdom/bill/index.vue @@ -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 = "修改库存单据"; } // 取消按钮