From 05c7478c26954ee6031f98fce6c8c9901abb98a0 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期二, 24 三月 2026 14:10:52 +0800
Subject: [PATCH] 调整

---
 src/views/dataAnalysis/components/DataReGasStation.vue |  154 ++++++++++++++++++++++++++++++++++++++
 src/views/dataAnalysis/components/CustTypeModal.vue    |   13 +-
 src/views/dataAnalysis/components/CustTypeConfig.vue   |   17 +++-
 src/views/dataAnalysis/components/DataRePieChart.vue   |   10 +-
 4 files changed, 178 insertions(+), 16 deletions(-)

diff --git a/src/views/dataAnalysis/components/CustTypeConfig.vue b/src/views/dataAnalysis/components/CustTypeConfig.vue
index 332e2e2..3b12660 100644
--- a/src/views/dataAnalysis/components/CustTypeConfig.vue
+++ b/src/views/dataAnalysis/components/CustTypeConfig.vue
@@ -47,7 +47,7 @@
 import CustTypeModal from './CustTypeModal'
 import { JeecgListMixin } from '@tievd/cube-block/lib/mixins/JeecgListMixin'
 import { UI_CACHE_DB_DICT_DATA } from '@tievd/cube-block/lib/store/mutation-types'
-import { deleteAction } from '@tievd/cube-block/lib/api/manage'
+import { deleteAction, getAction } from '@tievd/cube-block/lib/api/manage'
 import Vue from 'vue'
 
 export default {
@@ -127,8 +127,16 @@
 
   methods: {
     modalFormOk() {
-      // 娣诲姞/缂栬緫鎴愬姛鍚庡埛鏂伴〉闈互鏇存柊瀛楀吀缂撳瓨
-      window.location.reload()
+      this.loadData()
+      this.refreshDictCache()
+    },
+    refreshDictCache() {
+      getAction('/sys/dict/queryAllDictItems').then((res) => {
+        if (res.success) {
+          Vue.ls.remove(UI_CACHE_DB_DICT_DATA)
+          Vue.ls.set(UI_CACHE_DB_DICT_DATA, res.result, 7 * 24 * 60 * 60 * 1000)
+        }
+      })
     },
     handleDelete(id) {
       // 鍒犻櫎鍓嶆竻闄ゅ墠绔瓧鍏哥紦瀛�
@@ -137,7 +145,8 @@
         .then((res) => {
           if (res.success) {
             this.$message.success(res.message)
-            window.location.reload()
+            this.loadData()
+            this.refreshDictCache()
           } else {
             this.$message.warning(res.message)
           }
diff --git a/src/views/dataAnalysis/components/CustTypeModal.vue b/src/views/dataAnalysis/components/CustTypeModal.vue
index caf4def..169830c 100644
--- a/src/views/dataAnalysis/components/CustTypeModal.vue
+++ b/src/views/dataAnalysis/components/CustTypeModal.vue
@@ -17,6 +17,9 @@
             v-model="clientConfigsList.clientName"
           ></a-input>
         </a-form-item>
+        <div v-if="!clientConfigsList.clientConfigs || clientConfigsList.clientConfigs.length === 0" style="text-align: center">
+          <a-button type="primary" @click="addConditions"> 娣诲姞瑙勫垯 </a-button>
+        </div>
         <div v-for="(subItem, subIndex) in clientConfigsList.clientConfigs" :key="subIndex">
           <div style="display: flex">
             <div>鏉′欢{{ subIndex + 1 }}锛�</div>
@@ -135,7 +138,7 @@
               ></a-input>
             </a-form-item>
           </div>
-          <div style="text-align: center">
+          <div style="text-align: center" v-if="subIndex === clientConfigsList.clientConfigs.length - 1">
             <a-button type="primary" @click="addConditions"> 澧炲姞鏉′欢 </a-button>
           </div>
         </div>
@@ -238,8 +241,8 @@
         // 鍔犳补瓒嬪娍锛氭竻闄ら娆¢厤缃紝璁剧疆榛樿鍊�
         Object.assign(target, {
           ruleType: 2,
-          countType: null,
-          countRef: null,
+          countType: 2,
+          countRef: 1,
           countTrend: target.countTrend || 1,
           historyMonths: target.historyMonths || 3,
           recentMonths: target.recentMonths || 3,
@@ -283,7 +286,7 @@
       this.clientConfigsList = Object.assign({}, record, {
         clientConfigs: (record.clientConfigs || []).length
           ? record.clientConfigs.map((item) => this.buildCondition(item))
-          : [this.buildCondition()],
+          : [],
       })
     },
     close() {
@@ -341,8 +344,6 @@
             }
             if (res.success) {
               this.$message.success(res.message)
-              // 娣诲姞/缂栬緫鎴愬姛鍚庡埛鏂伴〉闈互鏇存柊瀛楀吀缂撳瓨
-              window.location.reload()
               this.$emit('ok')
             }
           } catch (err) {
diff --git a/src/views/dataAnalysis/components/DataReGasStation.vue b/src/views/dataAnalysis/components/DataReGasStation.vue
index 6c4dca0..4056c6a 100644
--- a/src/views/dataAnalysis/components/DataReGasStation.vue
+++ b/src/views/dataAnalysis/components/DataReGasStation.vue
@@ -122,6 +122,41 @@
         </div>
       </div>
     </div>
+    <div class="oil-freq-compare-ct">
+      <div class="block-title">娲诲姩鍓嶅悗杞﹁締鍔犳补棰戞</div>
+      <div class="oil-freq-compare-operator">
+        <span>娲诲姩鍓嶆椂娈�</span>
+        <a-range-picker
+          style="width: 360px; margin: 0 12px"
+          :value="beforeTimeRange"
+          format="YYYY-MM-DD HH:mm:ss"
+          valueFormat="YYYY-MM-DD HH:mm:ss"
+          :show-time="{ defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')] }"
+          @change="beforeTimeChange"
+        />
+        <span>娲诲姩鍚庢椂娈�</span>
+        <a-range-picker
+          style="width: 360px; margin: 0 12px"
+          :value="afterTimeRange"
+          format="YYYY-MM-DD HH:mm:ss"
+          valueFormat="YYYY-MM-DD HH:mm:ss"
+          :show-time="{ defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')] }"
+          @change="afterTimeChange"
+        />
+        <a-button type="primary" @click="getOilFreqCompareData"> 缁熻棰戞 </a-button>
+      </div>
+      <a-table
+        class="oil-freq-compare-table"
+        rowKey="licenseNum"
+        size="middle"
+        :columns="oilFreqCompareColumns"
+        :dataSource="oilFreqCompareData"
+        :loading="oilFreqCompareLoading"
+        :scroll="{ y: 420 }"
+        :pagination="{ pageSize: 10, showSizeChanger: true, pageSizeOptions: ['10', '20', '50'] }"
+      >
+      </a-table>
+    </div>
     <div>
       <div class="block-title">杞﹀瀷鍒嗘瀽</div>
       <div style="display: flex">
@@ -183,6 +218,7 @@
 import DataReLineChart from './DataReLineChart'
 import DataRePieChart from './DataRePieChart'
 import { getAction, postAction } from '@tievd/cube-block/lib/api/manage'
+import moment from 'moment'
 export default {
   name: 'DataReMechanism',
   components: {
@@ -228,10 +264,52 @@
       trendAnalysisUnit: 'DAYS', //瓒嬪娍鍒嗘瀽閫夋嫨鏃堕棿
       trendAnalysisData: {}, //瓒嬪娍鍒嗘瀽鏁版嵁
       trendAnalysisChart: null, //瓒嬪娍鍒嗘瀽鍥捐〃
+      beforeStartTime: '',
+      beforeEndTime: '',
+      afterStartTime: '',
+      afterEndTime: '',
+      beforeTimeRange: [],
+      afterTimeRange: [],
+      oilFreqCompareLoading: false,
+      oilFreqCompareData: [],
+      oilFreqCompareColumns: [
+        {
+          title: '杞︾墝鍙�',
+          align: 'center',
+          dataIndex: 'licenseNum',
+        },
+        {
+          title: '娲诲姩鍓嶅姞娌规鏁�',
+          align: 'center',
+          dataIndex: 'beforeOilCount',
+        },
+        {
+          title: '娲诲姩鍚庡姞娌规鏁�',
+          align: 'center',
+          dataIndex: 'afterOilCount',
+        },
+        {
+          title: '鍙樺寲鍊�',
+          align: 'center',
+          dataIndex: 'diffOilCount',
+        },
+        {
+          title: '鍙樺寲鐜�',
+          align: 'center',
+          dataIndex: 'diffRate',
+          customRender: function (t) {
+            if (t === null || t === undefined) {
+              return '--'
+            }
+            return t + '%'
+          },
+        },
+      ],
     }
   },
 
   methods: {
+    moment,
     //鑾峰彇杞﹀瀷/鍔犳补浣嶆姌绾垮浘鏁版嵁
     getVehicleTypeLineData() {
       postAction('/jyz/dataTable/statisMidTable', {
@@ -340,15 +418,70 @@
         this.contrastObj = res.result
       })
     },
+    beforeTimeChange(e, t) {
+      this.beforeTimeRange = t
+      this.beforeStartTime = t && t.length ? t[0] : ''
+      this.beforeEndTime = t && t.length ? t[1] : ''
+    },
+    afterTimeChange(e, t) {
+      this.afterTimeRange = t
+      this.afterStartTime = t && t.length ? t[0] : ''
+      this.afterEndTime = t && t.length ? t[1] : ''
+    },
+    setOilFreqDefaultRangeByActivity(activity) {
+      if (!activity || !activity.startTime || !activity.endTime) {
+        return
+      }
+      this.afterStartTime = activity.startTime
+      this.afterEndTime = activity.endTime
+      this.afterTimeRange = [this.afterStartTime, this.afterEndTime]
+      let startMoment = moment(activity.startTime)
+      let endMoment = moment(activity.endTime)
+      let spanSeconds = endMoment.diff(startMoment, 'seconds')
+      if (spanSeconds <= 0) {
+        return
+      }
+      this.beforeEndTime = startMoment.format('YYYY-MM-DD HH:mm:ss')
+      this.beforeStartTime = startMoment.clone().subtract(spanSeconds, 'seconds').format('YYYY-MM-DD HH:mm:ss')
+      this.beforeTimeRange = [this.beforeStartTime, this.beforeEndTime]
+    },
+    getOilFreqCompareData() {
+      if (!this.beforeStartTime || !this.beforeEndTime || !this.afterStartTime || !this.afterEndTime) {
+        this.oilFreqCompareData = []
+        return
+      }
+      this.oilFreqCompareLoading = true
+      postAction('/jyz/dataTable/statisOilFreqCompare', {
+        orgCode: this.selectTreeObj.orgCode,
+        beforeStartTime: this.beforeStartTime,
+        beforeEndTime: this.beforeEndTime,
+        afterStartTime: this.afterStartTime,
+        afterEndTime: this.afterEndTime,
+      })
+        .then((res) => {
+          this.oilFreqCompareData = res.result || []
+        })
+        .finally(() => {
+          this.oilFreqCompareLoading = false
+        })
+    },
     activeTimeChange(e) {
       console.log(e)
       if (e) {
         let item = this.activeOptions.find((el) => el.id == e)
         this.startTime = item.startTime
         this.endTime = item.endTime
+        this.setOilFreqDefaultRangeByActivity(item)
       } else {
         this.startTime = ''
         this.endTime = ''
+        this.beforeStartTime = ''
+        this.beforeEndTime = ''
+        this.afterStartTime = ''
+        this.afterEndTime = ''
+        this.beforeTimeRange = []
+        this.afterTimeRange = []
+        this.oilFreqCompareData = []
       }
     },
     activeChange() {},
@@ -390,6 +523,7 @@
       this.getVehicleStationPieData()
       this.getFuelingStationPieData()
       this.getTrendAnalysis()
+      this.getOilFreqCompareData()
     },
     initData() {
       this.getCustomerData()
@@ -410,7 +544,7 @@
 <style scoped lang="less">
 @import '~@assets/less/common.less';
 /deep/ .ant-table-content {
-  height: 500px;
+  height: auto;
   .ant-table-placeholder {
     background: none;
     border: none;
@@ -443,5 +577,23 @@
       }
     }
   }
+  .oil-freq-compare-ct {
+    margin: 8px 12px 24px 12px;
+    .oil-freq-compare-operator {
+      display: flex;
+      align-items: center;
+      flex-wrap: wrap;
+      gap: 8px 0;
+      margin: 12px 0;
+    }
+    .oil-freq-compare-table {
+      /deep/ .ant-table-body {
+        min-height: 240px;
+      }
+      /deep/ .ant-table-pagination.ant-pagination {
+        margin: 12px 0 4px 0;
+      }
+    }
+  }
 }
 </style>
diff --git a/src/views/dataAnalysis/components/DataRePieChart.vue b/src/views/dataAnalysis/components/DataRePieChart.vue
index b6db6bf..2adee7e 100644
--- a/src/views/dataAnalysis/components/DataRePieChart.vue
+++ b/src/views/dataAnalysis/components/DataRePieChart.vue
@@ -65,10 +65,10 @@
         legend: {
           orient: 'vertical',
           icon: 'circle',
-          right: '0',
-          top: '10%',
+          right: '2%',
+          top: 'middle',
           itemWidth: 14,
-          itemGap: 20,
+          itemGap: 12,
           textStyle: {
             rich: {
               a: {
@@ -106,9 +106,9 @@
             emphasis: {
               scale: false,
             },
-            center: ['40%', '50%'],
+            center: ['28%', '52%'],
             top: 'center',
-            right: '60%',
+            right: '62%',
             label: {
               show: true,
               position: 'inside',

--
Gitblit v1.8.0