|
|
@@ -1,12 +1,9 @@
|
|
|
-import { ApprovalWay, IProcessAccount, ProcessStatus, IProcess, ApprovalStatus } from '@sc/types';
|
|
|
-import { isArray, isEmpty } from 'lodash';
|
|
|
+import { ApprovalWay, ProcessStatus, IProcess, ApprovalStatus } from '@sc/types';
|
|
|
+import { isEmpty } from 'lodash';
|
|
|
|
|
|
// 获取流程某个环节审批状态
|
|
|
-export const getProcessStatus = (approvalWay: ApprovalWay, accounts: IProcessAccount[] | IProcessAccount) => {
|
|
|
- if (!isArray(accounts)) {
|
|
|
- return accounts.status;
|
|
|
- }
|
|
|
-
|
|
|
+export const getProcessStatus = (process: IProcess) => {
|
|
|
+ const { approvalWay, accounts } = process.participantInfo;
|
|
|
// 指定用户 退回上一环节为上报审批时,判断流程状态和指定用户一样
|
|
|
if (approvalWay === ApprovalWay.ACCOUNT || approvalWay === ApprovalWay.REPORT) {
|
|
|
const { status } = accounts[0];
|
|
|
@@ -44,8 +41,7 @@ export const getApprovalStatus = (processes: IProcess[]) => {
|
|
|
return undefined;
|
|
|
}
|
|
|
const lastProcess = processes[processes.length - 1];
|
|
|
- const { approvalWay, accounts } = lastProcess.participantInfo;
|
|
|
- const lastProcessStatus = getProcessStatus(approvalWay, accounts);
|
|
|
+ const lastProcessStatus = getProcessStatus(lastProcess);
|
|
|
// 审批通过
|
|
|
if (lastProcessStatus === ProcessStatus.APPROVED) {
|
|
|
return ApprovalStatus.APPROVED;
|