|
@@ -6,12 +6,12 @@ import {IdGen} from "@util/IdGen";
|
|
|
import dayjs from "dayjs";
|
|
|
import {PrjTaskOutcome} from "@core-models/PrjTaskOutcome";
|
|
|
import {PrjInfo} from "@core-models/PrjInfo";
|
|
|
-import {PrjPhaseDefine} from "@core-models/PrjPhaseDefine";
|
|
|
import {PrjPlanTask} from "@core-models/PrjPlanTask";
|
|
|
import {PrjPlanTaskDraft} from "@core-models/PrjPlanTaskDraft";
|
|
|
import {PrjTaskOutcomeDraft} from "@core-models/PrjTaskOutcomeDraft";
|
|
|
-import {start_plan_alt_flow} from "../../../../utils/plan_task_helper";
|
|
|
-import {ChangeMarker, TaskStatus} from "../../../../utils/define";
|
|
|
+import {start_plan_alt_flow} from "@src/utils/plan_task_helper";
|
|
|
+import {ChangeMarker, TaskStatus} from "@src/utils/define";
|
|
|
+import {if_project_task_manageable_in_current_phase} from "@src/utils/prj_premission_helper";
|
|
|
|
|
|
interface IData {
|
|
|
/**
|
|
@@ -52,33 +52,36 @@ function statusGuard(json: IRequest, cached_data: ICachedData): Promise<void> {
|
|
|
let prj_info = await PrjInfo.findOne({where: {id: task.prj_id}, raw: true});
|
|
|
if (!prj_info) return reject(Resp.gen_err(Resp.ResourceNotFound, '项目不存在。'));
|
|
|
|
|
|
- let phase = await PrjPhaseDefine.findOne({where: {id: prj_info.phase_id}, raw: true});
|
|
|
- if (!phase) return reject(Resp.gen_err(Resp.ResourceNotFound, '项目状态信息出错,id: ' + prj_info.id));
|
|
|
-
|
|
|
- if (phase.order_index < 20) return reject(Resp.gen_err(Resp.InvalidFlow, '需要先对项目进行立项,立项后才可制订计划。'));
|
|
|
- // if (phase.order_index >= 80) return reject(Resp.gen_err(Resp.InvalidFlow, '当前项目阶段不允许添加交付物。'));
|
|
|
-
|
|
|
- if (phase.order_index === 80) {
|
|
|
- return reject(Resp.gen_err(Resp.InvalidFlow, '项目验收中,不允许添加交付物。'));
|
|
|
- }
|
|
|
- if (phase.order_index === 90) {
|
|
|
- return reject(Resp.gen_err(Resp.InvalidFlow, '项目已作废,不允许添加交付物。'));
|
|
|
- }
|
|
|
- if (phase.order_index === 100) {
|
|
|
- return reject(Resp.gen_err(Resp.InvalidFlow, '项目已完成,不允许添加交付物。'));
|
|
|
- }
|
|
|
-
|
|
|
- // if (data.draft == true) {
|
|
|
- if (phase.order_index >= 60 && phase.order_index <= 65) {
|
|
|
- return reject(Resp.gen_err(Resp.InvalidFlow, '计划变更审核中,现阶段不允许添加交付物。'));
|
|
|
- }
|
|
|
- // } else {
|
|
|
- if (data.draft === false) {
|
|
|
- if (phase.order_index >= 30 && phase.order_index <= 40)
|
|
|
- return reject(Resp.gen_err(Resp.InvalidFlow, '项目计划审核中,当前阶段不允许添加。'));
|
|
|
- // if (phase.order_index === 70)
|
|
|
- // return reject(Resp.gen_err(Resp.InvalidFlow, '当前项目阶段不允许直接添加交付物,应在草稿中添加后重新提交计划变更审核。'));
|
|
|
- }
|
|
|
+ // let phase = await PrjPhaseDefine.findOne({where: {id: prj_info.phase_id}, raw: true});
|
|
|
+ // if (!phase) return reject(Resp.gen_err(Resp.ResourceNotFound, '项目状态信息出错,id: ' + prj_info.id));
|
|
|
+ //
|
|
|
+ // if (phase.order_index < 20) return reject(Resp.gen_err(Resp.InvalidFlow, '需要先对项目进行立项,立项后才可制订计划。'));
|
|
|
+ // // if (phase.order_index >= 80) return reject(Resp.gen_err(Resp.InvalidFlow, '当前项目阶段不允许添加交付物。'));
|
|
|
+ //
|
|
|
+ // if (phase.order_index === 80) {
|
|
|
+ // return reject(Resp.gen_err(Resp.InvalidFlow, '项目验收中,不允许添加交付物。'));
|
|
|
+ // }
|
|
|
+ // if (phase.order_index === 90) {
|
|
|
+ // return reject(Resp.gen_err(Resp.InvalidFlow, '项目已作废,不允许添加交付物。'));
|
|
|
+ // }
|
|
|
+ // if (phase.order_index === 100) {
|
|
|
+ // return reject(Resp.gen_err(Resp.InvalidFlow, '项目已完成,不允许添加交付物。'));
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // // if (data.draft == true) {
|
|
|
+ // if (phase.order_index >= 60 && phase.order_index <= 65) {
|
|
|
+ // return reject(Resp.gen_err(Resp.InvalidFlow, '计划变更审核中,现阶段不允许添加交付物。'));
|
|
|
+ // }
|
|
|
+ // // } else {
|
|
|
+ // if (data.draft === false) {
|
|
|
+ // if (phase.order_index >= 30 && phase.order_index <= 40)
|
|
|
+ // return reject(Resp.gen_err(Resp.InvalidFlow, '项目计划审核中,当前阶段不允许添加。'));
|
|
|
+ // // if (phase.order_index === 70)
|
|
|
+ // // return reject(Resp.gen_err(Resp.InvalidFlow, '当前项目阶段不允许直接添加交付物,应在草稿中添加后重新提交计划变更审核。'));
|
|
|
+ // }
|
|
|
+ let result = await if_project_task_manageable_in_current_phase(data.draft, prj_info.id, prj_info.phase_id, '添加交付物');
|
|
|
+ if (!result.manageable)
|
|
|
+ return reject(result.error);
|
|
|
if (task.status >= TaskStatus.apply_for_review) {
|
|
|
return reject(Resp.gen_err(Resp.InvalidFlow, '当前任务阶段不允许添加交付物。'));
|
|
|
}
|