From 0a58164ce2ea3f1a2b46781757d78b94b212883b Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 20 五月 2026 15:13:49 +0800
Subject: [PATCH] 工作交接/调岗申请/转正申请/请假申请/加班申请新增调用模板
---
src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js | 63 +++++++++++--------------------
1 files changed, 22 insertions(+), 41 deletions(-)
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
index 4b8510a..c17e88a 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
@@ -18,11 +18,13 @@
fetchBusinessTypeOptions,
formatDisplayTime,
mapEnabledFromApi,
- mapTemplateFromApi,
- unwrapTemplateDetail,
unwrapTemplateList,
} from "../approve-template/approveTemplateConstants.js";
-import { buildSubmitTemplateFromRow } from "../approve-template/formConfigUtils.js";
+import {
+ buildFormPayloadRules,
+ buildTemplateBindingFromDetail,
+ validateTemplateBinding,
+} from "../approve-shared/approvalTemplateBindingUtils.js";
import {
APPROVAL_TYPE_OPTIONS,
approvalStatusLabel,
@@ -32,17 +34,14 @@
buildApproveInstanceDto,
buildEditFormFromInstanceRow,
buildInstanceDto,
- clearLegacyApproveListStorage,
createEmptySubmitForm,
mapInstanceFromApi,
mapSubmitTemplateCard,
matchBusinessTypeValue,
- validateSubmitFlowNodes,
unwrapInstancePage,
} from "./approveListConstants.js";
export function useApproveList() {
- clearLegacyApproveListStorage();
const userStore = useUserStore();
const tableData = ref([]);
@@ -111,22 +110,10 @@
return submitForm.formFieldDefs || [];
});
- const submitFormRules = computed(() => {
- const rules = {
- templateKey: [{ required: true, message: "璇烽�夋嫨瀹℃壒绫诲瀷", trigger: "change" }],
- };
- submitFormFields.value.forEach((f) => {
- if (!f.required) return;
- if (f.type === "number") {
- rules[`formPayload.${f.key}`] = [{ required: true, message: `璇峰~鍐�${f.label}`, trigger: "blur" }];
- } else if (f.type === "datetimerange") {
- rules[`formPayload.${f.key}`] = [{ required: true, message: `璇烽�夋嫨${f.label}`, trigger: "change" }];
- } else {
- rules[`formPayload.${f.key}`] = [{ required: true, message: `璇峰~鍐�${f.label}`, trigger: "blur" }];
- }
- });
- return rules;
- });
+ const submitFormRules = computed(() => ({
+ templateKey: [{ required: true, message: "璇烽�夋嫨瀹℃壒绫诲瀷", trigger: "change" }],
+ ...buildFormPayloadRules(submitFormFields.value),
+ }));
const tableColumn = ref([
{ label: "鐢宠浜虹紪鍙�", prop: "applicantNo", width: 110 },
@@ -291,18 +278,12 @@
submitTemplatesLoading.value = true;
try {
const res = await getApprovalTemplateDetail(card.id);
- const mapped = mapTemplateFromApi(unwrapTemplateDetail(res));
- const tpl = {
- ...buildSubmitTemplateFromRow(mapped),
- templateId: mapped.id,
- };
- const base = createEmptySubmitForm(String(card.id), tpl, mapped.flowNodes);
+ const applied = buildTemplateBindingFromDetail(res);
Object.assign(submitForm, {
- ...base,
- templateName: mapped.templateName || tpl.label || "",
- businessType: mapped.businessType ?? card.businessType ?? selectedBusinessType.value,
- templateSnapshot: tpl,
- formFieldDefs: tpl.fields || [],
+ templateKey: String(card.id),
+ ...applied,
+ businessType:
+ applied.businessType ?? card.businessType ?? selectedBusinessType.value,
});
submitDialog.step = 3;
} catch {
@@ -343,9 +324,9 @@
return false;
}
if (!activeTemplate.value) return false;
- const flowCheck = validateSubmitFlowNodes(submitForm.flowNodes);
- if (!flowCheck.ok) {
- ElMessage.warning(flowCheck.message);
+ const bindingCheck = validateTemplateBinding({ flowNodes: submitForm.flowNodes });
+ if (!bindingCheck.ok) {
+ ElMessage.warning(bindingCheck.message);
return false;
}
if (!submitForm.templateId) {
@@ -360,7 +341,7 @@
submitForm,
activeTemplate: activeTemplate.value,
userStore,
- flowNodes: flowCheck.nodes,
+ flowNodes: bindingCheck.nodes,
})
);
submitDialog.visible = false;
@@ -382,9 +363,9 @@
return false;
}
if (!activeTemplate.value) return false;
- const flowCheck = validateSubmitFlowNodes(submitForm.flowNodes);
- if (!flowCheck.ok) {
- ElMessage.warning(flowCheck.message);
+ const bindingCheck = validateTemplateBinding({ flowNodes: submitForm.flowNodes });
+ if (!bindingCheck.ok) {
+ ElMessage.warning(bindingCheck.message);
return false;
}
if (!submitForm.instanceId) {
@@ -398,7 +379,7 @@
buildInstanceDto({
submitForm,
activeTemplate: activeTemplate.value,
- flowNodes: flowCheck.nodes,
+ flowNodes: bindingCheck.nodes,
existingRow: submitEditRow.value,
})
);
--
Gitblit v1.9.3