From f73c47c5c1c440881586f44739f24fab3d522e06 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Thu, 30 Oct 2025 16:19:43 +0800 Subject: [PATCH] =?UTF-8?q?2025-10-30=20=E6=8B=A3=E8=B4=A7=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E4=BB=BB=E5=8A=A1=E9=80=9A=E7=9F=A5=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8C=85=E8=A3=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/qc/outboundNotification.vue | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/src/views/modules/qc/outboundNotification.vue b/src/views/modules/qc/outboundNotification.vue index 5dbda3a..9f4dab9 100644 --- a/src/views/modules/qc/outboundNotification.vue +++ b/src/views/modules/qc/outboundNotification.vue @@ -53,6 +53,7 @@ {{'导出'}} + 包装 @@ -1251,6 +1252,78 @@ }, + // 包装 + packingModal () { + // 校验是否选择了单据 + if (this.outboundSelection.length === 0) { + this.$message.warning('请勾选要包装的单据!') + return + } + + // 校验选中的单据是否都是"销售出库"类型且状态为"待出库" + const invalidOrders = this.outboundSelection.filter(item => { + return item.orderType !== '销售出库' || item.orderStatus !== '待出库' + }) + + if (invalidOrders.length > 0) { + this.$message.warning('只能对"销售出库"类型且状态为"待出库"的单据进行包装操作!') + return + } + + // 确认操作 + this.$confirm(`确定将选中的 ${this.outboundSelection.length} 条单据状态更新为"待包装"?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 调用后端接口更新状态 + const updateList = this.outboundSelection.map(item => ({ + site: item.site, + buNo: item.buNo, + orderNo: item.orderNo, + orderStatus: '待包装' + })) + + this.batchUpdateOrderStatus(updateList) + }).catch(() => { + // 用户取消操作 + }) + }, + + // 批量更新单据状态 + batchUpdateOrderStatus (updateList) { + // 这里需要调用后端API,暂时使用循环调用单个更新接口 + let successCount = 0 + let errorCount = 0 + const totalCount = updateList.length + + const updatePromises = updateList.map(item => { + return this.$http({ + url: this.$http.adornUrl('/outboundNotification/updateOrderStatus'), + method: 'post', + data: this.$http.adornData(item) + }).then(({data}) => { + if (data && data.code === 0) { + successCount++ + } else { + errorCount++ + } + }).catch(() => { + errorCount++ + }) + }) + + Promise.all(updatePromises).then(() => { + if (errorCount === 0) { + this.$message.success(`成功更新 ${successCount} 条单据状态为"待包装"`) + } else { + this.$message.warning(`成功 ${successCount} 条,失败 ${errorCount} 条`) + } + this.getDataList() + this.outboundSelection = [] + }) + }, + // 关闭 closeModal (row) { if (this.currentRow.orderType === '销售出库') {