|
@@ -229,6 +229,22 @@ module.exports = app => {
|
|
|
if (stage) await this.ctx.service.stage.doCheckStage(stage);
|
|
if (stage) await this.ctx.service.stage.doCheckStage(stage);
|
|
|
return { type: 'stage', stage, filter: month };
|
|
return { type: 'stage', stage, filter: month };
|
|
|
}
|
|
}
|
|
|
|
|
+ async _filterUnderMonth(tender, month, checked) {
|
|
|
|
|
+ const stages = await this._getValidStages(tender.id, 'desc', checked);
|
|
|
|
|
+ let stage = this.ctx.helper._.find(stages, { s_time: month });
|
|
|
|
|
+ if (!stage) {
|
|
|
|
|
+ const checkTime = moment(month);
|
|
|
|
|
+ for (const s of stages) {
|
|
|
|
|
+ const rela_time = moment(s.s_time);
|
|
|
|
|
+ if (rela_time.isBefore(checkTime)) {
|
|
|
|
|
+ stage = s;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (stage) await this.ctx.service.stage.doCheckStage(stage);
|
|
|
|
|
+ return { type: 'stage', stage, filter: stage ? stage.s_time : month };
|
|
|
|
|
+ }
|
|
|
async _filterFinal(tender, checked) {
|
|
async _filterFinal(tender, checked) {
|
|
|
const stages = await this._getValidStages(tender.id, 'desc', checked);
|
|
const stages = await this._getValidStages(tender.id, 'desc', checked);
|
|
|
const stage = stages[0];
|
|
const stage = stages[0];
|
|
@@ -293,6 +309,8 @@ module.exports = app => {
|
|
|
return await this._filterTimeZone(tender, stageInfo.zone, stageInfo.checked);
|
|
return await this._filterTimeZone(tender, stageInfo.zone, stageInfo.checked);
|
|
|
case 'stage-zone':
|
|
case 'stage-zone':
|
|
|
return await this._filterOrderZone(tender, stageInfo.stage_zone, stageInfo.checked);
|
|
return await this._filterOrderZone(tender, stageInfo.stage_zone, stageInfo.checked);
|
|
|
|
|
+ case 'under-month':
|
|
|
|
|
+ return await this._filterUnderMonth(tender, stageInfo.month, stageInfo.checked);
|
|
|
default:
|
|
default:
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|