| | |
| | | import dayjs from "dayjs"; |
| | | import { buildFormPayloadFromFields } from "../approve-template/formConfigUtils.js"; |
| | | |
| | | /** 审批类型(与后端字段 approvalType 对齐,后期可同步) */ |
| | | export const APPROVAL_TYPE_OPTIONS = [ |
| | |
| | | } |
| | | } |
| | | |
| | | export function createEmptySubmitForm(templateKey) { |
| | | const tpl = SUBMIT_TEMPLATES[templateKey]; |
| | | const payload = { summary: "" }; |
| | | (tpl?.fields || []).forEach((f) => { |
| | | if (f.type === "number") payload[f.key] = undefined; |
| | | else if (f.type === "datetimerange") payload[f.key] = []; |
| | | else payload[f.key] = ""; |
| | | }); |
| | | export function createEmptySubmitForm(templateKey, templateOverride) { |
| | | const tpl = templateOverride || SUBMIT_TEMPLATES[templateKey]; |
| | | const payload = tpl?.fields?.length ? buildFormPayloadFromFields(tpl.fields) : { summary: "" }; |
| | | return { |
| | | templateKey: templateKey || "", |
| | | templateSnapshot: null, |
| | | approvalMode: tpl?.approvalMode || "parallel", |
| | | formPayload: payload, |
| | | approvalFlowNodes: buildDefaultFlowNodes(), |