|
@@ -843,19 +843,24 @@ module.exports = app => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- _checkMaterialFileCanModify(ctx) {
|
|
|
|
|
|
+ async _checkMaterialFileCanModify(ctx) {
|
|
// 检查登录用户,是否可操作
|
|
// 检查登录用户,是否可操作
|
|
const accountId = ctx.session.sessionUser.accountId;
|
|
const accountId = ctx.session.sessionUser.accountId;
|
|
- if (!ctx.material.curAuditor) {
|
|
|
|
- if (ctx.material.status === auditConst.status.uncheck || ctx.material.status === auditConst.status.checkNo && accountId === ctx.material.user_id) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- throw '该调差期当前您无权操作';
|
|
|
|
- } else {
|
|
|
|
- if (ctx.material.curAuditor.aid === accountId) return;
|
|
|
|
|
|
+ const auditors = await ctx.service.materialAudit.getAuditorsWithOwner(ctx.material.id, ctx.material.times);
|
|
|
|
+ // console.log(auditors);
|
|
|
|
+
|
|
|
|
+ if (auditors.findIndex(item => item.aid === accountId) === -1) {
|
|
throw '该调差期当前您无权操作';
|
|
throw '该调差期当前您无权操作';
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ // if (!ctx.material.curAuditor) {
|
|
|
|
+ // if (ctx.material.status === auditConst.status.uncheck || ctx.material.status === auditConst.status.checkNo && accountId === ctx.material.user_id) {
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ // throw '该调差期当前您无权操作';
|
|
|
|
+ // } else {
|
|
|
|
+ // if (ctx.material.curAuditor.aid === accountId) return;
|
|
|
|
+ // throw '该调差期当前您无权操作';
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* 上传附件
|
|
* 上传附件
|
|
@@ -864,7 +869,7 @@ module.exports = app => {
|
|
async upload(ctx) {
|
|
async upload(ctx) {
|
|
let stream;
|
|
let stream;
|
|
try {
|
|
try {
|
|
- this._checkMaterialFileCanModify(ctx);
|
|
|
|
|
|
+ await this._checkMaterialFileCanModify(ctx);
|
|
const parts = this.ctx.multipart({
|
|
const parts = this.ctx.multipart({
|
|
autoFields: true,
|
|
autoFields: true,
|
|
});
|
|
});
|