| | |
| | | </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"> |
| | |
| | | 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: { |
| | |
| | | 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', { |
| | |
| | | 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() {}, |
| | |
| | | this.getVehicleStationPieData() |
| | | this.getFuelingStationPieData() |
| | | this.getTrendAnalysis() |
| | | this.getOilFreqCompareData() |
| | | }, |
| | | initData() { |
| | | this.getCustomerData() |
| | |
| | | <style scoped lang="less"> |
| | | @import '~@assets/less/common.less'; |
| | | /deep/ .ant-table-content { |
| | | height: 500px; |
| | | height: auto; |
| | | .ant-table-placeholder { |
| | | background: none; |
| | | border: none; |
| | |
| | | } |
| | | } |
| | | } |
| | | .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> |