Flow_15zn1tu
${false}
${1}
project-plan
${true}
(async function () {
try {
let owner = await this.environment.services.owner(); // 获取任务责任人
if (!owner) {
await this.environment.services.gen_warn_task('admin', '提交计划变更审核时未找到负责人',
`提交计划变更审核时未找到负责人,流程出错。case id: ${this.environment.variables.id}`);
}
// 获取审核人列表
let checkers = await this.environment.services.get_handlers('project_checker');
if (!checkers || checkers.length === 0) return;
let checkers_str = "";
for (var i = 0; i < checkers.length; i++) {
if (i > 0) checkers_str += '、';
checkers_str += `${checkers[i].name}`;
}
await this.environment.services.gen_remind_task(owner.id, '计划变更已提交', `<b>${owner.name}</b>已于 <b>` +
this.environment.services.get_datetime() + `</b> 提交了计划变更,将由: <br> <b>${checkers_str}</b> 进行审核。`);
await this.environment.services.logger(owner.id, owner.name, `提交了计划变更,将由: <br> <b>${checkers_str}</b> <br>进行审核。`);
} catch (e) {
this.environment.Logger('work').error(e);
}
})();
(async function () {
try {
let handlers = this.environment.services.get_handlers('project_checker');
let result = handlers.length > 0 ? true: false;
if (!result) {
return {
result: false,
message: '计划变更申请前,请先配置审核组成员,否则无法执行计划变更审核任务。'
}
} else {
return {
result: true,
message: 'OK'
}
}
} catch (e) {
this.environment.Logger('work').error(e);
return {
result: false,
message: 'fail'
}
}
})();
Flow_1t45qnv
Flow_0gyvyyo
Flow_1rg4oob
Flow_0bhibn0
${true}
${1}
project-plan
${environment.variables.prj_id}
${true}
${{"target": "project-plan", "draft": false}}
(async function () {
try {
let owner = await this.environment.services.owner(); // 获取任务责任人
if (!owner) {
await this.environment.services.gen_warn_task('admin', '计划变更申请时未找到负责人',
`计划变更申请时未找到负责人,流程出错。case id: ${this.environment.variables.id}`);
}
this.environment.Logger('work').debug(this.content);
let checker = this.content.handlers[this.content.index]; // 获取当前审核人,这个是循环任务,有多个审核人依次审核
let result = this.content.output[this.content.index]; // 来自于审核人表单结果
if (result.pass) { // 如果审核通过
await this.environment.services.gen_remind_task(owner.id, `${checker.name}已批准计划变更`,
'<b>' + checker.name + '</b>已于 <b>' + this.environment.services.get_datetime() + '</b> 批准计划变更。审核意见如下:<br>' + result.opinion);
await this.environment.services.logger(checker.id, checker.name, '批准计划变更,审核意见:' + result.opinion);
} else {
await this.environment.services.gen_remind_task(owner.id, `${checker.name}已驳回计划变更`,
'<b>' + checker.name + '</b>已于 <b>' + this.environment.services.get_datetime() + '</b> 驳回计划变更。审核意见如下:<br>' + result.opinion);
await this.environment.services.logger(checker.id, checker.name, '驳回计划变更,审核意见:<span style="color: red;">' + result.opinion + '</span>');
}
} catch (e) {
this.environment.Logger('work').error(e);
}
})();
Flow_1rg4oob
Flow_193tusd
${content.handlers.length}
${!content.output.pass}
Flow_193tusd
Flow_0zubkyw
Flow_0nwaga3
next(null, this.environment.variables.pass===true);
${1}
(async function() {
try{
let owner = await this.environment.services.owner(); // 获取任务责任人
if (!owner) {
await this.environment.services.gen_warn_task('admin', '计划变更申请被撤回时未找到负责人',
`计划变更申请被撤回时未找到负责人,流程出错。case id: ${this.environment.variables.id}`);
}
await this.environment.services.gen_remind_task(owner.id, '计划变更已被撤回',
owner.name+'已于 ' + this.environment.services.get_datetime() + ' 撤回计划变更申请。');
await this.environment.services.logger(owner.id, owner.name, `撤回了计划变更申请。`);
} catch(e){
this.environment.Logger('work').error(e);
}
})();
Flow_0bhibn0
Flow_0tj9nd6
Flow_0nzbvpg
Flow_0tj9nd6
Flow_0zubkyw
Flow_02taytj
Flow_1ucg773
Flow_0nwaga3
Flow_06cxzjx
Flow_15zn1tu
Flow_0gyvyyo
Flow_0nzbvpg
Flow_06cxzjx
Flow_1t45qnv
Flow_1ucg773
Flow_02taytj