|
@@ -1,19 +1,17 @@
|
|
|
<template>
|
|
|
<div class="dataSituation">
|
|
|
<div class="dataSituation-title">{{ title }}</div>
|
|
|
- <div class="dataSituation-canvas-border">
|
|
|
- <div class="dataSituation-canvas-circle"></div>
|
|
|
- <div ref="dataSituation-canvas" style="width: 100px;height:100px;margin: 0 auto"></div>
|
|
|
+ <div class="dataSituation-canvas-border" :style="{height: circleHeight+'px'}">
|
|
|
+ <div class="dataSituation-canvas-circle" :style="{height: circleBgHeight+'px',backgroundImage:'url('+circleBg+')'}"></div>
|
|
|
+ <div ref="dataSituation-canvas" class="dataSituation-canvas" :style="{height: canvasHeight+'px'}"></div>
|
|
|
</div>
|
|
|
<div class="dataSituation-detail-label">{{ totalTitle }}</div>
|
|
|
<div class="dataSituation-detail">
|
|
|
<div class="dataSituation-detail-num">{{ totalNum }}</div>
|
|
|
- <div class="dataSituation-detail-unit">{{ unit }}</div>
|
|
|
</div>
|
|
|
<div class="dataSituation-detail-label">{{ usedTitle }}</div>
|
|
|
<div class="dataSituation-detail">
|
|
|
<div class="dataSituation-detail-num">{{ usedNum }}</div>
|
|
|
- <div class="dataSituation-detail-unit">{{ unit }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -21,12 +19,38 @@
|
|
|
<script>
|
|
|
import 'echarts-liquidfill'
|
|
|
|
|
|
+import yellowCircle from '@/assets/images/dashboard/circleWorkBg.png'
|
|
|
+import blueCircle from '@/assets/images/dashboard/circleMeetingBg.png'
|
|
|
+import greenCircle from '@/assets/images/dashboard/circleParkingBg.png'
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ circleBg: blueCircle,
|
|
|
+ circleHeight: 90,
|
|
|
+ circleBgHeight: 0,
|
|
|
+ canvasHeight: 0,
|
|
|
+ colors: {
|
|
|
+ blue: {
|
|
|
+ value: '#00AAFF',
|
|
|
+ circle: blueCircle,
|
|
|
+ },
|
|
|
+ green: {
|
|
|
+ value: '#3CC7B2',
|
|
|
+ circle: greenCircle,
|
|
|
+ },
|
|
|
+ yellow: {
|
|
|
+ value: '#F6A870',
|
|
|
+ circle: yellowCircle,
|
|
|
+ },
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
|
+ color: {
|
|
|
+ type: String,
|
|
|
+ default: 'blue'
|
|
|
+ },
|
|
|
title: {
|
|
|
type: String,
|
|
|
default: '态势'
|
|
@@ -35,10 +59,6 @@ export default {
|
|
|
type: Number,
|
|
|
default: 0
|
|
|
},
|
|
|
- unit: {
|
|
|
- type: String,
|
|
|
- default: '个'
|
|
|
- },
|
|
|
totalTitle: {
|
|
|
type: String,
|
|
|
default: '总数量'
|
|
@@ -66,30 +86,40 @@ export default {
|
|
|
created() {
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.initChart(this.percent)
|
|
|
+ let width = document.getElementsByClassName("dataSituation-canvas-border")[0].clientWidth;
|
|
|
+ this.circleHeight = Number(width);
|
|
|
+ this.circleBgHeight = width*0.82
|
|
|
+ this.canvasHeight = width*0.75
|
|
|
+ this.$forceUpdate()
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.circleBg = this.colors[this.color].circle
|
|
|
+ this.initChart(this.percent)
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
initChart(num) {
|
|
|
let echarts = this.$echarts.init(this.$refs['dataSituation-canvas'])
|
|
|
- let primaryColor = '#4c82ff';
|
|
|
+ let primaryColor = this.colors[this.color].value;
|
|
|
let option = {
|
|
|
series: [{
|
|
|
type: 'liquidFill',
|
|
|
data: [num],
|
|
|
color: [primaryColor],
|
|
|
- radius: '95%',
|
|
|
+ radius: '80%',
|
|
|
animationDuration: 800,
|
|
|
animationDurationUpdate: 500,
|
|
|
- waveLength: '70%',
|
|
|
+ amplitude: '5%',
|
|
|
+ waveLength: '50%',
|
|
|
label: {
|
|
|
show: true,
|
|
|
color: primaryColor,
|
|
|
insideColor: 'white',
|
|
|
- fontSize: 24,
|
|
|
+ fontSize: 14,
|
|
|
fontWeight: 'normal',
|
|
|
align: 'center',
|
|
|
baseline: 'middle',
|
|
|
- position: ['50%', '65%']
|
|
|
+ position: ['50%', '55%']
|
|
|
},
|
|
|
itemStyle: {
|
|
|
opacity: 1,
|
|
@@ -101,14 +131,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
outline: {
|
|
|
- show: true,
|
|
|
- borderDistance: 12,
|
|
|
- itemStyle: {
|
|
|
- color: 'white',
|
|
|
- borderColor: 'white',
|
|
|
- borderWidth: 0,
|
|
|
- shadowBlur: 0,
|
|
|
- }
|
|
|
+ show: false,
|
|
|
}
|
|
|
}],
|
|
|
};
|
|
@@ -122,48 +145,55 @@ export default {
|
|
|
.dataSituation {
|
|
|
display: inline-block;
|
|
|
margin: 5px 10px;
|
|
|
- width: 150px;
|
|
|
+ width: 100%;
|
|
|
+ padding: 0 2%;
|
|
|
+ //min-width: 70px;
|
|
|
height: auto;
|
|
|
- border: 1px solid #f2f7ff;
|
|
|
+ min-height: 120px;
|
|
|
+ background-color: #f7fcff;
|
|
|
+ border: 1px solid #f8ffff;
|
|
|
.dataSituation-title {
|
|
|
- font-weight: bold;
|
|
|
- font-size: 22px;
|
|
|
+ line-height: 36px;
|
|
|
+ font-size: 14px;
|
|
|
text-align: center;
|
|
|
+ color: #B2B2B2;
|
|
|
}
|
|
|
.dataSituation-canvas-border {
|
|
|
- width: 120px;
|
|
|
- height: 120px;
|
|
|
- margin: 12px auto;
|
|
|
+ width: 85%;
|
|
|
+ margin: 5% auto;
|
|
|
position: relative;
|
|
|
+ .dataSituation-canvas {
|
|
|
+ width: 75%;
|
|
|
+ margin: 0 auto;
|
|
|
+ position: absolute;
|
|
|
+ top: 4%;
|
|
|
+ left: 12%;
|
|
|
+ }
|
|
|
.dataSituation-canvas-circle {
|
|
|
- width: 110px;
|
|
|
- height: 110px;
|
|
|
- padding: 5px;
|
|
|
+ width: 82%;
|
|
|
+ margin: 0 auto;
|
|
|
+ //padding: 5px;
|
|
|
border-radius: 50%;
|
|
|
- background: conic-gradient(#c4d5ff,@primary-color, #7ba3ff, #7ba3ff, #7ba3ff, #98b7ff, #d4e1ff, #e2ebff, #e2ebff, white, white, white, white, white);
|
|
|
+ background-size: 100% 100%;
|
|
|
animation: roate 3s infinite linear;
|
|
|
}
|
|
|
- #canvas {
|
|
|
- position: absolute;
|
|
|
- top: 5px;
|
|
|
- left: 5px;
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
.dataSituation-detail-label {
|
|
|
- margin-left: 15px;
|
|
|
+ text-align: center;
|
|
|
font-weight: bold;
|
|
|
- font-size: 14px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #B2B2B2;
|
|
|
}
|
|
|
.dataSituation-detail {
|
|
|
margin: 5px 15px;
|
|
|
- padding: 3px 5px;
|
|
|
- background-color: #f2f7ff;
|
|
|
+ padding: 0px 2px;
|
|
|
+ text-align: center;
|
|
|
+ background-color: transparent;
|
|
|
.dataSituation-detail-num {
|
|
|
display: inline-block;
|
|
|
- color: @primary-color;
|
|
|
font-weight: bolder;
|
|
|
- font-size: 14px;
|
|
|
+ font-size: 16px;
|
|
|
}
|
|
|
.dataSituation-detail-unit {
|
|
|
display: inline-block;
|