123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <!-- 路段分析 -->
- <template>
- <view class="section">
- <!-- 营收趋势分析 -->
- <view class="section-part">
- <view class="section-part-title"><text>|</text>营收趋势分析</view>
- <view class="section-part-content">
- <ColumnChart v-if="revenueTrendsData.series[0].data.length" :chartData="revenueTrendsData" :title="title" :opts="opts1"/>
- <view class="empty" v-else>
- <u-empty></u-empty>
- </view>
- </view>
- </view>
- <view class="section-part">
- <view class="section-part-title"><text>|</text>车流量统计</view>
- <view class="section-part-content">
- <ColumnChart v-if="trafficFlowData.series[0].data.length" :chartData="trafficFlowData" :title="title" :opts="opts2"/>
- <view class="empty" v-else>
- <u-empty></u-empty>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import ColumnChart from '@/components/columnChart.vue'
- export default {
- components: {
- ColumnChart
- },
- props: {
- title: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- opts1: {
- enableScroll: true,
- xAxis: {
- rotateLabel: true,
- scrollShow: true,
- itemCount: 8
- },
- yAxis: {
- showTitle: true,
- splitNumber: 5,
- data: [{
- title: '收益(元)',
- titleOffsetY: -3
- }]
- },
- legend: {
- show: false
- },
- dataLabel: false,
- padding: [20, 0, 10, 0],
- extra: {
- column: {
- width: 20
- }
- }
- },
- opts2: {
- enableScroll: true,
- xAxis: {
- rotateLabel: true,
- scrollShow: true,
- itemCount: 8
- },
- yAxis: {
- showTitle: true,
- splitNumber: 5,
- data: [{
- title: '车辆(辆)',
- titleOffsetY: 0,
- titleOffsetX: 10
- }]
- },
- legend: {
- show: false
- },
- dataLabel: false,
- padding: [10, 0, 10, 0],
- extra: {
- column: {
- width: 20
- }
- }
- },
- revenueTrendsData: {
- categories: [],
- series: [{
- name: '',
- data: []
- }]
- },
- trafficFlowData: {
- categories: [],
- series: [{
- name: '',
- data: []
- }]
- }
- }
- },
- methods: {
- getData({ reportType, queryDate }) {
- this.reportType = reportType
- this.queryDate = queryDate
- this.getRevenueTrendsData()
- this.getRoadTrafficFlowData()
- },
- getRevenueTrendsData() {
- uni.$u.api.operationalAnalysisApi.getRevenueTrendsDataApi({
- reportType: this.reportType,
- queryDate: this.queryDate
- }).then(res => {
- if (res.code === 200) {
- if (res.data.itemList && res.data.itemList.length) {
- this.revenueTrendsData.categories = res.data.itemList.map(item => {
- return item.roadName
- })
- this.revenueTrendsData.series[0].data = res.data.itemList.map(item => {
- return item.amt
- })
- } else {
- this.revenueTrendsData.categories = []
- this.revenueTrendsData.series[0].data = []
- }
- }
- })
- },
- getRoadTrafficFlowData() {
- uni.$u.api.operationalAnalysisApi.getRoadTrafficFlowDataApi({
- reportType: this.reportType,
- queryDate: this.queryDate
- }).then(res => {
- if (res.code === 200) {
- if (res.data.itemList && res.data.itemList.length) {
- this.trafficFlowData.categories = res.data.itemList.map(item => {
- return item.roadName
- })
- this.trafficFlowData.series[0].data = res.data.itemList.map(item => {
- return item.vehicleCount
- })
- } else {
- this.trafficFlowData.categories = []
- this.trafficFlowData.series[0].data = []
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .section {
- &-part {
- background-color: #fff;
- border-radius: 5px;
- margin-bottom: 10px;
- &-title {
- padding: 15px;
- text {
- color: #f00;
- margin-right: 5px;
- }
- }
- }
- .empty {
- padding: 15px;
- }
- }
- </style>
|