Pārlūkot izejas kodu

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

Tony Kang 2 gadi atpakaļ
vecāks
revīzija
33664bf6b8

+ 1 - 1
app/const/payment.js

@@ -34,7 +34,7 @@ const const_rpt_list = [
 
 const setting_modes = {
     safe: {
-        name: '安全生产费',
+        name: '安全生产费(当前版本未做功能,请忽略)',
         checked: false,
         value: 1,
     },

+ 2 - 2
app/controller/payment_controller.js

@@ -252,7 +252,7 @@ module.exports = app => {
                 const modes = projectInfo.payment_setting ? JSON.parse(projectInfo.payment_setting) : ctx.helper._.cloneDeep(paymentConst.setting_modes);
                 for (const m in modes) {
                     const detailCount = await ctx.service.paymentDetail.getCountByPidType(ctx.session.sessionProject.id, modes[m].value);
-                    modes[m].can_check = !detailCount;
+                    modes[m].can_check = !detailCount && modes[m].value !== 1;
                 }
                 const renderData = {
                     setting_modes: paymentConst.setting_modes,
@@ -375,8 +375,8 @@ module.exports = app => {
                         const groupList = accountList.filter(item => item.account_group === idx);
                         return { groupName: item, groupList };
                     });
-                    renderData.rptAuditList = await ctx.service.paymentRptAudit.getAllDataByCondition({ where: { td_id: ctx.detail.id } });
                 }
+                renderData.rptAuditList = await ctx.service.paymentRptAudit.getListByDetail(ctx.detail.id);
                 await this.layout('payment/detail.ejs', renderData, 'payment/detail_modal.ejs');
             } catch (err) {
                 console.log(err);

+ 5 - 2
app/lib/rm/material.js

@@ -283,7 +283,7 @@ class ReportMemoryMaterial {
         }
     }
 
-    async _getMaterialStageGatherBills(tender_id, stage_id, stage_order, stageSelf) {
+    async _getMaterialStageGatherBills(tender_id, stage_id, stage_order, stageSelf, stageIndex = 0) {
         const decimal = this.materialGatherBase.decimal;
         //const billsData = this.ctx.helper.clone(this.materialGatherBase.billsData);
         const billsData = this.materialGatherBase.billsData;
@@ -322,6 +322,7 @@ class ReportMemoryMaterial {
         const materialGl = stageSelf
             ? this.materialGatherBase.materialGl.filter(x => { return x.sid === parseInt(stage_id); })
             : this.materialGatherBase.materialGl;
+        if (stageIndex) materialGl.forEach(x => { x.s_index = stageIndex });
         const materialNotJoin = this.materialGatherBase.materialNotJoin;
 
         const helper = this.ctx.helper;
@@ -331,10 +332,12 @@ class ReportMemoryMaterial {
             if (!g.contract_qty && !g.qc_qty) continue;
             g.sid = stage_id;
             g.sorder = stage_order;
+            g.s_index = stageIndex;
             g.jiacha = 0;
             for (const x of g.leafXmjs) {
                 x.sid = stage_id;
                 x.sorder = stage_order;
+                x.s_index = stageIndex;
                 x.jiacha = 0;
                 const mnj = materialNotJoin.find(m => {
                     return m.gcl_id === x.org_gcl_id && m.xmj_id === x.id && (x.mx_id && x.mx_id !== x.id  ? x.mx_id === m.mx_id : true);
@@ -388,7 +391,7 @@ class ReportMemoryMaterial {
                 const stageIds = material.stage_id.split(',');
                 const stageOrders = material.s_order.split(',');
                 for (const [i, sid] of stageIds.entries()) {
-                    const [gclList, leafXmjs] = await this._getMaterialStageGatherBills(tender_id, sid, stageOrders[i], true);
+                    const [gclList, leafXmjs] = await this._getMaterialStageGatherBills(tender_id, sid, stageOrders[i], true, i + 1);
                     mem_material_gather_bills.push(...gclList);
                     mem_material_gather_xmj.push(...leafXmjs);
                 }

+ 3 - 0
app/middleware/payment_tender_check.js

@@ -33,6 +33,9 @@ module.exports = options => {
                 if (!modes[m]) modes[m] = _.cloneDeep(paymentConst.setting_modes[m]);
             }
             const auditPermission = yield this.service.paymentPermissionAudit.getOnePermission(this.session.sessionUser.is_admin, this.session.sessionUser.accountId);
+            if (!auditPermission) {
+                throw '权限不足';
+            }
             if (!tender) {
                 throw '标段不存在';
             }

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

@@ -106,6 +106,9 @@ $(function () {
             }
             postData('/payment/' + tenderId + '/detail/' + detailId + '/save', { type: 'update_sign', signature_msg: rptAudit.signature_msg }, function (result) {
                 auditRptPrintHelper.showPage();
+                // 更新签署进度图表展示
+                $('#rpt_audit_sign td').eq(3).html(rptAudit.signature_msg.sign_path !== null ? '<i class="fa fa-check text-success"></i>' : '');
+                $('#rpt_audit_sign td').eq(4).html(rptAudit.signature_msg.company_stamp !== null || rptAudit.signature_msg.stamp_path !== null ? '<i class="fa fa-check text-success"></i>' : '');
             });
             $('#sub-sp5').modal('hide');
         } else {

+ 1 - 1
app/public/js/payment_index.js

@@ -77,7 +77,7 @@ $(function () {
             if (node.uid === uid || is_admin) {
                 html.push('<a class="dropdown-item edit_name_btn" data-type="'+ (node.parent_id === undefined ? 'tender' : 'folder') +'" data-id="'+ node.id +'" href="javascript:void(0);"><i class="fa fa-edit mr-2"></i>重命名</a>\n');
             }
-            if (!node.had_tender && node.uid === uid || is_admin) {
+            if (!node.had_tender && (node.uid === uid || is_admin)) {
                 if (node.have_detail) {
                     html.push('<a class="dropdown-item" style="cursor:not-allowed" href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="请先删除所有审批期数据"><i class="fa fa-remove mr-2"></i>删除</a>\n');
                 } else {

+ 11 - 7
app/public/js/payment_process.js

@@ -56,8 +56,10 @@ $(function () {
                         <span class="text-muted">${item.role || ''}</span>
                     </dd>`
                 });
-                $('#' + code + '_dropdownMenu .book-list').empty();
-                $('#' + code + '_dropdownMenu .book-list').append(html);
+                $(this).parents('.dropdown-menu').children('.book-list').empty();
+                $(this).parents('.dropdown-menu').children('.book-list').append(html);
+                // $('#' + code + '_dropdownMenu .book-list').empty();
+                // $('#' + code + '_dropdownMenu .book-list').append(html);
             } else {
                 if (!$('#' + code + '_dropdownMenu .acc-btn').length) {
                     accountGroup.forEach((group, idx) => {
@@ -76,8 +78,10 @@ $(function () {
                         });
                         html += '</div>';
                     });
-                    $('#' + code + '_dropdownMenu .book-list').empty();
-                    $('#' + code + '_dropdownMenu .book-list').append(html);
+                    // $('#' + code + '_dropdownMenu .book-list').empty();
+                    // $('#' + code + '_dropdownMenu .book-list').append(html);
+                    $(this).parents('.dropdown-menu').children('.book-list').empty();
+                    $(this).parents('.dropdown-menu').children('.book-list').append(html);
                 }
             }
         }, 400);
@@ -178,7 +182,7 @@ $(function () {
             html +='<div><span class="d-inline-block">\n' +
                 '                                                <div class="dropdown text-right">\n' +
                 '                                                    <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" id="' + tr_id + '_dropdownMenuButton2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n' +
-                '                                                        选择审批人\n' +
+                '                                                        选择上报人\n' +
                 '                                                    </button>\n' +
                 '                                                    <div class="dropdown-menu dropdown-menu-right" id="' + tr_id + '_dropdownMenu2" aria-labelledby="' + tr_id + '_dropdownMenuButton2" style="width:220px">\n' +
                 '                                                        <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"\n' +
@@ -475,8 +479,8 @@ $(function () {
     };
 
     $('#add-rpt').on('show.bs.modal', function () {
-        $('#rpt-table').find('input:checked:not(:disabled)').prop('checked', false);
-        $('#rpt-table').find('input:not(:disabled)').each(function () {
+        $('#rpt_table').find('input:checked:not(:disabled)').prop('checked', false);
+        $('#rpt_table').find('input:not(:disabled)').each(function () {
             if (_.findIndex(tenderRptList, { rpt_id: parseInt($(this).val()) }) !== -1) {
                 $(this).prop('checked', true);
             }

+ 13 - 1
app/service/payment_folder.js

@@ -64,7 +64,19 @@ module.exports = app => {
                     throw '您没有权限删除此目录';
                 }
                 let ids = [info.id];
-                if (info.parent_path) {
+                if (info.parent_id === 0) {
+                    const childList = await this.getAllDataByCondition({ where: { parent_id: info.id } });
+                    if (childList.length > 0) {
+                        ids = [...ids, ...this._.map(childList, 'id')];
+                        for (const c of childList) {
+                            const deleteData = await this.getDataByParentPath(this.tableName, c.parent_path + '-' + c.id + '%', transaction);
+                            if (deleteData.length > 0) {
+                                const delids = this._.map(deleteData, 'id');
+                                ids = [...ids, ...delids];
+                            }
+                        }
+                    }
+                } else if (info.parent_path) {
                     const deleteData = await this.getDataByParentPath(this.tableName, info.parent_path + '-' + info.id + '%', transaction);
                     if (deleteData.length > 0) {
                         const delids = this._.map(deleteData, 'id');

+ 12 - 0
app/service/payment_rpt_audit.js

@@ -70,6 +70,18 @@ module.exports = app => {
             }
             await transaction.updateRows(this.tableName, updateData);
         }
+
+        async getListByDetail(td_id) {
+            const sql = 'SELECT pra.*, pa.name as user_name FROM ?? as pra LEFT JOIN ?? as pa ON pra.`uid` = pa.`id` WHERE td_id = ?';
+            const params = [this.tableName, this.ctx.service.projectAccount.tableName, td_id];
+            const list = await this.db.query(sql, params);
+            if (list.length > 0) {
+                for (const ra of list) {
+                    ra.signature_msg = ra.signature_msg ? JSON.parse(ra.signature_msg) : null;
+                }
+            }
+            return list;
+        }
     }
 
     return PaymentRptAudit;

+ 4 - 4
app/service/payment_tender.js

@@ -25,9 +25,9 @@ module.exports = app => {
             }
             const typeValues = [];
             const projectInfo = await this.ctx.service.project.getDataById(this.ctx.session.sessionProject.id);
-            const modes = projectInfo.payment_setting ? JSON.parse(projectInfo.payment_setting) : _.cloneDeep(paymentConst.setting_modes);
+            const modes = projectInfo.payment_setting ? JSON.parse(projectInfo.payment_setting) : this._.cloneDeep(paymentConst.setting_modes);
             for (const m in paymentConst.setting_modes) {
-                if (!modes[m]) modes[m] = _.cloneDeep(paymentConst.setting_modes[m]);
+                if (!modes[m]) modes[m] = this._.cloneDeep(paymentConst.setting_modes[m]);
                 if (modes[m].checked) {
                     typeValues.push(modes[m].value);
                 }
@@ -35,13 +35,13 @@ module.exports = app => {
             if (typeValues.length === 0) {
                 return -1;
             }
-            const sql = 'SELECT pt.*, pa.name as user_name FROM ?? as pt LEFT JOIN ?? as pa ON pt.`uid` = pa.`id` WHERE pid = ? AND pt.`uid` = ? ' +
+            const sql = 'SELECT pt.*, pa.name as user_name FROM ?? as pt LEFT JOIN ?? as pa ON pt.`uid` = pa.`id` WHERE pid = ? AND (pt.`uid` = ? ' +
                 'OR pt.`id` in (SELECT pr.`tender_id` FROM ?? as pr WHERE pr.`uid` = ? AND pr.`type` IN (' + this.ctx.helper.getInArrStrSqlFilter(typeValues) + '))' +
                 'OR pt.`id` in (SELECT pd.`tender_id` FROM ?? as pd WHERE pd.`uid` = ?)' +
                 'OR pt.`id` in (SELECT pda.`tender_id` FROM ?? as pda LEFT JOIN ?? as pd ON pda.`tender_id` = pd.`tender_id` ' +
                 'WHERE pd.`status` != ' + auditConst.status.uncheck + ' AND pda.`aid` = ?)' +
                 'OR pt.`id` in (SELECT pra.`tender_id` FROM ?? as pra LEFT JOIN ?? as pd ON pra.`tender_id` = pd.`tender_id` ' +
-                'WHERE pd.`status` != ' + auditConst.status.uncheck + ' AND pd.`status` !=' + auditConst.status.checkNo + ' AND pra.`uid` = ?)';
+                'WHERE pd.`status` != ' + auditConst.status.uncheck + ' AND pd.`status` !=' + auditConst.status.checkNo + ' AND pra.`uid` = ?))';
             const params = [this.tableName, this.ctx.service.projectAccount.tableName, this.ctx.session.sessionProject.id, uid,
                 this.ctx.service.paymentTenderRpt.tableName, uid,
                 this.ctx.service.paymentDetail.tableName, uid,

+ 1 - 1
app/service/pos.js

@@ -28,7 +28,7 @@ module.exports = app => {
             return await this.db.select(this.departTableName(condition.tid), {
                 where: condition,
                 columns: column || ['id', 'tid', 'lid', 'name', 'quantity', 'position', 'drawing_code', 'sgfh_qty', 'sjcl_qty',
-                    'qtcl_qty', 'in_time', 'porder', 'add_stage', 'sgfh_expr', 'sjcl_expr', 'qtcl_expr', 'real_qty',
+                    'qtcl_qty', 'in_time', 'porder', 'add_stage', 'add_stage_order', 'sgfh_expr', 'sjcl_expr', 'qtcl_expr', 'real_qty',
                     'ex_memo1', 'ex_memo2', 'ex_memo3'],
                 order: [['porder', 'ASC']],
             });

+ 1 - 1
app/view/payment/audit_modal.ejs

@@ -22,7 +22,7 @@
                                             <div class="row">
                                                 <span class="col-2"><%- index+1 %></span>
                                                 <span class="col-6"><%- ra.signature_name %></span>
-                                                <span class="col-4"><%- ctx.helper._.findIndex(accountList, { id: ra.uid }) !== -1 ? ctx.helper._.find(accountList, { id: ra.uid }).name : '' %></span>
+                                                <span class="col-4"><%- ra.user_name %></span>
                                             </div>
                                         </li>
                                     <% } %>

+ 1 - 0
app/view/payment/detail.ejs

@@ -23,6 +23,7 @@
                 ) { %>
                 <a href="#sub-sp5" data-toggle="modal" data-target="#sub-sp5" class="btn btn-sm btn-primary pull-right mr-2">签字意见</a>
                 <% } %>
+                <a href="#sign-flow" data-toggle="modal" data-target="#sign-flow" class="btn btn-sm btn-outline-success pull-right mr-2">签署进度</a>
                 <% } %>
             </div>
         </div>

+ 37 - 0
app/view/payment/detail_modal.ejs

@@ -100,4 +100,41 @@
     </div>
 </div>
 <% } %>
+<!--签署进度-->
+<div class="modal fade" id="sign-flow" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">签署进度</h5>
+            </div>
+            <div class="modal-body">
+                <table class="table table-bordered">
+                    <thead class="text-center">
+                    <tr>
+                        <th>序号</th>
+                        <th>表单角色</th>
+                        <th>签署人</th>
+                        <th>签字</th>
+                        <th>签章</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <% for (const [index, ra] of rptAuditList.entries()) { %>
+                    <tr class="text-center" <% if (rptAudit && rptAudit.id === ra.id) { %>id="rpt_audit_sign"<% } %>>
+                        <td><%- index+1 %></td>
+                        <td><%- ra.signature_name %></td>
+                        <td><%- ra.user_name %></td>
+                        <td><% if (ra.signature_msg && ra.signature_msg.sign_path !== null ) { %><i class="fa fa-check text-success"></i><% } %></td>
+                        <td><% if (ra.signature_msg && (ra.signature_msg.stamp_path !== null || ra.signature_msg.company_stamp !== null)) { %><i class="fa fa-check text-success"></i><% } %></td>
+                    </tr>
+                    <% } %>
+                    </tbody>
+                </table>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">关闭</button>
+            </div>
+        </div>
+    </div>
+</div>
 <% include ./audit_modal.ejs %>

+ 6 - 1
app/view/payment/list_modal.ejs

@@ -12,7 +12,7 @@
                     <tr>
                         <th>序号</th>
                         <th>表单角色</th>
-                        <th>审批人</th>
+                        <th>签署人</th>
                     </tr>
                     </thead>
                     <tbody>
@@ -74,6 +74,11 @@
                 <form>
                     <div class="form-group">
                         <!--<a href="#" class="float-right"><i class="fa fa-cog"></i></a>-->
+                        <label for="add-detail-code">期数</label>
+                        <input type="text" class="form-control form-control-sm"  value="第<%- (!trDetailList || trDetailList.length === 0 ? '1' : (trDetailList && trDetailList.length >= 1 ? trDetailList[0].order + 1 : '')) %>期" readonly>
+                    </div>
+                    <div class="form-group">
+                        <!--<a href="#" class="float-right"><i class="fa fa-cog"></i></a>-->
                         <label for="add-detail-code">编号</label>
                         <input type="text" class="form-control form-control-sm" name="add_code" id="add-detail-code" placeholder="请输入编号" value="">
                     </div>

+ 1 - 1
app/view/payment/process_modal.ejs

@@ -5,7 +5,7 @@
                 <h5 class="modal-title">添加表单</h5>
             </div>
             <div class="modal-body" style="max-height:800px;overflow: auto">
-                <table id="rpt-table" class="table table-bordered">
+                <table id="rpt-table1" class="table table-bordered">
                     <thead>
                     <tr>
                         <th class="text-center"><input type="checkbox" id="select_all_rpt_checkbox"> 选择</th>