| | |
| | | /** 审批记录 approveAction → 页面 result */ |
| | | export function mapRecordResultFromApi(action) { |
| | | const s = String(action || "").toUpperCase(); |
| | | // 发起申请:申请人是本人,不是审批动作,单独标识,避免显示成「待处理」 |
| | | if (s === "SUBMIT" || s === "SUBMITTED" || s === "CREATE") return "submitted"; |
| | | if (s === "APPROVED" || s === "APPROVE" || s === "PASS") return "approved"; |
| | | if (s === "REJECTED" || s === "REJECT" || s === "REFUSE") return "rejected"; |
| | | return "pending"; |
| | | } |
| | | |
| | | /** 审批记录 result → 文案 */ |
| | | export function approvalRecordResultLabel(result) { |
| | | if (result === "submitted") return "申请"; |
| | | if (result === "approved") return "通过"; |
| | | if (result === "rejected") return "驳回"; |
| | | return "待处理"; |
| | | } |
| | | |
| | | /** 后端 records → 时间线展示结构 */ |
| | |
| | | if (isUpdate) { |
| | | dto.id = existingRow?.id ?? submitForm?.instanceId; |
| | | dto.instanceNo = existingRow?.instanceNo ?? submitForm?.instanceNo ?? ""; |
| | | dto.status = submitForm?.saveStatusApi || existingRow?.statusRaw || mapInstanceStatusToApi(existingRow?.approvalStatus) || "PENDING"; |
| | | dto.currentLevel = existingRow?.currentLevel ?? submitForm?.currentLevel ?? 1; |
| | | // 修改保存即重新提交,流程从第一级重新开始 |
| | | dto.status = "PENDING"; |
| | | dto.currentLevel = 1; |
| | | dto.applicantId = existingRow?.applicantId ?? existingRow?.applicantNo; |
| | | dto.applicantName = existingRow?.applicantName || ""; |
| | | } else { |
| | |
| | | currentNodeIndex: 0, |
| | | approvalRecords, |
| | | rejectReason: approvalRecords.find(r => r.result === "rejected")?.opinion || "", |
| | | purchaseContractNumber: row.purchaseContractNumber || "", |
| | | quotationNo: row.quotationNo || "", |
| | | shippingNo: row.shippingNo || "", |
| | | }; |
| | | } |
| | | |