|
@@ -9,7 +9,7 @@
|
|
*/
|
|
*/
|
|
|
|
|
|
const moment = require('moment');
|
|
const moment = require('moment');
|
|
-const auditConst = require('../const/audit');
|
|
|
|
|
|
+const auditConst = require('../const/audit').stage;
|
|
const spreadConst = require('../const/spread');
|
|
const spreadConst = require('../const/spread');
|
|
const tenderConst = require('../const/tender');
|
|
const tenderConst = require('../const/tender');
|
|
const payConst = require('../const/deal_pay.js');
|
|
const payConst = require('../const/deal_pay.js');
|
|
@@ -42,7 +42,7 @@ module.exports = app => {
|
|
const data = {
|
|
const data = {
|
|
tender: ctx.tender.data,
|
|
tender: ctx.tender.data,
|
|
tenderMenu: JSON.parse(JSON.stringify(this.menu.stageMenu)),
|
|
tenderMenu: JSON.parse(JSON.stringify(this.menu.stageMenu)),
|
|
- auditConst: auditConst.flow,
|
|
|
|
|
|
+ auditConst,
|
|
measureType,
|
|
measureType,
|
|
preUrl: '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.params.order,
|
|
preUrl: '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.params.order,
|
|
stage: ctx.stage,
|
|
stage: ctx.stage,
|
|
@@ -52,7 +52,7 @@ module.exports = app => {
|
|
}
|
|
}
|
|
|
|
|
|
_stageReadOnly(stage) {
|
|
_stageReadOnly(stage) {
|
|
- return stage.status === auditConst.flow.status.checked;
|
|
|
|
|
|
+ return stage.status === auditConst.status.checked;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -110,6 +110,7 @@ module.exports = app => {
|
|
});
|
|
});
|
|
ctx.stage.auditors = await ctx.service.stageAudit.getAuditors(ctx.stage.id, ctx.stage.times);
|
|
ctx.stage.auditors = await ctx.service.stageAudit.getAuditors(ctx.stage.id, ctx.stage.times);
|
|
ctx.stage.curAuditor = await ctx.service.stageAudit.getCurAuditor(ctx.stage.id, ctx.stage.times);
|
|
ctx.stage.curAuditor = await ctx.service.stageAudit.getCurAuditor(ctx.stage.id, ctx.stage.times);
|
|
|
|
+ console.log(ctx.stage.curAuditor);
|
|
ctx.stage.user = await ctx.service.projectAccount.getAccountInfoById(ctx.stage.user_id);
|
|
ctx.stage.user = await ctx.service.projectAccount.getAccountInfoById(ctx.stage.user_id);
|
|
ctx.stage.auditHistory = [];
|
|
ctx.stage.auditHistory = [];
|
|
if (ctx.stage.times > 1) {
|
|
if (ctx.stage.times > 1) {
|
|
@@ -176,7 +177,7 @@ module.exports = app => {
|
|
await this._getStage(ctx);
|
|
await this._getStage(ctx);
|
|
// 检查登录用户,是否可操作
|
|
// 检查登录用户,是否可操作
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
- if (ctx.stage.status === auditConst.flow.status.checking || ctx.stage.status === auditConst.flow.status.checked) {
|
|
|
|
|
|
+ if (ctx.stage.status === auditConst.status.checking || ctx.stage.status === auditConst.status.checked) {
|
|
throw '该计量期当前您无权操作';
|
|
throw '该计量期当前您无权操作';
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -226,7 +227,7 @@ module.exports = app => {
|
|
await this._getStage(ctx);
|
|
await this._getStage(ctx);
|
|
// 检查登录用户,是否可操作
|
|
// 检查登录用户,是否可操作
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
- if (ctx.stage.status === auditConst.flow.status.checking || ctx.stage.status === auditConst.flow.status.checked) {
|
|
|
|
|
|
+ if (ctx.stage.status === auditConst.status.checking || ctx.stage.status === auditConst.status.checked) {
|
|
throw '该计量期当前您无权操作';
|
|
throw '该计量期当前您无权操作';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -284,7 +285,7 @@ module.exports = app => {
|
|
await this._getStage(ctx);
|
|
await this._getStage(ctx);
|
|
// 检查登录用户,是否可操作
|
|
// 检查登录用户,是否可操作
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
- if (ctx.stage.status === auditConst.flow.status.checking || ctx.stage.status === auditConst.flow.status.checked) {
|
|
|
|
|
|
+ if (ctx.stage.status === auditConst.status.checking || ctx.stage.status === auditConst.status.checked) {
|
|
throw '该计量期当前您无权操作';
|
|
throw '该计量期当前您无权操作';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -309,7 +310,7 @@ module.exports = app => {
|
|
await this._getStage(ctx);
|
|
await this._getStage(ctx);
|
|
// 检查登录用户,是否可操作
|
|
// 检查登录用户,是否可操作
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
- if (ctx.stage.status === auditConst.flow.status.checking || ctx.stage.status === auditConst.flow.status.checked) {
|
|
|
|
|
|
+ if (ctx.stage.status === auditConst.status.checking || ctx.stage.status === auditConst.status.checked) {
|
|
throw '该计量期当前您无权操作';
|
|
throw '该计量期当前您无权操作';
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -356,7 +357,7 @@ module.exports = app => {
|
|
await this._getStage(ctx);
|
|
await this._getStage(ctx);
|
|
// 检查登录用户,是否可操作
|
|
// 检查登录用户,是否可操作
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
- if (ctx.stage.status === auditConst.flow.status.checking || ctx.stage.status === auditConst.flow.status.checked) {
|
|
|
|
|
|
+ if (ctx.stage.status === auditConst.status.checking || ctx.stage.status === auditConst.status.checked) {
|
|
throw '该计量期当前您无权操作';
|
|
throw '该计量期当前您无权操作';
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -404,7 +405,7 @@ module.exports = app => {
|
|
if (dealPay && dealPay.length > 0) {
|
|
if (dealPay && dealPay.length > 0) {
|
|
renderData.dealPay = dealPay;
|
|
renderData.dealPay = dealPay;
|
|
} else {
|
|
} else {
|
|
- await ctx.service.pay.addDefaultPayData();
|
|
|
|
|
|
+ await ctx.service.pay.addDefaultPayData(this.ctx.tender.id);
|
|
await ctx.service.stagePay.addInitialStageData(ctx.stage);
|
|
await ctx.service.stagePay.addInitialStageData(ctx.stage);
|
|
renderData.dealPay = await ctx.service.stagePay.getStagePays(ctx.stage);
|
|
renderData.dealPay = await ctx.service.stagePay.getStagePays(ctx.stage);
|
|
}
|
|
}
|
|
@@ -431,7 +432,7 @@ module.exports = app => {
|
|
await this._getStage(ctx);
|
|
await this._getStage(ctx);
|
|
// 检查登录用户,是否可操作
|
|
// 检查登录用户,是否可操作
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {
|
|
- if (ctx.stage.status === auditConst.flow.status.checking || ctx.stage.status === auditConst.flow.status.checked) {
|
|
|
|
|
|
+ if (ctx.stage.status === auditConst.status.checking || ctx.stage.status === auditConst.status.checked) {
|
|
throw '该计量期当前您无权操作';
|
|
throw '该计量期当前您无权操作';
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -582,7 +583,7 @@ module.exports = app => {
|
|
if (ctx.stage.user_id !== ctx.session.sessionUser.accountId) {
|
|
if (ctx.stage.user_id !== ctx.session.sessionUser.accountId) {
|
|
throw '您无权添加审核人';
|
|
throw '您无权添加审核人';
|
|
}
|
|
}
|
|
- if (ctx.stage.status === auditConst.flow.status.checking || ctx.stage.status === auditConst.flow.status.checked) {
|
|
|
|
|
|
+ if (ctx.stage.status === auditConst.status.checking || ctx.stage.status === auditConst.status.checked) {
|
|
throw '当前不允许添加审核人';
|
|
throw '当前不允许添加审核人';
|
|
}
|
|
}
|
|
// 检查审核人是否已存在
|
|
// 检查审核人是否已存在
|
|
@@ -644,7 +645,7 @@ module.exports = app => {
|
|
if (ctx.stage.user_id !== ctx.session.sessionUser.accountId) {
|
|
if (ctx.stage.user_id !== ctx.session.sessionUser.accountId) {
|
|
throw '您无权上报该期数据';
|
|
throw '您无权上报该期数据';
|
|
}
|
|
}
|
|
- if (ctx.stage.status === auditConst.flow.status.checking || ctx.stage.status === auditConst.flow.status.checked) {
|
|
|
|
|
|
+ if (ctx.stage.status === auditConst.status.checking || ctx.stage.status === auditConst.status.checked) {
|
|
throw '该期数据当前无法上报';
|
|
throw '该期数据当前无法上报';
|
|
}
|
|
}
|
|
|
|
|
|
@@ -665,7 +666,7 @@ module.exports = app => {
|
|
async checkAudit(ctx) {
|
|
async checkAudit(ctx) {
|
|
try {
|
|
try {
|
|
await this._getStage(ctx);
|
|
await this._getStage(ctx);
|
|
- if (!this.ctx.stage || this.ctx.stage.status !== auditConst.flow.status.checking) {
|
|
|
|
|
|
+ if (!this.ctx.stage || this.ctx.stage.status !== auditConst.status.checking) {
|
|
throw '当前期数据有误';
|
|
throw '当前期数据有误';
|
|
}
|
|
}
|
|
if (!this.ctx.stage.curAuditor || this.ctx.stage.curAuditor.aid !== ctx.session.sessionUser.accountId) {
|
|
if (!this.ctx.stage.curAuditor || this.ctx.stage.curAuditor.aid !== ctx.session.sessionUser.accountId) {
|
|
@@ -673,22 +674,23 @@ module.exports = app => {
|
|
}
|
|
}
|
|
const data = {
|
|
const data = {
|
|
checkType: parseInt(ctx.request.body.checkType),
|
|
checkType: parseInt(ctx.request.body.checkType),
|
|
- backType: parseInt(ctx.request.body.backType),
|
|
|
|
opinion: ctx.request.body.opinion,
|
|
opinion: ctx.request.body.opinion,
|
|
};
|
|
};
|
|
if (!data.checkType || isNaN(data.checkType)) {
|
|
if (!data.checkType || isNaN(data.checkType)) {
|
|
throw '提交数据错误';
|
|
throw '提交数据错误';
|
|
}
|
|
}
|
|
- if (data.checkType === auditConst.flow.status.checkNo) {
|
|
|
|
|
|
+ if (data.checkType === auditConst.status.checkNo) {
|
|
if (!data.backType || isNaN(data.backType)) {
|
|
if (!data.backType || isNaN(data.backType)) {
|
|
throw '提交数据错误';
|
|
throw '提交数据错误';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
await ctx.service.stageAudit.check(ctx.stage.id, data, ctx.stage.times);
|
|
await ctx.service.stageAudit.check(ctx.stage.id, data, ctx.stage.times);
|
|
|
|
+ console.log('success');
|
|
|
|
|
|
ctx.redirect(ctx.request.header.referer);
|
|
ctx.redirect(ctx.request.header.referer);
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
|
+ console.log(err);
|
|
this.log(err);
|
|
this.log(err);
|
|
ctx.session.postError = err.toString();
|
|
ctx.session.postError = err.toString();
|
|
ctx.redirect(ctx.request.header.referer);
|
|
ctx.redirect(ctx.request.header.referer);
|