|
@@ -46,8 +46,9 @@ module.exports = app => {
|
|
|
async index(ctx) {
|
|
|
try {
|
|
|
// 获取标段审批信息
|
|
|
- const noticeList = await ctx.service.noticePush.getNotice(ctx.session.sessionProject.id);
|
|
|
- console.log(noticeList);
|
|
|
+ const tenderidList = [];
|
|
|
+ console.log(ctx.session.sessionProject.dataCollect);
|
|
|
+ const noticeList = await ctx.service.noticePush.getNoticeByDataCollect(ctx.session.sessionProject.id, tenderidList);
|
|
|
const renderData = {
|
|
|
noticeList,
|
|
|
acLedger: auditConst.ledger,
|
|
@@ -65,6 +66,49 @@ module.exports = app => {
|
|
|
ctx.redirect(this.menu.menu.dashboard.url);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ async loadData(ctx) {
|
|
|
+ try {
|
|
|
+ const responseData = { err: 0, msg: '', data: {} };
|
|
|
+ // const tenderidList = [];
|
|
|
+ // const noticeList = await ctx.service.noticePush.getNoticeByDataCollect(ctx.session.sessionProject.id, tenderidList);
|
|
|
+ const tenderList = await ctx.service.tender.getList('', null, 1);
|
|
|
+ const thisMonth = new Date();
|
|
|
+ const [startMonth, endMonth] = ctx.helper.getStartEndMonth(thisMonth);
|
|
|
+ for (const t of tenderList) {
|
|
|
+ const tenderInfo = await ctx.service.tenderInfo.getTenderInfo(t.id);
|
|
|
+ t.contract_price = tenderInfo.deal_param.contractPrice;
|
|
|
+
|
|
|
+ if (t.ledger_status === auditConst.ledger.status.checkNo || t.ledger_status === auditConst.ledger.status.uncheck) {
|
|
|
+ const sum = await ctx.service.ledger.addUp({ tender_id: t.id/* , is_leaf: true*/ });
|
|
|
+ t.total_price = sum.total_price;
|
|
|
+ t.deal_tp = sum.deal_tp;
|
|
|
+ }
|
|
|
+ t.advance_tp = await ctx.service.advance.getSumAdvance(t.id);
|
|
|
+
|
|
|
+ if (t.ledger_status === auditConst.ledger.status.checked) {
|
|
|
+ t.lastStage = await ctx.service.stage.getLastestStage(t.id, true);
|
|
|
+ if (t.lastStage && t.lastStage.status === auditConst.stage.status.uncheck &&
|
|
|
+ t.lastStage.user_id !== ctx.session.sessionUser.accountId) {
|
|
|
+ t.lastStage = await ctx.service.stage.getLastestStage(t.id);
|
|
|
+ }
|
|
|
+ if (t.lastStage) await ctx.service.stage.checkStageGatherData(t.lastStage);
|
|
|
+ t.completeStage = await ctx.service.stage.getLastestCompleteStage(t.id);
|
|
|
+ }
|
|
|
+ t.material_tp = await ctx.service.material.getSumMaterial(t.id);
|
|
|
+ // 获取本标段 本月计量期审批通过数目,变更令审批通过数目,台账修订通过数目,材料调差通过数目
|
|
|
+ t.month_stage_num = await this.ctx.service.stageAudit.getNumByMonth(t.id, startMonth, endMonth);
|
|
|
+ t.month_change_num = await this.ctx.service.changeAudit.getNumByMonth(t.id, startMonth, endMonth);
|
|
|
+ t.month_revise_num = await this.ctx.service.reviseAudit.getNumByMonth(t.id, startMonth, endMonth);
|
|
|
+ t.month_material_num = await this.ctx.service.materialAudit.getNumByMonth(t.id, startMonth, endMonth);
|
|
|
+ }
|
|
|
+ responseData.data.tenderList = tenderList;
|
|
|
+ ctx.body = responseData;
|
|
|
+ } catch (err) {
|
|
|
+ this.log(err);
|
|
|
+ ctx.body = { err: 1, msg: err.toString(), data: null };
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return DatacollectController;
|