From 38eea14f1f866ecd937fd4426bccdbf29795141c Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Mon, 6 Oct 2025 09:55:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=8E=A5=E6=94=B6=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/purchase/cancelReceipt.vue | 128 ++++++++++-------- src/views/modules/purchase/receiptRecords.vue | 19 +-- 2 files changed, 82 insertions(+), 65 deletions(-) diff --git a/src/views/modules/purchase/cancelReceipt.vue b/src/views/modules/purchase/cancelReceipt.vue index 1381bd1..66c4905 100644 --- a/src/views/modules/purchase/cancelReceipt.vue +++ b/src/views/modules/purchase/cancelReceipt.vue @@ -94,13 +94,13 @@ label="库位" width="100"> - - + --> @@ -180,14 +181,12 @@ - + 取 消 确 定 @@ -204,12 +203,12 @@ export default { favorite: false, dataList: [], pageIndex: 1, - pageSize: 10, + pageSize: 20, totalPage: 0, dataListLoading: false, dataListSelections: [], queryHeaderData: { - site: '', + site: localStorage.getItem('site'), receiptNo: '', partNo: '', batchNo: '', @@ -276,9 +275,19 @@ export default { }, // 取消单个接收记录 cancelSingleReceipt (row) { - this.currentCancelRecords = [row] - this.cancelForm.cancelReason = '' - this.cancelDialogVisible = true + // 显示确认提示 + this.$confirm(`确认要取消接收单号 ${row.receiptNo} 的记录吗?`, '确认取消', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.currentCancelRecords = [row] + this.cancelForm.cancelReason = ' ' + //this.cancelDialogVisible = true + this.confirmCancel() + }).catch(() => { + // 用户取消操作 + }) }, // 批量取消接收记录 cancelSelectedReceipts () { @@ -286,54 +295,61 @@ export default { this.$message.warning('请选择要取消的记录') return } - this.currentCancelRecords = this.dataListSelections - this.cancelForm.cancelReason = '' - this.cancelDialogVisible = true + + // 显示确认提示 + this.$confirm(`确认要取消选中的 ${this.dataListSelections.length} 条接收记录吗?`, '确认取消', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.currentCancelRecords = this.dataListSelections + this.cancelForm.cancelReason = ' ' + //this.cancelDialogVisible = true + this.confirmCancel() + }).catch(() => { + // 用户取消操作 + }) }, // 确认取消 confirmCancel () { - this.$refs.cancelForm.validate((valid) => { - if (valid) { - this.cancelLoading = true - const promises = this.currentCancelRecords.map(record => { - return cancelReceipt({ - receiptNo: record.receiptNo, - site: record.site, - itemNo: record.itemNo, - cancelReason: this.cancelForm.cancelReason - }) - }) + this.cancelLoading = true + const promises = this.currentCancelRecords.map(record => { + return cancelReceipt({ + receiptNo: record.receiptNo, + site: record.site, + itemNo: record.itemNo, + cancelReason: this.cancelForm.cancelReason + }) + }) - Promise.all(promises).then(results => { - let successCount = 0 - let errorMessages = [] + Promise.all(promises).then(results => { + let successCount = 0 + let errorMessages = [] - results.forEach((result, index) => { - if (result.data && result.data.code === 0) { - successCount++ - } else { - const record = this.currentCancelRecords[index] - errorMessages.push(`${record.receiptNo}: ${result.data.msg || '取消失败'}`) - } - }) + results.forEach((result, index) => { + if (result.data && result.data.code === 0) { + successCount++ + } else { + const record = this.currentCancelRecords[index] + errorMessages.push(`${record.receiptNo}: ${result.data.msg || '取消失败'}`) + } + }) - if (successCount > 0) { - this.$message.success(`成功取消 ${successCount} 条记录`) - this.getDataList() - } + if (successCount > 0) { + this.$message.success(`成功取消 ${successCount} 条记录`) + this.getDataList() + } - if (errorMessages.length > 0) { - this.$message.error(`部分记录取消失败:\n${errorMessages.join('\n')}`) - } + if (errorMessages.length > 0) { + this.$message.error(`部分记录取消失败:\n${errorMessages.join('\n')}`) + } - this.cancelDialogVisible = false - this.cancelLoading = false - }).catch(() => { - this.$message.error('取消操作失败') - this.cancelLoading = false - }) - } - }) + this.cancelDialogVisible = false + this.cancelLoading = false + }).catch(() => { + this.$message.error('取消操作失败') + this.cancelLoading = false + }) }, // 重置查询 resetQuery () { diff --git a/src/views/modules/purchase/receiptRecords.vue b/src/views/modules/purchase/receiptRecords.vue index 7cd3bdc..f0eef5a 100644 --- a/src/views/modules/purchase/receiptRecords.vue +++ b/src/views/modules/purchase/receiptRecords.vue @@ -90,13 +90,13 @@ label="批次号" width="120"> - - + --> { - this.height = (window.innerHeight - 240)/2; + this.height = (window.innerHeight - 250); }) }, activated () {