From 3871b147189ad78a6019d82770d70e2b42abbaa3 Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Tue, 11 Aug 2026 09:47:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=B9=E9=87=8F=E9=80=9A=E8=BF=87=20?= =?UTF-8?q?=E9=A9=B3=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reportAudit/finishDistrbute.vue | 55 +++++++++----- src/views/warning/index.vue | 74 ++++++++++++++++++- 2 files changed, 111 insertions(+), 18 deletions(-) diff --git a/src/components/reportAudit/finishDistrbute.vue b/src/components/reportAudit/finishDistrbute.vue index 004e50d..fc77e10 100644 --- a/src/components/reportAudit/finishDistrbute.vue +++ b/src/components/reportAudit/finishDistrbute.vue @@ -8,7 +8,7 @@ import {getList,save,delCommon} from '@/api/commonOpinions'; import useCatchStore from "@/stores/modules/catch"; import useUserStore from "@/stores/modules/user"; const userStore = useUserStore(); -const props = defineProps(['dialog','reportId','nextNode','message',"isWarning","flowId"]) +const props = defineProps(['dialog','reportId','nextNode','message',"isWarning","flowId","batchItems"]) const emits = defineEmits(['submitFeedback',"closeFun"]) const catchStore = useCatchStore(); @@ -19,6 +19,7 @@ const formData = ref({ data:{} }) const auditForm= ref() +const submitLoading = ref(false) const dict = catchStore.getDicts([ "businessType", "suspectProblem", @@ -99,23 +100,43 @@ const closeAdd=()=>{ } const submitFun = async ()=>{ - await auditForm.value.validate(); - await feedback.confirm("是否确认通过?"); - formData.value.reportId = props.reportId; - formData.value.flowId = props.flowId; - //nextNode - if(props.nextNode){ - formData.value.nextNode = props.nextNode; - } - if(props.isWarning){ - const res = await auditPassWarningDistribute(formData.value); - // const res = await auditWarning(formData.value); - }else{ - const res = await auditReport(formData.value); + const isBatch = Array.isArray(props.batchItems) && props.batchItems.length > 0 + const targets = isBatch ? props.batchItems : [{ + reportId: props.reportId, + flowId: props.flowId + }] + await feedback.confirm(isBatch ? `是否确认批量通过选中的 ${targets.length} 个项目?` : "是否确认通过?"); + submitLoading.value = true + try { + const createSubmitData = (target) => ({ + ...formData.value, + data: {...formData.value.data}, + reportId: target.reportId, + flowId: target.flowId, + nextNode: props.nextNode || formData.value.nextNode + }) + if (isBatch) { + const results = await Promise.allSettled(targets.map(target => + auditPassWarningDistribute(createSubmitData(target)) + )) + const successCount = results.filter(item => item.status === 'fulfilled').length + const failCount = results.length - successCount + if (failCount > 0) { + feedback.msgError(`批量通过完成:成功 ${successCount} 个,失败 ${failCount} 个`) + } else { + feedback.msgSuccess(`已批量通过 ${successCount} 个项目`) + } + } else if(props.isWarning){ + await auditPassWarningDistribute(createSubmitData(targets[0])); + }else{ + await auditReport(createSubmitData(targets[0])); + } + emits('submitFeedback',true) + closeAdd() + } finally { + submitLoading.value = false } - emits('submitFeedback',true) - closeAdd() } @@ -295,7 +316,7 @@ watch(()=>formData.value.approverId,(val)=>{