Flow_15zn1tu
${false}
${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}`);
}
// 获取项目审核人列表
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 checkers = await this.environment.services.get_handlers('project_checker');
this.environment.Logger('work').error(checkers);
let result = checkers.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
content.output.*来自于signal
${true}
${1}
project-detail
${environment.variables.prj_id}
(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_0jpbzcr
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_12nug8s
Flow_0tj9nd6
Flow_0nzbvpg
Flow_0tj9nd6
Flow_0zubkyw
Flow_02taytj
Flow_1ucg773
Flow_0nwaga3
Flow_06cxzjx
Flow_15zn1tu
Flow_0gyvyyo
Flow_0nzbvpg
Flow_01n3edp
Flow_0sb2avy
Flow_1t45qnv
Flow_1ucg773
Flow_0if8for
Flow_1rg4oob
Flow_01ekshh
this.environment.services.get_handlers('project_checker').then((handlers) => {
this.environment.variables.checkers_ok = handlers.length > 0 ? true: false;
next();
});
Flow_01ekshh
Flow_0a0l2t3
Flow_10qwx33
next(null, this.environment.variables.checkers_ok===true);
Flow_10qwx33
Flow_01n3edp
try{
this.environment.services.get_handlers('owner').then((handlers) => {
for (var i = 0; i < handlers.length; i++) {
this.environment.services.gen_remind_task(handlers[i].id, '提醒:没有配置审核组成员', '立项申请前,请先配置审核组成员,否则无法执行立项审核任务。');
}
next();
});
}catch(e){
console.log(e);
}
Flow_0a0l2t3
Flow_12nug8s
Flow_0jpbzcr
Flow_06cxzjx
Flow_0sb2avy
try{
let files = this.environment.output.task_request.files;
this.environment.services.place_on_files(files, "立项驳回").then(()=> next());
} catch(e){
this.environment.Logger('work').error(e);
next();
}
Flow_02taytj
Flow_0if8for
try{
let files = this.environment.output.task_request.files;
this.environment.services.place_on_files(files, "立项通过", "project_set_up").then(()=> next());
}catch(e){
next();
}