Bläddra i källkod

变更增加分页调整,调差用户增加金额数据(报表用)

ellisran 1 år sedan
förälder
incheckning
127f2f7a2a

+ 20 - 4
app/controller/change_controller.js

@@ -48,6 +48,7 @@ module.exports = app => {
             // const tenderList = await this.service.tender.getList();
 
             const page = ctx.page;
+            const pageSize = ctx.pageSize;
             const sorts = ctx.query.sort ? ctx.query.sort : 0;
             const orders = ctx.query.order ? ctx.query.order : 0;
             const changes = await ctx.service.change.getListByStatus(tender.id, status, 1, sorts, orders);
@@ -103,7 +104,10 @@ module.exports = app => {
             // 分页相关
             const pageInfo = {
                 page,
-                total: Math.ceil(total / app.config.pageSize),
+                pageSizeSelect: 1,
+                pageSize,
+                total_num: total,
+                total: Math.ceil(total / pageSize),
                 queryData: JSON.stringify(ctx.urlInfo.query),
             };
 
@@ -1902,6 +1906,7 @@ module.exports = app => {
             // const tenderList = await this.service.tender.getList();
 
             const page = ctx.page;
+            const pageSize = ctx.pageSize;
             const sorts = ctx.query.sort ? ctx.query.sort : 0;
             const orders = ctx.query.order ? ctx.query.order : 0;
             const changes = await ctx.service.changeProject.getListByStatus(tender.id, status, 1, sorts, orders);
@@ -1915,7 +1920,10 @@ module.exports = app => {
             // 分页相关
             const pageInfo = {
                 page,
-                total: Math.ceil(total / app.config.pageSize),
+                pageSizeSelect: 1,
+                pageSize,
+                total_num: total,
+                total: Math.ceil(total / pageSize),
                 queryData: JSON.stringify(ctx.urlInfo.query),
             };
 
@@ -2515,6 +2523,7 @@ module.exports = app => {
             // const tenderList = await this.service.tender.getList();
 
             const page = ctx.page;
+            const pageSize = ctx.pageSize;
             const sorts = ctx.query.sort ? ctx.query.sort : 0;
             const orders = ctx.query.order ? ctx.query.order : 0;
             const changes = await ctx.service.changeApply.getListByStatus(tender.id, status, 1, sorts, orders);
@@ -2529,7 +2538,10 @@ module.exports = app => {
             // 分页相关
             const pageInfo = {
                 page,
-                total: Math.ceil(total / app.config.pageSize),
+                pageSizeSelect: 1,
+                pageSize,
+                total_num: total,
+                total: Math.ceil(total / pageSize),
                 queryData: JSON.stringify(ctx.urlInfo.query),
             };
 
@@ -3128,6 +3140,7 @@ module.exports = app => {
             // const tenderList = await this.service.tender.getList();
 
             const page = ctx.page;
+            const pageSize = ctx.pageSize;
             const sorts = ctx.query.sort ? ctx.query.sort : 0;
             const orders = ctx.query.order ? ctx.query.order : 0;
             const changes = await ctx.service.changePlan.getListByStatus(tender.id, status, 1, sorts, orders);
@@ -3142,7 +3155,10 @@ module.exports = app => {
             // 分页相关
             const pageInfo = {
                 page,
-                total: Math.ceil(total / app.config.pageSize),
+                pageSizeSelect: 1,
+                pageSize,
+                total_num: total,
+                total: Math.ceil(total / pageSize),
                 queryData: JSON.stringify(ctx.urlInfo.query),
             };
 

+ 16 - 8
app/public/js/change.js

@@ -145,7 +145,7 @@ $(document).ready(() => {
         postbackSafe:true,
         partialRefresh:true
     });
-    
+
     // 首次进入设置
     let showNoNeed = false;
     if (parseInt(cRuleFirst)) {
@@ -294,11 +294,13 @@ $(document).ready(() => {
        if (status !== 0) {
            url += '/status/'+ status;
        }
-       let orderSetting = getLocalCache('change-'+ $('#tenderId').val() +'-list-order');
-       if (orderSetting) {
-           const orders = orderSetting.split('|');
-           url += '?sort=' + orders[0] + '&order=' + orders[1];
-       }
+       const filterString = setChangeFilterData('change-'+ $('#tenderId').val() +'-list-order');
+       if (filterString) url = url + filterString;
+        // let orderSetting = getLocalCache('change-'+ $('#tenderId').val() +'-list-order');
+       // if (orderSetting) {
+       //     const orders = orderSetting.split('|');
+       //     url += '?sort=' + orders[0] + '&order=' + orders[1];
+       // }
        window.location.href = url;
     });
     // 不再显示首次使用
@@ -342,14 +344,20 @@ $(document).ready(() => {
         const orderStr = $(this).val() + '|' + $('#order-radio input[name="paixu"]:checked').val();
         setLocalCache('change-'+ $('#tenderId').val() +'-list-order', orderStr);
         // setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
-        const link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
+        let link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
+        if (getLocalCache('account-pageSize')) {
+            link += '&pageSize=' + getLocalCache('account-pageSize');
+        }
         window.location.href = link;
     });
     $('#order-radio input[name="paixu"]').click(function () {
         const orderStr = $('#sort-radio input[name="paizhi"]:checked').val() + '|' + $(this).val();
         setLocalCache('change-'+ $('#tenderId').val() +'-list-order', orderStr);
         // setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
-        const link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
+        let link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
+        if (getLocalCache('account-pageSize')) {
+            link += '&pageSize=' + getLocalCache('account-pageSize');
+        }
         window.location.href = link;
     })
 });

+ 23 - 20
app/public/js/change_apply.js

@@ -172,13 +172,13 @@ $(document).ready(() => {
         const content = $(this).attr('href');
         if (content === '#add-bj') {
             $('#add-bj-modal').modal('show')
-                getNewCode();
-                if ($('#changeList').children.length === 0) {
-                    $('#addCancel').hide();
-                } else {
-                    $('#addCancel').show();
-                }
-                $('#bj-code').removeClass('is-invalid');
+            getNewCode();
+            if ($('#changeList').children.length === 0) {
+                $('#addCancel').hide();
+            } else {
+                $('#addCancel').show();
+            }
+            $('#bj-code').removeClass('is-invalid');
         }
     });
 
@@ -239,17 +239,14 @@ $(document).ready(() => {
 
     //状态切换
     $('#status_select a').on('click', function () {
-       const status = $(this).data('val');
-       let url = '/tender/'+ tenderId +'/change/apply';
-       if (status !== 0) {
-           url += '/status/'+ status;
-       }
-       let orderSetting = getLocalCache('change-apply-'+ tenderId +'-list-order');
-       if (orderSetting) {
-           const orders = orderSetting.split('|');
-           url += '?sort=' + orders[0] + '&order=' + orders[1];
-       }
-       window.location.href = url;
+        const status = $(this).data('val');
+        let url = '/tender/'+ tenderId +'/change/apply';
+        if (status !== 0) {
+            url += '/status/'+ status;
+        }
+        const filterString = setChangeFilterData('change-apply-'+ tenderId +'-list-order');
+        if (filterString) url = url + filterString;
+        window.location.href = url;
     });
     // 不再显示首次使用
     $('#changeFirst').click(function () {
@@ -292,14 +289,20 @@ $(document).ready(() => {
         const orderStr = $(this).val() + '|' + $('#order-radio input[name="paixu"]:checked').val();
         setLocalCache('change-apply-'+ tenderId +'-list-order', orderStr);
         // setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
-        const link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
+        let link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
+        if (getLocalCache('account-pageSize')) {
+            link += '&pageSize=' + getLocalCache('account-pageSize');
+        }
         window.location.href = link;
     });
     $('#order-radio input[name="paixu"]').click(function () {
         const orderStr = $('#sort-radio input[name="paizhi"]:checked').val() + '|' + $(this).val();
         setLocalCache('change-apply-'+ tenderId +'-list-order', orderStr);
         // setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
-        const link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
+        let link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
+        if (getLocalCache('account-pageSize')) {
+            link += '&pageSize=' + getLocalCache('account-pageSize');
+        }
         window.location.href = link;
     })
 

+ 23 - 20
app/public/js/change_plan.js

@@ -172,13 +172,13 @@ $(document).ready(() => {
         const content = $(this).attr('href');
         if (content === '#add-bj') {
             $('#add-bj-modal').modal('show')
-                getNewCode();
-                if ($('#changeList').children.length === 0) {
-                    $('#addCancel').hide();
-                } else {
-                    $('#addCancel').show();
-                }
-                $('#bj-code').removeClass('is-invalid');
+            getNewCode();
+            if ($('#changeList').children.length === 0) {
+                $('#addCancel').hide();
+            } else {
+                $('#addCancel').show();
+            }
+            $('#bj-code').removeClass('is-invalid');
         }
     });
 
@@ -239,17 +239,14 @@ $(document).ready(() => {
 
     //状态切换
     $('#status_select a').on('click', function () {
-       const status = $(this).data('val');
-       let url = '/tender/'+ tenderId +'/change/plan';
-       if (status !== 0) {
-           url += '/status/'+ status;
-       }
-       let orderSetting = getLocalCache('change-plan-'+ tenderId +'-list-order');
-       if (orderSetting) {
-           const orders = orderSetting.split('|');
-           url += '?sort=' + orders[0] + '&order=' + orders[1];
-       }
-       window.location.href = url;
+        const status = $(this).data('val');
+        let url = '/tender/'+ tenderId +'/change/plan';
+        if (status !== 0) {
+            url += '/status/'+ status;
+        }
+        const filterString = setChangeFilterData('change-plan-'+ tenderId +'-list-order');
+        if (filterString) url = url + filterString;
+        window.location.href = url;
     });
     // 不再显示首次使用
     $('#changeFirst').click(function () {
@@ -292,14 +289,20 @@ $(document).ready(() => {
         const orderStr = $(this).val() + '|' + $('#order-radio input[name="paixu"]:checked').val();
         setLocalCache('change-plan-'+ tenderId +'-list-order', orderStr);
         // setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
-        const link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
+        let link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
+        if (getLocalCache('account-pageSize')) {
+            link += '&pageSize=' + getLocalCache('account-pageSize');
+        }
         window.location.href = link;
     });
     $('#order-radio input[name="paixu"]').click(function () {
         const orderStr = $('#sort-radio input[name="paizhi"]:checked').val() + '|' + $(this).val();
         setLocalCache('change-plan-'+ tenderId +'-list-order', orderStr);
         // setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
-        const link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
+        let link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
+        if (getLocalCache('account-pageSize')) {
+            link += '&pageSize=' + getLocalCache('account-pageSize');
+        }
         window.location.href = link;
     })
 

+ 23 - 20
app/public/js/change_project.js

@@ -172,13 +172,13 @@ $(document).ready(() => {
         const content = $(this).attr('href');
         if (content === '#add-bj') {
             $('#add-bj-modal').modal('show')
-                getNewCode();
-                if ($('#changeList').children.length === 0) {
-                    $('#addCancel').hide();
-                } else {
-                    $('#addCancel').show();
-                }
-                $('#bj-code').removeClass('is-invalid');
+            getNewCode();
+            if ($('#changeList').children.length === 0) {
+                $('#addCancel').hide();
+            } else {
+                $('#addCancel').show();
+            }
+            $('#bj-code').removeClass('is-invalid');
         }
     });
 
@@ -229,17 +229,14 @@ $(document).ready(() => {
 
     //状态切换
     $('#status_select a').on('click', function () {
-       const status = $(this).data('val');
-       let url = '/tender/'+ tenderId +'/change/project';
-       if (status !== 0) {
-           url += '/status/'+ status;
-       }
-       let orderSetting = getLocalCache('change-project-'+ tenderId +'-list-order');
-       if (orderSetting) {
-           const orders = orderSetting.split('|');
-           url += '?sort=' + orders[0] + '&order=' + orders[1];
-       }
-       window.location.href = url;
+        const status = $(this).data('val');
+        let url = '/tender/'+ tenderId +'/change/project';
+        if (status !== 0) {
+            url += '/status/'+ status;
+        }
+        const filterString = setChangeFilterData('change-project-'+ tenderId +'-list-order');
+        if (filterString) url = url + filterString;
+        window.location.href = url;
     });
     // 不再显示首次使用
     $('#changeFirst').click(function () {
@@ -282,14 +279,20 @@ $(document).ready(() => {
         const orderStr = $(this).val() + '|' + $('#order-radio input[name="paixu"]:checked').val();
         setLocalCache('change-project-'+ tenderId +'-list-order', orderStr);
         // setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
-        const link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
+        let link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
+        if (getLocalCache('account-pageSize')) {
+            link += '&pageSize=' + getLocalCache('account-pageSize');
+        }
         window.location.href = link;
     });
     $('#order-radio input[name="paixu"]').click(function () {
         const orderStr = $('#sort-radio input[name="paizhi"]:checked').val() + '|' + $(this).val();
         setLocalCache('change-project-'+ tenderId +'-list-order', orderStr);
         // setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
-        const link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
+        let link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
+        if (getLocalCache('account-pageSize')) {
+            link += '&pageSize=' + getLocalCache('account-pageSize');
+        }
         window.location.href = link;
     })
 

+ 25 - 21
app/public/js/global.js

@@ -113,35 +113,23 @@ $(function(){
 
     $('.change_sort_link').each(function () {
         const tender_id = $(this).attr('href').split('/')[2];
-        let orderSetting = getLocalCache('change-'+ tender_id +'-list-order');
-        if(orderSetting) {
-            const orders = orderSetting.split('|');
-            $(this).attr('href', $(this).attr('href') + '?sort=' + orders[0] + '&order=' + orders[1]);
-        }
+        const filterString = setChangeFilterData('change-'+ tender_id +'-list-order');
+        if (filterString) $(this).attr('href', $(this).attr('href') + filterString);
     });
     $('.change_project_sort_link').each(function () {
         const tender_id = $(this).attr('href').split('/')[2];
-        let orderSetting = getLocalCache('change-project-'+ tender_id +'-list-order');
-        if(orderSetting) {
-            const orders = orderSetting.split('|');
-            $(this).attr('href', $(this).attr('href') + '?sort=' + orders[0] + '&order=' + orders[1]);
-        }
+        const filterString = setChangeFilterData('change-project-'+ tender_id +'-list-order');
+        if (filterString) $(this).attr('href', $(this).attr('href') + filterString);
     });
     $('.change_apply_sort_link').each(function () {
         const tender_id = $(this).attr('href').split('/')[2];
-        let orderSetting = getLocalCache('change-apply-'+ tender_id +'-list-order');
-        if(orderSetting) {
-            const orders = orderSetting.split('|');
-            $(this).attr('href', $(this).attr('href') + '?sort=' + orders[0] + '&order=' + orders[1]);
-        }
+        const filterString = setChangeFilterData('change-apply-'+ tender_id +'-list-order');
+        if (filterString) $(this).attr('href', $(this).attr('href') + filterString);
     });
     $('.change_plan_sort_link').each(function () {
         const tender_id = $(this).attr('href').split('/')[2];
-        let orderSetting = getLocalCache('change-plan-'+ tender_id +'-list-order');
-        if(orderSetting) {
-            const orders = orderSetting.split('|');
-            $(this).attr('href', $(this).attr('href') + '?sort=' + orders[0] + '&order=' + orders[1]);
-        }
+        const filterString = setChangeFilterData('change-plan-'+ tender_id +'-list-order');
+        if (filterString) $(this).attr('href', $(this).attr('href') + filterString);
     });
 
     $('#nav_management').click(function(e) {
@@ -201,6 +189,22 @@ $(function(){
     })
 });
 
+function setChangeFilterData(orderLocal) {
+    const filterData = [];
+    const orderSetting = getLocalCache(orderLocal);
+    if(orderSetting) {
+        const orders = orderSetting.split('|');
+        filterData.push('sort=' + orders[0]);
+        filterData.push('order=' + orders[1]);
+    }
+    if (getLocalCache('account-pageSize')) {
+        filterData.push('pageSize=' + getLocalCache('account-pageSize'));
+    }
+    let filterString = '';
+    if (filterData.length > 0) filterString = filterString + '?' + filterData.join('&');
+    return filterString;
+}
+
 function checkShowLast (count) {
     if (count > 12500) {
         $('a[name=showLevel][tag=last]').hide();
@@ -1212,4 +1216,4 @@ const spreadColor = {
 
 $(document).ready(function () {
   $('.modal').draggable({handle: '.modal-header'});
-});
+});

+ 1 - 1
app/service/change.js

@@ -320,7 +320,7 @@ module.exports = app => {
                 sql += ' ORDER BY a.in_time DESC';
             }
             if (hadlimit) {
-                const limit = this.app.config.pageSize;
+                const limit = this.ctx.pageSize ? this.ctx.pageSize : this.app.config.pageSize;
                 const offset = limit * (this.ctx.page - 1);
                 const limitString = offset >= 0 ? offset + ',' + limit : limit;
                 sql += ' LIMIT ' + limitString;

+ 1 - 1
app/service/change_apply.js

@@ -176,7 +176,7 @@ module.exports = app => {
                 sql += ' ORDER BY a.in_time DESC';
             }
             if (hadlimit) {
-                const limit = this.app.config.pageSize;
+                const limit = this.ctx.pageSize ? this.ctx.pageSize : this.app.config.pageSize;
                 const offset = limit * (this.ctx.page - 1);
                 const limitString = offset >= 0 ? offset + ',' + limit : limit;
                 sql += ' LIMIT ' + limitString;

+ 1 - 1
app/service/change_plan.js

@@ -197,7 +197,7 @@ module.exports = app => {
                 sql += ' ORDER BY a.in_time DESC';
             }
             if (hadlimit) {
-                const limit = this.app.config.pageSize;
+                const limit = this.ctx.pageSize ? this.ctx.pageSize : this.app.config.pageSize;
                 const offset = limit * (this.ctx.page - 1);
                 const limitString = offset >= 0 ? offset + ',' + limit : limit;
                 sql += ' LIMIT ' + limitString;

+ 1 - 1
app/service/change_project.js

@@ -170,7 +170,7 @@ module.exports = app => {
                 sql += ' ORDER BY a.in_time DESC';
             }
             if (hadlimit) {
-                const limit = this.app.config.pageSize;
+                const limit = this.ctx.pageSize ? this.ctx.pageSize : this.app.config.pageSize;
                 const offset = limit * (this.ctx.page - 1);
                 const limitString = offset >= 0 ? offset + ',' + limit : limit;
                 sql += ' LIMIT ' + limitString;

+ 32 - 4
app/service/material_audit.js

@@ -204,6 +204,29 @@ module.exports = app => {
             return true;
         }
 
+        async getTpData(materialId) {
+            const materialInfo = await this.ctx.material.getDataById(materialId);
+            const tp_data = {
+                m_tp: materialInfo.m_tp,
+                m_tax_tp: materialInfo.m_tax_tp,
+            }
+            if (materialInfo.is_stage_self) {
+                const materialStageList = await this.ctx.materialStage.getAllDataByCondition({ where: { mid: materialId }});
+                const stage_tp = [];
+                for (const ms of materialStageList) {
+                    stage_tp.push({
+                        id: ms.id,
+                        sid: ms.sid,
+                        order: ms.order,
+                        m_tp: ms.m_tp,
+                        m_tax_tp: ms.m_tax_tp,
+                    });
+                }
+                tp_data.stage_tp = stage_tp;
+            }
+            return tp_data;
+        }
+
         /**
          * 开始审批
          * @param {Number} materialId - 材料调差期id
@@ -222,10 +245,11 @@ module.exports = app => {
             }
 
             const transaction = await this.db.beginTransaction();
+            const tp_data = await this.getTpData(materialId);
             try {
                 await transaction.update(this.tableName, { id: audit.id, status: auditConst.status.checking, begin_time: new Date() });
                 await transaction.update(this.ctx.service.material.tableName, {
-                    id: materialId, status: auditConst.status.checking,
+                    id: materialId, status: auditConst.status.checking, tp_data: JSON.stringify(tp_data),
                 });
                 // 本期一些必要数据(如应耗数量和上期调差金额)插入到material_bills_history表里
                 const materialBillsData = await this.ctx.service.materialBills.getAllDataByCondition({ where: { tid: this.ctx.tender.id } });
@@ -286,10 +310,12 @@ module.exports = app => {
 
             const nextAudit = await this.getDataByCondition({ mid: materialId, times, order: audit.order + 1 });
 
+            // 获取当前总金额及独立单价期的金额,添加到tp_data中,报表使用
+            const tp_data = await this.getTpData(materialId);
 
             const transaction = await this.db.beginTransaction();
             try {
-                await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
+                await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time, tp_data: JSON.stringify(tp_data) });
 
                 // 获取推送必要信息
                 const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId, audit.aid, checkData.opinion);
@@ -469,8 +495,9 @@ module.exports = app => {
                 order++;
             }
             const transaction = await this.db.beginTransaction();
+            const tp_data = await this.getTpData(materialId);
             try {
-                await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
+                await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time, tp_data: JSON.stringify(tp_data), });
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId, audit.aid, checkData.opinion);
                 const records = [{ pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNo, content: noticeContent }];
@@ -564,6 +591,7 @@ module.exports = app => {
             const preAuditor = auditors2[auditorIndex - 1];
             const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId, audit.aid, checkData.opinion);
             const transaction = await this.db.beginTransaction();
+            const tp_data = await this.getTpData(materialId);
             try {
                 // 添加到消息推送表
                 const records = [{ pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNoPre, content: noticeContent }];
@@ -571,7 +599,7 @@ module.exports = app => {
                     records.push({ pid, type: pushType.material, uid: audit.aid, status: auditConst.status.checkNoPre, content: noticeContent });
                 });
                 await transaction.insert('zh_notice', records);
-                await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });
+                await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time, tp_data: JSON.stringify(tp_data) });
                 // 顺移气候审核人流程顺序
                 this.initSqlBuilder();
                 this.sqlBuilder.setAndWhere('mid', { value: materialId, operate: '=' });

+ 4 - 13
sql/update.sql

@@ -1,15 +1,5 @@
-ALTER TABLE `zh_tender_cache`
-MODIFY COLUMN `stage_flow_cur_uid`  varchar(1000) NOT NULL DEFAULT 0 COMMENT '期-当前流程人id(,间隔)' AFTER `stage_complete_count`,
-MODIFY COLUMN `stage_flow_pre_uid`  varchar(1000) NOT NULL DEFAULT 0 COMMENT '期-上一流程人id(,间隔)' AFTER `stage_flow_cur_tp`;
+ALTER TABLE `zh_material_audit`
+ADD COLUMN `tp_data` json DEFAULT NULL COMMENT '金额数据(报表用)' AFTER `opinion`;
 
-ALTER TABLE `zh_shenpi_audit`
-ADD COLUMN `audit_type`  tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '审批类型(1个人,2会签,3或签)' AFTER `audit_id`,
-ADD COLUMN `audit_order`  tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批顺序' AFTER `audit_type`;
-
-ALTER TABLE `zh_stage_audit`
-ADD COLUMN `audit_type`  tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '审批类型(1个人,2会签,3或签)' AFTER `is_old`,
-ADD COLUMN `audit_order`  tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批顺序' AFTER `audit_type`;
-
-ALTER TABLE `zh_payment_tender_info`
-ADD COLUMN `pay_account`  varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '付款账号' AFTER `tech_param`;
+ALTER TABLE `zh_material`
+ADD COLUMN `tp_data` json DEFAULT NULL COMMENT '上报人上报时的金额数据(报表用)' AFTER `is_stage_self`;

+ 15 - 0
sql/update20230822.sql

@@ -0,0 +1,15 @@
+-- 会签或签 暂不更新 --
+ALTER TABLE `zh_tender_cache`
+MODIFY COLUMN `stage_flow_cur_uid`  varchar(1000) NOT NULL DEFAULT 0 COMMENT '期-当前流程人id(,间隔)' AFTER `stage_complete_count`,
+MODIFY COLUMN `stage_flow_pre_uid`  varchar(1000) NOT NULL DEFAULT 0 COMMENT '期-上一流程人id(,间隔)' AFTER `stage_flow_cur_tp`;
+
+ALTER TABLE `zh_shenpi_audit`
+ADD COLUMN `audit_type`  tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '审批类型(1个人,2会签,3或签)' AFTER `audit_id`,
+ADD COLUMN `audit_order`  tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批顺序' AFTER `audit_type`;
+
+ALTER TABLE `zh_stage_audit`
+ADD COLUMN `audit_type`  tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '审批类型(1个人,2会签,3或签)' AFTER `is_old`,
+ADD COLUMN `audit_order`  tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批顺序' AFTER `audit_type`;
+
+ALTER TABLE `zh_payment_tender_info`
+ADD COLUMN `pay_account`  varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '付款账号' AFTER `tech_param`;