|
@@ -515,7 +515,6 @@ module.exports = app => {
|
|
|
// 获取验证规则
|
|
|
const rule = ctx.service.projectAccount.rule('modify');
|
|
|
ctx.validate(rule);
|
|
|
-
|
|
|
const result = await ctx.service.projectAccount.save(ctx.request.body);
|
|
|
if (!result) {
|
|
|
throw '保存账号数据失败';
|
|
@@ -1084,9 +1083,14 @@ module.exports = app => {
|
|
|
where: { project_id: ctx.session.sessionProject.id, enable: 1 },
|
|
|
columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
|
|
|
});
|
|
|
- const accountGroupList = accountGroup.map((item, idx) => {
|
|
|
- const groupList = accountList.filter(item => item.account_group === idx);
|
|
|
- return { groupName: item, groupList };
|
|
|
+ // const accountGroupList = accountGroup.map((item, idx) => {
|
|
|
+ // const groupList = accountList.filter(item => item.account_group === idx);
|
|
|
+ // return { groupName: item, groupList };
|
|
|
+ // });
|
|
|
+ const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
|
|
|
+ const accountGroupList = unitList.map(item => {
|
|
|
+ const groupList = accountList.filter(item1 => item1.company === item.name);
|
|
|
+ return { groupName: item.name, companyId: item.id, groupList };
|
|
|
});
|
|
|
const categoryData = await ctx.service.category.getAllCategory(ctx.session.sessionProject.id);
|
|
|
const tenders = await ctx.service.tender.getList('', null, 1);
|
|
@@ -1125,25 +1129,25 @@ module.exports = app => {
|
|
|
ctx.session.sessionProject.showDataCollect = data.data_collect ? 1 : 0;
|
|
|
break;
|
|
|
case 'add-audit':
|
|
|
- // 判断该用户的组是否已加入到表中,已加入则提示无需添加
|
|
|
+ // 判断该用户是否已加入到表中,已加入则提示无需添加
|
|
|
const auditInfo = await ctx.service.datacollectAudit.getDataByCondition({ pid: projectId, uid: data.id });
|
|
|
if (auditInfo) {
|
|
|
throw '该用户已存在权限中,无需重复添加';
|
|
|
}
|
|
|
- const accountInfo = await ctx.service.projectAccount.getDataById(data.id);
|
|
|
- const groupInfo = await ctx.service.datacollectAudit.getGroupInfo(projectId, accountInfo.account_group);
|
|
|
- if (groupInfo) {
|
|
|
- throw '该用户所在单位已存在权限中,无需单独添加';
|
|
|
- }
|
|
|
- await ctx.service.datacollectAudit.saveAudit(projectId, accountInfo.account_group, data.id);
|
|
|
+ // const accountInfo = await ctx.service.projectAccount.getDataById(data.id);
|
|
|
+ // const companyInfo = await ctx.service.datacollectAudit.getCompanyInfo(projectId, accountInfo.company_id);
|
|
|
+ // if (companyInfo) {
|
|
|
+ // throw '该用户所在单位已存在权限中,无需单独添加';
|
|
|
+ // }
|
|
|
+ await ctx.service.datacollectAudit.saveAudit(projectId, data.id);
|
|
|
responseData.data = await ctx.service.datacollectAudit.getList(projectId);
|
|
|
break;
|
|
|
- case 'add-group':
|
|
|
- const groupInfo2 = await ctx.service.datacollectAudit.getGroupInfo(projectId, data.id);
|
|
|
- if (groupInfo2) {
|
|
|
+ case 'add-company':
|
|
|
+ const companyInfo = await ctx.service.datacollectAudit.getCompanyInfo(projectId, data.id);
|
|
|
+ if (companyInfo) {
|
|
|
throw '该单位已存在权限中,无需重复添加';
|
|
|
}
|
|
|
- await ctx.service.datacollectAudit.saveGroup(projectId, data.id);
|
|
|
+ await ctx.service.datacollectAudit.saveCompany(projectId, data.id);
|
|
|
responseData.data = await ctx.service.datacollectAudit.getList(projectId);
|
|
|
break;
|
|
|
case 'del-audit':
|
|
@@ -1162,6 +1166,14 @@ module.exports = app => {
|
|
|
await ctx.service.datacollectAudit.delAudit(data.id);
|
|
|
responseData.data = await ctx.service.datacollectAudit.getList(projectId);
|
|
|
break;
|
|
|
+ case 'del-company':
|
|
|
+ const companyInfo2 = await ctx.service.datacollectAudit.getDataById(data.id);
|
|
|
+ if (!companyInfo2) {
|
|
|
+ throw '该单位已不存在权限中,移除失败';
|
|
|
+ }
|
|
|
+ await ctx.service.datacollectAudit.delAudit(data.id);
|
|
|
+ responseData.data = await ctx.service.datacollectAudit.getList(projectId);
|
|
|
+ break;
|
|
|
case 'tender':
|
|
|
if (ctx.session.sessionProject.page_show.addDataCollect !== parseInt(data.add_datacollect)) {
|
|
|
ctx.session.sessionProject.page_show.addDataCollect = parseInt(data.add_datacollect);
|