feat: approval, fix draft (#1281)
Reviewed-on: daoyoucloud/tachybase#1281 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:
parent
7036f3216c
commit
7d121efb95
@ -136,7 +136,7 @@ export default class ApprovalInstruction extends Instruction {
|
||||
});
|
||||
const approvalExecution = approval.approvalExecutions.find((item) => item.executionId === processor.execution.id);
|
||||
// NOTE: 属于重新提交的情况时候, 不必进入待办列表, 应该由用户手动提交
|
||||
if (approval.status === APPROVAL_STATUS.RESUBMIT) {
|
||||
if ([APPROVAL_STATUS.RESUBMIT, APPROVAL_STATUS.DRAFT].includes(approval.status)) {
|
||||
return job;
|
||||
}
|
||||
const RecordModel = db.getModel('approvalRecords');
|
||||
|
@ -39,7 +39,9 @@ export default class ApprovalTrigger extends Trigger {
|
||||
transaction,
|
||||
});
|
||||
const isChangedStatus = approval.changed('status');
|
||||
const isAllowStatusList = [APPROVAL_STATUS.SUBMITTED, APPROVAL_STATUS.RESUBMIT].includes(approval.status);
|
||||
const isAllowStatusList = [APPROVAL_STATUS.DRAFT, APPROVAL_STATUS.SUBMITTED, APPROVAL_STATUS.RESUBMIT].includes(
|
||||
approval.status,
|
||||
);
|
||||
if (!workflow || !isChangedStatus || !isAllowStatusList) {
|
||||
return;
|
||||
}
|
||||
|
@ -262,18 +262,18 @@ const approvals = {
|
||||
// });
|
||||
// await Promise.all(promises); // 等待所有的 resume 操作完成
|
||||
// }
|
||||
if (jobs.length) {
|
||||
const waitList = [];
|
||||
jobs.forEach((job) => {
|
||||
job.set('status', JOB_STATUS.CANCELED);
|
||||
waitList.push(workflowPlugin.resume(job));
|
||||
});
|
||||
// await Promise.all(waitList)
|
||||
} else {
|
||||
await execution.update({
|
||||
status: EXECUTION_STATUS.CANCELED,
|
||||
});
|
||||
}
|
||||
// if (jobs.length) {
|
||||
// const waitList = [];
|
||||
// jobs.forEach((job) => {
|
||||
// job.set('status', JOB_STATUS.CANCELED);
|
||||
// waitList.push(workflowPlugin.resume(job));
|
||||
// });
|
||||
// // await Promise.all(waitList)
|
||||
// } else {
|
||||
await execution.update({
|
||||
status: EXECUTION_STATUS.CANCELED,
|
||||
});
|
||||
// }
|
||||
/** FIXME: 以上 */
|
||||
},
|
||||
async listCentralized(context, next) {
|
||||
|
Loading…
Reference in New Issue
Block a user