|
@@ -38,7 +38,7 @@ module.exports = app => {
|
|
|
ctx.showProject = true;
|
|
|
ctx.showTender = true;
|
|
|
ctx.showTitle = true;
|
|
|
- ctx.reUploadPermission = false;
|
|
|
+ // ctx.reUploadPermission = false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -342,16 +342,16 @@ module.exports = app => {
|
|
|
const qtyData = ctx.helper.checkBillsWithPos(ledgerData, posData, ['contract_qty', 'qc_qty']);
|
|
|
qtyData.error.forEach(x => { x.errorType = 'qty'; });
|
|
|
const tpData = ctx.helper.checkBillsTp(ledgerData, [
|
|
|
- {qty: 'contract_qty', tp: 'contract_tp'}, {qty: 'qc_qty', tp: 'qc_tp'}
|
|
|
+ { qty: 'contract_qty', tp: 'contract_tp' }, { qty: 'qc_qty', tp: 'qc_tp' },
|
|
|
], this.ctx.tender.info.decimal);
|
|
|
tpData.error.forEach(x => { x.errorType = 'tp'; });
|
|
|
ctx.body = { err: 0, msg: '', data: {
|
|
|
- error: [...qtyData.error, ...tpData.error],
|
|
|
- source: {
|
|
|
- bills: [...qtyData.source.bills, ...tpData.source.bills],
|
|
|
- pos: [...qtyData.source.pos, ...tpData.source.pos],
|
|
|
- },
|
|
|
- }};
|
|
|
+ error: [...qtyData.error, ...tpData.error],
|
|
|
+ source: {
|
|
|
+ bills: [...qtyData.source.bills, ...tpData.source.bills],
|
|
|
+ pos: [...qtyData.source.pos, ...tpData.source.pos],
|
|
|
+ },
|
|
|
+ } };
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
|
ctx.body = this.ajaxErrorBody(err, '检查数据错误');
|
|
@@ -1266,27 +1266,27 @@ module.exports = app => {
|
|
|
* 检查当前期当前用户是否在审核列表中,如果是的话允许再次上传附件
|
|
|
* @param {Object} ctx 上下文
|
|
|
*/
|
|
|
- _checkStageCanModifyRe(ctx) {
|
|
|
- // 检查登录用户,是否可操作
|
|
|
- if (ctx.stage.readOnly) {
|
|
|
- if (ctx.stage.status === auditConst.status.checked) {
|
|
|
- // 当前期状态为完成,且提交人是审核列表中的则可再次上传
|
|
|
- if (ctx.stage.user_id === ctx.session.sessionUser.accountId || ctx.stage.auditors.findIndex(auditor => auditor.aid === ctx.session.sessionUser.accountId) !== -1) {
|
|
|
- // 再次上传的图片要给个标识,方便给前端进行编辑操作
|
|
|
- ctx.reUploadPermission = true;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- throw '该计量期当前您无权操作';
|
|
|
-
|
|
|
- } else {
|
|
|
- throw '该计量期当前您无权操作';
|
|
|
- }
|
|
|
- }
|
|
|
- if (ctx.stage.revising) {
|
|
|
- throw '台账修订中,请勿修改提交期数据';
|
|
|
- }
|
|
|
- }
|
|
|
+ // _checkStageCanModifyRe(ctx) {
|
|
|
+ // // 检查登录用户,是否可操作
|
|
|
+ // if (ctx.stage.readOnly) {
|
|
|
+ // if (ctx.stage.status === auditConst.status.checked) {
|
|
|
+ // // 当前期状态为完成,且提交人是审核列表中的则可再次上传
|
|
|
+ // if (ctx.stage.user_id === ctx.session.sessionUser.accountId || ctx.stage.auditors.findIndex(auditor => auditor.aid === ctx.session.sessionUser.accountId) !== -1) {
|
|
|
+ // // 再次上传的图片要给个标识,方便给前端进行编辑操作
|
|
|
+ // ctx.reUploadPermission = true;
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // throw '该计量期当前您无权操作';
|
|
|
+
|
|
|
+ // } else {
|
|
|
+ // throw '该计量期当前您无权操作';
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (ctx.stage.revising) {
|
|
|
+ // throw '台账修订中,请勿修改提交期数据';
|
|
|
+ // }
|
|
|
+ // }
|
|
|
/**
|
|
|
* 上传附件
|
|
|
* @param {Object} ctx - egg全局变量
|
|
@@ -1300,11 +1300,12 @@ module.exports = app => {
|
|
|
};
|
|
|
let stream;
|
|
|
try {
|
|
|
- this._checkStageCanModifyRe(ctx);
|
|
|
+ // this._checkStageCanModifyRe(ctx);
|
|
|
|
|
|
const parts = ctx.multipart({ autoFields: true });
|
|
|
const files = [];
|
|
|
let index = 0;
|
|
|
+ const extra_upload = ctx.stage.status === auditConst.status.checked;
|
|
|
while ((stream = await parts()) !== undefined) {
|
|
|
// 判断用户是否选择上传文件
|
|
|
if (!stream.filename) {
|
|
@@ -1338,10 +1339,11 @@ module.exports = app => {
|
|
|
fileext: fileInfo.ext,
|
|
|
filesize: Array.isArray(parts.field.size) ? parts.field.size[index] : parts.field.size,
|
|
|
filepath,
|
|
|
+ extra_upload,
|
|
|
};
|
|
|
- if (ctx.reUploadPermission) {
|
|
|
- fileData.re_upload = 1;
|
|
|
- }
|
|
|
+ // if (ctx.reUploadPermission) {
|
|
|
+ // fileData.re_upload = 1;
|
|
|
+ // }
|
|
|
const result = await ctx.service.stageAtt.save(parts.field, fileData, ctx.session.sessionUser.accountId);
|
|
|
if (!result) {
|
|
|
throw '导入数据库保存失败';
|
|
@@ -1447,10 +1449,13 @@ module.exports = app => {
|
|
|
data: '',
|
|
|
};
|
|
|
try {
|
|
|
- this._checkStageCanModifyRe(ctx);
|
|
|
+ // this._checkStageCanModifyRe(ctx);
|
|
|
|
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
|
const fileInfo = await ctx.service.stageAtt.getDataById(data.id);
|
|
|
+ if (!fileInfo.extra_upload && ctx.stage.status === auditConst.status.checked) {
|
|
|
+ throw '无权限删除';
|
|
|
+ }
|
|
|
if (fileInfo !== undefined && fileInfo !== '') {
|
|
|
// 先删除文件
|
|
|
await fs.unlinkSync(path.join(this.app.baseDir, fileInfo.filepath));
|