|
@@ -56,6 +56,7 @@ module.exports = app => {
|
|
|
s.curAuditors2 = await ctx.service.stageAudit.getAuditorsByStatus(s.id, auditConst.status.checking, s.times);
|
|
|
}
|
|
|
}
|
|
|
+ renderData.unCompleteStageCount = renderData.stages.filter(s => { return s.status !== auditConst.status.checked; }).length;
|
|
|
await this.layout('measure/stage.ejs', renderData, 'measure/stage_modal.ejs');
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
@@ -97,6 +98,16 @@ module.exports = app => {
|
|
|
if (!date || !period) {
|
|
|
throw '请选择计量年月和开始-截止日期';
|
|
|
}
|
|
|
+ const stages = await ctx.service.stage.getAllDataByCondition({ where: { tid: ctx.tender.id }});
|
|
|
+ const unCompleteStageCount = stages.filter(s => { return s.status !== auditConst.status.checked; }).length;
|
|
|
+ if (unCompleteStageCount.length > 0) {
|
|
|
+ if (ctx.session.sessionProject.page_show.openMultiStageCalc) {
|
|
|
+ if (unCompleteStageCount >= ctx.session.sessionProject.page_show.maxMultiStageCount)
|
|
|
+ throw `最多只可同时进行${ctx.session.sessionProject.page_show.maxMultiStageCount}期计量`;
|
|
|
+ } else {
|
|
|
+ throw `最新一起未审批通过,请审批通过后再新增计量`
|
|
|
+ }
|
|
|
+ }
|
|
|
const newStage = await ctx.service.stage.addStage(ctx.tender.id, date, period);
|
|
|
if (!newStage) {
|
|
|
throw '新增计量期失败,请重试';
|