peng
2026-03-24 05c7478c26954ee6031f98fce6c8c9901abb98a0
调整
4个文件已修改
194 ■■■■■ 已修改文件
src/views/dataAnalysis/components/CustTypeConfig.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataAnalysis/components/CustTypeModal.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataAnalysis/components/DataReGasStation.vue 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataAnalysis/components/DataRePieChart.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
          }
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) {
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>
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',