fix(approval): 容错处理,审批权限设置错误后,重新设置权限时触发的报错 (#1536)

Reviewed-on: daoyoucloud/tachybase#1536
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
Co-authored-by: bai.zixv <bai.zixv@foxmail.com>
Co-committed-by: bai.zixv <bai.zixv@foxmail.com>
This commit is contained in:
bai.zixv 2024-09-19 22:23:17 +08:00 committed by sealday
parent ad5b23654f
commit ead5ff1842

View File

@ -45,9 +45,9 @@ export const approvalRecords = {
switch (true) {
// case !approvalRecord.workflow.enabled:
// return context.throw(400, ERROR_CODE_MAP['not_enable_workflow']);
case approvalRecord.execution.status:
case approvalRecord.execution?.status:
return context.throw(400, ERROR_CODE_MAP['execution_finished']);
case approvalRecord.job.status:
case approvalRecord.job?.status:
return context.throw(400, ERROR_CODE_MAP['job_finished']);
case approvalRecord.status !== APPROVAL_ACTION_STATUS.PENDING:
return context.throw(400, ERROR_CODE_MAP['not_approval_pending']);