|
@@ -3,7 +3,7 @@
|
|
<view class="revenue">
|
|
<view class="revenue">
|
|
<template v-if="type === 'line'">
|
|
<template v-if="type === 'line'">
|
|
<view class="revenue-line">
|
|
<view class="revenue-line">
|
|
- <LineChart v-if="chartData.series[0].data.length || chartData.series[1].data.length"
|
|
|
|
|
|
+ <LineChart v-if="hasData"
|
|
:chartData="chartData" :title="title" :opts="opts" />
|
|
:chartData="chartData" :title="title" :opts="opts" />
|
|
<view class="empty" v-else>
|
|
<view class="empty" v-else>
|
|
<u-empty></u-empty>
|
|
<u-empty></u-empty>
|
|
@@ -12,7 +12,7 @@
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
<view class="revenue-line">
|
|
<view class="revenue-line">
|
|
- <ColumnChart v-if="chartData.series[0].data.length || chartData.series[1].data.length"
|
|
|
|
|
|
+ <ColumnChart v-if="hasData"
|
|
:chartData="chartData" :title="title" :opts="opts" />
|
|
:chartData="chartData" :title="title" :opts="opts" />
|
|
<view class="empty" v-else>
|
|
<view class="empty" v-else>
|
|
<u-empty></u-empty>
|
|
<u-empty></u-empty>
|
|
@@ -48,17 +48,14 @@
|
|
return {
|
|
return {
|
|
chartData: {
|
|
chartData: {
|
|
categories: [],
|
|
categories: [],
|
|
- series: [{
|
|
|
|
- name: '路段',
|
|
|
|
- data: []
|
|
|
|
- }, {
|
|
|
|
- name: '停车场',
|
|
|
|
- data: []
|
|
|
|
- }]
|
|
|
|
|
|
+ series: []
|
|
},
|
|
},
|
|
- loading: false,
|
|
|
|
|
|
+ hasData: false,
|
|
opts: {
|
|
opts: {
|
|
enableScroll: true,
|
|
enableScroll: true,
|
|
|
|
+ tooltip: {
|
|
|
|
+ trigger: 'axis'
|
|
|
|
+ },
|
|
xAxis: {
|
|
xAxis: {
|
|
rotateLabel: true,
|
|
rotateLabel: true,
|
|
scrollShow: true,
|
|
scrollShow: true,
|
|
@@ -73,10 +70,10 @@
|
|
}]
|
|
}]
|
|
},
|
|
},
|
|
legend: {
|
|
legend: {
|
|
- show: false
|
|
|
|
|
|
+ show: true
|
|
},
|
|
},
|
|
dataLabel: false,
|
|
dataLabel: false,
|
|
- padding: [10, 0, 10, 0],
|
|
|
|
|
|
+ padding: [10, 10, 10, 10],
|
|
extra: {
|
|
extra: {
|
|
column: {
|
|
column: {
|
|
width: 20
|
|
width: 20
|
|
@@ -93,17 +90,25 @@
|
|
reportType,
|
|
reportType,
|
|
queryDate
|
|
queryDate
|
|
}) {
|
|
}) {
|
|
- this.loading = true
|
|
|
|
|
|
+ this.hasData = false
|
|
this.chartData.categories = []
|
|
this.chartData.categories = []
|
|
- this.chartData.series[0].data = []
|
|
|
|
- this.chartData.series[1].data = []
|
|
|
|
- // 路段数据
|
|
|
|
|
|
+ this.chartData.series = []
|
|
|
|
+ this.getRoadData({ reportType, queryDate })
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * 路段数据
|
|
|
|
+ */
|
|
|
|
+ getRoadData({ reportType, queryDate }) {
|
|
uni.$u.api.operationalAnalysisApi.getRevenueDataApi({
|
|
uni.$u.api.operationalAnalysisApi.getRevenueDataApi({
|
|
reportType,
|
|
reportType,
|
|
queryDate
|
|
queryDate
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
if (res.data.itemList && res.data.itemList.length) {
|
|
if (res.data.itemList && res.data.itemList.length) {
|
|
|
|
+ this.chartData.series[0] = {
|
|
|
|
+ name: '路段',
|
|
|
|
+ data: []
|
|
|
|
+ }
|
|
this.chartData.categories = res.data.itemList.map(item => {
|
|
this.chartData.categories = res.data.itemList.map(item => {
|
|
return item.statisTime
|
|
return item.statisTime
|
|
})
|
|
})
|
|
@@ -112,24 +117,48 @@
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- this.loading = false
|
|
|
|
|
|
+ this.getParkingData({ reportType, queryDate })
|
|
})
|
|
})
|
|
- // 停车场数据
|
|
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * 停车场数据
|
|
|
|
+ */
|
|
|
|
+ getParkingData({ reportType, queryDate }) {
|
|
uni.$u.api.operationalAnalysisApi.getParkingRevenueDataApi({
|
|
uni.$u.api.operationalAnalysisApi.getParkingRevenueDataApi({
|
|
reportType,
|
|
reportType,
|
|
queryDate
|
|
queryDate
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
if (res.data.itemList && res.data.itemList.length) {
|
|
if (res.data.itemList && res.data.itemList.length) {
|
|
- this.chartData.categories = res.data.itemList.map(item => {
|
|
|
|
- return item.statisTime
|
|
|
|
- })
|
|
|
|
- this.chartData.series[1].data = res.data.itemList.map(item => {
|
|
|
|
- return item.amt
|
|
|
|
- })
|
|
|
|
|
|
+ if (this.chartData.series.length) {
|
|
|
|
+ this.chartData.series[1] = {
|
|
|
|
+ name: '停车场',
|
|
|
|
+ data: []
|
|
|
|
+ }
|
|
|
|
+ this.chartData.series[1].data = res.data.itemList.map(item => {
|
|
|
|
+ return item.amt
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.chartData.series[0] = {
|
|
|
|
+ name: '停车场',
|
|
|
|
+ data: []
|
|
|
|
+ }
|
|
|
|
+ this.chartData.series[0].data = res.data.itemList.map(item => {
|
|
|
|
+ return item.amt
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (!this.chartData.categories.length) {
|
|
|
|
+ this.chartData.categories = res.data.itemList.map(item => {
|
|
|
|
+ return item.statisTime
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ this.hasData = true
|
|
|
|
+ } else if (this.chartData.series.length === 1) {
|
|
|
|
+ this.hasData = true
|
|
|
|
+ } else if (!this.chartData.series.length) {
|
|
|
|
+ this.hasData = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- this.loading = false
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|