|
@@ -1353,7 +1353,7 @@ module.exports = app => {
|
|
|
// }
|
|
// }
|
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
|
if (ctx.session.sessionUser.is_admin && ctx.change.status !== audit.change.status.checked) {
|
|
if (ctx.session.sessionUser.is_admin && ctx.change.status !== audit.change.status.checked) {
|
|
|
- await ctx.service.changeAudit.saveAudit(ctx.change.cid, ctx.change.times, data);
|
|
|
|
|
|
|
+ await ctx.service.changeAudit.saveAudit(ctx.change.cid, ctx.change.times, ctx.change.sp_group, data);
|
|
|
const auditors = await ctx.service.changeAudit.getUniqUserGroup(ctx.change.cid, ctx.change.times);
|
|
const auditors = await ctx.service.changeAudit.getUniqUserGroup(ctx.change.cid, ctx.change.times);
|
|
|
ctx.body = { err: 0, msg: '', data: auditors };
|
|
ctx.body = { err: 0, msg: '', data: auditors };
|
|
|
} else {
|
|
} else {
|
|
@@ -1711,7 +1711,7 @@ module.exports = app => {
|
|
|
const changes = await ctx.service.changeProject.getListByStatus(tender.id, status, 1, sorts, orders);
|
|
const changes = await ctx.service.changeProject.getListByStatus(tender.id, status, 1, sorts, orders);
|
|
|
const total = await ctx.service.changeProject.getCountByStatus(tender.id, status);
|
|
const total = await ctx.service.changeProject.getCountByStatus(tender.id, status);
|
|
|
for (const c of changes) {
|
|
for (const c of changes) {
|
|
|
- c.curAuditor = await ctx.service.changeProjectAudit.getAuditorByStatus(c.id, c.status, c.times);
|
|
|
|
|
|
|
+ c.curAuditors = await ctx.service.changeProjectAudit.getAuditorsByStatus(c.id, c.status, c.times);
|
|
|
}
|
|
}
|
|
|
const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
|
|
const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
|
|
|
const userPermission = accountInfo !== undefined && accountInfo.permission !== ''
|
|
const userPermission = accountInfo !== undefined && accountInfo.permission !== ''
|
|
@@ -1781,6 +1781,7 @@ module.exports = app => {
|
|
|
auditConst: audit.changeProject,
|
|
auditConst: audit.changeProject,
|
|
|
ruleConst: codeRuleConst.measure,
|
|
ruleConst: codeRuleConst.measure,
|
|
|
changeConst,
|
|
changeConst,
|
|
|
|
|
+ auditType,
|
|
|
tenderMenu: this.menu.tenderMenu,
|
|
tenderMenu: this.menu.tenderMenu,
|
|
|
preUrl: '/tender/' + tender.id,
|
|
preUrl: '/tender/' + tender.id,
|
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.project),
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.project),
|
|
@@ -1804,6 +1805,25 @@ module.exports = app => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 审批流程(Get)
|
|
|
|
|
+ * @param ctx
|
|
|
|
|
+ * @return {Promise<void>}
|
|
|
|
|
+ */
|
|
|
|
|
+ async changeProjectAuditors(ctx) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const id = JSON.parse(ctx.request.body.data).id;
|
|
|
|
|
+ const tenderId = ctx.params.id;
|
|
|
|
|
+ const changeInfo = await ctx.service.changeProject.getDataById(id);
|
|
|
|
|
+ await ctx.service.changeProject.loadChangeUser(changeInfo);
|
|
|
|
|
+ await ctx.service.changeProject.loadChangeAuditViewData(changeInfo);
|
|
|
|
|
+ ctx.body = { err: 0, msg: '', data: changeInfo };
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ this.log(error);
|
|
|
|
|
+ ctx.body = { err: 1, msg: error.toString(), data: null };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 新增变更立项 (Post)
|
|
* 新增变更立项 (Post)
|
|
|
*
|
|
*
|
|
|
* @param {Object} ctx - egg全局变量
|
|
* @param {Object} ctx - egg全局变量
|
|
@@ -1872,23 +1892,7 @@ module.exports = app => {
|
|
|
* @private
|
|
* @private
|
|
|
*/
|
|
*/
|
|
|
async _getChangeProjectAuditViewData(ctx) {
|
|
async _getChangeProjectAuditViewData(ctx) {
|
|
|
- const auditConst = audit.changeProject;
|
|
|
|
|
- const times = (ctx.change.status === auditConst.status.back || ctx.change.status === auditConst.status.revise) ? ctx.change.times - 1 : ctx.change.times;
|
|
|
|
|
- ctx.change.user = await ctx.service.projectAccount.getAccountInfoById(ctx.change.uid);
|
|
|
|
|
- ctx.change.auditHistory = [];
|
|
|
|
|
- if (times >= 1) {
|
|
|
|
|
- for (let i = 1; i <= times; i++) {
|
|
|
|
|
- ctx.change.auditHistory.push(await ctx.service.changeProjectAudit.getAuditors(ctx.change.id, i));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- // 获取审批流程中左边列表
|
|
|
|
|
- ctx.change.auditors2 = (ctx.change.status === auditConst.status.back || ctx.change.status === auditConst.status.revise) && ctx.change.uid !== ctx.session.sessionUser.accountId ?
|
|
|
|
|
- await ctx.service.changeProjectAudit.getAuditorsWithOwner(ctx.change.id, times) :
|
|
|
|
|
- await ctx.service.changeProjectAudit.getAuditorsWithOwner(ctx.change.id, ctx.change.times);
|
|
|
|
|
- if (ctx.change.status === auditConst.status.uncheck || ctx.change.status === auditConst.status.back || ctx.change.status === auditConst.status.revise) {
|
|
|
|
|
- ctx.change.auditorList = await ctx.service.changeProjectAudit.getAuditors(ctx.change.id, ctx.change.times);
|
|
|
|
|
- }
|
|
|
|
|
- ctx.change.xsAuditors = await ctx.service.changeProjectXsAudit.getAuditList(ctx.change.id);
|
|
|
|
|
|
|
+ await ctx.service.changeProject.loadChangeAuditViewData(ctx.change);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 变更类别获取及更新
|
|
// 变更类别获取及更新
|
|
@@ -1923,7 +1927,7 @@ module.exports = app => {
|
|
|
async projectInformation(ctx) {
|
|
async projectInformation(ctx) {
|
|
|
try {
|
|
try {
|
|
|
const whiteList = this.ctx.app.config.multipart.whitelist;
|
|
const whiteList = this.ctx.app.config.multipart.whitelist;
|
|
|
- const tender = await ctx.service.tender.getDataById(ctx.tender.id);
|
|
|
|
|
|
|
+ // const tender = await ctx.service.tender.getDataById(ctx.tender.id);
|
|
|
// 获取附件列表
|
|
// 获取附件列表
|
|
|
const fileList = await ctx.service.changeProjectAtt.getAllChangeProjectAtt(ctx.tender.id, ctx.change.id);
|
|
const fileList = await ctx.service.changeProjectAtt.getAllChangeProjectAtt(ctx.tender.id, ctx.change.id);
|
|
|
await this._getChangeProjectAuditViewData(ctx);
|
|
await this._getChangeProjectAuditViewData(ctx);
|
|
@@ -1933,7 +1937,7 @@ module.exports = app => {
|
|
|
const auth_mobile = pa.auth_mobile;
|
|
const auth_mobile = pa.auth_mobile;
|
|
|
// 判断并更新
|
|
// 判断并更新
|
|
|
const renderData = {
|
|
const renderData = {
|
|
|
- tender,
|
|
|
|
|
|
|
+ tender: ctx.tender,
|
|
|
change: ctx.change,
|
|
change: ctx.change,
|
|
|
changeConst,
|
|
changeConst,
|
|
|
changeClass,
|
|
changeClass,
|
|
@@ -1941,6 +1945,8 @@ module.exports = app => {
|
|
|
fileList,
|
|
fileList,
|
|
|
whiteList,
|
|
whiteList,
|
|
|
authMobile: auth_mobile,
|
|
authMobile: auth_mobile,
|
|
|
|
|
+ auditType,
|
|
|
|
|
+ shenpiConst,
|
|
|
returnUrl: this.app._.includes(ctx.request.headers.referer, '/tender/' + ctx.tender.id + '/change/project') ? ctx.request.headers.referer : null,
|
|
returnUrl: this.app._.includes(ctx.request.headers.referer, '/tender/' + ctx.tender.id + '/change/project') ? ctx.request.headers.referer : null,
|
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.project_information),
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.project_information),
|
|
|
preUrl: '/tender/' + ctx.tender.id + '/change/project/' + ctx.change.id + '/information',
|
|
preUrl: '/tender/' + ctx.tender.id + '/change/project/' + ctx.change.id + '/information',
|
|
@@ -1958,6 +1964,10 @@ module.exports = app => {
|
|
|
const groupList = accountList.filter(item1 => item1.company === item.name);
|
|
const groupList = accountList.filter(item1 => item1.company === item.name);
|
|
|
return { groupName: item.name, groupList };
|
|
return { groupName: item.name, groupList };
|
|
|
});
|
|
});
|
|
|
|
|
+ // 获取固定审批流列表
|
|
|
|
|
+ if (ctx.tender.info.shenpi.change === shenpiConst.sp_status.gdspl) {
|
|
|
|
|
+ renderData.spGroupList = await ctx.service.shenpiGroup.getGroupListByChangeType(ctx.tender.id, shenpiConst.sp_type.change, 'changeProject');
|
|
|
|
|
+ }
|
|
|
// }
|
|
// }
|
|
|
await this.layout('change/project_information.ejs', renderData, 'change/project_information_modal.ejs');
|
|
await this.layout('change/project_information.ejs', renderData, 'change/project_information_modal.ejs');
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -1966,6 +1976,20 @@ module.exports = app => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ async changeProjectSpGroup(ctx) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const data = JSON.parse(ctx.request.body.data);
|
|
|
|
|
+ const result = await ctx.service.changeProjectAudit.changeSpGroup(ctx.change, data.sp_group);
|
|
|
|
|
+ if (!result) {
|
|
|
|
|
+ throw '切换审批组失败';
|
|
|
|
|
+ }
|
|
|
|
|
+ const auditors = await ctx.service.changeProjectAudit.getUserGroup(ctx.change.id, ctx.change.times);
|
|
|
|
|
+ ctx.body = { err: 0, msg: '', data: auditors };
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ ctx.body = { err: 1, msg: err.toString(), data: null };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 审批相关
|
|
// 审批相关
|
|
|
/**
|
|
/**
|
|
|
* 添加审批人
|
|
* 添加审批人
|
|
@@ -2000,14 +2024,14 @@ module.exports = app => {
|
|
|
if (exist) {
|
|
if (exist) {
|
|
|
throw '该审核人已存在,请勿重复添加';
|
|
throw '该审核人已存在,请勿重复添加';
|
|
|
}
|
|
}
|
|
|
- // const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: ctx.tender.id, sp_type: shenpiConst.sp_type.material, sp_status: shenpiConst.sp_status.gdzs });
|
|
|
|
|
- // const is_gdzs = shenpiInfo && ctx.tender.info.shenpi.material === shenpiConst.sp_status.gdzs ? 1 : 0;
|
|
|
|
|
- const result = await ctx.service.changeProjectAudit.addAuditor(ctx.change.id, id, ctx.change.times);
|
|
|
|
|
|
|
+ const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: ctx.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpiConst.sp_status.gdzs });
|
|
|
|
|
+ const is_gdzs = shenpiInfo && ctx.tender.info.shenpi.change === shenpiConst.sp_status.gdzs ? 1 : 0;
|
|
|
|
|
+ const result = await ctx.service.changeProjectAudit.addAuditor(ctx.change.id, id, ctx.change.times, is_gdzs);
|
|
|
if (!result) {
|
|
if (!result) {
|
|
|
throw '添加审核人失败';
|
|
throw '添加审核人失败';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const auditors = await ctx.service.changeProjectAudit.getAuditorsWithOwner(ctx.change.id, ctx.change.times);
|
|
|
|
|
|
|
+ const auditors = await ctx.service.changeProjectAudit.getUserGroup(ctx.change.id, ctx.change.times);
|
|
|
ctx.body = { err: 0, msg: '', data: auditors };
|
|
ctx.body = { err: 0, msg: '', data: auditors };
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
this.log(err);
|
|
@@ -2109,6 +2133,31 @@ module.exports = app => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ async saveProjectAudit(ctx) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // if (ctx.change.revising) {
|
|
|
|
|
+ // throw '台账修订中,请勿修改提交期数据';
|
|
|
|
|
+ // }
|
|
|
|
|
+ const data = JSON.parse(ctx.request.body.data);
|
|
|
|
|
+ if (ctx.session.sessionUser.is_admin && ctx.change.status !== audit.change.status.checked) {
|
|
|
|
|
+ await ctx.service.changeProjectAudit.saveAudit(ctx.change.id, ctx.change.times, ctx.change.sp_group, data);
|
|
|
|
|
+ const auditors = await ctx.service.changeProjectAudit.getUniqUserGroup(ctx.change.id, ctx.change.times);
|
|
|
|
|
+ ctx.body = { err: 0, msg: '', data: auditors };
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw '您无权进行该操作';
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ this.log(err);
|
|
|
|
|
+ // ctx.session.postError = err.toString();
|
|
|
|
|
+ // ctx.redirect(ctx.request.header.referer);
|
|
|
|
|
+ ctx.body = {
|
|
|
|
|
+ err: 1,
|
|
|
|
|
+ // url: ctx.request.header.referer,
|
|
|
|
|
+ msg: err,
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 上传附件
|
|
* 上传附件
|
|
|
* @param {*} ctx 上下文
|
|
* @param {*} ctx 上下文
|
|
@@ -2296,7 +2345,7 @@ module.exports = app => {
|
|
|
if (!ctx.change || ctx.change.status !== auditConst.status.checking) {
|
|
if (!ctx.change || ctx.change.status !== auditConst.status.checking) {
|
|
|
throw '当前材料调差期数据有误';
|
|
throw '当前材料调差期数据有误';
|
|
|
}
|
|
}
|
|
|
- if (!ctx.change.curAuditor || ctx.change.curAuditor.aid !== ctx.session.sessionUser.accountId) {
|
|
|
|
|
|
|
+ if (ctx.change.curAuditorIds.length === 0 || ctx.change.curAuditorIds.indexOf(ctx.session.sessionUser.accountId) === -1) {
|
|
|
throw '您无权进行该操作';
|
|
throw '您无权进行该操作';
|
|
|
}
|
|
}
|
|
|
const data = {
|
|
const data = {
|
|
@@ -2346,8 +2395,9 @@ module.exports = app => {
|
|
|
async checkProjectAgain(ctx) {
|
|
async checkProjectAgain(ctx) {
|
|
|
try {
|
|
try {
|
|
|
// 获取终审
|
|
// 获取终审
|
|
|
- const auditInfo = await this.ctx.service.changeProjectAudit.getAuditorByStatus(ctx.change.id, audit.changeProject.status.checked);
|
|
|
|
|
- if (ctx.change.status !== audit.changeProject.status.checked || ctx.session.sessionUser.accountId !== auditInfo.aid) {
|
|
|
|
|
|
|
+ // const auditInfo = await this.ctx.service.changeProjectAudit.getAuditorByStatus(ctx.change.id, audit.changeProject.status.checked);
|
|
|
|
|
+ // if (ctx.change.status !== audit.changeProject.status.checked || ctx.session.sessionUser.accountId !== auditInfo.aid) {
|
|
|
|
|
+ if (ctx.change.status !== audit.changeProject.status.checked) {
|
|
|
throw '您无权进行该操作';
|
|
throw '您无权进行该操作';
|
|
|
}
|
|
}
|
|
|
// 判断是否被变更申请调用了,是则无法发起修订
|
|
// 判断是否被变更申请调用了,是则无法发起修订
|