瀏覽代碼

Merge branch 'master' of http://smartcost.in.8866.org:26903/maixinrong/calculation

maixinrong 5 年之前
父節點
當前提交
d165ca0ce9

+ 14 - 0
app/controller/tender_controller.js

@@ -82,6 +82,20 @@ module.exports = app => {
                         t.lastStage = await this.ctx.service.stage.getLastestStage(t.id, true);
                         t.completeStage = await this.ctx.service.stage.getLastestCompleteStage(t.id);
                     }
+                    if (t.lastStage) {
+                        if (t.lastStage.status === auditConst.stage.status.uncheck || t.lastStage.status === auditConst.stage.status.checkNo) {
+                            const status_name = await this.ctx.service.projectAccount.getAccountInfoById(t.lastStage.user_id);
+                            t.status_users = status_name ? status_name.name : '';
+                        } else {
+                            const status_name = await this.ctx.service.stageAudit.getStatusName(t.lastStage.id);
+                            t.status_users = status_name ? status_name.name : '';
+                        }
+                    } else {
+                        if (t.ledger_status !== auditConst.ledger.status.uncheck) {
+                            const status_name = await this.ctx.service.ledgerAudit.getStatusName(t.id);
+                            t.status_users = status_name ? status_name.name : '';
+                        }
+                    }
                 }
                 renderData.categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
                 renderData.valuations = await this.ctx.service.valuation.getProjectValidValuation(this.ctx.session.sessionProject.id);

+ 12 - 10
app/public/js/change_company.js

@@ -11,7 +11,7 @@
 $(document).ready(() => {
     //提出单位编辑
     $('#addcompany').click(function(){
-        let newinput = '<div class="form-group"><input type="text" class="form-control" placeholder="请输入名称"></div>';
+        let newinput = '<div class="form-group"><input type="text" class="form-control form-control-sm" placeholder="请输入名称"></div>';
         $('#companyadddiv').append(newinput);
     });
 
@@ -19,7 +19,9 @@ $(document).ready(() => {
         $(this).attr('disabled','disabled');
         let addcompanyArr = new Array();
         $('#companyadddiv').find('.form-control').each(function(){
-            addcompanyArr.push($(this).val());
+            if ($.trim($(this).val()) !== '') {
+                addcompanyArr.push($(this).val());
+            }
         });
         var updatecompanyArr = new Array();
         var updatecompanyidArr = new Array();
@@ -39,8 +41,8 @@ $(document).ready(() => {
             };
             postData('/change/update/company', data, function (result) {
                 $('#companyadddiv').html('');
-                addCompanyHtml(result);
-                selectCOmpanyHtml(result);
+                updateCompanyHtml(result);
+                selectCompanyHtml(result);
                 $('#editcompany').modal('hide');
                 toastr.success('变更单位已更新');
                 $('#updatecompany').attr('disabled',false);
@@ -55,24 +57,24 @@ $(document).ready(() => {
 function isRepeat(arr){
     let hash = {};
     for(let i in arr) {
-        if(hash[arr[i]])
+        if($.trim(arr[i]) !== '' && hash[arr[i]])
             return true;
         hash[arr[i]] = true;
     }
     return false;
 }
 
-function addCompanyHtml(data) {
+function updateCompanyHtml(data) {
     const html = [];
 
-    for (const a of data.add) {
+    for (const a of data.select) {
         html.push('<div class="form-group">');
-        html.push('<input type="text" id="' + a.id +'" class="form-control" value="'+ a.name +'">');
+        html.push('<input type="text" id="' + a.id +'" class="form-control form-control-sm" value="'+ a.name +'">');
         html.push('</div>');
     }
-    $('#companyshow').append(html.join(''));
+    $('#companyshow').html(html.join(''));
 }
-function selectCOmpanyHtml(data) {
+function selectCompanyHtml(data) {
     const html = [];
     for (const s of data.select) {
         html.push('<option>'+ s.name +'</option>');

+ 10 - 6
app/public/js/tender_list.js

@@ -303,6 +303,7 @@ function recursiveGetTenderNodeHtml (node, arr, pid) {
     // 审批状态
     html.push('<td>');
     html.push(node.lastStage ? auditConst.stage.statusString[node.lastStage.status] : auditConst.ledger.statusString[node.ledger_status]);
+    html.push(node.status_users ? '(' + node.status_users + ')' : '');
     html.push('</td>');
     html.push('</tr>');
     if (node.children) {
@@ -443,18 +444,21 @@ $(document).ready(() => {
 function doTrStatus(node, status) {
     if (status === 'show') {
         $('.c-body').find('tr[pid="'+ node.sort_id +'"]').show();
-        $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '收起');
-        $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-plus-square-o').removeClass('fa-minus-square-o').addClass('fa-minus-square-o');
+        // $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '收起');
+        // $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-plus-square-o').removeClass('fa-minus-square-o').addClass('fa-minus-square-o');
     } else {
         $('.c-body').find('tr[pid="'+ node.sort_id +'"]').hide();
-        $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '展开');
-        $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-minus-square-o').removeClass('fa-plus-square-o').addClass('fa-plus-square-o');
+        // $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '展开');
+        // $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-minus-square-o').removeClass('fa-plus-square-o').addClass('fa-plus-square-o');
 
     }
     // 判断是否还有一层
     if (node.children) {
-        for (const c of node.children) {
-            doTrStatus(c, status);
+        for (const [index,c] of node.children.entries()) {
+            const title = $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').eq(index).attr('title');
+            if (title === '收起') {
+                doTrStatus(c, status);
+            }
         }
     }
 }

+ 10 - 6
app/service/change_company.js

@@ -39,12 +39,16 @@ module.exports = app => {
                 // 更新公司信息
                 if (updateIdArray.length !== 0) {
                     for (const index in updateIdArray) {
-                        const updateData = {
-                            id: updateIdArray[index],
-                            name: updateArray[index],
-                        };
-                        await this.transaction.update(this.tableName, updateData);
-                        selectCompany.push(updateData);
+                        if (updateArray[index].trim() === '') {
+                            await this.transaction.delete(this.tableName, {id: updateIdArray[index]});
+                        } else {
+                            const updateData = {
+                                id: updateIdArray[index],
+                                name: updateArray[index],
+                            };
+                            await this.transaction.update(this.tableName, updateData);
+                            selectCompany.push(updateData);
+                        }
                     }
                 }
 

+ 17 - 0
app/service/ledger_audit.js

@@ -43,6 +43,23 @@ module.exports = app => {
         }
 
         /**
+         * 获取标段审核人最后一位的名称
+         *
+         * @param {Number} tenderId - 标段id
+         * @param {Number} auditorId - 审核人id
+         * @param {Number} times - 第几次审批
+         * @returns {Promise<*>}
+         */
+        async getStatusName(tenderId) {
+            const sql = 'SELECT pa.`name` ' +
+                'FROM ?? AS la, ?? AS pa ' +
+                'WHERE la.`tender_id` = ?' +
+                '    and la.`audit_id` = pa.`id` and la.`status` != ? ORDER BY la.`id` DESC';
+            const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tenderId, auditConst.status.uncheck];
+            return await this.db.queryOne(sql, sqlParam);
+        }
+
+        /**
          * 获取标段审核列表信息
          *
          * @param {Number} tenderId - 标段id

+ 17 - 0
app/service/stage_audit.js

@@ -65,6 +65,23 @@ module.exports = app => {
         }
 
         /**
+         * 获取标段审核人最后一位的名称
+         *
+         * @param {Number} tenderId - 标段id
+         * @param {Number} auditorId - 审核人id
+         * @param {Number} times - 第几次审批
+         * @returns {Promise<*>}
+         */
+        async getStatusName(stageId) {
+            const sql = 'SELECT pa.`name` ' +
+                'FROM ?? AS sa, ?? AS pa ' +
+                'WHERE sa.`sid` = ?' +
+                '    and sa.`aid` = pa.`id` and sa.`status` != ? ORDER BY sa.`id` DESC';
+            const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, auditConst.status.uncheck];
+            return await this.db.queryOne(sql, sqlParam);
+        }
+
+        /**
          * 获取 当前审核人
          *
          * @param {Number} stageId - 期id

+ 3 - 1
app/view/profile/sms.ejs

@@ -51,7 +51,9 @@
                             <% const user_smsType = accountData.sms_type !== '' ? JSON.parse(accountData.sms_type) : null; %>
                             <% for (const s in smsType) { %>
                             <div class="form-group row">
-                                <label class="col-auto col-form-label"><%= smsType[s].name %><a href="#sms-view" data-toggle="modal" data-target="#sms-view" class="ml-2"><i class="fa fa-info-circle"></i></a></label>
+                                <label class="col-auto col-form-label"><%= smsType[s].name %>
+                                    <!--<a href="#sms-view" data-toggle="modal" data-target="#sms-view" class="ml-2"><i class="fa fa-info-circle"></i></a>-->
+                                </label>
                                 <div class="col-5">
                                     <% for (const c of smsType[s].children) { %>
                                     <div class="form-check ">

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

@@ -2,7 +2,7 @@
     <% include ./sub_menu.ejs %>
     <div class="content-wrap">
         <div class="sjs-height-0">
-            <div class="c-body">
+            <div class="c-body" onselectstart="return false" style="{-moz-user-select:none}">
             </div>
         </div>
     </div>