This commit is contained in:
sjl
2025-12-12 09:29:09 +08:00
parent b36f765d07
commit e87d05c587
4 changed files with 72 additions and 12 deletions

View File

@@ -195,15 +195,54 @@ watch(
/** 处理审批通过和不通过的操作 */
const handleAudit = async (task, pass) => {
loading.value = true
// 1.1 获得对应表单
const index = runningTasks.value.indexOf(task)
const auditFormRef = proxy.$refs['form' + index][0]
// 1.2 校验表单
const elForm = unref(auditFormRef)
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
if (!elForm){
loading.value = false
return
}
// const valid = await elForm.validate()
// if (!valid)
// return
try {
const valid = await new Promise((resolve) => {
elForm.validate((isValid) => {
resolve(isValid)
})
})
if (!valid){
loading.value = false
return
}
} catch (error) {
loading.value = false
return
}
// 1.3 验证 approveForms 中的 radio 字段是否都有值
const currentApproveForm = approveForms.value[index];
if (currentApproveForm && currentApproveForm.rule && Array.isArray(currentApproveForm.rule)) {
const emptyRadioFields = currentApproveForm.rule.filter(rule =>
rule.type === 'radio' &&
(rule.value === undefined ||
rule.value === null ||
rule.value === '')
);
if (emptyRadioFields.length > 0) {
ElMessage.error('请确认试运行分析报告审核要点都已勾选!');
loading.value = false;
return;
}
}
// 2.1 提交审批
const data = {