Selaa lähdekoodia

近30天各小组任务类型修改为当日任务类型TOP5

seimin 3 vuotta sitten
vanhempi
commit
47e2759fd8
2 muutettua tiedostoa jossa 143 lisäystä ja 215 poistoa
  1. 140 212
      src/components/BusinessTypeRatio.vue
  2. 3 3
      src/views/AppIndex.vue

+ 140 - 212
src/components/BusinessTypeRatio.vue

@@ -12,240 +12,173 @@ export default {
12 12
     return {
13 13
       timer: null,
14 14
       myChart: null,
15
-      associationTypeProportion: [],
16 15
       associationTypeProportionNum: [],
17
-      associationTypeProportionName: [],
18
-      associationTypeProportionAll: []
16
+      associationTypeProportionName: []
19 17
     }
20 18
   },
21 19
   methods: {
22 20
     // 画图
23 21
     draw () {
24
-      const that = this
25 22
       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
+      ]
26 46
       const option = {
27 47
         tooltip: {
28
-          trigger: 'item',
29
-          formatter: '{a} <br/>{b} : {c} ({d}%)'
48
+          show: false,
49
+          formatter: '{b}:{c}'
30 50
         },
31 51
         grid: {
32
-          show: false,
33
-          top: '5%',
34 52
           left: '5%',
53
+          top: '5%',
35 54
           right: '5%',
36
-          bottom: '0%'
55
+          bottom: '0%',
56
+          containLabel: true
37 57
         },
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: {
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]}%`
74
-            }
58
+        xAxis: {
59
+          type: 'value',
60
+          show: false,
61
+          position: 'top',
62
+          max: function (value) {
63
+            return value.max * 1.5
75 64
           },
76
-          {
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: {
65
+          axisTick: {
66
+            show: false
67
+          },
68
+          axisLine: {
69
+            show: false,
70
+            lineStyle: {
88 71
               color: '#fff'
89
-            },
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 72
             }
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% 处的颜色
113
-              }
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 73
           },
74
+          splitLine: {
75
+            show: false
76
+          }
77
+        },
78
+        yAxis: [
207 79
           {
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% 处的颜色
80
+            type: 'category',
81
+            axisTick: {
82
+              show: false,
83
+              alignWithLabel: false,
84
+              length: 5
85
+            },
86
+            splitLine: {
87
+              // 网格线
88
+              show: false
89
+            },
90
+            inverse: 'true', // 排序
91
+            axisLine: {
92
+              show: false,
93
+              lineStyle: {
94
+                color: '#fff'
221 95
               }
222
-            ],
223
-            global: false // 缺省为 false
96
+            },
97
+            data: this.associationTypeProportionName
224 98
           }
225 99
         ],
226 100
         series: [
227 101
           {
228
-            name: '数据统计',
229
-            type: 'pie',
230
-            center: ['50%', '35%'],
231
-            roseType: 'radius',
102
+            name: 'xxx',
103
+            type: 'bar',
232 104
             label: {
233 105
               normal: {
234
-                show: false
235
-              },
236
-              emphasis: {
237
-                show: false
106
+                show: true,
107
+                position: [365, 0],
108
+                formatter: '{c}',
109
+                textStyle: {
110
+                  color: '#fff'
111
+                }
238 112
               }
239 113
             },
240
-            lableLine: {
114
+            itemStyle: {
241 115
               normal: {
242
-                show: false
243
-              },
244
-              emphasis: {
245
-                show: true
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'
246 176
               }
247 177
             },
248
-            data: this.associationTypeProportion
178
+            barGap: '0%',
179
+            barCategoryGap: '70%',
180
+            barWidth: 8,
181
+            data: this.associationTypeProportionNum
249 182
           }
250 183
         ]
251 184
       }
@@ -253,22 +186,17 @@ export default {
253 186
     },
254 187
     // 获取数据
255 188
     async getData () {
256
-      const srartTime = this.$moment()
257
-        .subtract(29, 'days')
258
-        .format('YYYY-MM-DD') // 近三十天
189
+      const srartTime = this.$moment().format('YYYY-MM-DD') // 今天
259 190
       const endTime = this.$moment().format('YYYY-MM-DD') // 今天
260 191
       const result = await post(
261
-        `/largeScreen/getData/associationTypeProportion/${this.hospitalId}`,
192
+        `/largeScreen/getData/getTasktypeTop5/${this.hospitalId}`,
262 193
         { srartTime, endTime }
263 194
       )
264 195
       this.associationTypeProportionNum = []
265 196
       this.associationTypeProportionName = []
266
-      this.associationTypeProportion = []
267
-      this.associationTypeProportionAll = result.associationTypeProportion
268
-      result.associationTypeProportion.forEach((item) => {
197
+      result.list.forEach((item) => {
269 198
         this.associationTypeProportionNum.push(item[1]) // 获取到的数据
270 199
         this.associationTypeProportionName.push(item[0]) // 获取到的名称
271
-        this.associationTypeProportion.push({ value: item[1], name: item[0] }) // 获取到的名称
272 200
       })
273 201
       this.draw()
274 202
       this.polling()
@@ -292,7 +220,7 @@ export default {
292 220
 
293 221
 <style lang="less">
294 222
 .business-type-ratio {
295
-  height: 7rem;
223
+  height: 5rem;
296 224
   margin: 0 auto;
297 225
 }
298 226
 </style>

+ 3 - 3
src/views/AppIndex.vue

@@ -79,9 +79,9 @@
79 79
               <h2 class="app-item__header">近三十天人员按时到达率排行榜</h2>
80 80
               <OnTimeArrivalRate></OnTimeArrivalRate>
81 81
             </div>
82
-            <!-- 近三十天各业务类型占比 -->
82
+            <!-- 当日任务类型TOP5 -->
83 83
             <div class="app-item">
84
-              <h2 class="app-item__header">近三十天各业务类型占比</h2>
84
+              <h2 class="app-item__header">当日任务类型TOP5</h2>
85 85
               <BusinessTypeRatio></BusinessTypeRatio>
86 86
             </div>
87 87
           </aside>
@@ -112,7 +112,7 @@ export default {
112 112
     OnDutyToday, // 今日当班情况
113 113
     TodayWorkOrder, // 当日工单趋势图
114 114
     PointsRanking, // 今日积分前三人员
115
-    BusinessTypeRatio, // 近三十天各业务类型占比
115
+    BusinessTypeRatio, // 当日任务类型TOP5
116 116
     ErrorWorkOrder, // 今日工单异常情况
117 117
     DeliveryRate, // 近三十天各类型工单按时送达率趋势
118 118
     TimeUtilization, // 近三十天各小组人员工作时间利用率