Browse Source

汇总表,根据终审审批通过时间汇总期

MaiXinRong 2 years ago
parent
commit
4012dc0b80

+ 12 - 0
app/public/report/js/rpt_custom.js

@@ -310,10 +310,13 @@ const rptCustomObj = (function () {
         if (gsObj.setting.type === 'zone') $('#gather-by-zone').show();
         if (gsObj.setting.type === 'stage') $('#gather-by-stage').show();
         if (gsObj.setting.type === 'stage-zone') $('#gather-by-stage-zone').show();
+        if (gsObj.setting.type === 'checked-zone') $('#gather-by-checked-zone').show();
 
         if (gsSelect) {
             if (gsSelect.zone) {
                 $('#gather-zone').val(gsSelect.zone ? gsSelect.zone : '');
+            } else if (gsSelect.checked_zone) {
+                $('#gather-checked-zone').val(gsSelect.checked_zone ? gsSelect.checked_zone : '');
             } else if (gsSelect.month) {
                 $('#gather-month').val(gsSelect.month ? gsSelect.month: '');
             } else if (gsSelect.stage) {
@@ -613,6 +616,15 @@ const rptCustomObj = (function () {
                 return;
             }
             data[sGatherSelect].stage_zone = stageBegin + ':' + stageEnd;
+        } else if (gsObj.setting.type === 'checked-zone') {
+            data[sGatherSelect].checked_zone = $('#gather-checked-zone').val();
+            if (data[sGatherSelect].checked_zone === '') {
+                hintObj.html('请选择 汇总周期').show();
+                return;
+            } else if(data[sGatherSelect].checked_zone.indexOf(' - ') < 0) {
+                hintObj.html('请选择 完整汇总周期').show();
+                return;
+            }
         }
         hintObj.hide();
         if (resolve) {

+ 30 - 5
app/service/rpt_gather_memory.js

@@ -290,7 +290,6 @@ module.exports = app => {
             }
             return validStages;
         }
-
         async _getOrderZoneStages (tender, zone) {
             let [iBegin, iEnd] = zone.split(':');
             iBegin = this.ctx.helper._.toInteger(iBegin) || 0;
@@ -303,6 +302,25 @@ module.exports = app => {
             }
             return validStages;
         }
+        async _getCheckedZoneStages(tender, zone) {
+            const times = zone.split(' - ');
+            if (times.length !== 2) throw '选择的汇总周期无效';
+            const beginTime = moment(times[0], 'YYYY-MM-DD');
+            const endTime = moment(times[1], 'YYYY-MM-DD');
+
+            const stages = await this._getValidStages(tender.id), validStages = [];
+            for (const stage of stages) {
+                if (stage.status !== auditConst.stage.status.checked) continue;
+                const finalAudit = this.ctx.service.stageAudit.getLastestAuditor(stage.id, stage.times, stage.status);
+                if (!finalAudit) continue;
+
+                const sTime = moment(finalAudit.end_time);
+                if (sTime.isBetween(beginTime, endTime, null, '[]')) {
+                    validStages.push(stage);
+                }
+            }
+            return validStages;
+        }
 
         /**
          * 台账数据
@@ -410,6 +428,14 @@ module.exports = app => {
             const stages = await this._getTimeZoneStages(tender, zone);
             await this._gatherStagesData(completeData, tender, stages);
         }
+        async _gatherIndexZoneData(tender, completeData, stageZone) {
+            const stages = await this._getOrderZoneStages(tender, stageZone);
+            await this._gatherStagesData(completeData, tender, stages);
+        }
+        async _gatherCheckedZoneData(tender, completeData, zone) {
+            const stages = await this._getCheckedZoneStages(tender, zone);
+            await this._gatherStagesData(completeData, tender, stages);
+        }
 
         async _gatherStageData(completeData, tender, stage, hasPre) {
             const helper = this.ctx.helper;
@@ -505,10 +531,6 @@ module.exports = app => {
             const stage = this.ctx.helper._.find(stages, {order: index});
             await this._gatherStageData(completeData, tender, stage, hasPre);
         }
-        async _gatherIndexZoneData(tender, completeData, stageZone) {
-            const stages = await this._getOrderZoneStages(tender, stageZone);
-            await this._gatherStagesData(completeData, tender, stages);
-        }
         async _gatherFinalData(tender, completeData, hasPre) {
             const stages = await this._getValidStages(tender.id);
             await this._gatherStageData(completeData, tender, stages[0], hasPre);
@@ -618,6 +640,9 @@ module.exports = app => {
                         case 'stage-zone':
                             await this._gatherIndexZoneData(tender, completeData, gsCustom.stage_zone);
                             break;
+                        case 'checked-zone':
+                            await this._gatherCheckedZoneData(tender, completeData, gsCustom.check_zone);
+                            break;
                     }
                     commonIndex++;
                 } else {

+ 8 - 0
app/view/report/rpt_all_popup.ejs

@@ -377,6 +377,14 @@
                                 <input id="gather-zone" class="datepicker-here form-control mt-0" placeholder="点击选择周期" data-range="true" data-multiple-dates-separator=" - "  data-min-view="months" data-view="months" data-date-format="yyyy-MM" data-language="zh" type="text" autocomplete="off">
                             </div>
                         </div>
+                        <div id="gather-by-checked-zone" name="gather-type">
+                            <div class="input-group input-group-sm">
+                                <div class="input-group-prepend">
+                                    <span class="input-group-text">汇总周期</span>
+                                </div>
+                                <input id="gather-checked-zone" class="datepicker-here form-control mt-0" placeholder="点击选择周期" data-range="true" data-multiple-dates-separator=" - "  data-min-view="days" data-view="days" data-date-format="yyyy-MM-DD" data-language="zh" type="text" autocomplete="off">
+                            </div>
+                        </div>
                         <div id="gather-by-stage" name="gather-type">
                             <div class="input-group input-group-sm">
                                 <div class="input-group-prepend">