|
@@ -266,7 +266,7 @@ module.exports = app => {
|
|
|
const auditStatus = await ctx.service.changeAudit.getStatusByChange(change);
|
|
|
|
|
|
// 获取附件列表
|
|
|
- const attList = await ctx.service.changeAtt.getAllChangeFiles(ctx.params.cid);
|
|
|
+ const attList = await ctx.service.changeAtt.getChangeAttachment(ctx.params.cid);
|
|
|
|
|
|
// 根据auditStatus获取审批人列表
|
|
|
const auditList = await ctx.service.changeAudit.getListByStatus(change, auditStatus);
|
|
@@ -749,6 +749,36 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 查看附件
|
|
|
+ * @param {Object} ctx - egg全局变量
|
|
|
+ * @return {void}
|
|
|
+ */
|
|
|
+ async checkFile(ctx) {
|
|
|
+ const responseData = { err: 0, msg: '' };
|
|
|
+ const id = parseInt(ctx.params.id);
|
|
|
+ if (id) {
|
|
|
+ try {
|
|
|
+ const fileInfo = await ctx.service.changeAtt.getDataById(id);
|
|
|
+ if (fileInfo && Object.keys(fileInfo).length) {
|
|
|
+ let filepath = fileInfo.filepath;
|
|
|
+ if (!ctx.helper.canPreview(fileInfo.fileext)) {
|
|
|
+ filepath = `/change/download/file/${fileInfo.id}`;
|
|
|
+ } else {
|
|
|
+ filepath = filepath.replace(/^app|\/app/, '');
|
|
|
+ }
|
|
|
+ fileInfo.filepath && (responseData.data = { filepath });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.log(error);
|
|
|
+ this.setMessage(error.toString(), this.messageType.ERROR);
|
|
|
+ responseData.err = 1;
|
|
|
+ responseData.msg = error.toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ctx.body = responseData;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 删除变更令
|
|
|
* @param {Object} ctx - egg全局变量
|
|
|
* @return {void}
|