From 9cbe9de3839675c9b28f61a1a452c1ccec7a0169 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Thu, 30 Jul 2026 09:49:06 +0800 Subject: [PATCH] =?UTF-8?q?2026-07-30=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/boxManage/saleBoxManage.vue | 188 +++++++++++++++--- src/views/modules/qc/inboundNotification.vue | 6 +- 2 files changed, 163 insertions(+), 31 deletions(-) diff --git a/src/views/modules/boxManage/saleBoxManage.vue b/src/views/modules/boxManage/saleBoxManage.vue index a79ab49..e34268a 100644 --- a/src/views/modules/boxManage/saleBoxManage.vue +++ b/src/views/modules/boxManage/saleBoxManage.vue @@ -348,7 +348,7 @@ - + @@ -373,19 +373,22 @@ +
+ + +
打印 - 应用 - 保存 - 关闭 + 应用 + 保存 + 关闭
@@ -495,8 +509,10 @@ export default { searchExpanded: true, currentRow: {}, selectedCaseRolls: [], // 装盒对话框中选中的卷标签 + selectedCaseRollMap: {}, // 装盒对话框中跨页选中的卷标签 printLoading: false, // 打印loading printCasesLoading: false, // 扫描装盒页签打印loading + caseSaving: false, // 装盒保存中 searchData:{ orderNo:'', customerId:'', @@ -540,12 +556,16 @@ export default { partNo: '' }, caseRollList: [], + caseRollKeyMap: {}, caseStatistics: { casesCount: 0, rollCount: 0, totalQty: 0 }, selectedCaseRecords: [], + caseDialogPageIndex: 1, + caseDialogPageSize: 100, + caseDialogPageSizes: [50, 100, 200], // 扫描装盒分页 casesPageIndex: 1, casesPageSize: 50, @@ -903,6 +923,14 @@ export default { pallet }, + computed: { + caseRollPageData(){ + const start = (this.caseDialogPageIndex - 1) * this.caseDialogPageSize + const end = start + this.caseDialogPageSize + return this.caseRollList.slice(start, end) + } + }, + mounted() { this.$nextTick(() => { this.calculateTableHeight(); @@ -929,6 +957,51 @@ export default { this.calculateTableHeight(); }, + buildCaseRollKey(site, rollNo){ + return `${site || ''}|${rollNo || ''}` + }, + + getCaseRollTableRowKey(row){ + return this.buildCaseRollKey(row.site, row.rollNo) + }, + + getCaseRollIndex(index){ + return (this.caseDialogPageIndex - 1) * this.caseDialogPageSize + index + 1 + }, + + rebuildSelectedCaseRolls(){ + this.selectedCaseRolls = Object.keys(this.selectedCaseRollMap).map(key => this.selectedCaseRollMap[key]).filter(item => !!item) + }, + + syncCaseRollPageSelection(){ + this.$nextTick(() => { + if (!this.$refs.caseRollTable || typeof this.$refs.caseRollTable.clearSelection !== 'function') { + return + } + this.$refs.caseRollTable.clearSelection() + if (typeof this.$refs.caseRollTable.toggleRowSelection !== 'function') { + return + } + this.caseRollPageData.forEach(row => { + const rowKey = this.buildCaseRollKey(row.site, row.rollNo) + if (this.selectedCaseRollMap[rowKey]) { + this.$refs.caseRollTable.toggleRowSelection(row, true) + } + }) + }) + }, + + handleCaseDialogSizeChange(val){ + this.caseDialogPageSize = val + this.caseDialogPageIndex = 1 + this.syncCaseRollPageSelection() + }, + + handleCaseDialogCurrentChange(val){ + this.caseDialogPageIndex = val + this.syncCaseRollPageSelection() + }, + getMainData(){ this.dataListLoading = true this.searchData.limit = this.pageSize @@ -1149,7 +1222,10 @@ export default { partNo: '' } this.caseRollList = [] + this.caseRollKeyMap = {} this.selectedCaseRolls = [] + this.selectedCaseRollMap = {} + this.caseDialogPageIndex = 1 this.updateCaseStatistics() }, @@ -1185,15 +1261,24 @@ export default { const newRolls = [] rollList.forEach(rollInfo => { - // 检查当前列表中是否已存在相同 site 和 rollNo 的记录 - const isDuplicate = this.caseRollList.some(item => - item.site === this.caseForm.site && item.rollNo === rollInfo.rollNo - ) + const rollKey = this.buildCaseRollKey(this.caseForm.site, rollInfo.rollNo) + const isDuplicate = !!this.caseRollKeyMap[rollKey] if (isDuplicate) { duplicateRolls.push(rollInfo.rollNo) } else { - newRolls.push(rollInfo) + newRolls.push({ + casesNo: this.caseForm.casesNo, + rollNo: rollInfo.rollNo, + packingList: rollInfo.packingList || '', + rollQty: rollInfo.rollQty, + partNo: rollInfo.partNo, + partDesc: rollInfo.partDesc, + batchNo: rollInfo.batchNo, + notifyNo: this.caseForm.notifyNo, + site: this.caseForm.site, + buNo: this.caseForm.buNo + }) } }) @@ -1204,20 +1289,16 @@ export default { // 只添加不重复的卷到列表最前面(后扫描的在上面) newRolls.forEach(rollInfo => { - this.caseRollList.unshift({ - casesNo: this.caseForm.casesNo, - rollNo: rollInfo.rollNo, - packingList: rollInfo.packingList || '', - rollQty: rollInfo.rollQty, - partNo: rollInfo.partNo, - partDesc: rollInfo.partDesc, - batchNo: rollInfo.batchNo, - notifyNo: this.caseForm.notifyNo, - site: this.caseForm.site, - buNo: this.caseForm.buNo - }) + this.caseRollList.unshift(rollInfo) + const rollKey = this.buildCaseRollKey(rollInfo.site, rollInfo.rollNo) + this.caseRollKeyMap[rollKey] = true }) + if (newRolls.length > 0) { + this.caseDialogPageIndex = 1 + this.syncCaseRollPageSelection() + } + // 更新统计信息 this.updateCaseStatistics() @@ -1266,13 +1347,29 @@ export default { cancelButtonText: '取消', type: 'warning' }).then(() => { - this.caseRollList.splice(index, 1) + const actualIndex = (this.caseDialogPageIndex - 1) * this.caseDialogPageSize + index + const deletedRow = this.caseRollList[actualIndex] + if (deletedRow) { + const rollKey = this.buildCaseRollKey(deletedRow.site, deletedRow.rollNo) + delete this.caseRollKeyMap[rollKey] + delete this.selectedCaseRollMap[rollKey] + this.caseRollList.splice(actualIndex, 1) + } + const maxPage = Math.max(1, Math.ceil(this.caseRollList.length / this.caseDialogPageSize)) + if (this.caseDialogPageIndex > maxPage) { + this.caseDialogPageIndex = maxPage + } + this.rebuildSelectedCaseRolls() + this.syncCaseRollPageSelection() this.updateCaseStatistics() this.$message.success('删除成功') }).catch(() => {}) }, async applyCaseScan(){ + if (this.caseSaving) { + return + } if(this.caseRollList.length === 0){ this.$message.warning('请先扫描卷标签') return @@ -1284,10 +1381,13 @@ export default { } // 应用:保存但不关闭对话框,重置输入框、计数和列表 - this.saveCaseData(false) + await this.saveCaseData(false) }, async saveCaseScan(){ + if (this.caseSaving) { + return + } if(this.caseRollList.length === 0){ this.$message.warning('请先扫描卷标签') return @@ -1299,7 +1399,7 @@ export default { } // 保存:保存后关闭对话框 - this.saveCaseData(true) + await this.saveCaseData(true) }, // 校验盒清单数量不能超过要求发货数量 @@ -1348,6 +1448,10 @@ export default { }, async saveCaseData(closeDialog){ + if (this.caseSaving) { + return + } + this.caseSaving = true try { const {data} = await saveCaseRollList(this.caseRollList) if(data && data.code === 0){ @@ -1360,7 +1464,9 @@ export default { // 应用:重置表单继续扫描 this.resetCaseForm() this.$nextTick(() => { - this.$refs.caseNoInput.focus() + if (this.$refs.rollNoInput) { + this.$refs.rollNoInput.focus() + } }) } @@ -1370,22 +1476,48 @@ export default { this.$message.error(data.msg || '保存失败') } } catch (error) { - this.$message.error(error.msg || '保存失败') + const errMsg = (error && error.response && error.response.data && error.response.data.msg) + || error.msg + || error.message + || '保存失败' + this.$message.error(errMsg) + } finally { + this.caseSaving = false } }, closeCaseDialog(){ + if (this.caseSaving) { + this.$message.warning('正在保存,请稍后') + return + } this.caseDialogVisible = false this.resetCaseForm() }, + handleCaseDialogBeforeClose(done){ + if (this.caseSaving) { + this.$message.warning('正在保存,请稍后') + return + } + done() + }, + handleCaseSelectionChange(selection){ this.selectedCaseRecords = selection }, // 装盒对话框中卷标签选择变化 handleCaseRollSelectionChange(selection){ - this.selectedCaseRolls = selection + const currentPageKeyList = this.caseRollPageData.map(item => this.buildCaseRollKey(item.site, item.rollNo)) + currentPageKeyList.forEach(key => { + delete this.selectedCaseRollMap[key] + }) + selection.forEach(item => { + const key = this.buildCaseRollKey(item.site, item.rollNo) + this.selectedCaseRollMap[key] = item + }) + this.rebuildSelectedCaseRolls() }, // 打印选中的卷标签 diff --git a/src/views/modules/qc/inboundNotification.vue b/src/views/modules/qc/inboundNotification.vue index ce75602..05c064f 100644 --- a/src/views/modules/qc/inboundNotification.vue +++ b/src/views/modules/qc/inboundNotification.vue @@ -1864,9 +1864,10 @@ this.pageSize2 = 20 this.totalPage2 = 0 if (this.currentRow.orderType === '生产入库') { - this.detailSearchData.status = '已开工' + this.detailSearchData.status = '' } - this.handleGetProjectPartList() + // 仅打开弹窗,不默认查询可选物料,等待用户手动点击“查询” + this.detailModal = true }, handleGetProjectPartList () { @@ -1878,7 +1879,6 @@ this.pageIndex2 = data.page.currPage this.pageSize2 = data.page.pageSize this.totalPage2 = data.page.totalCount - this.detailModal = true } }) },