Flow_15zn1tu
${false}
${1}
project-plan
${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}`);
}
// 获取审核人列表
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 = await 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}
${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