You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
4.6 KiB

2 years ago
<template>
<div class="leftBox">
<div class="echartsContainer" ref="echartsContainer"></div>
<div class="bottomBox">
<section class="top">
2 years ago
<div class="flex">
<img src="@/assets/svg/Operation/LeftTop/TrianglePurple.svg" />
<div>总人数</div>
2 years ago
</div>
<p>
<span class="panmen">{{ totalPopulation }}</span>
</p>
2 years ago
</section>
<section class="bottom">
2 years ago
<template v-for="(item, index) in peopleData">
<div :key="index">
<div class="left">
2 years ago
<img src="@/assets/svg/Operation/LeftTop/PointBlue.svg" />
<span>{{ item['itemName'] }}</span>
2 years ago
</div>
<div class="right">
<span class="panmen">{{ item['itemVal'] }}</span>
2 years ago
</div>
</div>
</template>
</section>
</div>
</div>
</template>
<script>
import * as echarts from 'echarts';
import { GetMonitorOperationCount } from '@/api/monitor';
import dayjs from 'dayjs';
let chart = null;
2 years ago
export default {
data() {
return {
chartOptions: {
series: [
{
type: 'gauge',
2 years ago
startAngle: 90,
endAngle: -270,
pointer: {
show: false,
},
max: 100,
radius: '100%',
center: ['50%', '50%'],
2 years ago
progress: {
show: true,
overlap: false,
roundCap: true,
clip: false,
itemStyle: {
color: {
type: 'linear',
2 years ago
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: '#6551B4',
2 years ago
},
{
offset: 1,
color: '#ACA0DC',
2 years ago
},
],
global: false,
},
},
},
axisLine: {
lineStyle: {
color: [[1, '#fff']],
2 years ago
opacity: 0.7,
width: 30,
},
},
splitLine: {
show: false,
distance: 0,
length: 10,
},
axisTick: {
show: false,
},
axisLabel: {
show: false,
distance: 50,
},
data: [
{
value: 86,
name: '首台准点率',
2 years ago
title: {
offsetCenter: ['0%', '24%'],
2 years ago
fontSize: 22,
fontFamily: 'Microsoft YaHei',
color: '#5D49AF',
overflow: 'break',
2 years ago
lineHeight: 20,
},
detail: {
valueAnimation: true,
offsetCenter: ['0%', '-15%'],
2 years ago
fontSize: 40,
fontFamily: 'panmen',
color: '#5D49AF',
2 years ago
formatter: `{value}%`,
},
},
],
},
],
},
peopleData: [
{
itemName: '进行中',
itemVal: '50',
2 years ago
},
{
itemName: '待进行',
itemVal: '300',
2 years ago
},
],
totalPopulation: 0,
isLoading: true,
2 years ago
};
},
methods: {
onGetPageData() {
let nowDay = dayjs().format('YYYY-MM-DD');
if (this.$store.getters.isMock) {
nowDay = '2024-06-06';
}
GetMonitorOperationCount(nowDay).then(res => {
if (!res.data) {
this.isLoading = false;
return;
}
let fisrtRate = res['data']['firstPunctualityRate'];
if (fisrtRate.includes('%')) {
this.chartOptions['series'][0]['data'][0]['value'] = fisrtRate.slice(0, -1);
} else {
this.chartOptions['series'][0]['data'][0]['value'] = Number(fisrtRate);
}
this.peopleData[0]['itemVal'] = res['data']['patOperationing'];
this.peopleData[1]['itemVal'] = res['data']['patWating'];
this.totalPopulation = res['data']['patCount'];
chart.setOption(this.chartOptions);
this.isLoading = false;
});
},
},
2 years ago
mounted() {
chart = echarts.init(this.$refs.echartsContainer);
this.onGetPageData();
setInterval(() => {
this.onGetPageData();
}, this.$store.getters.intervalTime);
2 years ago
},
};
</script>
<style lang="scss" scoped>
@import "./index.scss";
2 years ago
</style>