|
@@ -23,6 +23,30 @@ const needCustomTables = ['mem_gather_stage_bills', 'mem_gather_deal_bills', 'me
|
|
|
|
|
|
module.exports = app => {
|
|
|
class ReportController extends app.BaseController {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取审批界面所需的 原报、审批人数据等
|
|
|
+ * @param ctx
|
|
|
+ * @return {Promise<void>}
|
|
|
+ * @private
|
|
|
+ */
|
|
|
+ async _getStageAuditViewData(ctx) {
|
|
|
+ const times = ctx.stage.status === auditConst.stage.status.checkNo ? ctx.stage.times - 1 : ctx.stage.times;
|
|
|
+
|
|
|
+ ctx.stage.user = await ctx.service.projectAccount.getAccountInfoById(ctx.stage.user_id);
|
|
|
+ ctx.stage.auditHistory = [];
|
|
|
+ if (ctx.stage.times > 1) {
|
|
|
+ for (let i = 1; i < ctx.stage.times; i++) {
|
|
|
+ ctx.stage.auditHistory.push(await ctx.service.stageAudit.getAuditors(ctx.stage.id, i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 获取审批流程中左边列表
|
|
|
+ ctx.stage.auditors2 = await ctx.service.stageAudit.getAuditGroupByList(ctx.stage.id, times);
|
|
|
+ if (ctx.stage.status === auditConst.stage.status.uncheck || ctx.stage.status === auditConst.stage.status.checkNo) {
|
|
|
+ ctx.stage.auditorList = await ctx.service.stageAudit.getAuditors(ctx.stage.id, ctx.stage.times);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 报表显示页面
|
|
|
*
|
|
@@ -31,6 +55,7 @@ module.exports = app => {
|
|
|
*/
|
|
|
async index(ctx) {
|
|
|
try {
|
|
|
+ await this._getStageAuditViewData(ctx);
|
|
|
const tender = ctx.tender;
|
|
|
const stage = ctx.stage;
|
|
|
// console.log(tender.data);
|
|
@@ -138,7 +163,15 @@ module.exports = app => {
|
|
|
if (custTreeNodes.length > 0) {
|
|
|
rpt_tpl_items = custTreeNodes[0].rpt_tpl_items;
|
|
|
}
|
|
|
+
|
|
|
+ // 获取所有项目参与者
|
|
|
+ const accountList = await ctx.service.projectAccount.getAllDataByCondition({
|
|
|
+ where: { project_id: ctx.session.sessionProject.id, enable: 1 },
|
|
|
+ columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group'],
|
|
|
+ });
|
|
|
const renderData = {
|
|
|
+ accountGroup,
|
|
|
+ accountList,
|
|
|
tender: tender.data,
|
|
|
tenderInfo: tender.info,
|
|
|
rpt_tpl_data: JSON.stringify(treeNodes),
|
|
@@ -157,7 +190,7 @@ module.exports = app => {
|
|
|
role_list: JSON.stringify(roleList),
|
|
|
used_list: JSON.stringify(usedList),
|
|
|
tenderMenu,
|
|
|
- preUrl: '/tender/' + tender.id,
|
|
|
+ preUrl: '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.params.order,
|
|
|
measureType,
|
|
|
categoryData,
|
|
|
tenderList,
|
|
@@ -168,7 +201,7 @@ module.exports = app => {
|
|
|
rptCustomType: reportConst.rptCustomType,
|
|
|
materialList,
|
|
|
stages: stageList,
|
|
|
- dataSelects
|
|
|
+ dataSelects,
|
|
|
};
|
|
|
await this.layout('report/index.ejs', renderData, 'report/rpt_all_popup.ejs');
|
|
|
// await this.layout('report/index.ejs', renderData);
|
|
@@ -186,8 +219,7 @@ module.exports = app => {
|
|
|
}
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
|
- console.log(err);
|
|
|
- // ctx.redirect('/tender/' + ctx.tender.id);
|
|
|
+ ctx.redirect('/tender/' + ctx.tender.id + '/measure/stage');
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -747,7 +779,8 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
|
|
|
}
|
|
|
// 如果是用户交互类型的表,则应该单独获取数据
|
|
|
if (params.customSelect && params.customSelect[tplIdx]) {
|
|
|
- const cfTables = [], cmFieldKeys = [];
|
|
|
+ const cfTables = [],
|
|
|
+ cmFieldKeys = [];
|
|
|
const curFilter = rptDataUtil.getDataRequestFilter();
|
|
|
for (const table of curFilter.tables) {
|
|
|
if (needCustomTables.indexOf(table) >= 0) {
|