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-template/formConfigUtils.js | 31 +++++++++++++++++++++++++++----
1 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/formConfigUtils.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/formConfigUtils.js
index 0cb20ea..c1f66bd 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/formConfigUtils.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/formConfigUtils.js
@@ -1,3 +1,12 @@
+import { mapAttachmentsFromApi } from "./approveTemplateConstants.js";
+import {
+ isDynamicOptionSource,
+ SELECT_OPTION_SOURCE,
+ selectOptionSourceLabel,
+} from "./selectOptionSource.js";
+
+export { selectOptionSourceLabel };
+
/** 濉姤椤圭被鍨嬶紙涓庡鎵规彁浜ら〉 field.type 涓�鑷达級 */
export const FORM_FIELD_TYPE_OPTIONS = [
{ value: "text", label: "鍗曡鏂囨湰" },
@@ -67,6 +76,7 @@
min: 0,
precision: 0,
defaultValue: "",
+ optionSource: SELECT_OPTION_SOURCE.STATIC,
options: [{ label: "", value: "" }],
};
}
@@ -154,6 +164,7 @@
min: f.min ?? 0,
precision: f.precision ?? 0,
defaultValue: normalizeDefaultValueFromApi(f),
+ optionSource: f.optionSource || SELECT_OPTION_SOURCE.STATIC,
options: (f.options || []).length
? f.options.map((o) => ({ label: o.label || "", value: o.value ?? "" }))
: [{ label: "", value: "" }],
@@ -180,9 +191,13 @@
item.precision = f.precision ?? 0;
}
if (item.type === "select") {
- item.options = (f.options || [])
- .filter((o) => (o.label || "").trim() || o.value !== "" && o.value != null)
- .map((o) => ({ label: (o.label || "").trim(), value: o.value }));
+ const source = f.optionSource || SELECT_OPTION_SOURCE.STATIC;
+ item.optionSource = source;
+ if (!isDynamicOptionSource(source)) {
+ item.options = (f.options || [])
+ .filter((o) => (o.label || "").trim() || (o.value !== "" && o.value != null))
+ .map((o) => ({ label: (o.label || "").trim(), value: o.value }));
+ }
}
if (hasDefaultValue(f)) {
item.defaultValue =
@@ -223,6 +238,8 @@
if (keys.has(key)) return { ok: false, message: `瀛楁鏍囪瘑銆�${key}銆嶉噸澶嶏紝璇蜂慨鏀筦 };
keys.add(key);
if (f.type === "select") {
+ const source = f.optionSource || SELECT_OPTION_SOURCE.STATIC;
+ if (isDynamicOptionSource(source)) continue;
const opts = (f.options || []).filter((o) => (o.label || "").trim() && o.value !== "" && o.value != null);
if (!opts.length) return { ok: false, message: `璇蜂负銆�${label}銆嶉厤缃嚦灏戜竴涓笅鎷夐�夐」` };
}
@@ -241,13 +258,16 @@
return dv.length === 2 ? `${dv[0]} ~ ${dv[1]}` : "鈥�";
}
if (field?.type === "select") {
+ if (isDynamicOptionSource(field.optionSource)) {
+ return `${selectOptionSourceLabel(field.optionSource)}锛�${String(dv)}`;
+ }
const opt = (field.options || []).find((o) => String(o.value) === String(dv));
return opt?.label || String(dv);
}
return String(dv);
}
-/** 灏嗗悗绔ā鏉胯杞负鎻愪氦椤垫ā鏉跨粨鏋勶紙鍚� fields 榛樿鍊硷級 */
+/** 灏嗗悗绔ā鏉胯杞负鎻愪氦椤垫ā鏉跨粨鏋勶紙鍚� fields 榛樿鍊笺�侀檮浠讹級 */
export function buildSubmitTemplateFromRow(row) {
const cfg = parseFormConfigToData(row?.formConfig);
const fields = (cfg.fields || []).map(({ _uid, ...rest }) => ({
@@ -260,14 +280,17 @@
min: rest.min,
precision: rest.precision,
defaultValue: rest.defaultValue,
+ optionSource: rest.optionSource,
options: rest.options,
}));
return {
label: row?.templateName || "瀹℃壒",
+ businessType: row?.businessType ?? cfg.approvalType ?? "",
approvalType: cfg.approvalType || "",
summaryPlaceholder: cfg.summaryPlaceholder || "",
approvalMode: cfg.approvalMode || "parallel",
fields,
+ storageBlobDTOs: mapAttachmentsFromApi(row),
};
}
--
Gitblit v1.9.3