From e2d502394c15a444e3f72a391a14daed5c78abae Mon Sep 17 00:00:00 2001 From: yangzifeng <2547435354@qq.com> Date: Thu, 12 Feb 2026 15:22:50 +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 | 87 +++++++++++++++++++++++++++++++- src/views/wisdom/stock/index.vue | 8 ++- 2 files changed, 93 insertions(+), 2 deletions(-) diff --git a/src/views/wisdom/bill/index.vue b/src/views/wisdom/bill/index.vue index f04b33c..5861495 100644 --- a/src/views/wisdom/bill/index.vue +++ b/src/views/wisdom/bill/index.vue @@ -307,6 +307,20 @@ 添加 +
+
+
+ + 添加至入库 +
+
[已添加{{ outTempData.length }}条库存]
+ +
+
+ + 删除 +
+
@@ -666,7 +680,7 @@ const printNumList = ref([ { id: 3, statusName: "3" }, { id: 4, statusName: "4" }, ]); -const printNum = ref(0); //打印机编号 +const printNum = ref(1); //打印机编号 const moveReason = ref(""); //移库原因 const operationTime = ref([]); const actionUrl = @@ -860,6 +874,7 @@ function handleAdd(single) { isSingle.value = single; reset(); open.value = true; + outTempData.value = [] title.value = "添加库存单据"; } @@ -880,6 +895,56 @@ const statusList = ref([ { value: 2, label: "部分入库" }, ]); const checkPlanList = ref([]); //已选中的要入库的数据 + +// 点击添加至出库 +const outTempData = ref([]); +function addData() { + if (checkPlanList.value.length == 0) { + proxy.$modal.msgError("请勾选数据"); + return; + } + let data = outTempData.value.concat(checkPlanList.value); + let arr = [] + let spaNoTotal = '' + const idList = []; // 用于统计每个id出现的次数 + // 第一步:遍历数组,统计id出现次数 + 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); + } + outTempData.value = arr +} + +// 查看所有的出库数据 +const viewData = () => { + planList.value = JSON.parse(JSON.stringify(outTempData.value)); +} + +// 删除选中的出库数据 +const deleteData = () => { + if (checkPlanList.value.length == 0) { + proxy.$modal.msgError("请勾选数据"); + return; + } + proxy.$modal.confirm("确认删除选中的出库数据吗?").then(() => { + const ids = checkPlanList.value.map(item => item.id); + console.log(ids) + planList.value = planList.value.filter(item => { + // 无id的元素默认保留(如果想删除无id的,可改为 item?.id && !arr2Ids.has(item.id)) + return !ids.includes(item?.id); + }); + outTempData.value = planList.value + }); +} + + //新增入库 多选框选中数据 function handleSelectionChange(selection) { checkPlanList.value = selection; @@ -972,6 +1037,10 @@ function addNum(row) { /** 确定入库按钮 */ function submitForm() { + if (outTempData.value.length !== planList.value.length) { + proxy.$modal.msgError("请查看勾选数据"); + return; + } proxy.$refs["stockRef"].validate((valid) => { if (valid) { if (checkPlanList.value.length == 0) { @@ -1790,4 +1859,20 @@ isAudit(); display: flex; justify-content: flex-end; } + + +.addBox{ + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 10px; + cursor: pointer; + .addData { + display: flex; + align-items: center; + color: var(--el-text-color-regular); + font-weight: bold; + } + +} diff --git a/src/views/wisdom/stock/index.vue b/src/views/wisdom/stock/index.vue index 49514ab..ae24fbb 100644 --- a/src/views/wisdom/stock/index.vue +++ b/src/views/wisdom/stock/index.vue @@ -65,11 +65,16 @@ - + + + + + + @@ -377,6 +382,7 @@ const data = reactive({ cangku: "", wlMs: "", ids: [], + remark: "", }, rules: { wlType: [{ required: true, message: "物资类型不能为空", trigger: "change" }],