|
@@ -148,6 +148,22 @@ module.exports = app => {
|
|
|
return { accountList, newAccountGroup, advance };
|
|
|
}
|
|
|
|
|
|
+ async _getPrjAccList(ctx, pageShow) {
|
|
|
+ let prjAccList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile', 'company_id', 'account', 'telephone', 'permission', 'sign_path', 'stamp_path']);
|
|
|
+ // 根据需求,如果开启了‘开启个人「签字」’功能,则只能是本身用户签名,管理员例外
|
|
|
+ if (!ctx.session.sessionUser.is_admin && pageShow.individualSign === 1) {
|
|
|
+ // 削减其他account
|
|
|
+ const newAccList = [];
|
|
|
+ for (const acc of prjAccList) {
|
|
|
+ if (acc.id === this.ctx.session.sessionUser.accountId) {
|
|
|
+ newAccList.push(acc);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ prjAccList = newAccList;
|
|
|
+ }
|
|
|
+ return prjAccList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 报表显示页面
|
|
|
*
|
|
@@ -235,25 +251,9 @@ module.exports = app => {
|
|
|
archiveList = JSON.parse(archives[0].content);
|
|
|
}
|
|
|
}
|
|
|
- // let prjAccList = await ctx.service.projectAccount.getAllAccountByProjectId(tender.data.project_id);
|
|
|
- // prjAccList = prjAccList.filter(pa => pa.enable !== 0);
|
|
|
- let prjAccList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile', 'company_id', 'account', 'telephone', 'permission', 'sign_path', 'stamp_path']);
|
|
|
const roleList = await ctx.service.signatureRole.getSignatureRolesByTenderId(tender.id);
|
|
|
const usedList = await ctx.service.signatureUsed.getSignatureUsedByTenderId(tender.id);
|
|
|
-
|
|
|
- // ctx.session.sessionUser.is_admin
|
|
|
- // const pageShow = ctx.session.sessionProject.page_show;
|
|
|
- // 根据需求,如果开启了‘开启个人「签字」’功能,则只能是本身用户签名,管理员例外
|
|
|
- if (!ctx.session.sessionUser.is_admin && pageShow.individualSign === 1) {
|
|
|
- // 削减其他account
|
|
|
- const newAccList = [];
|
|
|
- for (const acc of prjAccList) {
|
|
|
- if (acc.id === this.ctx.session.sessionUser.accountId) {
|
|
|
- newAccList.push(acc);
|
|
|
- }
|
|
|
- }
|
|
|
- prjAccList = newAccList;
|
|
|
- }
|
|
|
+ const prjAccList = this._getPrjAccList(ctx, pageShow);
|
|
|
|
|
|
// 分类列表
|
|
|
const categoryData = await this.ctx.service.category.getAllCategory(ctx.subProject);
|
|
@@ -433,22 +433,9 @@ module.exports = app => {
|
|
|
const isAdmin = ctx.session.sessionUser.is_admin;
|
|
|
const lastAuditor = null;
|
|
|
const archiveList = [];
|
|
|
- // let prjAccList = await ctx.service.projectAccount.getAllAccountByProjectId(tender.pid);
|
|
|
- // prjAccList = prjAccList.filter(pa => pa.enable !== 0);
|
|
|
- let prjAccList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile', 'company_id', 'account', 'telephone', 'permission', 'sign_path', 'stamp_path']);
|
|
|
const roleList = await ctx.service.signatureRole.getSignatureRolesByTenderId(tender.id);
|
|
|
const usedList = await ctx.service.signatureUsed.getSignatureUsedByTenderId(tender.id);
|
|
|
- // 根据需求,如果开启了‘开启个人「签字」’功能,则只能是本身用户签名,管理员例外
|
|
|
- if (!ctx.session.sessionUser.is_admin && pageShow.individualSign === 1) {
|
|
|
- // 削减其他account
|
|
|
- const newAccList = [];
|
|
|
- for (const acc of prjAccList) {
|
|
|
- if (acc.id === this.ctx.session.sessionUser.accountId) {
|
|
|
- newAccList.push(acc);
|
|
|
- }
|
|
|
- }
|
|
|
- prjAccList = newAccList;
|
|
|
- }
|
|
|
+ const prjAccList = this._getPrjAccList(ctx, pageShow);
|
|
|
// 分类列表 todo 支付审批 目前没有所属子项目,自定义分类暂无法按所属子项目取值
|
|
|
const categoryData = await this.ctx.service.category.getAllCategory(this.ctx.subProject.id);
|
|
|
// 获取用户权限
|
|
@@ -588,22 +575,9 @@ module.exports = app => {
|
|
|
const isAdmin = ctx.session.sessionUser.is_admin;
|
|
|
const lastAuditor = null;
|
|
|
const archiveList = [];
|
|
|
- // let prjAccList = await ctx.service.projectAccount.getAllAccountByProjectId(pid);
|
|
|
- // prjAccList = prjAccList.filter(pa => pa.enable !== 0);
|
|
|
- let prjAccList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile', 'company_id', 'account', 'telephone', 'permission', 'sign_path', 'stamp_path']);
|
|
|
const roleList = [];
|
|
|
const usedList = [];
|
|
|
- // 根据需求,如果开启了‘开启个人「签字」’功能,则只能是本身用户签名,管理员例外
|
|
|
- if (!ctx.session.sessionUser.is_admin && pageShow.individualSign === 1) {
|
|
|
- // 削减其他account
|
|
|
- const newAccList = [];
|
|
|
- for (const acc of prjAccList) {
|
|
|
- if (acc.id === this.ctx.session.sessionUser.accountId) {
|
|
|
- newAccList.push(acc);
|
|
|
- }
|
|
|
- }
|
|
|
- prjAccList = newAccList;
|
|
|
- }
|
|
|
+ const prjAccList = this._getPrjAccList(ctx, pageShow);
|
|
|
// 分类列表
|
|
|
const categoryData = await this.ctx.service.category.getAllCategory(ctx.subProject);
|
|
|
// 获取用户权限
|
|
@@ -806,22 +780,9 @@ module.exports = app => {
|
|
|
archiveList = JSON.parse(archives[0].content);
|
|
|
}
|
|
|
|
|
|
- // let prjAccList = await ctx.service.projectAccount.getAllAccountByProjectId(pid);
|
|
|
- // prjAccList = prjAccList.filter(pa => pa.enable !== 0);
|
|
|
- let prjAccList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile', 'company_id', 'account', 'telephone', 'permission', 'sign_path', 'stamp_path']);
|
|
|
const roleList = [];
|
|
|
const usedList = await ctx.service.signatureUsed.getSignatureUsedByTenderId(tenderId);
|
|
|
- // 根据需求,如果开启了‘开启个人「签字」’功能,则只能是本身用户签名,管理员例外
|
|
|
- if (!ctx.session.sessionUser.is_admin && pageShow.individualSign === 1) {
|
|
|
- // 削减其他account
|
|
|
- const newAccList = [];
|
|
|
- for (const acc of prjAccList) {
|
|
|
- if (acc.id === this.ctx.session.sessionUser.accountId) {
|
|
|
- newAccList.push(acc);
|
|
|
- }
|
|
|
- }
|
|
|
- prjAccList = newAccList;
|
|
|
- }
|
|
|
+ const prjAccList = this._getPrjAccList(ctx, pageShow);
|
|
|
// 分类列表
|
|
|
const categoryData = await this.ctx.service.category.getAllCategory(ctx.subProject);
|
|
|
// 获取用户权限
|
|
@@ -952,7 +913,7 @@ module.exports = app => {
|
|
|
await this._indexForBGL(ctx, sourceTypeConst.sourceType.change_apply, -303);
|
|
|
}
|
|
|
|
|
|
- async _indexForContract(ctx, source_type, stage_id) {
|
|
|
+ async _indexForContract(ctx, source_type, stage_id, preUrl) {
|
|
|
// 合同管理报表入口(项目、标段级别)
|
|
|
try {
|
|
|
await this._getStageAuditViewData(ctx);
|
|
@@ -960,24 +921,140 @@ module.exports = app => {
|
|
|
pageShow.closeWatermark = 1;
|
|
|
pageShow.showArchive = 1;
|
|
|
pageShow.closeShowAllCustomized = 0;
|
|
|
- const tenderId = ctx.params.tid || -1; // 标段级别有
|
|
|
+ // const tenderId = ctx.params.tid || -1; // 标段级别有
|
|
|
+ const tenderId = ctx.contractOptions.tid || -1;
|
|
|
const bglObj = {};
|
|
|
+ // const tender = ctx.tender;
|
|
|
+ const stage = ctx.stage;
|
|
|
+ const stage_order = -1;
|
|
|
+ const sorder = -1;
|
|
|
+ const stage_times = -1;
|
|
|
+ const stage_status = -1;
|
|
|
+ const project_id = ctx.params.id;
|
|
|
+ const { treeNodes, custCfg, commonArrs } = await this._createNodes(ctx, sourceTypeConst.sourceType.contract_management, project_id);
|
|
|
if (stage_id === -400) {
|
|
|
- // 项目级别
|
|
|
- } else {
|
|
|
- // 标段级别 -401
|
|
|
+ // 统一为合同管理
|
|
|
+ }
|
|
|
+ const cust_select_keys = JSON.stringify(['common', 'customize']); // 因其他地方也有可能保存用户报表的显示选择项,因当初设计问题,不好改数据库结构了,但可以调节内部json来满足需求
|
|
|
+ const rpt_tpl_items = { customize: [], common: [] };
|
|
|
+ commonArrs.forEach(item => {
|
|
|
+ rpt_tpl_items.common.push(item.name);
|
|
|
+ });
|
|
|
+ if (treeNodes && treeNodes.length > 0) {
|
|
|
+ for (let tIdx = treeNodes.length - 1; tIdx >= 0; tIdx--) {
|
|
|
+ if (treeNodes[tIdx].name !== '通用报表') {
|
|
|
+ rpt_tpl_items.customize.push(treeNodes[tIdx].name);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ // const custTreeFolders = await ctx.service.rptTreeNodeCust.getCustFoldersByUserId(this.ctx.session.sessionUser.accountId);
|
|
|
+ // if (custTreeFolders.length > 0) {
|
|
|
+ // const cust_select_item = JSON.parse(custTreeFolders[0].rpt_tpl_items);
|
|
|
+ // if (cust_select_item.common) rpt_tpl_items.common = cust_select_item.common;
|
|
|
+ // if (cust_select_item.customize) rpt_tpl_items.customize = cust_select_item.customize;
|
|
|
+ // }
|
|
|
+ // 获取所有项目参与者
|
|
|
+ const { accountList, newAccountGroup, advance } = await this._getInvolveAcc(ctx, tenderId);
|
|
|
+ const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } }); // 找公司章用的
|
|
|
+ const roleList = await ctx.service.signatureRole.getSignatureRolesByTenderId(tenderId);
|
|
|
+ const usedList = await ctx.service.signatureUsed.getSignatureUsedByTenderId(tenderId);
|
|
|
+ const isAdmin = ctx.session.sessionUser.is_admin;
|
|
|
+ const prjAccList = await this._getPrjAccList(ctx, pageShow);
|
|
|
+ for (const prjAcc of prjAccList) {
|
|
|
+ prjAcc.account_group = prjAcc.company;
|
|
|
+ }
|
|
|
+ // 分类列表
|
|
|
+ const categoryData = await this.ctx.service.category.getAllCategory(ctx.subProject);
|
|
|
+ // // 获取用户权限
|
|
|
+ const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
|
|
|
+ const tenderList = [];
|
|
|
+ const cid = this.ctx.helper._.map(treeNodes, 'id');
|
|
|
+ const customSelects = null;
|
|
|
+ const dataSelects = {};
|
|
|
+ dataSelects.material_select = await ctx.service.rptCustomDefine.getDataSelectByRpt(cid,
|
|
|
+ reportConst.rptDataType[JV.NODE_CUS_MATERIAL_SELECT]);
|
|
|
+
|
|
|
+ // const materialList = await ctx.service.material.getValidMaterials(ctx.tenderId);
|
|
|
+ // const materialAdjAuditList = await ctx.service.materialAudit.getAuditorsByTender(tenderId);
|
|
|
+
|
|
|
+ const renderData = {
|
|
|
+ accountGroup: newAccountGroup,
|
|
|
+ accountList,
|
|
|
+ unitList: JSON.stringify(unitList),
|
|
|
+ tender: null,
|
|
|
+ tenderInfo: null,
|
|
|
+ rpt_tpl_data: JSON.stringify(treeNodes),
|
|
|
+ cust_tpl_data: JSON.stringify(rpt_tpl_items),
|
|
|
+ all_common_tpl_data: JSON.stringify([]),
|
|
|
+ all_indivi_tpl_data: JSON.stringify([]),
|
|
|
+ cust_select_keys,
|
|
|
+ cust_cfg: JSON.stringify(custCfg),
|
|
|
+ project_id,
|
|
|
+ tender_id: tenderId,
|
|
|
+ budget_id: -1,
|
|
|
+ sp_id: -1,
|
|
|
+ tender_name: '',
|
|
|
+ detail_id: -1,
|
|
|
+ stg_id: stage_id,
|
|
|
+ stg_order: stage_order,
|
|
|
+ cur_order: sorder,
|
|
|
+ stg_times: stage_times,
|
|
|
+ stg_status: stage_status,
|
|
|
+ stage_list: '[]',
|
|
|
+ prj_account_list: JSON.stringify(prjAccList),
|
|
|
+ role_list: JSON.stringify(roleList),
|
|
|
+ used_list: JSON.stringify(usedList),
|
|
|
+ tenderMenu,
|
|
|
+ preUrl,
|
|
|
+ thisUrl: `/sp/${ctx.params.id}/contract/detail`, // 合同专有
|
|
|
+ measureType,
|
|
|
+ categoryData,
|
|
|
+ tenderList,
|
|
|
+ auditConst: auditConst.stage,
|
|
|
+ ledgerAuditConst: auditConst.ledger,
|
|
|
+ jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.report.main),
|
|
|
+ customSelects,
|
|
|
+ rptCustomType: reportConst.rptCustomType,
|
|
|
+ advanceList: JSON.stringify([]),
|
|
|
+ advanceAuditList: JSON.stringify([]),
|
|
|
+ materialAdjList: JSON.stringify([]),
|
|
|
+ materialAdjAuditList: JSON.stringify([]),
|
|
|
+ materialList: [],
|
|
|
+ stages: [],
|
|
|
+ dataSelects,
|
|
|
+ pageShow,
|
|
|
+ authMobile: accountInfo.auth_mobile,
|
|
|
+ shenpiConst,
|
|
|
+ archiveList: [],
|
|
|
+ lastAuditor: null,
|
|
|
+ rpt_id: ctx.query.rpt_id,
|
|
|
+ isAdmin,
|
|
|
+ prePay: JSON.stringify(advance),
|
|
|
+ OSS_PATH: ctx.app.config.fujianOssPath,
|
|
|
+ viewPmData: PermissionCheck.viewPmData(this.ctx.session.sessionUser.permission),
|
|
|
+ source_type,
|
|
|
+ bglObj: JSON.stringify(bglObj),
|
|
|
+ changes: 'null',
|
|
|
+ otherChangeList: 'null',
|
|
|
+ otherHintName: '',
|
|
|
+ bizId: bglObj.BUSINESS_ID,
|
|
|
+ };
|
|
|
+ await this.layout('report/index.ejs', renderData, 'report/rpt_all_popup.ejs');
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async indexForProjectContract(ctx) {
|
|
|
- await this._indexForContract(ctx, sourceTypeConst.sourceType.project_contract, -400);
|
|
|
+ const preUrl = `/sp/${ctx.params.prjid}/contract/panel`;
|
|
|
+ await this._indexForContract(ctx, sourceTypeConst.sourceType.contract_management, -400, preUrl);
|
|
|
}
|
|
|
|
|
|
async indexForTenderContract(ctx) {
|
|
|
- await this._indexForContract(ctx, sourceTypeConst.sourceType.tender_contract, -401);
|
|
|
+ // const preUrl = `/sp/${ctx.params.prjid}/contract/panel`;
|
|
|
+ const preUrl = '';
|
|
|
+ await this._indexForContract(ctx, sourceTypeConst.sourceType.contract_management, -400, preUrl);
|
|
|
}
|
|
|
|
|
|
/**
|