12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <!-- 车流量分析 -->
- <template>
- <view class="revenue">
- <view class="revenue-line">
- <LineChart v-if="chartData.series[0].data.length" :chartData="chartData" :title="title" :opts="opts"/>
- <view class="empty" v-else>
- <u-empty></u-empty>
- </view>
- </view>
- </view>
- </template>
- <script>
- import LineChart from '@/components/lineChart.vue'
- export default {
- components: {
- LineChart
- },
- props: {
- title: {
- type: String,
- default: ''
- },
- opts: {
- type: Object,
- default: () => {
- return {
- xAxis: {
- rotateLabel: false,
- labelCount: 6
- },
- yAxis: {
- showTitle: true,
- splitNumber: 5,
- data: [{
- title: '辆',
- titleOffsetY: -5
- }]
- },
- legend: {
- show: false
- },
- dataLabel: false,
- extra: {
- column: {
- width: 20
- }
- }
- }
- }
- }
- },
- data() {
- return {
- chartData: {
- categories: [],
- series: [{
- name: '',
- data: []
- }]
- }
- }
- },
- methods: {
- getData({ reportType, queryDate }) {
- uni.$u.api.operationalAnalysisApi.getTrafficFlowDataApi({ reportType, queryDate }).then(res => {
- if (res.code === 200) {
- if (res.data.itemList && res.data.itemList.length) {
- this.chartData.categories = res.data.itemList.map(item => {
- return item.statisTime
- })
- this.chartData.series[0].data = res.data.itemList.map(item => {
- return item.vehicleCount
- })
- } else {
- this.chartData.categories = []
- this.chartData.series[0].data = []
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .revenue {
- background-color: #fff;
- border-radius: 5px;
- .empty {
- padding: 15px;
- }
- }
- </style>
|