| | |
| | | const submitTemplatesLoading = ref(false); |
| | | |
| | | const submitTemplateCards = computed(() => { |
| | | if (selectedBusinessType.value == null || selectedBusinessType.value === "") return []; |
| | | if (selectedBusinessType.value == null || selectedBusinessType.value === "") |
| | | return []; |
| | | return allSubmitTemplates.value.filter((card) => |
| | | matchBusinessTypeValue(card.businessType, selectedBusinessType.value) |
| | | ); |
| | |
| | | const isSubmitEdit = computed(() => submitDialog.mode === "edit"); |
| | | const submitDialogTitle = computed(() => { |
| | | if (submitDialog.mode === "edit") { |
| | | return `修改${activeTemplate.value?.label || submitForm.templateName || "审批"}`; |
| | | return `修改${ |
| | | activeTemplate.value?.label || submitForm.templateName || "审批" |
| | | }`; |
| | | } |
| | | if (submitDialog.step === 1) return "选择模板类型"; |
| | | if (submitDialog.step === 2) return `选择审批模板${businessTypeLabel(selectedBusinessType.value) ? `(${businessTypeLabel(selectedBusinessType.value)})` : ""}`; |
| | | if (submitDialog.step === 2) |
| | | return `选择审批模板${ |
| | | businessTypeLabel(selectedBusinessType.value) |
| | | ? `(${businessTypeLabel(selectedBusinessType.value)})` |
| | | : "" |
| | | }`; |
| | | return `提交${activeTemplate.value?.label || "审批"}`; |
| | | }); |
| | | |
| | | const selectedBusinessTypeLabel = computed(() => businessTypeLabel(selectedBusinessType.value)); |
| | | const selectedBusinessTypeLabel = computed(() => |
| | | businessTypeLabel(selectedBusinessType.value) |
| | | ); |
| | | |
| | | function businessTypeLabel(type) { |
| | | if (type == null || type === "") return ""; |
| | | const hit = submitBusinessTypeOptions.value.find((x) => matchBusinessTypeValue(x.value, type)); |
| | | const hit = submitBusinessTypeOptions.value.find((x) => |
| | | matchBusinessTypeValue(x.value, type) |
| | | ); |
| | | return hit?.label || ""; |
| | | } |
| | | |
| | | function countTemplatesByBusinessType(type) { |
| | | return allSubmitTemplates.value.filter((card) => matchBusinessTypeValue(card.businessType, type)).length; |
| | | return allSubmitTemplates.value.filter((card) => |
| | | matchBusinessTypeValue(card.businessType, type) |
| | | ).length; |
| | | } |
| | | |
| | | const activeTemplate = computed(() => submitForm.templateSnapshot || null); |
| | |
| | | }); |
| | | |
| | | const submitFormRules = computed(() => ({ |
| | | templateKey: [{ required: true, message: "请选择审批类型", trigger: "change" }], |
| | | templateKey: [ |
| | | { required: true, message: "请选择审批类型", trigger: "change" }, |
| | | ], |
| | | ...buildFormPayloadRules(submitFormFields.value), |
| | | })); |
| | | |
| | |
| | | disabled: (row) => row.approvalStatus !== "pending" || !row.isApprove, |
| | | clickFun: (row) => openApprove(row), |
| | | }, |
| | | { |
| | | name: "删除", |
| | | type: "danger", |
| | | clickFun: (row) => removeInstance(row), |
| | | }, |
| | | // { |
| | | // name: "删除", |
| | | // type: "danger", |
| | | // clickFun: (row) => removeInstance(row), |
| | | // }, |
| | | ], |
| | | }, |
| | | ]); |
| | |
| | | try { |
| | | await navigateToReimburseManageForEdit(proxy?.$router, moduleKey, rid); |
| | | } catch { |
| | | ElMessage.warning("未找到差旅/费用报销菜单路由,请从左侧菜单进入后再编辑"); |
| | | ElMessage.warning( |
| | | "未找到差旅/费用报销菜单路由,请从左侧菜单进入后再编辑" |
| | | ); |
| | | } |
| | | return; |
| | | } |
| | |
| | | templateKey: String(card.id), |
| | | ...applied, |
| | | businessType: |
| | | applied.businessType ?? card.businessType ?? selectedBusinessType.value, |
| | | applied.businessType ?? |
| | | card.businessType ?? |
| | | selectedBusinessType.value, |
| | | }); |
| | | submitDialog.step = 3; |
| | | } catch { |
| | |
| | | return false; |
| | | } |
| | | if (!activeTemplate.value) return false; |
| | | const bindingCheck = validateTemplateBinding({ flowNodes: submitForm.flowNodes }); |
| | | const bindingCheck = validateTemplateBinding({ |
| | | flowNodes: submitForm.flowNodes, |
| | | }); |
| | | if (!bindingCheck.ok) { |
| | | ElMessage.warning(bindingCheck.message); |
| | | return false; |
| | |
| | | return false; |
| | | } |
| | | if (!activeTemplate.value) return false; |
| | | const bindingCheck = validateTemplateBinding({ flowNodes: submitForm.flowNodes }); |
| | | const bindingCheck = validateTemplateBinding({ |
| | | flowNodes: submitForm.flowNodes, |
| | | }); |
| | | if (!bindingCheck.ok) { |
| | | ElMessage.warning(bindingCheck.message); |
| | | return false; |
| | |
| | | ); |
| | | submitDialog.visible = false; |
| | | await fetchApprovalList(); |
| | | if (detailDialog.visible && detailRow.value?.id === submitForm.instanceId) { |
| | | if ( |
| | | detailDialog.visible && |
| | | detailRow.value?.id === submitForm.instanceId |
| | | ) { |
| | | const hit = tableData.value.find((r) => r.id === submitForm.instanceId); |
| | | if (hit) detailRow.value = { ...hit }; |
| | | else detailDialog.visible = false; |