Browse Source

fix: 修复计量-附件原报无法删除上传附件的bug

lanjianrong 5 năm trước cách đây
mục cha
commit
7362a74b61
3 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 2 1
      app/controller/stage_controller.js
  2. 4 0
      app/public/js/stage.js
  3. 1 0
      app/view/stage/index.ejs

+ 2 - 1
app/controller/stage_controller.js

@@ -1207,7 +1207,8 @@ module.exports = app => {
                 if (ctx.stage.status === auditConst.status.checked) {
                     // 当前期状态为完成,且提交人是审核列表中的则可再次上传
                     console.log('当前期审核通过!');
-                    if (ctx.stage.auditors.findIndex(auditor => auditor.aid === ctx.session.sessionUser.accountId) !== -1) {
+                    console.log(ctx.stage.auditors);
+                    if (ctx.stage.user_id === ctx.session.sessionUser.accountId || ctx.stage.auditors.findIndex(auditor => auditor.aid === ctx.session.sessionUser.accountId) !== -1) {
                         console.log('当前用户拥有上传权限!');
                         // 再次上传的图片要给个标识,方便给前端进行编辑操作
                         ctx.reUploadPermission = true;

+ 4 - 0
app/public/js/stage.js

@@ -3059,6 +3059,10 @@ $(document).ready(() => {
                         $('#btn-att a').eq(3).hide();
                     }
                 }
+                // 台账未上报、当前用户为原报, 可以删除附件
+                if (stage.status === auditConst.status.uncheck && stage.user_id === parseInt(cur_uid)) {
+                    $('#btn-att a').eq(3).show();
+                }
                 // $('#btn-att a').eq(3).show();
                 $('#btn-att a').eq(2).hide();
                 $('#btn-att a').eq(4).hide();

+ 1 - 0
app/view/stage/index.ejs

@@ -586,6 +586,7 @@
     let attData = JSON.parse('<%- JSON.stringify(attData) %>');
     const ckColSetting = 'stage-col-visible-1.0.3-<%- tender.id %>';
     const auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
+    const cur_uid = '<%- ctx.session.sessionUser.accountId %>';
 </script>
 <% if (ctx.stage.status === auditConst.status.uncheck && ctx.session.sessionUser.accountId === ctx.stage.user_id) {%>
 <script>