|
@@ -2,8 +2,12 @@
|
|
|
<div class="dataSituation">
|
|
|
<div class="dataSituation-title">{{ title }}</div>
|
|
|
<div class="dataSituation-canvas-border" style="height: auto">
|
|
|
- <img class="dataSituation-canvas-circle" :src="circleBg" />
|
|
|
- <div ref="dataSituation-canvas" class="dataSituation-canvas" :style="{height: canvasHeight+'px'}"></div>
|
|
|
+ <img
|
|
|
+ class="dataSituation-canvas-circle"
|
|
|
+ :src="circleBg"
|
|
|
+ :style="{ width: canvasHeight + 'px', height: canvasHeight + 'px' }"
|
|
|
+ />
|
|
|
+ <div ref="dataSituation-canvas" class="dataSituation-canvas" :style="{ height: canvasHeight + 'px' }"></div>
|
|
|
</div>
|
|
|
<div class="dataSituation-detail-label">{{ totalTitle }}</div>
|
|
|
<div class="dataSituation-detail">
|
|
@@ -17,11 +21,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import 'echarts-liquidfill'
|
|
|
+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'
|
|
|
+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() {
|
|
@@ -30,28 +34,28 @@ export default {
|
|
|
canvasHeight: 0,
|
|
|
colors: {
|
|
|
blue: {
|
|
|
- value: '#00AAFF',
|
|
|
- circle: blueCircle,
|
|
|
+ value: "#00AAFF",
|
|
|
+ circle: blueCircle
|
|
|
},
|
|
|
green: {
|
|
|
- value: '#3CC7B2',
|
|
|
- circle: greenCircle,
|
|
|
+ value: "#3CC7B2",
|
|
|
+ circle: greenCircle
|
|
|
},
|
|
|
yellow: {
|
|
|
- value: '#F6A870',
|
|
|
- circle: yellowCircle,
|
|
|
- },
|
|
|
+ value: "#F6A870",
|
|
|
+ circle: yellowCircle
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
props: {
|
|
|
color: {
|
|
|
type: String,
|
|
|
- default: 'blue'
|
|
|
+ default: "blue"
|
|
|
},
|
|
|
title: {
|
|
|
type: String,
|
|
|
- default: '态势'
|
|
|
+ default: "态势"
|
|
|
},
|
|
|
percent: {
|
|
|
type: Number,
|
|
@@ -59,7 +63,7 @@ export default {
|
|
|
},
|
|
|
totalTitle: {
|
|
|
type: String,
|
|
|
- default: '总数量'
|
|
|
+ default: "总数量"
|
|
|
},
|
|
|
totalNum: {
|
|
|
type: Number,
|
|
@@ -67,80 +71,79 @@ export default {
|
|
|
},
|
|
|
usedTitle: {
|
|
|
type: String,
|
|
|
- default: '已使用数量'
|
|
|
+ default: "已使用数量"
|
|
|
},
|
|
|
usedNum: {
|
|
|
type: Number,
|
|
|
default: 0
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
- "percent": function (val) {
|
|
|
+ percent: function(val) {
|
|
|
this.initChart(val);
|
|
|
}
|
|
|
},
|
|
|
- components: {
|
|
|
- },
|
|
|
- created() {
|
|
|
- },
|
|
|
+ components: {},
|
|
|
+ created() {},
|
|
|
mounted() {
|
|
|
- this.$nextTick(()=>{
|
|
|
+ this.$nextTick(() => {
|
|
|
let canvasWidth = document.getElementsByClassName("dataSituation-canvas")[0].clientWidth;
|
|
|
- this.canvasHeight = Number(canvasWidth)
|
|
|
- this.circleBg = this.colors[this.color].circle
|
|
|
- this.$forceUpdate()
|
|
|
+ this.canvasHeight = Number(canvasWidth);
|
|
|
+ this.circleBg = this.colors[this.color].circle;
|
|
|
+ this.$forceUpdate();
|
|
|
let app = this;
|
|
|
- setTimeout(()=>{
|
|
|
- app.initChart(this.percent)
|
|
|
- },50)
|
|
|
- setTimeout(()=>{
|
|
|
- app.initChart(this.percent)
|
|
|
- },300)
|
|
|
- })
|
|
|
-
|
|
|
+ setTimeout(() => {
|
|
|
+ app.initChart(this.percent);
|
|
|
+ }, 50);
|
|
|
+ setTimeout(() => {
|
|
|
+ app.initChart(this.percent);
|
|
|
+ }, 300);
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
initChart(num) {
|
|
|
- let echarts = this.$echarts.init(this.$refs['dataSituation-canvas'])
|
|
|
+ let echarts = this.$echarts.init(this.$refs["dataSituation-canvas"]);
|
|
|
let primaryColor = this.colors[this.color].value;
|
|
|
let option = {
|
|
|
- series: [{
|
|
|
- type: 'liquidFill',
|
|
|
- data: [num],
|
|
|
- color: [primaryColor],
|
|
|
- radius: '75%',
|
|
|
- animationDuration: 800,
|
|
|
- animationDurationUpdate: 500,
|
|
|
- amplitude: '5%',
|
|
|
- waveLength: '50%',
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- color: primaryColor,
|
|
|
- insideColor: 'white',
|
|
|
- fontSize: '0.8rem',
|
|
|
- fontWeight: 'normal',
|
|
|
- align: 'center',
|
|
|
- baseline: 'middle',
|
|
|
- position: ['50%', '50%']
|
|
|
- },
|
|
|
- itemStyle: {
|
|
|
- opacity: 1,
|
|
|
- shadowColor: '#eaf2ff'
|
|
|
- },
|
|
|
- emphasis: {
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: "liquidFill",
|
|
|
+ data: [num],
|
|
|
+ color: [primaryColor],
|
|
|
+ radius: "75%",
|
|
|
+ animationDuration: 800,
|
|
|
+ animationDurationUpdate: 500,
|
|
|
+ amplitude: "5%",
|
|
|
+ waveLength: "50%",
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ color: primaryColor,
|
|
|
+ insideColor: "white",
|
|
|
+ fontSize: "0.8rem",
|
|
|
+ fontWeight: "normal",
|
|
|
+ align: "center",
|
|
|
+ baseline: "middle",
|
|
|
+ position: ["50%", "50%"]
|
|
|
+ },
|
|
|
itemStyle: {
|
|
|
- opacity: 1
|
|
|
+ opacity: 1,
|
|
|
+ shadowColor: "#eaf2ff"
|
|
|
+ },
|
|
|
+ emphasis: {
|
|
|
+ itemStyle: {
|
|
|
+ opacity: 1
|
|
|
+ }
|
|
|
+ },
|
|
|
+ outline: {
|
|
|
+ show: false
|
|
|
}
|
|
|
- },
|
|
|
- outline: {
|
|
|
- show: false,
|
|
|
}
|
|
|
- }],
|
|
|
+ ]
|
|
|
};
|
|
|
- echarts.setOption(option)
|
|
|
- },
|
|
|
+ echarts.setOption(option);
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
@@ -152,15 +155,27 @@ export default {
|
|
|
height: 210px;
|
|
|
background-color: #f7fcff;
|
|
|
border: 1px solid #f8ffff;
|
|
|
- @keyframes roate{
|
|
|
- 0%{ transform:rotateZ(360deg);-ms-transform:rotateZ(360deg);-moz-transform:rotateZ(360deg);-webkit-transform:rotateZ(360deg);-o-transform:rotateZ(360deg);}
|
|
|
- 100%{ transform:rotateZ(0);-ms-transform:rotateZ(0);-moz-transform:rotateZ(0);-webkit-transform:rotateZ(0);-o-transform:rotateZ(0); }
|
|
|
+ @keyframes roate {
|
|
|
+ 0% {
|
|
|
+ transform: rotateZ(360deg);
|
|
|
+ -ms-transform: rotateZ(360deg);
|
|
|
+ -moz-transform: rotateZ(360deg);
|
|
|
+ -webkit-transform: rotateZ(360deg);
|
|
|
+ -o-transform: rotateZ(360deg);
|
|
|
+ }
|
|
|
+ 100% {
|
|
|
+ transform: rotateZ(0);
|
|
|
+ -ms-transform: rotateZ(0);
|
|
|
+ -moz-transform: rotateZ(0);
|
|
|
+ -webkit-transform: rotateZ(0);
|
|
|
+ -o-transform: rotateZ(0);
|
|
|
+ }
|
|
|
}
|
|
|
.dataSituation-title {
|
|
|
line-height: 36px;
|
|
|
font-size: 14px;
|
|
|
text-align: center;
|
|
|
- color: #B2B2B2;
|
|
|
+ color: #b2b2b2;
|
|
|
}
|
|
|
.dataSituation-canvas-border {
|
|
|
width: 60%;
|
|
@@ -170,19 +185,17 @@ export default {
|
|
|
margin: 0 auto;
|
|
|
}
|
|
|
.dataSituation-canvas-circle {
|
|
|
- width: 100%;
|
|
|
margin: 0 auto;
|
|
|
position: absolute;
|
|
|
border-radius: 50%;
|
|
|
animation: roate 3s infinite linear;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
.dataSituation-detail-label {
|
|
|
text-align: center;
|
|
|
font-weight: bold;
|
|
|
font-size: 12px;
|
|
|
- color: #B2B2B2;
|
|
|
+ color: #b2b2b2;
|
|
|
}
|
|
|
.dataSituation-detail {
|
|
|
margin: 5px 15px;
|