|
|
@@ -290,11 +290,14 @@
|
|
|
|
|
|
<script setup lang='ts'>
|
|
|
import Layout from '@/components/layout.vue'
|
|
|
-import { ref, watch } from 'vue'
|
|
|
+import { onMounted, ref } from 'vue'
|
|
|
import Box from '@/components/box.vue'
|
|
|
import { Vue3Marquee } from 'vue3-marquee'
|
|
|
import { graphic } from 'echarts'
|
|
|
import Echart from '@/components/chart.vue'
|
|
|
+import HomeService from '../services/homepage.service'
|
|
|
+
|
|
|
+const homeService = new HomeService()
|
|
|
|
|
|
const datas = [
|
|
|
{
|
|
|
@@ -522,6 +525,7 @@ const leftContent = ref({
|
|
|
fontSize: 20
|
|
|
}
|
|
|
},
|
|
|
+ yAxis: [ ],
|
|
|
series: [
|
|
|
{
|
|
|
type: 'pie', // 图表类型为饼图
|
|
|
@@ -577,7 +581,7 @@ const leftContent = ref({
|
|
|
fontSize: 18
|
|
|
}
|
|
|
},
|
|
|
- yAxis: {
|
|
|
+ yAxis: [ {
|
|
|
type: 'category',
|
|
|
inverse: true,
|
|
|
axisTick: {
|
|
|
@@ -654,7 +658,7 @@ const leftContent = ref({
|
|
|
return `{b|${id}} ${params}`
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
+ } ],
|
|
|
series: [
|
|
|
{
|
|
|
z: 2,
|
|
|
@@ -663,19 +667,7 @@ const leftContent = ref({
|
|
|
barWidth: 25,
|
|
|
zlevel: 1,
|
|
|
data: datas.map((item, i) => ({
|
|
|
- value: item.value,
|
|
|
- itemStyle: {
|
|
|
- color: new graphic.LinearGradient(0, 0, 1, 0, [
|
|
|
- {
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(20,167,250,0.3)'
|
|
|
- },
|
|
|
- {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(0,255,209,1)'
|
|
|
- }
|
|
|
- ])
|
|
|
- }
|
|
|
+ value: item.value
|
|
|
})),
|
|
|
label: {
|
|
|
position: 'inside',
|
|
|
@@ -683,7 +675,17 @@ const leftContent = ref({
|
|
|
fontSize: 16
|
|
|
},
|
|
|
itemStyle: {
|
|
|
- borderRadius: [ 0, 15, 15, 0 ]
|
|
|
+ borderRadius: [ 0, 15, 15, 0 ],
|
|
|
+ color: new graphic.LinearGradient(0, 0, 1, 0, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(20,167,250,0.3)'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(0,255,209,1)'
|
|
|
+ }
|
|
|
+ ])
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
@@ -717,7 +719,7 @@ const leftContent = ref({
|
|
|
fontSize: 18
|
|
|
}
|
|
|
},
|
|
|
- yAxis: {
|
|
|
+ yAxis: [ {
|
|
|
type: 'category',
|
|
|
inverse: true,
|
|
|
axisTick: {
|
|
|
@@ -794,7 +796,7 @@ const leftContent = ref({
|
|
|
return `{b|${id}} ${params}`
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
+ } ],
|
|
|
series: [
|
|
|
{
|
|
|
z: 2,
|
|
|
@@ -803,19 +805,7 @@ const leftContent = ref({
|
|
|
barWidth: 25,
|
|
|
zlevel: 1,
|
|
|
data: datas.map((item, i) => ({
|
|
|
- value: item.value,
|
|
|
- itemStyle: {
|
|
|
- color: new graphic.LinearGradient(0, 0, 1, 0, [
|
|
|
- {
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(20,167,250,0.3)'
|
|
|
- },
|
|
|
- {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(246,189,22,1)'
|
|
|
- }
|
|
|
- ])
|
|
|
- }
|
|
|
+ value: item.value
|
|
|
})),
|
|
|
label: {
|
|
|
position: 'inside',
|
|
|
@@ -823,7 +813,17 @@ const leftContent = ref({
|
|
|
fontSize: 16
|
|
|
},
|
|
|
itemStyle: {
|
|
|
- borderRadius: [ 0, 15, 15, 0 ]
|
|
|
+ borderRadius: [ 0, 15, 15, 0 ],
|
|
|
+ color: new graphic.LinearGradient(0, 0, 1, 0, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(20,167,250,0.3)'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(246,189,22,1)'
|
|
|
+ }
|
|
|
+ ])
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
@@ -951,6 +951,68 @@ const rightContent = ref([
|
|
|
function changeFn(id: number, item: any) {
|
|
|
item.checkId = id
|
|
|
}
|
|
|
+const type = 1
|
|
|
+
|
|
|
+async function getBusSummaryInfo() {
|
|
|
+ const res = await homeService.getBusSummaryInfo()
|
|
|
+ leftContent.value.topCount[0][0].num = res.swipeCount
|
|
|
+ leftContent.value.topCount[0][1].num = res.passengerFlow
|
|
|
+ leftContent.value.topCount[0][2].num = res.mileageDriven
|
|
|
+
|
|
|
+ leftContent.value.topCount[1][0].num = res.carbonEmission
|
|
|
+ leftContent.value.topCount[1][1].num = res.accidentRate
|
|
|
+ leftContent.value.topCount[1][2].num = res.satisfaction
|
|
|
+}
|
|
|
+getBusSummaryInfo()
|
|
|
+
|
|
|
+async function getBusTrafficVolume() {
|
|
|
+ const res = await homeService.getBusTrafficVolume(type)
|
|
|
+ const xData = res.map((item: any) => item.time)
|
|
|
+ const trafficVolumeData = res.map((item: any) => item.trafficVolume)
|
|
|
+ const growthRateData = res.map((item: any) => item.growthRate)
|
|
|
+
|
|
|
+ leftContent.value.charts[0].option.xAxis!.data = xData
|
|
|
+ leftContent.value.charts[0].option.series[0].data = trafficVolumeData
|
|
|
+ leftContent.value.charts[0].option.series[1].data = growthRateData
|
|
|
+}
|
|
|
+async function getBusStatistics() {
|
|
|
+ const { consumptionProportion = [], flowRanking = [], lineFlowRanking = [] } = await homeService.getBusStatistics()
|
|
|
+
|
|
|
+ leftContent.value.charts[1].option.series[0].data = consumptionProportion
|
|
|
+
|
|
|
+ leftContent.value.charts[2].option.yAxis[0].data = flowRanking.map((item: any) => item.name)
|
|
|
+ leftContent.value.charts[2].option.series[0].data = flowRanking
|
|
|
+
|
|
|
+ leftContent.value.charts[3].option.yAxis[0].data = lineFlowRanking.map((item: any) => item.name)
|
|
|
+ leftContent.value.charts[3].option.series[0].data = lineFlowRanking
|
|
|
+}
|
|
|
+
|
|
|
+async function getBusWarning() {
|
|
|
+ const {
|
|
|
+ warningNum, companyNum, feedbackNum, secureNum, warningSummary
|
|
|
+ } = await homeService.getBusWarning()
|
|
|
+
|
|
|
+ rightContent.value[0].content[0][0].num = warningNum
|
|
|
+ rightContent.value[0].content[0][1].num = companyNum
|
|
|
+ rightContent.value[0].content[0][2].num = feedbackNum
|
|
|
+ rightContent.value[0].content[0][3].num = secureNum
|
|
|
+
|
|
|
+ rightContent.value[0].content[1][0].num = warningSummary.accident
|
|
|
+ rightContent.value[0].content[1][1].num = warningSummary.sentiment
|
|
|
+ rightContent.value[0].content[1][2].num = warningSummary.risk
|
|
|
+ rightContent.value[0].content[1][3].num = warningSummary.flood
|
|
|
+ rightContent.value[0].content[1][4].num = warningSummary.network
|
|
|
+ rightContent.value[0].content[1][5].num = warningSummary.fire
|
|
|
+ rightContent.value[0].content[1][6].num = warningSummary.warning
|
|
|
+ rightContent.value[0].content[1][7].num = warningSummary.charge
|
|
|
+ rightContent.value[0].content[1][8].num = warningSummary.battery
|
|
|
+}
|
|
|
+getBusWarning()
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getBusTrafficVolume()
|
|
|
+ getBusStatistics()
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|