|
|
|
|
@ -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)=>{
|
|
|
|
|
</el-form> |
|
|
|
|
<div class="flex end"> |
|
|
|
|
<el-button @click="closeAdd">关闭</el-button> |
|
|
|
|
<el-button type="primary" @click="submitFun">提交</el-button> |
|
|
|
|
<el-button type="primary" :loading="submitLoading" @click="submitFun">提交</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
</template> |
|
|
|
|
|