|
|
@@ -40,12 +40,12 @@ module.exports = app => {
|
|
|
rela: { title: '关联标段', value: 1 },
|
|
|
},
|
|
|
info: {
|
|
|
- view: { title: '查看', value: 1},
|
|
|
+ view: { title: '查看', value: 1 },
|
|
|
edit: { title: '编辑', value: 2 },
|
|
|
editfile: { title: '编辑文件', value: 3 },
|
|
|
},
|
|
|
datacollect: {
|
|
|
- view: { title: '查看', value: 1},
|
|
|
+ view: { title: '查看', value: 1 },
|
|
|
},
|
|
|
contract: {
|
|
|
edit: { title: '编辑节点', value: 1 },
|
|
|
@@ -75,7 +75,8 @@ module.exports = app => {
|
|
|
this.PermissionBlock = [
|
|
|
{ key: 'datacollect', name: '决策大屏', field: 'datacollect_permission' },
|
|
|
{ key: 'info', name: '项目概况', field: 'info_permission' },
|
|
|
- { key: 'contract', name: '项目合同', field: 'contract_permission', hint: ['1、编辑节点:编辑合同管理内页树结构',
|
|
|
+ {
|
|
|
+ key: 'contract', name: '项目合同', field: 'contract_permission', hint: ['1、编辑节点:编辑合同管理内页树结构',
|
|
|
'2、添加合同:允许添加合同',
|
|
|
'3、编辑合同:编辑非自己上传的合同信息',
|
|
|
'4、添加支付:给非自己上传的合同添加合同支付',
|
|
|
@@ -83,7 +84,8 @@ module.exports = app => {
|
|
|
'6、授权节点下查看本单位合同:授权节点下查看本单位人员添加的所有合同',
|
|
|
'7、查看所有合同:未授权节点情况下可以查看包括其他单位人员添加的合同',
|
|
|
'注:查看合同第5、6、7必须选择其一,否则无法查看本项目合同管理',
|
|
|
- ] },
|
|
|
+ ]
|
|
|
+ },
|
|
|
{ key: 'file', name: '资料管理', field: 'file_permission' },
|
|
|
{ key: 'budget', name: '项目进度', field: 'budget_permission' },
|
|
|
{
|
|
|
@@ -101,7 +103,7 @@ module.exports = app => {
|
|
|
const pConst = this.PermissionConst[c.key];
|
|
|
if (!pConst) continue;
|
|
|
for (const prop in pConst) {
|
|
|
- c.permission.push({ key: prop, ...pConst[prop]});
|
|
|
+ c.permission.push({ key: prop, ...pConst[prop] });
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
@@ -109,7 +111,7 @@ module.exports = app => {
|
|
|
const pConst = this.PermissionConst[p.key];
|
|
|
if (!pConst) continue;
|
|
|
for (const prop in pConst) {
|
|
|
- p.permission.push({ key: prop, ...pConst[prop]});
|
|
|
+ p.permission.push({ key: prop, ...pConst[prop] });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -126,7 +128,7 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- get adminPermission () {
|
|
|
+ get adminPermission() {
|
|
|
return {
|
|
|
budget_permission: this.ctx.helper.mapAllSubField(this.PermissionConst.budget, 'value'),
|
|
|
file_permission: this.ctx.helper.mapAllSubField(this.PermissionConst.file, 'value'),
|
|
|
@@ -169,7 +171,7 @@ module.exports = app => {
|
|
|
x.contract_permission = x.contract_permission ? _.map(x.contract_permission.split(','), _.toInteger) : [];
|
|
|
x.fund_pay_permission = x.fund_pay_permission ? _.map(x.fund_pay_permission.split(','), _.toInteger) : [];
|
|
|
x.fund_trans_permission = x.fund_trans_permission ? _.map(x.fund_trans_permission.split(','), _.toInteger) : [];
|
|
|
- x.filing_type = x.filing_type ? _.map(x.filing_type.split(','), _.toInteger): [];
|
|
|
+ x.filing_type = x.filing_type ? _.map(x.filing_type.split(','), _.toInteger) : [];
|
|
|
x.payment_permission = x.payment_permission ? _.map(x.payment_permission.split(','), _.toInteger) : [];
|
|
|
});
|
|
|
}
|
|
|
@@ -190,9 +192,9 @@ module.exports = app => {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- async getUserPermission(pid, uid) {
|
|
|
+ async getUserPermission(pid = this.ctx.session.sessionProject.id, uid = this.ctx.session.sessionUser.accountId) {
|
|
|
const result = await this.getAllDataByCondition({
|
|
|
- where: { uid: this.ctx.session.sessionUser.accountId, pid: this.ctx.session.sessionProject.id }
|
|
|
+ where: { uid, pid }
|
|
|
});
|
|
|
this.parsePermission(result);
|
|
|
return result;
|
|
|
@@ -334,7 +336,7 @@ module.exports = app => {
|
|
|
// }
|
|
|
await conn.updateRows(this.tableName, updateData);
|
|
|
await conn.commit();
|
|
|
- } catch(err) {
|
|
|
+ } catch (err) {
|
|
|
await conn.rollback();
|
|
|
throw err;
|
|
|
}
|
|
|
@@ -342,7 +344,7 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
async _copyUserPermission(copyData, force = false) {
|
|
|
- const copyPermission = await this.getAllDataByCondition({ where: { spid: this.ctx.subProject.id, uid: copyData.uid }});
|
|
|
+ const copyPermission = await this.getAllDataByCondition({ where: { spid: this.ctx.subProject.id, uid: copyData.uid } });
|
|
|
if (copyPermission.length === 0) throw '选择的用户不存在';
|
|
|
|
|
|
const insertData = [], updateData = [];
|
|
|
@@ -489,13 +491,13 @@ module.exports = app => {
|
|
|
|
|
|
async getContractPermission(cp) {
|
|
|
const permission = {
|
|
|
- permission_edit: cp.indexOf(1) !== -1 ? 1: 0,
|
|
|
- permission_add: cp.indexOf(2) !== -1 ? 1: 0,
|
|
|
- permission_edit_contract: cp.indexOf(7) !== -1 ? 1: 0,
|
|
|
- permission_add_pay: cp.indexOf(8) !== -1 ? 1: 0,
|
|
|
- permission_show_node: cp.indexOf(3) !== -1 ? 1: 0,
|
|
|
- permission_show_unit: cp.indexOf(4) !== -1 ? 1: 0,
|
|
|
- permission_att: cp.indexOf(6) !== -1 ? 1: 0,
|
|
|
+ permission_edit: cp.indexOf(1) !== -1 ? 1 : 0,
|
|
|
+ permission_add: cp.indexOf(2) !== -1 ? 1 : 0,
|
|
|
+ permission_edit_contract: cp.indexOf(7) !== -1 ? 1 : 0,
|
|
|
+ permission_add_pay: cp.indexOf(8) !== -1 ? 1 : 0,
|
|
|
+ permission_show_node: cp.indexOf(3) !== -1 ? 1 : 0,
|
|
|
+ permission_show_unit: cp.indexOf(4) !== -1 ? 1 : 0,
|
|
|
+ permission_att: cp.indexOf(6) !== -1 ? 1 : 0,
|
|
|
};
|
|
|
return permission;
|
|
|
}
|
|
|
@@ -540,7 +542,7 @@ module.exports = app => {
|
|
|
return permission;
|
|
|
}
|
|
|
|
|
|
- async savePaymentPermissionAudits(spid, uids, operation = 'add', transaction= null) {
|
|
|
+ async savePaymentPermissionAudits(spid, uids, operation = 'add', transaction = null) {
|
|
|
const updateArr = [];
|
|
|
const spAudits = await this.getAllDataByCondition({ where: { spid: spid, uid: uids } });
|
|
|
for (const a of spAudits) {
|
|
|
@@ -598,7 +600,7 @@ module.exports = app => {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- async saveDatacollectPermissionAudits(spid, uids, operation = 'add', transaction= null) {
|
|
|
+ async saveDatacollectPermissionAudits(spid, uids, operation = 'add', transaction = null) {
|
|
|
const updateArr = [];
|
|
|
const spAudits = await this.getAllDataByCondition({ where: { spid: spid, uid: uids } });
|
|
|
for (const a of spAudits) {
|