|
@@ -12,173 +12,240 @@ export default {
|
12
|
12
|
return {
|
13
|
13
|
timer: null,
|
14
|
14
|
myChart: null,
|
|
15
|
+ associationTypeProportion: [],
|
15
|
16
|
associationTypeProportionNum: [],
|
16
|
|
- associationTypeProportionName: []
|
|
17
|
+ associationTypeProportionName: [],
|
|
18
|
+ associationTypeProportionAll: []
|
17
|
19
|
}
|
18
|
20
|
},
|
19
|
21
|
methods: {
|
20
|
22
|
// 画图
|
21
|
23
|
draw () {
|
|
24
|
+ const that = this
|
22
|
25
|
this.myChart = echarts.init(this.$refs.BusinessTypeRatio)
|
23
|
|
- var colorArray = [
|
24
|
|
- {
|
25
|
|
- top: '#c2ab70', // 第一
|
26
|
|
- bottom: 'rgba(194, 171, 112, 0.5)',
|
27
|
|
- borderColor: '#c2ab70'
|
28
|
|
- },
|
29
|
|
- {
|
30
|
|
- top: '#70c282', // 第二
|
31
|
|
- bottom: 'rgba(112, 194, 130, 0.5)'
|
32
|
|
- },
|
33
|
|
- {
|
34
|
|
- top: '#709cc2', // 第三
|
35
|
|
- bottom: 'rgba(112, 156, 194, 0.5)'
|
36
|
|
- },
|
37
|
|
- {
|
38
|
|
- top: '#709cc2', // 第四
|
39
|
|
- bottom: 'rgba(112, 156, 194, 0.5)'
|
40
|
|
- },
|
41
|
|
- {
|
42
|
|
- top: '#709cc2', // 第五
|
43
|
|
- bottom: 'rgba(112, 156, 194, 0.5)'
|
44
|
|
- }
|
45
|
|
- ]
|
46
|
26
|
const option = {
|
47
|
27
|
tooltip: {
|
48
|
|
- show: false,
|
49
|
|
- formatter: '{b}:{c}'
|
|
28
|
+ trigger: 'item',
|
|
29
|
+ formatter: '{a} <br/>{b} : {c} ({d}%)'
|
50
|
30
|
},
|
51
|
31
|
grid: {
|
52
|
|
- left: '5%',
|
|
32
|
+ show: false,
|
53
|
33
|
top: '5%',
|
|
34
|
+ left: '5%',
|
54
|
35
|
right: '5%',
|
55
|
|
- bottom: '0%',
|
56
|
|
- containLabel: true
|
|
36
|
+ bottom: '0%'
|
57
|
37
|
},
|
58
|
|
- xAxis: {
|
59
|
|
- type: 'value',
|
60
|
|
- show: false,
|
61
|
|
- position: 'top',
|
62
|
|
- max: function (value) {
|
63
|
|
- return value.max * 1.5
|
64
|
|
- },
|
65
|
|
- axisTick: {
|
66
|
|
- show: false
|
67
|
|
- },
|
68
|
|
- axisLine: {
|
69
|
|
- show: false,
|
70
|
|
- lineStyle: {
|
|
38
|
+ // legend: {
|
|
39
|
+ // left: '20%',
|
|
40
|
+ // orient: 'horizontal',
|
|
41
|
+ // itemWidth: 8,
|
|
42
|
+ // itemHeight: 8,
|
|
43
|
+ // icon: 'rect',
|
|
44
|
+ // bottom: '0%',
|
|
45
|
+ // data: this.associationTypeProportionName,
|
|
46
|
+ // textStyle: {
|
|
47
|
+ // color: '#fff'
|
|
48
|
+ // },
|
|
49
|
+ // formatter (name) {
|
|
50
|
+ // const arr = that.associationTypeProportionAll.filter(item => item[0] === name)
|
|
51
|
+ // return `${name} ${arr[0][1]}单 ${arr[0][2]}%`
|
|
52
|
+ // }
|
|
53
|
+ // },
|
|
54
|
+ legend: [
|
|
55
|
+ {
|
|
56
|
+ right: '55%',
|
|
57
|
+ orient: 'horizontal',
|
|
58
|
+ itemWidth: 8,
|
|
59
|
+ itemHeight: 8,
|
|
60
|
+ icon: 'rect',
|
|
61
|
+ bottom: '20%',
|
|
62
|
+ data: this.associationTypeProportionName.slice(
|
|
63
|
+ 0,
|
|
64
|
+ Math.ceil(this.associationTypeProportionName.length / 2)
|
|
65
|
+ ),
|
|
66
|
+ textStyle: {
|
71
|
67
|
color: '#fff'
|
|
68
|
+ },
|
|
69
|
+ formatter (name) {
|
|
70
|
+ const arr = that.associationTypeProportionAll.filter(
|
|
71
|
+ (item) => item[0] === name
|
|
72
|
+ )
|
|
73
|
+ return `${name} ${arr[0][1]}单 ${arr[0][2]}%`
|
72
|
74
|
}
|
73
|
75
|
},
|
74
|
|
- splitLine: {
|
75
|
|
- show: false
|
76
|
|
- }
|
77
|
|
- },
|
78
|
|
- yAxis: [
|
79
|
76
|
{
|
80
|
|
- type: 'category',
|
81
|
|
- axisTick: {
|
82
|
|
- show: false,
|
83
|
|
- alignWithLabel: false,
|
84
|
|
- length: 5
|
85
|
|
- },
|
86
|
|
- splitLine: {
|
87
|
|
- // 网格线
|
88
|
|
- show: false
|
|
77
|
+ left: '55%',
|
|
78
|
+ orient: 'horizontal',
|
|
79
|
+ itemWidth: 8,
|
|
80
|
+ itemHeight: 8,
|
|
81
|
+ icon: 'rect',
|
|
82
|
+ bottom: '24%',
|
|
83
|
+ data: this.associationTypeProportionName.slice(
|
|
84
|
+ Math.ceil(this.associationTypeProportionName.length / 2),
|
|
85
|
+ this.associationTypeProportionName.length
|
|
86
|
+ ),
|
|
87
|
+ textStyle: {
|
|
88
|
+ color: '#fff'
|
89
|
89
|
},
|
90
|
|
- inverse: 'true', // 排序
|
91
|
|
- axisLine: {
|
92
|
|
- show: false,
|
93
|
|
- lineStyle: {
|
94
|
|
- color: '#fff'
|
|
90
|
+ formatter (name) {
|
|
91
|
+ const arr = that.associationTypeProportionAll.filter(
|
|
92
|
+ (item) => item[0] === name
|
|
93
|
+ )
|
|
94
|
+ return `${name} ${arr[0][1]}单 ${arr[0][2]}%`
|
|
95
|
+ }
|
|
96
|
+ }
|
|
97
|
+ ],
|
|
98
|
+ color: [
|
|
99
|
+ {
|
|
100
|
+ type: 'linear',
|
|
101
|
+ x: 0,
|
|
102
|
+ y: 0,
|
|
103
|
+ x2: 0,
|
|
104
|
+ y2: 1,
|
|
105
|
+ colorStops: [
|
|
106
|
+ {
|
|
107
|
+ offset: 0,
|
|
108
|
+ color: '#c27073' // 0% 处的颜色
|
|
109
|
+ },
|
|
110
|
+ {
|
|
111
|
+ offset: 1,
|
|
112
|
+ color: 'rgba(194, 112, 115, 0.5)' // 100% 处的颜色
|
95
|
113
|
}
|
96
|
|
- },
|
97
|
|
- data: this.associationTypeProportionName
|
|
114
|
+ ],
|
|
115
|
+ global: false // 缺省为 false
|
|
116
|
+ },
|
|
117
|
+ {
|
|
118
|
+ type: 'linear',
|
|
119
|
+ x: 0,
|
|
120
|
+ y: 0,
|
|
121
|
+ x2: 0,
|
|
122
|
+ y2: 1,
|
|
123
|
+ colorStops: [
|
|
124
|
+ {
|
|
125
|
+ offset: 0,
|
|
126
|
+ color: '#c2ab70' // 0% 处的颜色
|
|
127
|
+ },
|
|
128
|
+ {
|
|
129
|
+ offset: 1,
|
|
130
|
+ color: 'rgba(194, 171, 112, 0.5)' // 100% 处的颜色
|
|
131
|
+ }
|
|
132
|
+ ],
|
|
133
|
+ global: false // 缺省为 false
|
|
134
|
+ },
|
|
135
|
+ {
|
|
136
|
+ type: 'linear',
|
|
137
|
+ x: 0,
|
|
138
|
+ y: 0,
|
|
139
|
+ x2: 0,
|
|
140
|
+ y2: 1,
|
|
141
|
+ colorStops: [
|
|
142
|
+ {
|
|
143
|
+ offset: 0,
|
|
144
|
+ color: '#70c2ab' // 0% 处的颜色
|
|
145
|
+ },
|
|
146
|
+ {
|
|
147
|
+ offset: 1,
|
|
148
|
+ color: 'rgba(112, 194, 171, 0.5)' // 100% 处的颜色
|
|
149
|
+ }
|
|
150
|
+ ],
|
|
151
|
+ global: false // 缺省为 false
|
|
152
|
+ },
|
|
153
|
+ {
|
|
154
|
+ type: 'linear',
|
|
155
|
+ x: 0,
|
|
156
|
+ y: 0,
|
|
157
|
+ x2: 0,
|
|
158
|
+ y2: 1,
|
|
159
|
+ colorStops: [
|
|
160
|
+ {
|
|
161
|
+ offset: 0,
|
|
162
|
+ color: '#70c282' // 0% 处的颜色
|
|
163
|
+ },
|
|
164
|
+ {
|
|
165
|
+ offset: 1,
|
|
166
|
+ color: 'rgba(112, 194, 130, 0.5)' // 100% 处的颜色
|
|
167
|
+ }
|
|
168
|
+ ],
|
|
169
|
+ global: false // 缺省为 false
|
|
170
|
+ },
|
|
171
|
+ {
|
|
172
|
+ type: 'linear',
|
|
173
|
+ x: 0,
|
|
174
|
+ y: 0,
|
|
175
|
+ x2: 0,
|
|
176
|
+ y2: 1,
|
|
177
|
+ colorStops: [
|
|
178
|
+ {
|
|
179
|
+ offset: 0,
|
|
180
|
+ color: '#9cc270' // 0% 处的颜色
|
|
181
|
+ },
|
|
182
|
+ {
|
|
183
|
+ offset: 1,
|
|
184
|
+ color: 'rgba(156, 194, 112, 0.5)' // 100% 处的颜色
|
|
185
|
+ }
|
|
186
|
+ ],
|
|
187
|
+ global: false // 缺省为 false
|
|
188
|
+ },
|
|
189
|
+ {
|
|
190
|
+ type: 'linear',
|
|
191
|
+ x: 0,
|
|
192
|
+ y: 0,
|
|
193
|
+ x2: 0,
|
|
194
|
+ y2: 1,
|
|
195
|
+ colorStops: [
|
|
196
|
+ {
|
|
197
|
+ offset: 0,
|
|
198
|
+ color: '#709cc2' // 0% 处的颜色
|
|
199
|
+ },
|
|
200
|
+ {
|
|
201
|
+ offset: 1,
|
|
202
|
+ color: 'rgba(112, 156, 194, 0.5)' // 100% 处的颜色
|
|
203
|
+ }
|
|
204
|
+ ],
|
|
205
|
+ global: false // 缺省为 false
|
|
206
|
+ },
|
|
207
|
+ {
|
|
208
|
+ type: 'linear',
|
|
209
|
+ x: 0,
|
|
210
|
+ y: 0,
|
|
211
|
+ x2: 0,
|
|
212
|
+ y2: 1,
|
|
213
|
+ colorStops: [
|
|
214
|
+ {
|
|
215
|
+ offset: 0,
|
|
216
|
+ color: '#c270b0' // 0% 处的颜色
|
|
217
|
+ },
|
|
218
|
+ {
|
|
219
|
+ offset: 1,
|
|
220
|
+ color: 'rgba(194, 112, 176, 0.5)' // 100% 处的颜色
|
|
221
|
+ }
|
|
222
|
+ ],
|
|
223
|
+ global: false // 缺省为 false
|
98
|
224
|
}
|
99
|
225
|
],
|
100
|
226
|
series: [
|
101
|
227
|
{
|
102
|
|
- name: 'xxx',
|
103
|
|
- type: 'bar',
|
|
228
|
+ name: '数据统计',
|
|
229
|
+ type: 'pie',
|
|
230
|
+ center: ['50%', '35%'],
|
|
231
|
+ roseType: 'radius',
|
104
|
232
|
label: {
|
105
|
233
|
normal: {
|
106
|
|
- show: true,
|
107
|
|
- position: [330, 0],
|
108
|
|
- formatter: '{c}单',
|
109
|
|
- textStyle: {
|
110
|
|
- color: '#fff'
|
111
|
|
- }
|
|
234
|
+ show: false
|
|
235
|
+ },
|
|
236
|
+ emphasis: {
|
|
237
|
+ show: false
|
112
|
238
|
}
|
113
|
239
|
},
|
114
|
|
- itemStyle: {
|
|
240
|
+ lableLine: {
|
115
|
241
|
normal: {
|
116
|
|
- show: true,
|
117
|
|
- color: function (params) {
|
118
|
|
- const num = colorArray.length
|
119
|
|
- return {
|
120
|
|
- type: 'linear',
|
121
|
|
- colorStops: [
|
122
|
|
- {
|
123
|
|
- offset: 0,
|
124
|
|
- color: colorArray[params.dataIndex % num].bottom
|
125
|
|
- },
|
126
|
|
- {
|
127
|
|
- offset: 1,
|
128
|
|
- color: colorArray[params.dataIndex % num].top
|
129
|
|
- },
|
130
|
|
- {
|
131
|
|
- offset: 0,
|
132
|
|
- color: colorArray[params.dataIndex % num].bottom
|
133
|
|
- },
|
134
|
|
- {
|
135
|
|
- offset: 1,
|
136
|
|
- color: colorArray[params.dataIndex % num].top
|
137
|
|
- },
|
138
|
|
- {
|
139
|
|
- offset: 0,
|
140
|
|
- color: colorArray[params.dataIndex % num].bottom
|
141
|
|
- },
|
142
|
|
- {
|
143
|
|
- offset: 1,
|
144
|
|
- color: colorArray[params.dataIndex % num].top
|
145
|
|
- },
|
146
|
|
- {
|
147
|
|
- offset: 0,
|
148
|
|
- color: colorArray[params.dataIndex % num].bottom
|
149
|
|
- },
|
150
|
|
- {
|
151
|
|
- offset: 1,
|
152
|
|
- color: colorArray[params.dataIndex % num].top
|
153
|
|
- },
|
154
|
|
- {
|
155
|
|
- offset: 0,
|
156
|
|
- color: colorArray[params.dataIndex % num].bottom
|
157
|
|
- },
|
158
|
|
- {
|
159
|
|
- offset: 1,
|
160
|
|
- color: colorArray[params.dataIndex % num].top
|
161
|
|
- },
|
162
|
|
- {
|
163
|
|
- offset: 0,
|
164
|
|
- color: colorArray[params.dataIndex % num].bottom
|
165
|
|
- },
|
166
|
|
- {
|
167
|
|
- offset: 1,
|
168
|
|
- color: colorArray[params.dataIndex % num].top
|
169
|
|
- }
|
170
|
|
- ]
|
171
|
|
- }
|
172
|
|
- },
|
173
|
|
- barBorderRadius: 70,
|
174
|
|
- borderWidth: 0,
|
175
|
|
- borderColor: '#333'
|
|
242
|
+ show: false
|
|
243
|
+ },
|
|
244
|
+ emphasis: {
|
|
245
|
+ show: true
|
176
|
246
|
}
|
177
|
247
|
},
|
178
|
|
- barGap: '0%',
|
179
|
|
- barCategoryGap: '70%',
|
180
|
|
- barWidth: 8,
|
181
|
|
- data: this.associationTypeProportionNum
|
|
248
|
+ data: this.associationTypeProportion
|
182
|
249
|
}
|
183
|
250
|
]
|
184
|
251
|
}
|
|
@@ -186,17 +253,22 @@ export default {
|
186
|
253
|
},
|
187
|
254
|
// 获取数据
|
188
|
255
|
async getData () {
|
189
|
|
- const srartTime = this.$moment().format('YYYY-MM-DD') // 今天
|
|
256
|
+ const srartTime = this.$moment()
|
|
257
|
+ .subtract(29, 'days')
|
|
258
|
+ .format('YYYY-MM-DD') // 近三十天
|
190
|
259
|
const endTime = this.$moment().format('YYYY-MM-DD') // 今天
|
191
|
260
|
const result = await post(
|
192
|
|
- `/largeScreen/getData/getTasktypeTop5/${this.hospitalId}`,
|
|
261
|
+ `/largeScreen/getData/associationTypeProportion/${this.hospitalId}`,
|
193
|
262
|
{ srartTime, endTime }
|
194
|
263
|
)
|
195
|
264
|
this.associationTypeProportionNum = []
|
196
|
265
|
this.associationTypeProportionName = []
|
197
|
|
- result.list.forEach((item) => {
|
|
266
|
+ this.associationTypeProportion = []
|
|
267
|
+ this.associationTypeProportionAll = result.associationTypeProportion
|
|
268
|
+ result.associationTypeProportion.forEach((item) => {
|
198
|
269
|
this.associationTypeProportionNum.push(item[1]) // 获取到的数据
|
199
|
270
|
this.associationTypeProportionName.push(item[0]) // 获取到的名称
|
|
271
|
+ this.associationTypeProportion.push({ value: item[1], name: item[0] }) // 获取到的名称
|
200
|
272
|
})
|
201
|
273
|
this.draw()
|
202
|
274
|
this.polling()
|
|
@@ -220,7 +292,7 @@ export default {
|
220
|
292
|
|
221
|
293
|
<style lang="less">
|
222
|
294
|
.business-type-ratio {
|
223
|
|
- height: 5rem;
|
|
295
|
+ height: 7rem;
|
224
|
296
|
margin: 0 auto;
|
225
|
297
|
}
|
226
|
298
|
</style>
|