|
|
@@ -515,25 +515,28 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async changeCheck(ctx) {
|
|
|
+ async changeCheck(ctx, curChangeMap) {
|
|
|
try {
|
|
|
- const type = ctx.request.query.type || ctx.request.body.type;
|
|
|
- const curChangeMap = changeMap[type];
|
|
|
-
|
|
|
const subProject = await ctx.service.subProject.getDataById(ctx.tender.data.spid);
|
|
|
+ if (subProject.page_show && typeof subProject.page_show === 'string') {
|
|
|
+ subProject.page_show = JSON.parse(subProject.page_show);
|
|
|
+ };
|
|
|
if (curChangeMap && curChangeMap.pageShowKey && !subProject.page_show[curChangeMap.pageShowKey]) {
|
|
|
+
|
|
|
throw '该功能已关闭';
|
|
|
}
|
|
|
const id = ctx.request.query.id || ctx.request.body.id;
|
|
|
if (!id) {
|
|
|
throw '您访问的变更数据不存在';
|
|
|
}
|
|
|
- const condition = { [type === 'change' ? 'cid' : 'id']: id };
|
|
|
+ const condition = { [curChangeMap.idKey]: id };
|
|
|
const change = await ctx.service[curChangeMap.service].getDataByCondition(condition);
|
|
|
|
|
|
if (!change) throw '变更方案数据有误';
|
|
|
// 读取原报、审核人数据
|
|
|
await ctx.service[curChangeMap.service].loadChangeUser(change);
|
|
|
+ await ctx.service[curChangeMap.service].loadChangeAuditViewData(change);
|
|
|
+
|
|
|
// decimal小数位设置
|
|
|
change.decimal = change.decimal ? JSON.parse(change.decimal) : { tp: ctx.tender.info.decimal.tp, up: ctx.tender.info.decimal.up, precision: ctx.tender.info.precision };
|
|
|
|
|
|
@@ -542,6 +545,7 @@ module.exports = app => {
|
|
|
const accountId = ctx.session.sessionUser.accountId,
|
|
|
shareIds = [];
|
|
|
const permission = ctx.session.sessionUser.permission;
|
|
|
+ const type = ctx.request.query.type || ctx.request.body.type;
|
|
|
const status = auditConst[type].status;
|
|
|
|
|
|
if (accountId === change.uid) { // 原报
|
|
|
@@ -549,6 +553,7 @@ module.exports = app => {
|
|
|
change.filePermission = true;
|
|
|
} else if (change.auditorIds.indexOf(accountId) !== -1) { // 审批人
|
|
|
if (change.status === status.uncheck) {
|
|
|
+
|
|
|
throw '您无权查看该数据';
|
|
|
}
|
|
|
// change.readOnly = change.status !== status.checking || accountId !== change.curAuditor.aid;
|
|
|
@@ -574,6 +579,7 @@ module.exports = app => {
|
|
|
} else { // 其他不可见
|
|
|
throw '您无权查看该数据';
|
|
|
}
|
|
|
+
|
|
|
// 调差的readOnly 指表格和页面只能看不能改,和审批无关
|
|
|
change.readOnly = !((change.status === status.uncheck || change.status === status.checkNo || change.status === status.revise) && accountId === change.uid);
|
|
|
change.shenpiPower = change.status === status.checking && change.curAuditorIds.indexOf(accountId) !== -1;
|
|
|
@@ -581,17 +587,14 @@ module.exports = app => {
|
|
|
await ctx.service[curChangeMap.service].doCheckChangeCanCancel(this.change);
|
|
|
} catch (error) {
|
|
|
this.log(error);
|
|
|
- ctx.body = { code: -1, msg: error.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async changeDetail(ctx) {
|
|
|
try {
|
|
|
- await this.changeCheck(ctx);
|
|
|
const type = ctx.request.query.type;
|
|
|
const curChangeMap = changeMap[type];
|
|
|
- await ctx.service[curChangeMap.service].loadChangeUser(this.change);
|
|
|
- await ctx.service[curChangeMap.service].loadChangeAuditViewData(this.change);
|
|
|
+ await this.changeCheck(ctx, curChangeMap);
|
|
|
|
|
|
const tpUnit = ctx.tender.info.decimal.tp;
|
|
|
const subProject = await ctx.service.subProject.getDataById(ctx.tender.data.spid);
|