| | |
| | | deleteApprovalTemplate, |
| | | getApprovalTemplateDetail, |
| | | listApprovalTemplatePage, |
| | | TEMPLATE_TYPE_CUSTOM, |
| | | TEMPLATE_TYPE_BUILTIN, |
| | | updateApprovalTemplate, |
| | | } from "@/api/officeProcessAutomation/approvalTemplate.js"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { reactive, ref } from "vue"; |
| | | import { computed, reactive, ref } from "vue"; |
| | | import { |
| | | buildApprovalTemplateListParams, |
| | | createEmptyTemplateForm, |
| | | fetchBusinessTypeOptions, |
| | | flowNodesSummary, |
| | | isBuiltinTemplate, |
| | | mapTemplateFromApi, |
| | | mapTemplateToApi, |
| | | nodeSignModeLabel, |
| | |
| | | const formDialog = reactive({ visible: false, title: "", mode: "add" }); |
| | | const form = reactive(createEmptyTemplateForm()); |
| | | const formRef = ref(); |
| | | |
| | | const isEditingBuiltin = computed( |
| | | () => formDialog.mode === "edit" && Number(form.templateType) === TEMPLATE_TYPE_BUILTIN |
| | | ); |
| | | |
| | | async function loadTemplateTypeOptions() { |
| | | try { |
| | |
| | | name: "删除", |
| | | type: "danger", |
| | | link: true, |
| | | disabled: (row) => isBuiltinTemplate(row), |
| | | clickFun: (row) => removeTemplate(row), |
| | | }, |
| | | ], |
| | |
| | | Object.assign(form, base); |
| | | return; |
| | | } |
| | | const formConfigData = JSON.parse( |
| | | JSON.stringify(row.formConfigData || parseFormConfigToData(row.formConfig)) |
| | | ); |
| | | const builtin = isBuiltinTemplate(row); |
| | | Object.assign(form, { |
| | | ...base, |
| | | id: row.id, |
| | | templateName: row.templateName || "", |
| | | description: row.description || "", |
| | | templateType: row.templateType != null ? Number(row.templateType) : base.templateType, |
| | | businessType: row.businessType ?? "", |
| | | formConfig: row.formConfig || "", |
| | | formConfigData: JSON.parse( |
| | | JSON.stringify(row.formConfigData || parseFormConfigToData(row.formConfig)) |
| | | ), |
| | | formConfigData, |
| | | lockedFormFieldUids: builtin |
| | | ? (formConfigData.fields || []).map((f) => f._uid).filter(Boolean) |
| | | : [], |
| | | enabled: row.enabled !== false, |
| | | flowNodes: JSON.parse(JSON.stringify(row.flowNodes || [base.flowNodes[0]])), |
| | | storageBlobDTOs: JSON.parse(JSON.stringify(row.storageBlobDTOs || [])), |
| | |
| | | } |
| | | |
| | | async function removeTemplate(row) { |
| | | if (isBuiltinTemplate(row)) { |
| | | ElMessage.warning("系统内置模板不允许删除"); |
| | | return; |
| | | } |
| | | if (row?.id == null || row.id === "") { |
| | | ElMessage.warning("无法删除:缺少模板 ID"); |
| | | return; |
| | |
| | | form, |
| | | formRef, |
| | | formRules, |
| | | isEditingBuiltin, |
| | | detailDialog, |
| | | detailRow, |
| | | detailLoading, |