|
@@ -47,6 +47,7 @@ module.exports = app => {
|
|
|
auditConst: auditConst.settle,
|
|
|
auditType: auditConst.auditType,
|
|
|
};
|
|
|
+ renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.settle.list);
|
|
|
renderData.settles = await ctx.service.settle.getValidSettles(ctx.tender.id);
|
|
|
for (const s of renderData.settles) {
|
|
|
if (s.status === auditConst.settle.status.uncheck) {
|
|
@@ -63,7 +64,7 @@ module.exports = app => {
|
|
|
renderData.checkedStageCount = await ctx.service.stage.count({ tid: ctx.tender.id, status: auditConst.stage.status.checked });
|
|
|
await this.layout('settle/list.ejs', renderData, 'settle/list_modal.ejs');
|
|
|
} catch (err) {
|
|
|
- this.log(err);
|
|
|
+ ctx.log(err);
|
|
|
ctx.redirect(this.menu.menu.dashboard.url);
|
|
|
}
|
|
|
}
|
|
@@ -82,7 +83,7 @@ module.exports = app => {
|
|
|
await ctx.service.settle.loadAuditViewData(settle);
|
|
|
ctx.body = { err: 0, msg: '', data: settle };
|
|
|
} catch (error) {
|
|
|
- this.log(error);
|
|
|
+ ctx.log(error);
|
|
|
ctx.body = { err: 1, msg: error.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
@@ -150,7 +151,6 @@ module.exports = app => {
|
|
|
async _getDefaultRenderData(ctx) {
|
|
|
const data = {
|
|
|
tender: ctx.tender.data,
|
|
|
- tenderMenu: JSON.parse(JSON.stringify(this.menu.settleMenu)),
|
|
|
auditConst: auditConst.settle,
|
|
|
measureType,
|
|
|
preUrl: '/tender/' + ctx.tender.id + '/settle/' + ctx.params.sorder,
|
|
@@ -194,6 +194,7 @@ module.exports = app => {
|
|
|
renderData.whiteList = this.ctx.app.config.multipart.whitelist;
|
|
|
await this.layout('settle/index.ejs', renderData, 'settle/modal.ejs');
|
|
|
} catch(err) {
|
|
|
+ console.log(err);
|
|
|
ctx.log(err);
|
|
|
ctx.redirect('/tender/' + ctx.tender.id + '/settle');
|
|
|
}
|
|
@@ -236,10 +237,36 @@ module.exports = app => {
|
|
|
|
|
|
ctx.body = responseData;
|
|
|
} catch (err) {
|
|
|
- this.log(err);
|
|
|
+ ctx.log(err);
|
|
|
ctx.body = { err: 1, msg: err.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ async loadGatherData(ctx) {
|
|
|
+ try {
|
|
|
+ const settle = await this.ctx.service.settle.getLatestCompleteSettle(ctx.tender.id);
|
|
|
+ const bills = await this.ctx.service.settleBillsFinal.getDataByCondition({ where: { settle_id: settle.id }});
|
|
|
+ const pos = await this.ctx.service.settlePosFinal.getDataByCondition({ where: { settle_id: settle.id }});
|
|
|
+ ctx.body = { err: 0, msg: '', data: { bills, pos } };
|
|
|
+ } catch(err) {
|
|
|
+ ctx.log(err);
|
|
|
+ ctx.ajaxErrorBody(err, '获取结算汇总数据错误');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ async gather(ctx) {
|
|
|
+ try {
|
|
|
+ const renderData = {
|
|
|
+ tender: ctx.tender.data,
|
|
|
+ preUrl: `/tender/${ctx.tender.id}/measure/stage`,
|
|
|
+ };
|
|
|
+ renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.settle.gather);
|
|
|
+ await this.layout('settle/gather.ejs', renderData, 'settle/gather_modal.ejs');
|
|
|
+ } catch (err) {
|
|
|
+ ctx.log(err);
|
|
|
+ ctx.redirect(this.menu.menu.dashboard.url);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return SettleController;
|