|
@@ -232,9 +232,12 @@ module.exports = app => {
|
|
|
for (const prjAcc of prjAccList) {
|
|
|
prjAcc.account_group = accountGroup[prjAcc.account_group];
|
|
|
}
|
|
|
- let rpt_tpl_items = '{ customize: [], common: [] }';
|
|
|
+ const cust_select_keys = JSON.stringify(['common', 'customize']); // 因其他地方也有可能保存用户报表的显示选择项,因当初设计问题,不好改数据库结构了,但可以调节内部json来满足需求
|
|
|
+ const rpt_tpl_items = { customize: [], common: [] };
|
|
|
if (custTreeNodes.length > 0) {
|
|
|
- rpt_tpl_items = custTreeNodes[0].rpt_tpl_items;
|
|
|
+ const cust_select_item = JSON.parse(custTreeNodes[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;
|
|
|
}
|
|
|
|
|
|
// 获取所有项目参与者
|
|
@@ -264,7 +267,8 @@ module.exports = app => {
|
|
|
tender: tender.data,
|
|
|
tenderInfo: tender.info,
|
|
|
rpt_tpl_data: JSON.stringify(treeNodes),
|
|
|
- cust_tpl_data: rpt_tpl_items,
|
|
|
+ cust_tpl_data: JSON.stringify(rpt_tpl_items),
|
|
|
+ cust_select_keys,
|
|
|
cust_cfg: JSON.stringify(custCfg),
|
|
|
project_id: tender.data.project_id,
|
|
|
tender_id: tender.id,
|
|
@@ -410,6 +414,7 @@ module.exports = app => {
|
|
|
prjAcc.account_group = accountGroup[prjAcc.account_group];
|
|
|
}
|
|
|
// const rpt_tpl_items = '{ customize: [], common: [] }';
|
|
|
+ const cust_select_keys = JSON.stringify(['common_safe', 'customize_safe']); // 因其他地方也有可能保存用户报表的显示选择项,因当初设计问题,不好改数据库结构了,但可以调节内部json来满足需求,安全生产费没有这个,就过了
|
|
|
const rpt_tpl_items = { customize: [], common: [] };
|
|
|
commonArrs.forEach(item => {
|
|
|
rpt_tpl_items.common.push(item.name);
|
|
@@ -444,6 +449,7 @@ module.exports = app => {
|
|
|
rpt_tpl_data: JSON.stringify(treeNodes),
|
|
|
// cust_tpl_data: rpt_tpl_items,
|
|
|
cust_tpl_data: JSON.stringify(rpt_tpl_items),
|
|
|
+ cust_select_keys,
|
|
|
cust_cfg: JSON.stringify(custCfg),
|
|
|
project_id: tender.pid,
|
|
|
tender_id: tenderId,
|
|
@@ -496,9 +502,9 @@ module.exports = app => {
|
|
|
try {
|
|
|
await this._getStageAuditViewData(ctx);
|
|
|
const pageShow = ctx.session.sessionProject.page_show;
|
|
|
- pageShow.showArchive = 1;
|
|
|
// pageShow.closeWatermark = 1;
|
|
|
pageShow.showArchive = 0;
|
|
|
+ pageShow.closeShowAllCustomized = 0;
|
|
|
const tenderId = -1;
|
|
|
const paymentDetail_id = -1;
|
|
|
// const tender = ctx.paymentTender;
|
|
@@ -514,6 +520,7 @@ module.exports = app => {
|
|
|
});
|
|
|
// 加一个dummy的通用报表
|
|
|
const dummyCommonRptNode = { id: 1, name: '通用报表', pid: -1, rpt_type: 0, items: JSON.stringify(commonArrs) };
|
|
|
+ // const dummyCommonRptNode = { id: 1, name: '通用报表', pid: -1, rpt_type: 0, items: '[]' };
|
|
|
treeNodes.push(dummyCommonRptNode);
|
|
|
// const custTreeNodes = await ctx.service.rptTreeNodeCust.getCustFoldersByUserId(this.ctx.session.sessionUser.accountId);
|
|
|
const custCfg = await ctx.service.rptCustomizeCfg.getCustomizeCfgByUserId('Administrator');
|
|
@@ -561,11 +568,23 @@ module.exports = app => {
|
|
|
for (const prjAcc of prjAccList) {
|
|
|
prjAcc.account_group = accountGroup[prjAcc.account_group];
|
|
|
}
|
|
|
- // const rpt_tpl_items = '{ customize: [], common: [] }';
|
|
|
+ const cust_select_keys = JSON.stringify(['common_dynamic', 'customize_dynamic']); // 因其他地方也有可能保存用户报表的显示选择项,因当初设计问题,不好改数据库结构了,但可以调节内部json来满足需求
|
|
|
const rpt_tpl_items = { customize: [], common: [] };
|
|
|
- commonArrs.forEach(item => {
|
|
|
- rpt_tpl_items.common.push(item.name);
|
|
|
- });
|
|
|
+ const custTreeNodes = await ctx.service.rptTreeNodeCust.getCustFoldersByUserId(this.ctx.session.sessionUser.accountId);
|
|
|
+ if (custTreeNodes.length > 0) {
|
|
|
+ const cust_select_item = JSON.parse(custTreeNodes[0].rpt_tpl_items);
|
|
|
+ if (cust_select_item.common_dynamic) rpt_tpl_items.common = cust_select_item.common_dynamic;
|
|
|
+ if (cust_select_item.customize_dynamic) rpt_tpl_items.customize = cust_select_item.customize_dynamic;
|
|
|
+ if (!cust_select_item.hasOwnProperty('common_dynamic') && !cust_select_item.hasOwnProperty('customize_dynamic')) {
|
|
|
+ commonArrs.forEach(item => {
|
|
|
+ rpt_tpl_items.common.push(item.name);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ commonArrs.forEach(item => {
|
|
|
+ rpt_tpl_items.common.push(item.name);
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
// 获取所有项目参与者
|
|
|
const accountList = await ctx.service.projectAccount.getAllDataByCondition({
|
|
@@ -596,6 +615,7 @@ module.exports = app => {
|
|
|
rpt_tpl_data: JSON.stringify(treeNodes),
|
|
|
// cust_tpl_data: rpt_tpl_items,
|
|
|
cust_tpl_data: JSON.stringify(rpt_tpl_items),
|
|
|
+ cust_select_keys,
|
|
|
cust_cfg: JSON.stringify(custCfg),
|
|
|
project_id: pid,
|
|
|
tender_id: tenderId,
|
|
@@ -1204,8 +1224,9 @@ module.exports = app => {
|
|
|
const params = JSON.parse(ctx.request.body.params);
|
|
|
// console.log(params);
|
|
|
const custId = this.ctx.session.sessionUser.accountId;
|
|
|
- const newNodeItems = JSON.stringify(params.nodeItems);
|
|
|
- const rst = await ctx.service.rptTreeNodeCust.updateCustNode(custId, newNodeItems);
|
|
|
+ const newNodeItems = params.nodeItems;
|
|
|
+ const custSelectKeys = params.custSelectKeys;
|
|
|
+ const rst = await ctx.service.rptTreeNodeCust.updateCustNode(custId, newNodeItems, custSelectKeys);
|
|
|
// console.log(rst);
|
|
|
ctx.body = { data: rst };
|
|
|
// ctx.body = { data: { msg: 'test the network' } };
|