瀏覽代碼

报表,工程变更数据问题

MaiXinRong 3 年之前
父節點
當前提交
6e4e4ea294

+ 2 - 0
app/const/page_show.js

@@ -42,6 +42,8 @@ const defaultSetting = {
     close1stStageCheckDealParam: 0,
     openChangeProject: 0,
     openChangeApply: 0,
+    isPreset: 0,
+    isOnlyChecked: 1
 };
 
 

+ 0 - 1
app/controller/report_controller.js

@@ -382,7 +382,6 @@ module.exports = app => {
             const customSelect = rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_AUDIT_SELECT].enable
                 ? await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, params.rpt_tpl_id)
                 : await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, -1, params.rpt_tpl_id);
-            console.log(customSelect);
 
             let copyCustomSelect = this.ctx.helper.clone(customSelect);
             if (!params.gather_select && copyCustomSelect) delete copyCustomSelect.gather_select;

+ 8 - 3
app/controller/tender_controller.js

@@ -1367,26 +1367,31 @@ module.exports = app => {
                 const data = JSON.parse(ctx.request.body.data);
                 const filter = data.filter.split(';');
                 const responseData = { err: 0, msg: '', data: {} };
+                const where = { tid: this.ctx.tender.id };
                 for (const f of filter) {
                     switch (f) {
                         case 'change':
+                            where.valid = 1;
+                            if (ctx.session.sessionProject.page_show.isOnlyChecked) where.status = auditConst.flow.status.checked;
                             responseData.data[f] = await ctx.service.change.getAllDataByCondition({
                                 columns: [ 'cid', 'code', 'name', 'selected' ],
-                                where: { tid: this.ctx.tender.id, valid: 1 },
+                                where,
                                 orders: [['sin_time', 'desc']],
                             });
                             break;
                         case 'change_project':
+                            if (ctx.session.sessionProject.page_show.isOnlyChecked) where.status = auditConst.changeProject.status.checked;
                             responseData.data[f] = await ctx.service.changeProject.getAllDataByCondition({
                                 columns: [ 'id', 'code', 'name', 'selected' ],
-                                where: { tid: this.ctx.tender.id },
+                                where,
                                 orders: [['in_time', 'desc']],
                             });
                             break;
                         case 'change_apply':
+                            if (ctx.session.sessionProject.page_show.isOnlyChecked) where.status = auditConst.changeApplyProject.status.checked;
                             responseData.data[f] = await ctx.service.changeApply.getAllDataByCondition({
                                 columns: [ 'id', 'code', 'name', 'selected' ],
-                                where: { tid: this.ctx.tender.id },
+                                where,
                                 orders: [['in_time', 'desc']],
                             });
                             break;

+ 1 - 1
app/public/report/js/rpt_change_rela.js

@@ -8,7 +8,7 @@ const rptChangeRela = (function (){
     let curType = '';
     const initList = function () {
         const header = info[curType].colHeader;
-        $('#scr-header').html(`<tr><th>${header[0]}</th><th>${header[1]}</th><th>${header[2]}</th></tr>`);
+        $('#scr-header').html(`<tr class="text-center"><th>${header[0]}</th><th>${header[1]}</th><th>${header[2]}</th></tr>`);
         const html = [], arr = data[curType];
         for (const a of arr) {
             const checked = a.selected ? 'checked' : '';

+ 2 - 2
app/service/report.js

@@ -247,11 +247,11 @@ module.exports = app => {
                             runnableKey.push(filter);
                             break;
                         case 'mem_change_apply':
-                            runnableRst.push(service.changeApply.getAllDataByCondition({ where: { tid: params.tender_id } }));
+                            runnableRst.push(service.reportMemory.getChangeApplyData(params.tender_id));
                             runnableKey.push(filter);
                             break;
                         case 'mem_change_project':
-                            runnableRst.push(service.changeProject.getAllDataByCondition({ where: { tid: params.tender_id } }));
+                            runnableRst.push(service.reportMemory.getChangeProjectData(params.tender_id));
                             runnableKey.push(filter);
                             break;
                         default:

+ 15 - 1
app/service/report_memory.js

@@ -732,7 +732,9 @@ module.exports = app => {
             const self = this;
             try {
                 const decimal = this.ctx.tender.info.decimal, ctx = this.ctx;
-                const change = await this.ctx.service.change.getAllCheckedChanges(tid);
+                const where = { tid, valid: 1 };
+                if (this.ctx.session.sessionProject.page_show.isOnlyChecked) where.status = audit.flow.status.checked;
+                const change = await this.ctx.service.change.getAllDataByCondition({ where, orders: [['in_time', 'desc']] });
                 for (const c of change) {
                     const types = ctx.helper._.map(c.type.split(','), function (t) {
                         return self._getChangeConstName(changeConst.type, ctx.helper._.toInteger(t));
@@ -835,6 +837,18 @@ module.exports = app => {
             }
         }
 
+        async getChangeApplyData(tid, sid, fields) {
+            const where = { tid };
+            if (this.ctx.session.sessionProject.page_show.isOnlyChecked) where.status = audit.changeApply.status.checked;
+            return await this.ctx.service.changeApply.getAllDataByCondition({ where });
+        }
+
+        async getChangeProjectData(tid, sid, fields) {
+            const where = { tid };
+            if (this.ctx.session.sessionProject.page_show.isOnlyChecked) where.status = audit.changeProject.status.checked;
+            return await this.ctx.service.changeProject.getAllDataByCondition({ where });
+        }
+
         async getStageJgcl(tid, sid, fields) {
             try {
                 await this.ctx.service.tender.checkTender(tid);

+ 3 - 0
app/view/report/index.ejs

@@ -26,6 +26,8 @@
                         -->
                     </ul>
                 </div>
+                <% console.log(ctx.session.sessionProject.page_show) %>
+                <% if (ctx.session.sessionProject.page_show.isPreset) { %>
                 <div class="d-inline-block">
                     <div class="dropdown">
                         <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">报表数据预设</button>
@@ -36,6 +38,7 @@
                         </div>
                     </div>
                 </div>
+                <% } %>
             </div>
             <div>
             </div>

+ 1 - 1
builder_report_index_define.js

@@ -243,7 +243,7 @@ const change = {
         { name: '费用承担方', field: 'charge', type: dataType.int },
         { name: '金额', field: 'total_price', type: dataType.currency, tag: { type: 'tp' } },
         { name: '变更状态发生时间(时间戳)', field: 'cin_time', type: dataType.str },
-        { name: '完成审批时间(时间戳)', field: 'sin_ime', type: dataType.str },
+        { name: '完成审批时间(时间戳)', field: 'sin_time', type: dataType.str },
         { name: '金额_1', field: 'tp_1', type: dataType.currency, tag: { type: 'tp' } },
         { name: '金额_2', field: 'tp_2', type: dataType.currency, tag: { type: 'tp' } },
         { name: '金额_3', field: 'tp_3', type: dataType.currency, tag: { type: 'tp' } },