Commit e00e4982aafb392e7ad916d1a2f487b0d688d128
1 parent
7818f74f
道闸 诱导屏
Showing
4 changed files
with
278 additions
and
3 deletions
src/components/allPieChart.vue
0 → 100644
1 | +<template> | ||
2 | + <div :class="className" :style="{height:height,width:width}"></div> | ||
3 | +</template> | ||
4 | + | ||
5 | +<script> | ||
6 | +import echarts from 'echarts' | ||
7 | + | ||
8 | +require('echarts/theme/macarons') // echarts theme | ||
9 | +import {debounce} from '../utils/debounce' | ||
10 | + | ||
11 | +export default { | ||
12 | + name: 'allPieChart', | ||
13 | + props: { | ||
14 | + className: { | ||
15 | + type: String, | ||
16 | + default: 'chart' | ||
17 | + }, | ||
18 | + width: { | ||
19 | + type: String, | ||
20 | + default: '100%' | ||
21 | + }, | ||
22 | + height: { | ||
23 | + type: String, | ||
24 | + default: '350px' | ||
25 | + }, | ||
26 | + autoResize: { | ||
27 | + type: Boolean, | ||
28 | + default: true | ||
29 | + }, | ||
30 | + chartData: { | ||
31 | + type: Object, | ||
32 | + required: true | ||
33 | + } | ||
34 | + }, | ||
35 | + data() { | ||
36 | + return { | ||
37 | + chart: null, | ||
38 | + sidebarElm: null | ||
39 | + } | ||
40 | + }, | ||
41 | + watch: { | ||
42 | + chartData: { | ||
43 | + deep: true, | ||
44 | + } | ||
45 | + }, | ||
46 | + mounted() { | ||
47 | + this.initChart() | ||
48 | + if (this.autoResize) { | ||
49 | + this.__resizeHandler = debounce(() => { | ||
50 | + if (this.chart) { | ||
51 | + this.chart.resize() | ||
52 | + } | ||
53 | + }, 100) | ||
54 | + window.addEventListener('resize', this.__resizeHandler) | ||
55 | + } | ||
56 | + }, | ||
57 | + beforeDestroy() { | ||
58 | + if (!this.chart) { | ||
59 | + return | ||
60 | + } | ||
61 | + if (this.autoResize) { | ||
62 | + window.removeEventListener('resize', this.__resizeHandler) | ||
63 | + } | ||
64 | + | ||
65 | + this.chart.dispose() | ||
66 | + this.chart = null | ||
67 | + }, | ||
68 | + methods: { | ||
69 | + setOptions({xData, yData} = {}) { | ||
70 | + this.chart.setOption({ | ||
71 | + tooltip: { | ||
72 | + trigger: 'item', | ||
73 | + formatter: "{b} : {c} ({d}%)" | ||
74 | + }, | ||
75 | + series: [{ | ||
76 | + name: '内环', | ||
77 | + type: 'pie', | ||
78 | + silent: true, | ||
79 | + clockWise: true, | ||
80 | + hoverAnimation: false, | ||
81 | + animationType: 'scale', | ||
82 | + radius: '8%', | ||
83 | + center: ['50%', '50%'], | ||
84 | + label: { | ||
85 | + normal: { | ||
86 | + position: 'center' | ||
87 | + } | ||
88 | + }, | ||
89 | + data: [{ | ||
90 | + value: 100, | ||
91 | + itemStyle: { | ||
92 | + normal: { | ||
93 | + color: { | ||
94 | + colorStops: [{ | ||
95 | + offset: 0, | ||
96 | + color: '#fff' // 0% 处的颜色 | ||
97 | + }, { | ||
98 | + offset: 1, | ||
99 | + color: '#cfcfcf' // 100% 处的颜色 | ||
100 | + }] | ||
101 | + } | ||
102 | + } | ||
103 | + } | ||
104 | + }] | ||
105 | + }, | ||
106 | + | ||
107 | + { | ||
108 | + name: '半径模式', | ||
109 | + type: 'pie', | ||
110 | + radius: ['10%', '40%'], | ||
111 | + center: ['50%', '50%'], | ||
112 | + roseType: 'radius', | ||
113 | + label: { | ||
114 | + show: false | ||
115 | + }, | ||
116 | + lableLine: { | ||
117 | + show: false | ||
118 | + }, | ||
119 | + data: [{ | ||
120 | + value: 55, | ||
121 | + name: '待维修', | ||
122 | + itemStyle: { | ||
123 | + normal: { | ||
124 | + color: { | ||
125 | + colorStops: [{ | ||
126 | + offset: 0, | ||
127 | + color: '#FF7671' // 0% 处的颜色 | ||
128 | + }, { | ||
129 | + offset: 1, | ||
130 | + color: '#A14AFF' // 100% 处的颜色 | ||
131 | + }] | ||
132 | + }, | ||
133 | + } | ||
134 | + } | ||
135 | + }, | ||
136 | + { | ||
137 | + value: 35, | ||
138 | + name: '维修中', | ||
139 | + itemStyle: { | ||
140 | + normal: { | ||
141 | + color: { | ||
142 | + colorStops: [{ | ||
143 | + offset: 0, | ||
144 | + color: '#FFEA4F' // 0% 处的颜色 | ||
145 | + }, { | ||
146 | + offset: 1, | ||
147 | + color: '#F89212' // 100% 处的颜色 | ||
148 | + }] | ||
149 | + }, | ||
150 | + } | ||
151 | + } | ||
152 | + }, | ||
153 | + { | ||
154 | + value: 200, | ||
155 | + name: '运行中', | ||
156 | + itemStyle: { | ||
157 | + normal: { | ||
158 | + color: { | ||
159 | + colorStops: [{ | ||
160 | + offset: 0, | ||
161 | + color: '#57FFE0' // 0% 处的颜色 | ||
162 | + }, { | ||
163 | + offset: 1, | ||
164 | + color: '#3469E2' // 100% 处的颜色 | ||
165 | + }] | ||
166 | + }, | ||
167 | + } | ||
168 | + } | ||
169 | + } | ||
170 | + ], | ||
171 | + animationType: 'scale', | ||
172 | + animationEasing: 'elasticOut', | ||
173 | + animationDelay: function(idx) { | ||
174 | + return Math.random() * 200; | ||
175 | + } | ||
176 | + } | ||
177 | + | ||
178 | + ] | ||
179 | + }) | ||
180 | + }, | ||
181 | + initChart() { | ||
182 | + this.chart = echarts.init(this.$el, 'macarons') | ||
183 | + this.setOptions(this.chartData) | ||
184 | + } | ||
185 | + } | ||
186 | +} | ||
187 | +</script> |
src/views/dicisection.vue
@@ -80,7 +80,7 @@ export default { | @@ -80,7 +80,7 @@ export default { | ||
80 | left: 0; | 80 | left: 0; |
81 | } | 81 | } |
82 | @mixin countStyle($color){ | 82 | @mixin countStyle($color){ |
83 | - width: 100px; | 83 | + width: 80px; |
84 | padding-left: 23px; | 84 | padding-left: 23px; |
85 | text-align: left; | 85 | text-align: left; |
86 | color: $color; | 86 | color: $color; |
src/views/mainContainer.vue
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | <li> | 4 | <li> |
5 | <pdasection class="sectionsmall"></pdasection> | 5 | <pdasection class="sectionsmall"></pdasection> |
6 | <dicisection class="sectionsmall margin12-0"></dicisection> | 6 | <dicisection class="sectionsmall margin12-0"></dicisection> |
7 | - <div class="sectionsmall"></div> | 7 | + <youdaopingsection class="sectionsmall"></youdaopingsection> |
8 | </li> | 8 | </li> |
9 | <li class="margin0-12"> | 9 | <li class="margin0-12"> |
10 | <div class="heightper-top"></div> | 10 | <div class="heightper-top"></div> |
@@ -24,12 +24,14 @@ | @@ -24,12 +24,14 @@ | ||
24 | import loadinggif from '../components/loading' | 24 | import loadinggif from '../components/loading' |
25 | import pdasection from '../views/pdasection' | 25 | import pdasection from '../views/pdasection' |
26 | import dicisection from '../views/dicisection' | 26 | import dicisection from '../views/dicisection' |
27 | +import youdaopingsection from '../views/youdaopingsection' | ||
27 | export default { | 28 | export default { |
28 | name: 'mainContainer', | 29 | name: 'mainContainer', |
29 | components: { | 30 | components: { |
30 | loadinggif, | 31 | loadinggif, |
31 | pdasection, | 32 | pdasection, |
32 | - dicisection | 33 | + dicisection, |
34 | + youdaopingsection | ||
33 | }, | 35 | }, |
34 | data() { | 36 | data() { |
35 | return { | 37 | return { |
src/views/youdaopingsection.vue
0 → 100644
1 | +<template> | ||
2 | + <div> | ||
3 | + <titlesection title="道闸/诱导屏"></titlesection> | ||
4 | + <ul class="flexfm ydp-dz-wrap"> | ||
5 | + <li> | ||
6 | + <div> | ||
7 | + <div class="bg-wrap"> | ||
8 | + <p>123</p> | ||
9 | + <p>123</p> | ||
10 | + </div> | ||
11 | + </div> | ||
12 | + <div> | ||
13 | + <div class="bg-wrap"> | ||
14 | + <p>123</p> | ||
15 | + <p>123</p> | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + </li> | ||
19 | + <!--<allPieChart tag="li"></allPieChart>--> | ||
20 | + <li> | ||
21 | + <allPieChart :chart-data="lineChartData"/> | ||
22 | + </li> | ||
23 | + </ul> | ||
24 | + </div> | ||
25 | +</template> | ||
26 | + | ||
27 | +<script> | ||
28 | +import titlesection from '../components/titlesection' | ||
29 | +import allPieChart from '../components/allPieChart' | ||
30 | +import { formatNum } from '../filters/filters' | ||
31 | +import {fetchList} from '../api/api' | ||
32 | + | ||
33 | +const lineChartData = { | ||
34 | + newVisitis: { | ||
35 | + yData: [100, 120, 161], | ||
36 | + xData: ['正常', '异常', '故障'] | ||
37 | + } | ||
38 | +} | ||
39 | + | ||
40 | + | ||
41 | +export default { | ||
42 | + name: 'youdaopingsection', | ||
43 | + components: { | ||
44 | + titlesection, | ||
45 | + allPieChart | ||
46 | + }, | ||
47 | + data() { | ||
48 | + return { | ||
49 | + lineChartData: lineChartData.newVisitis | ||
50 | + } | ||
51 | + }, | ||
52 | + created() { | ||
53 | + }, | ||
54 | + methods: { | ||
55 | + getList() { | ||
56 | + fetchList() | ||
57 | + .then(res => { | ||
58 | + console.log(res); | ||
59 | + | ||
60 | + }); | ||
61 | + }, | ||
62 | + } | ||
63 | +} | ||
64 | +</script> | ||
65 | + | ||
66 | +<style lang="scss" scoped> | ||
67 | + .ydp-dz-wrap{ | ||
68 | + display: flex; | ||
69 | + li{ | ||
70 | + height: 100%; | ||
71 | + flex: 1; | ||
72 | + &:nth-of-type(1)>div{ | ||
73 | + height: 50%; | ||
74 | + .bg-wrap{ | ||
75 | + width: 111px; | ||
76 | + height: 52px; | ||
77 | + position: relative; | ||
78 | + top:50%; | ||
79 | + left: 50%; | ||
80 | + transform: translate(-50%,-50%); | ||
81 | + background-color: #f00; | ||
82 | + } | ||
83 | + } | ||
84 | + } | ||
85 | + } | ||
86 | +</style> |