| | |
| | | import { |
| | | APPROVAL_STATUS_SEARCH_OPTIONS, |
| | | APPROVAL_TYPE_OPTIONS, |
| | | approvalRecordResultLabel, |
| | | approvalStatusLabel, |
| | | approvalStatusTagType, |
| | | approvalTypeLabel, |
| | |
| | | mapInstanceFromApi, |
| | | mapSubmitTemplateCard, |
| | | matchBusinessTypeValue, |
| | | normalizeApprovalStatusKey, |
| | | unwrapInstancePage, |
| | | } from "./approveListConstants.js"; |
| | | |
| | |
| | | ...buildFormPayloadRules(submitFormFields.value), |
| | | })); |
| | | |
| | | /** 仅「发起人本人」在「已驳回」状态下可修改 */ |
| | | function canEditInstanceRow(row) { |
| | | if (!row) return false; |
| | | const key = normalizeApprovalStatusKey(row.approvalStatus ?? row.statusRaw ?? row.status); |
| | | if (key !== "rejected") return false; |
| | | const applicantId = row.applicantId ?? row.applicantNo; |
| | | if (applicantId == null || applicantId === "") return false; |
| | | return String(applicantId) === String(userStore.id); |
| | | } |
| | | |
| | | const tableColumn = ref([ |
| | | // { label: "申请人编号", prop: "applicantNo", width: 110 }, |
| | | { label: "申请人名称", prop: "applicantName", minWidth: 100 }, |
| | | { label: "发起人", prop: "applicantName", minWidth: 100 }, |
| | | { label: "模板类型", prop: "businessName", minWidth: 120 }, |
| | | { |
| | | label: "审批类型", |
| | |
| | | prop: "unread", |
| | | width: 90, |
| | | align: "center", |
| | | dataType: "tag", |
| | | formatData: (v) => (v ? "是" : "否"), |
| | | formatType: (v) => (v ? "success" : "danger"), |
| | | }, |
| | | { |
| | | label: "审批状态", |
| | |
| | | { |
| | | name: "修改", |
| | | type: "text", |
| | | disabled: (row) => row.approvalStatus !== "pending", |
| | | disabled: (row) => !canEditInstanceRow(row), |
| | | clickFun: (row) => openEditDialog(row), |
| | | }, |
| | | { |
| | |
| | | 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), |
| | | // }, |
| | | ], |
| | | }, |
| | | ]); |
| | |
| | | } |
| | | |
| | | async function openEditDialog(row) { |
| | | if (row?.approvalStatus !== "pending") { |
| | | ElMessage.warning("仅审核中的审批可修改"); |
| | | if (!canEditInstanceRow(row)) { |
| | | ElMessage.warning("仅本人发起、且已被驳回的审批可修改"); |
| | | return; |
| | | } |
| | | const moduleKey = inferReimburseModuleKeyFromInstance(row); |
| | |
| | | } |
| | | |
| | | function approvalActionLabel(result) { |
| | | if (result === "approved") return "通过"; |
| | | if (result === "rejected") return "驳回"; |
| | | return "待处理"; |
| | | return approvalRecordResultLabel(result); |
| | | } |
| | | |
| | | return { |
| | |
| | | resetSubmitDialogState, |
| | | openSubmitDialog, |
| | | openEditDialog, |
| | | canEditInstanceRow, |
| | | onBusinessTypePick, |
| | | onTemplatePick, |
| | | backToBusinessTypePick, |