瀏覽代碼

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

MaiXinRong 6 年之前
父節點
當前提交
637628f34d

+ 6 - 0
app/controller/stage_controller.js

@@ -543,6 +543,12 @@ module.exports = app => {
                 renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.pay);
                 renderData.whiteList = this.ctx.app.config.multipart.whitelist;
 
+                // 用户有无权限上传和删除附件
+                renderData.uploadPermission = (ctx.stage.status === auditConst.status.uncheck && ctx.session.sessionUser.accountId === ctx.stage.user_id) ||
+                    (ctx.stage.status === auditConst.status.checking && ctx.session.sessionUser.accountId === ctx.stage.user_id) ||
+                    (ctx.stage.status === auditConst.status.checkNoPre && ctx.session.sessionUser.accountId === ctx.stage.curAuditor.aid) ||
+                    (ctx.stage.status === auditConst.status.checking && ctx.stage.curAuditor && ctx.stage.curAuditor.aid === ctx.session.sessionUser.accountId);
+
                 // 计算 本期金额
                 const payCalculator = new PayCalculator(this.ctx, this.ctx.tender.info.decimal);
                 await payCalculator.calculateAll(renderData.dealPay);

+ 3 - 0
app/public/js/change.js

@@ -179,6 +179,7 @@ $(document).ready(() => {
     $('#autoCode').click(getNewCode);
     // 新增变更令 确认
     $('#addOk').click(function () {
+        $(this).attr('disabled', true);
         const data = {
             code: $('#bj-code').val(),
             name: $('#bj-name').val(),
@@ -187,10 +188,12 @@ $(document).ready(() => {
             postData('/tender/'+ $('#tenderId').val() +'/change/add', data, function (rst) {
                 $('#bj-code').removeClass('is-invalid');
                 $('#mj-add').modal('hide');
+                $(this).attr('disabled', false);
                 window.location.href = '/tender/'+ $('#tenderId').val() +'/change/' + rst.cid + '/info';
             }, function () {
                 $('#mj-code').addClass('is-invalid');
                 $('#mj-Hint').show();
+                $(this).attr('disabled', false);
             });
         }
     });

+ 11 - 12
app/public/js/stage.js

@@ -1251,7 +1251,6 @@ $(document).ready(() => {
             $('#showPage').show();
         }
     });
-
     // 上传附件
     $('#upload-file-btn').click(function () {
         const file = $('#upload-file')[0];
@@ -1274,7 +1273,7 @@ $(document).ready(() => {
         formData.append('lid', node.id);
         formData.append('size', filesize);
         formData.append('file', file.files[0]);
-        postDataWithFile('/tender/' + tender.id + '/measure/stage/' + tender.ledger_times + '/upload/file', formData, function (data) {
+        postDataWithFile('/tender/' + tender.id + '/measure/stage/' + stage.order + '/upload/file', formData, function (data) {
             $('#upload').modal('hide');
             // 插入到attData中
             attData.unshift(data);
@@ -1300,9 +1299,9 @@ $(document).ready(() => {
         $('#show-att').show();
         if (att !== undefined) {
             $('#show-att tr').eq(0).children('td').text(att.filename + att.fileext);
-            const name = att.code !== null && att.code !== '' ? att.code : att.b_code;
-            $('#show-att tr').eq(1).children('td').text(name + ' ' + att.lname);
-            $('#show-att tr').eq(2).find('a').attr('href', '/tender/' + tender.id + '/measure/stage/' + tender.ledger_times + '/download/file/' + att.id);
+            const name = att.code !== null && att.code !== '' ? att.code : (att.b_code !== null ? att.b_code : '');
+            $('#show-att tr').eq(1).children('td').text($.trim(name + ' ' + att.lname));
+            $('#show-att tr').eq(2).find('a').attr('href', '/tender/' + tender.id + '/measure/stage/' + stage.order + '/download/file/' + att.id);
             $('#show-att tr').eq(3).children('td').eq(0).text(att.username);
             $('#show-att tr').eq(3).children('td').eq(1).text(att.in_time);
             $('#show-att tr').eq(4).children('td').text(att.remark);
@@ -1344,8 +1343,8 @@ $(document).ready(() => {
             });
             $('#edit-att .form-group').eq(0).find('input').val(att.filename);
             $('#edit-att .form-group').eq(0).find('span').eq(1).text(att.fileext);
-            const name = att.code !== null && att.code !== '' ? att.code : att.b_code;
-            $('#edit-att .form-group').eq(1).find('input').val(name + ' ' + att.lname);
+            const name = att.code !== null && att.code !== '' ? att.code : (att.b_code !== null ? att.b_code : '');
+            $('#edit-att .form-group').eq(1).find('input').val($.trim(name + ' ' + att.lname));
             $('#edit-att .form-group').eq(2).find('input').val(att.in_time);
             $('#edit-att .form-group').eq(3).find('input').val(att.remark);
         } else if (content === 'cancel') {
@@ -1367,7 +1366,7 @@ $(document).ready(() => {
                 formData.append('size', filesize);
                 formData.append('file', file.files[0]);
             }
-            postDataWithFile('/tender/' + tender.id + '/measure/stage/' + tender.ledger_times + '/save/file', formData, function (data) {
+            postDataWithFile('/tender/' + tender.id + '/measure/stage/' + stage.order + '/save/file', formData, function (data) {
                 // 替换到attData中
                 const att_index = attData.findIndex(function (item) {
                     return item.id === parseInt(fid);
@@ -1379,9 +1378,9 @@ $(document).ready(() => {
                 $('#show-att').show();
                 $('#edit-att').hide();
                 $('#show-att tr').eq(0).children('td').text(data.filename + data.fileext);
-                const name = data.code !== null && data.code !== '' ? data.code : data.b_code;
-                $('#show-att tr').eq(1).children('td').text(name + ' ' + data.lname);
-                $('#show-att tr').eq(2).find('a').attr('href', '/tender/' + tender.id + '/measure/stage/' + tender.ledger_times + '/download/file/' + data.id);
+                const name = data.code !== null && data.code !== '' ? data.code : (data.b_code !== null ? data.b_code : '');
+                $('#show-att tr').eq(1).children('td').text($.trim(name + ' ' + data.lname));
+                $('#show-att tr').eq(2).find('a').attr('href', '/tender/' + tender.id + '/measure/stage/' + stage.order + '/download/file/' + data.id);
                 $('#show-att tr').eq(3).children('td').eq(0).text(data.username);
                 $('#show-att tr').eq(3).children('td').eq(1).text(data.in_time);
                 $('#show-att tr').eq(4).children('td').text(data.remark);
@@ -1395,7 +1394,7 @@ $(document).ready(() => {
             $('#change-att-btn').val('');
         } else if (content === 'del') {
             const data = {id: fid};
-            postData('/tender/' + tender.id + '/measure/stage/' + tender.ledger_times + '/delete/file', data, function (result) {
+            postData('/tender/' + tender.id + '/measure/stage/' + stage.order + '/delete/file', data, function (result) {
                 // 删除到attData中
                 const att_index = attData.findIndex(function (item) {
                     return item.id === parseInt(fid);

+ 2 - 1
app/public/js/stage_pay.js

@@ -32,9 +32,10 @@ function makeAttTable(id, attachment) {
     let html = '';
     if (attachment !== null) {
         for (const [index, att] of attachment.entries()) {
+            const delhtml = uploadPermission && parseInt(att.uid) === parseInt(userID) ? '<a class="delete-att text-danger" href="javascript:void(0);" data-payid="'+ id +'" data-attindex="'+ index +'" title="删除"><i class="fa fa-remove "></i></a>' : '';
             html += '<tr><td style="width: 200px">' + att.filename + att.fileext + '</td><td>' + att.username + '</td><td>' + att.in_time + '</td>' +
                 '<td><a href="/tender/'+ tender.id + '/measure/stage/' + tender.ledger_times +'/pay/download/file/'+ id +'/'+ index +'" title="下载"><i class="fa fa-download "></i></a> ' +
-                '<a class="delete-att text-danger" href="javascript:void(0);" data-payid="'+ id +'" data-attindex="'+ index +'" title="删除"><i class="fa fa-remove "></i></a>' +
+                delhtml +
                 '</td></tr>';
         }
     }

+ 9 - 3
app/public/js/tender_list_manage.js

@@ -315,13 +315,14 @@ function bindTenderUrl() {
         }
     });
     // 编辑
-    $('a[name=edit]', '.c-body').bind('click', function () {
+    $('a[name=edit]', '.c-body').on('click', function () {
         const tid = parseInt($(this).parent().attr('tid'));
         const tender = _.find(tenders, {id: tid});
         $('[name=name]', '#edit-bd').val(tender.name);
+        $('input[type=radio]', '#add-bd').prop('checked', false);
         for (const c of tender.category) {
-            $('input[value=' + c.value + ']', '#edit-bd').attr('checked', 'checked');
-            $('option[value=' + c.value + ']', '#edit-bd').attr('selected', true);
+            $('input[value=' + c.value + ']', '#edit-bd').prop('checked', 'checked');
+            $('option[value=' + c.value + ']', '#edit-bd').prop('selected', true);
         }
         $('#edit-bd-ok').attr('tid', tid);
         $('#edit-bd').modal('show');
@@ -371,6 +372,11 @@ $(document).ready(() => {
             $('#cate-set').modal('hide');
         });
     });
+
+    $('a[name=add]').click(function () {
+        $('input[type=radio]', '#edit-bd').prop('checked', false);
+        $('input[type=radio]', '#add-bd').eq(0).prop('checked', true);
+    });
     // 新增标段
     $('#add-bd-ok').click(function () {
         const data = {

+ 3 - 3
app/view/stage/index.ejs

@@ -120,7 +120,7 @@
                         <div class="tab-content">
                             <div class="tab-pane active" id="dqjiedian">
                                 <div class="sjs-height-3" style="overflow:auto; overflow-x:hidden;">
-                                    <table class="table table-sm table-bordered table-hover">
+                                    <table class="table table-sm table-bordered table-hover" style="word-break:break-all; table-layout: fixed">
                                         <tr><th>文件名</th><th width="80">上传</th></tr>
                                         <tbody id="nodelist-table" class="list-table">
                                         </tbody>
@@ -129,7 +129,7 @@
                             </div>
                             <div class="tab-pane" id="syfujian">
                                 <div class="sjs-height-3" style="overflow:auto; overflow-x:hidden;">
-                                    <table class="table table-sm table-bordered table-hover">
+                                    <table class="table table-sm table-bordered table-hover" style="word-break:break-all; table-layout: fixed">
                                         <tr><th>文件名</th><th width="80">上传</th></tr>
                                         <tbody id="alllist-table" class="list-table">
                                         </tbody>
@@ -150,7 +150,7 @@
                                             <a href="javascript:void(0);" content="cancel" class="btn btn-sm btn-outline-secondary" style="display: none">取消</a>
                                         </div>
                                         <!--显示信息-->
-                                        <table class="table table-sm table-bordered" id="show-att">
+                                        <table class="table table-sm table-bordered" id="show-att" style="word-break:break-all; table-layout: fixed">
                                             <tbody>
                                             <tr><th>文件名</th><td colspan="3">asdasd.jpg</td></tr>
                                             <tr><th>所在节点</th><td colspan="3">1 第一部分 建筑安装工程非</td></tr>

+ 6 - 2
app/view/stage/pay.ejs

@@ -55,8 +55,10 @@
         </div>
     </div>
 </div>
-<img src="/public/images/file_clip.png" id="rela-file-icon" />
-<img src="/public/images/file_clip_hover.png" id="rela-file-hover" />
+<div style="display: none">
+    <img src="/public/images/file_clip.png" id="rela-file-icon" />
+    <img src="/public/images/file_clip_hover.png" id="rela-file-hover" />
+</div>
 <script>
     const tender = JSON.parse('<%- JSON.stringify(tender) %>');
     const stage = JSON.parse('<%- JSON.stringify(ctx.stage) %>');
@@ -65,4 +67,6 @@
     const calcBase = JSON.parse('<%- JSON.stringify(calcBase) %>');
     const decimal = JSON.parse('<%- JSON.stringify(ctx.tender.info.decimal) %>');
     const whiteList = JSON.parse('<%- JSON.stringify(whiteList) %>');
+    const uploadPermission = <%- uploadPermission %>;
+    const userID = '<%- ctx.session.sessionUser.accountId %>';
 </script>

+ 2 - 0
app/view/stage/pay_modal.ejs

@@ -75,10 +75,12 @@
                 <h5 class="modal-title">附件</h5>
             </div>
             <div class="modal-body">
+                <% if (uploadPermission) { %>
                 <div class="form-group">
                     <label for="formGroupExampleInput">大小限制:10MB,支持<span data-toggle="tooltip" data-placement="bottom" title="doc,docx,xls,xlsx,ppt,pptx,pdf">office等文档格式</span>、<span data-toggle="tooltip" data-placement="bottom" title="jpg,png,bmp">图片格式</span>、<span data-toggle="tooltip" data-placement="bottom" title="rar,zip">压缩包格式</span></label>
                     <input type="file" class="form-control" id="upload-file">
                 </div>
+                <% } %>
                 <div class="modal-height-500" style="overflow:auto;">
                     <table class="table table-sm table-bordered" style="word-break:break-all; table-layout: fixed">
                         <thead>

+ 1 - 1
app/view/tender/sub_menu.ejs

@@ -30,7 +30,7 @@
         </div>
         <% if (userPermission !== null && userPermission.tender !== undefined && userPermission.tender.indexOf('1') !== -1) { %>
         <div>
-            <a href="#add-bd" data-toggle="modal" data-target="#add-bd" class="btn btn-sm btn-primary pull-right">新建标段</a>
+            <a href="#add-bd" name="add" data-toggle="modal" data-target="#add-bd" class="btn btn-sm btn-primary pull-right">新建标段</a>
         </div>
         <% } %>
     </div>

+ 1 - 0
config/config.default.js

@@ -106,6 +106,7 @@ module.exports = appInfo => {
             '.xls', '.xlsx',
             '.doc', '.docx',
             '.pdf',
+            '.ppt', '.pptx',
             '.png', '.jpg', '.jpeg', '.gif', '.bmp',
             '.zip', '.rar', '.7z'],
         fileSize: '30mb',