|
|
@@ -1,4 +1,4 @@
|
|
|
- 'use strict';
|
|
|
+'use strict';
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
@@ -90,7 +90,7 @@ module.exports = app => {
|
|
|
ctx.body = responseData;
|
|
|
} catch (err) {
|
|
|
ctx.log(err);
|
|
|
- ctx.body = {err: 1, msg: err.toString(), data: null};
|
|
|
+ ctx.body = { err: 1, msg: err.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -102,20 +102,20 @@ module.exports = app => {
|
|
|
*/
|
|
|
async updateCategory(ctx) {
|
|
|
try {
|
|
|
- const responseData = {err: 0, msg: '', data: null};
|
|
|
+ const responseData = { err: 0, msg: '', data: null };
|
|
|
|
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
|
if (!data.id) {
|
|
|
throw '提交数据错误';
|
|
|
}
|
|
|
if (data.name) {
|
|
|
- const count = await ctx.service.category.count({spid: ctx.subProject.id, name: data.name});
|
|
|
+ const count = await ctx.service.category.count({ spid: ctx.subProject.id, name: data.name });
|
|
|
if (count >= 1) {
|
|
|
throw '存在同名类别';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const result = await ctx.service.category.update(data, {id: data.id});
|
|
|
+ const result = await ctx.service.category.update(data, { id: data.id });
|
|
|
if (!result) {
|
|
|
throw '提交数据失败';
|
|
|
}
|
|
|
@@ -125,13 +125,13 @@ module.exports = app => {
|
|
|
ctx.body = responseData;
|
|
|
} catch (err) {
|
|
|
ctx.log(err);
|
|
|
- ctx.body = {err: 1, msg: err.toString(), data: null};
|
|
|
+ ctx.body = { err: 1, msg: err.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async setCategoryValue(ctx) {
|
|
|
try {
|
|
|
- const responseData = {err: 0, msg: '', data: {}};
|
|
|
+ const responseData = { err: 0, msg: '', data: {} };
|
|
|
|
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
|
if (!data.id) {
|
|
|
@@ -146,7 +146,7 @@ module.exports = app => {
|
|
|
ctx.body = responseData;
|
|
|
} catch (err) {
|
|
|
ctx.log(err);
|
|
|
- ctx.body = {err: 1, msg: err instanceof String ? err : '提交数据失败', data: null};
|
|
|
+ ctx.body = { err: 1, msg: err instanceof String ? err : '提交数据失败', data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -172,7 +172,7 @@ module.exports = app => {
|
|
|
ctx.body = responseData;
|
|
|
} catch (err) {
|
|
|
ctx.log(err);
|
|
|
- ctx.body = {err: 1, msg: err.toString(), data: null};
|
|
|
+ ctx.body = { err: 1, msg: err.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -194,7 +194,7 @@ module.exports = app => {
|
|
|
ctx.body = responseData;
|
|
|
} catch (err) {
|
|
|
ctx.log(err);
|
|
|
- ctx.body = {err: 1, msg: err.toString(), data: null};
|
|
|
+ ctx.body = { err: 1, msg: err.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -203,8 +203,8 @@ module.exports = app => {
|
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
|
|
|
|
await ctx.service.subProjPermission.defaultUpdate({
|
|
|
- self_category_level: data.self_category_level || ''
|
|
|
- }, { where: { spid: ctx.subProject.id, uid: ctx.session.sessionUser.accountId}});
|
|
|
+ self_category_level: data.self_category_level || '',
|
|
|
+ }, { where: { spid: ctx.subProject.id, uid: ctx.session.sessionUser.accountId } });
|
|
|
ctx.body = {
|
|
|
err: 0, msg: '', data: null,
|
|
|
};
|
|
|
@@ -300,7 +300,7 @@ module.exports = app => {
|
|
|
return { id: item.id, name: item.name, groupList };
|
|
|
}).filter(x => { return x.groupList.length > 0; });
|
|
|
const relaBlock = ctx.service.subProjPermission.getRelaPermissionBlock(ctx.query.ptype);
|
|
|
- const subProjects = await this.ctx.service.subProject.getAllDataByCondition({ where: { project_id: this.ctx.session.sessionProject.id, is_folder: 0, is_delete: 0 }});
|
|
|
+ const subProjects = await this.ctx.service.subProject.getAllDataByCondition({ where: { project_id: this.ctx.session.sessionProject.id, is_folder: 0, is_delete: 0 } });
|
|
|
const renderData = {
|
|
|
ptype: ctx.query.ptype,
|
|
|
ptypeStr: relaBlock ? relaBlock.name : '',
|
|
|
@@ -374,7 +374,7 @@ module.exports = app => {
|
|
|
/**
|
|
|
* 保存功能设置相关
|
|
|
* @param ctx
|
|
|
- * @returns {Promise<void>}
|
|
|
+ * @return {Promise<void>}
|
|
|
*/
|
|
|
async updateFun(ctx) {
|
|
|
try {
|
|
|
@@ -415,7 +415,7 @@ module.exports = app => {
|
|
|
if (!result3) throw '保存数据失败';
|
|
|
}
|
|
|
|
|
|
- ctx.body = {err: 0, msg: '', data: null};
|
|
|
+ ctx.body = { err: 0, msg: '', data: null };
|
|
|
} catch (error) {
|
|
|
ctx.log(error);
|
|
|
this.ajaxErrorBody(error, '保存数据失败');
|
|
|
@@ -433,10 +433,10 @@ module.exports = app => {
|
|
|
const dataCollectAudits = await ctx.service.subProjPermission.getDatacollectAuditList(ctx.subProject.id);
|
|
|
// 获取所有项目参与者
|
|
|
const accountList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject);
|
|
|
- const unitList = await ctx.service.constructionUnit.getAllDataByCondition({where: {pid: ctx.session.sessionProject.id}});
|
|
|
+ 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};
|
|
|
+ return { groupName: item.name, companyId: item.id, groupList };
|
|
|
}).filter(x => { return x.groupList.length > 0; });
|
|
|
const categoryData = await ctx.service.category.getAllCategory(ctx.subProject);
|
|
|
const tenders = await ctx.service.tender.getList('', null, 1);
|
|
|
@@ -488,7 +488,7 @@ module.exports = app => {
|
|
|
responseData.data = await ctx.service.subProject.update({
|
|
|
data_collect: data.data_collect,
|
|
|
data_collect_pages: data.data_collect_pages.join(','),
|
|
|
- }, {id: ctx.subProject.id});
|
|
|
+ }, { id: ctx.subProject.id });
|
|
|
ctx.subProject.data_collect = data.data_collect;
|
|
|
ctx.subProject.showDataCollect = data.data_collect ? 1 : 0;
|
|
|
break;
|
|
|
@@ -533,7 +533,7 @@ module.exports = app => {
|
|
|
ctx.body = responseData;
|
|
|
} catch (err) {
|
|
|
ctx.log(err);
|
|
|
- ctx.body = {err: 1, msg: err.toString(), data: null};
|
|
|
+ ctx.body = { err: 1, msg: err.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -564,11 +564,13 @@ module.exports = app => {
|
|
|
|
|
|
// 获取所有项目参与者
|
|
|
const accountList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject);
|
|
|
- const unitList = await ctx.service.constructionUnit.getAllDataByCondition({where: {pid: ctx.session.sessionProject.id}});
|
|
|
+ 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, groupList};
|
|
|
+ console.log(groupList);
|
|
|
+ return { groupName: item.name, groupList };
|
|
|
}).filter(x => { return x.groupList.length > 0; });
|
|
|
+ // console.log(accountGroupList);
|
|
|
|
|
|
// 获取项目列表
|
|
|
// const subProjects = await ctx.service.subProject.getAllDataByCondition({ where: { project_id: projectId, is_folder: 0, is_delete: 0 } });
|