浏览代码

近30天各小组完成以及异常工单数调整为科室当日建单TOP10

seimin 3 年之前
父节点
当前提交
3069ef744d
共有 2 个文件被更改,包括 144 次插入308 次删除
  1. 141 305
      src/components/GroupPerformance.vue
  2. 3 3
      src/views/AppIndex.vue

+ 141 - 305
src/components/GroupPerformance.vue

@@ -13,9 +13,8 @@ export default {
13 13
   data () {
14 14
     return {
15 15
       timer: null,
16
-      groutWorkOrderListSuccessNum: [], // 获取到的正常单数
17
-      groutWorkOrderListErrorNum: [], // 获取到的异常单数
18
-      groutWorkOrderListName: [] // 获取到的小组名称
16
+      groutWorkOrderListNum: [], // 获取到的单数
17
+      groutWorkOrderListName: [] // 获取到的科室名称
19 18
     }
20 19
   },
21 20
   methods: {
@@ -24,346 +23,183 @@ export default {
24 23
       const myChart = echarts.init(
25 24
         document.getElementById('group-performance')
26 25
       )
27
-      var xData = this.groutWorkOrderListName
28
-      var lastYearData = this.groutWorkOrderListSuccessNum // 正常
29
-      var thisYearData = this.groutWorkOrderListErrorNum // 异常
30
-      var timeLineData = [1]
31
-      const legend = ['已完成工单数(单)', '异常工单数(单)']
32
-      var background = 'rgba(255,255,255,0)' // 背景
33
-      const textColor = '#fff'
34
-      const lineColor = 'rgba(255,255,255,0.2)'
35
-      const colors = [
26
+      var colorArray = [
36 27
         {
37
-          borderColor: 'rgba(112, 194, 130,1)',
38
-          start: 'rgba(112, 194, 130,0.8)',
39
-          end: 'rgba(112, 194, 130,0.1)'
28
+          top: '#c2ab70', // 第一
29
+          bottom: 'rgba(194, 171, 112, 0.5)',
30
+          borderColor: '#c2ab70'
40 31
         },
41 32
         {
42
-          borderColor: 'rgba(194, 112, 115,1)',
43
-          start: 'rgba(194, 112, 115,0.1)',
44
-          end: 'rgba(194, 112, 115,0.8)'
33
+          top: '#70c282', // 第二
34
+          bottom: 'rgba(112, 194, 130, 0.5)'
35
+        },
36
+        {
37
+          top: '#709cc2', // 第三
38
+          bottom: 'rgba(112, 156, 194, 0.5)'
39
+        },
40
+        {
41
+          top: '#709cc2', // 第四
42
+          bottom: 'rgba(112, 156, 194, 0.5)'
43
+        },
44
+        {
45
+          top: '#709cc2', // 第五
46
+          bottom: 'rgba(112, 156, 194, 0.5)'
45 47
         }
46 48
       ]
47
-      let borderData = []
48
-      const scale = 2
49
-      borderData = xData.map((item) => {
50
-        return scale
51
-      })
52
-      var option = {
53
-        baseOption: {
54
-          backgroundColor: background,
55
-          timeline: {
56
-            show: false,
57
-            top: 0,
58
-            data: []
49
+      const option = {
50
+        tooltip: {
51
+          show: false,
52
+          formatter: '{b}:{c}'
53
+        },
54
+        grid: {
55
+          left: '0%',
56
+          top: '5%',
57
+          right: '5%',
58
+          bottom: '5%',
59
+          containLabel: true
60
+        },
61
+        xAxis: {
62
+          type: 'value',
63
+          show: false,
64
+          position: 'top',
65
+          max: function (value) {
66
+            return value.max * 1.5
59 67
           },
60
-          legend: {
61
-            top: '3%',
62
-            right: 'left',
63
-            itemWidth: 20,
64
-            itemHeight: 5,
65
-            icon: 'none',
66
-            width: '100%',
67
-            itemGap: 124,
68
-            textStyle: {
69
-              color: '#ffffff',
70
-              fontSize: 14
71
-            },
72
-            data: legend
68
+          axisTick: {
69
+            show: false
73 70
           },
74
-          grid: [
75
-            {
76
-              show: false,
77
-              left: '5%',
78
-              top: '10%',
79
-              bottom: '8%',
80
-              containLabel: true,
81
-              width: '37%'
82
-            },
83
-            {
84
-              show: false,
85
-              left: '51%',
86
-              top: '10%',
87
-              bottom: '8%',
88
-              width: '0%'
89
-            },
90
-            {
91
-              show: false,
92
-              right: '2%',
93
-              top: '10%',
94
-              bottom: '8%',
95
-              containLabel: true,
96
-              width: '37%'
71
+          axisLine: {
72
+            show: false,
73
+            lineStyle: {
74
+              color: '#fff'
97 75
             }
98
-          ],
99
-          xAxis: [
100
-            {
101
-              type: 'value',
102
-              inverse: true,
103
-              axisLine: {
104
-                show: false
105
-              },
106
-              axisTick: {
107
-                show: false
108
-              },
109
-              position: 'top',
110
-              axisLabel: {
111
-                show: false,
112
-                color: textColor
113
-              },
114
-              max: function (value) {
115
-                return Math.ceil(value.max * 1.5)
116
-              },
117
-              splitLine: {
118
-                show: false,
119
-                lineStyle: {
120
-                  color: lineColor
121
-                }
122
-              }
76
+          },
77
+          splitLine: {
78
+            show: false
79
+          }
80
+        },
81
+        yAxis: [
82
+          {
83
+            type: 'category',
84
+            axisTick: {
85
+              show: false,
86
+              alignWithLabel: false,
87
+              length: 5
123 88
             },
124
-            {
125
-              gridIndex: 1,
89
+            splitLine: {
90
+              // 网格线
126 91
               show: false
127 92
             },
128
-            {
129
-              gridIndex: 2,
130
-              axisLine: {
131
-                show: false
132
-              },
133
-              max: function (value) {
134
-                return Math.ceil(value.max * 1.5)
135
-              },
136
-              axisTick: {
137
-                show: false
138
-              },
139
-              position: 'top',
140
-              axisLabel: {
141
-                show: false,
142
-                color: textColor
143
-              },
144
-              splitLine: {
145
-                show: false,
146
-                lineStyle: {
147
-                  color: lineColor
148
-                }
93
+            inverse: 'true', // 排序
94
+            axisLine: {
95
+              show: false,
96
+              lineStyle: {
97
+                color: '#fff'
149 98
               }
150
-            }
151
-          ],
152
-          yAxis: [
153
-            {
154
-              type: 'category',
155
-              inverse: true,
156
-              position: 'right',
157
-              axisLine: {
158
-                show: true,
159
-                lineStyle: {
160
-                  color: lineColor
161
-                }
162
-              },
163
-              axisTick: {
164
-                show: false
165
-              },
166
-              axisLabel: {
167
-                show: false
168
-              },
169
-              data: xData
170 99
             },
171
-            {
172
-              gridIndex: 1,
173
-              type: 'category',
174
-              inverse: true,
175
-              position: 'left',
176
-              axisLine: {
177
-                show: false
178
-              },
179
-              axisTick: {
180
-                show: false
181
-              },
182
-              axisLabel: {
183
-                show: true,
184
-                color: '#ffffff',
185
-                fontSize: 14,
186
-                align: 'center',
187
-                margin: -3
188
-              },
189
-              data: xData.map(function (params) {
190
-                var newParamsName = ''// 最终拼接成的字符串
191
-                var paramsNameNumber = params.length // 实际标签的个数
192
-                var provideNumber = 4 // 每行能显示的字的个数
193
-                var rowNumber = Math.ceil(paramsNameNumber / provideNumber) // 换行的话,需要显示几行,向上取整
194
-                /**
195
-                 * 判断标签的个数是否大于规定的个数, 如果大于,则进行换行处理 如果不大于,即等于或小于,就返回原标签
196
-                 */
197
-                // 条件等同于rowNumber>1
198
-                if (paramsNameNumber > provideNumber) {
199
-                  /** 循环每一行,p表示行 */
200
-                  for (var p = 0; p < rowNumber; p++) {
201
-                    var tempStr = '' // 表示每一次截取的字符串
202
-                    var start = p * provideNumber // 开始截取的位置
203
-                    var end = start + provideNumber // 结束截取的位置
204
-                    // 此处特殊处理最后一行的索引值
205
-                    if (p === rowNumber - 1) {
206
-                      // 最后一次不换行
207
-                      tempStr = params.substring(start, paramsNameNumber)
208
-                    } else {
209
-                      // 每一次拼接字符串并换行
210
-                      tempStr = params.substring(start, end) + '\n'
211
-                    }
212
-                    newParamsName += tempStr // 最终拼成的字符串
213
-                  }
214
-                } else {
215
-                  // 将旧标签的值赋给新标签
216
-                  newParamsName = params
217
-                }
218
-                return {
219
-                  value: newParamsName,
220
-                  textStyle: {
221
-                    align: 'center'
222
-                  }
223
-                }
224
-              })
225
-            },
226
-            {
227
-              gridIndex: 2,
228
-              type: 'category',
229
-              inverse: true,
230
-              position: 'left',
231
-              axisLine: {
232
-                show: true,
233
-                lineStyle: {
234
-                  color: lineColor
235
-                }
236
-              },
237
-              axisTick: {
238
-                show: false
239
-              },
240
-              axisLabel: {
241
-                show: false
242
-              },
243
-              data: xData
244
-            }
245
-          ],
246
-          series: []
247
-        },
248
-        options: []
249
-      }
250
-
251
-      option.baseOption.timeline.data.push(timeLineData[0])
252
-      option.options.push({
100
+            data: this.groutWorkOrderListName
101
+          }
102
+        ],
253 103
         series: [
254 104
           {
255
-            name: '已完成工单数(单)',
105
+            name: 'xxx',
256 106
             type: 'bar',
257
-            barWidth: 10,
258
-            stack: '1',
259
-            itemStyle: {
260
-              normal: {
261
-                color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
262
-                  {
263
-                    offset: 0,
264
-                    color: colors[0].start
265
-                  },
266
-                  {
267
-                    offset: 1,
268
-                    color: colors[0].end
269
-                  }
270
-                ])
271
-              }
272
-            },
273 107
             label: {
274 108
               normal: {
275 109
                 show: true,
276
-                position: 'right',
277
-                offset: [-170, 2],
110
+                position: [300, 0],
111
+                formatter: '{c}',
278 112
                 textStyle: {
279
-                  color: '#fff',
280
-                  fontSize: 14
113
+                  color: '#fff'
281 114
                 }
282 115
               }
283 116
             },
284
-            data: lastYearData,
285
-            animationEasing: 'elasticOut'
286
-          },
287
-          {
288
-            name: '已完成工单数(单)',
289
-            type: 'bar',
290
-            barWidth: 25,
291
-            stack: '1',
292 117
             itemStyle: {
293 118
               normal: {
294
-                color: colors[0].borderColor
295
-              }
296
-            },
297
-            data: borderData
298
-          },
299
-          {
300
-            name: '异常工单数(单)',
301
-            type: 'bar',
302
-            stack: '2',
303
-            barWidth: 10,
304
-            xAxisIndex: 2,
305
-            yAxisIndex: 2,
306
-            itemStyle: {
307
-              normal: {
308
-                color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
309
-                  {
310
-                    offset: 0,
311
-                    color: colors[1].start
312
-                  },
313
-                  {
314
-                    offset: 1,
315
-                    color: colors[1].end
119
+                show: true,
120
+                color: function (params) {
121
+                  const num = colorArray.length
122
+                  return {
123
+                    type: 'linear',
124
+                    colorStops: [
125
+                      {
126
+                        offset: 0,
127
+                        color: colorArray[params.dataIndex % num].bottom
128
+                      },
129
+                      {
130
+                        offset: 1,
131
+                        color: colorArray[params.dataIndex % num].top
132
+                      },
133
+                      {
134
+                        offset: 0,
135
+                        color: colorArray[params.dataIndex % num].bottom
136
+                      },
137
+                      {
138
+                        offset: 1,
139
+                        color: colorArray[params.dataIndex % num].top
140
+                      },
141
+                      {
142
+                        offset: 0,
143
+                        color: colorArray[params.dataIndex % num].bottom
144
+                      },
145
+                      {
146
+                        offset: 1,
147
+                        color: colorArray[params.dataIndex % num].top
148
+                      },
149
+                      {
150
+                        offset: 0,
151
+                        color: colorArray[params.dataIndex % num].bottom
152
+                      },
153
+                      {
154
+                        offset: 1,
155
+                        color: colorArray[params.dataIndex % num].top
156
+                      },
157
+                      {
158
+                        offset: 0,
159
+                        color: colorArray[params.dataIndex % num].bottom
160
+                      },
161
+                      {
162
+                        offset: 1,
163
+                        color: colorArray[params.dataIndex % num].top
164
+                      },
165
+                      {
166
+                        offset: 0,
167
+                        color: colorArray[params.dataIndex % num].bottom
168
+                      },
169
+                      {
170
+                        offset: 1,
171
+                        color: colorArray[params.dataIndex % num].top
172
+                      }
173
+                    ]
316 174
                   }
317
-                ])
175
+                },
176
+                barBorderRadius: 70,
177
+                borderWidth: 0,
178
+                borderColor: '#333'
318 179
               }
319 180
             },
320
-            label: {
321
-              show: true,
322
-              position: [140, 0],
323
-              textStyle: {
324
-                color: '#fff',
325
-                fontSize: 14
326
-              }
327
-            },
328
-            data: thisYearData,
329
-            animationEasing: 'elasticOut'
330
-          },
331
-          {
332
-            name: '异常工单数(单)',
333
-            type: 'bar',
334
-            barWidth: 25,
335
-            stack: '2',
336
-            itemStyle: {
337
-              normal: {
338
-                color: colors[1].borderColor
339
-              }
340
-            },
341
-            data: borderData
181
+            barGap: '0%',
182
+            barCategoryGap: '70%',
183
+            barWidth: 8,
184
+            data: this.groutWorkOrderListNum
342 185
           }
343 186
         ]
344
-      })
187
+      }
345 188
       myChart.setOption(option)
346 189
     },
347 190
     // 获取数据
348 191
     async getData () {
349
-      const srartTime = this.$moment()
350
-        .subtract(29, 'days')
351
-        .format('YYYY-MM-DD') // 近三十天
192
+      const srartTime = this.$moment().format('YYYY-MM-DD') // 今天
352 193
       const endTime = this.$moment().format('YYYY-MM-DD') // 今天
353 194
       const result = await post(
354
-        `/largeScreen/getData/groupWorkOrder/${this.hospitalId}`,
195
+        `/largeScreen/getData/getDeptOrderTop10/${this.hospitalId}`,
355 196
         { srartTime, endTime }
356 197
       )
357
-      this.groutWorkOrderListSuccessNum = []
358
-      this.groutWorkOrderListErrorNum = []
198
+      this.groutWorkOrderListNum = []
359 199
       this.groutWorkOrderListName = []
360
-      if (result.groutWorkOrderList.length > 5) {
361
-        result.groutWorkOrderList = result.groutWorkOrderList.slice(0, 5)
362
-      }
363
-      result.groutWorkOrderList.forEach((item) => {
364
-        this.groutWorkOrderListSuccessNum.push(item[1]) // 获取到的正常单数
365
-        this.groutWorkOrderListErrorNum.push(item[0]) // 获取到的异常单数
366
-        this.groutWorkOrderListName.push(item[3]) // 获取到的小组名称
200
+      result.list.forEach((item) => {
201
+        this.groutWorkOrderListNum.push(item[1]) // 获取到的异常单数
202
+        this.groutWorkOrderListName.push(item[0]) // 获取到的小组名称
367 203
       })
368 204
       this.draw()
369 205
       this.polling()
@@ -391,7 +227,7 @@ export default {
391 227
   height: 100%;
392 228
 }
393 229
 .group-performanceWrap {
394
-  width: 5.15rem;
230
+  // width: 5.15rem;
395 231
   height: 5.0625rem;
396 232
   margin: 0.2rem auto;
397 233
 }

+ 3 - 3
src/views/AppIndex.vue

@@ -12,9 +12,9 @@
12 12
               <h2 class="app-item__header">近三十天各小组好评率排行榜</h2>
13 13
               <GroupPraise></GroupPraise>
14 14
             </div>
15
-            <!-- 近三十天各小组完成以及异常工单数 -->
15
+            <!-- 科室当日建单TOP10 -->
16 16
             <div class="app-item">
17
-              <h2 class="app-item__header">近三十天各小组完成以及异常工单数</h2>
17
+              <h2 class="app-item__header">科室当日建单TOP10</h2>
18 18
               <GroupPerformance></GroupPerformance>
19 19
             </div>
20 20
             <!-- 近三十天各小组人员工作时间利用率 -->
@@ -108,7 +108,7 @@ export default {
108 108
   components: {
109 109
     AppHeader, // 头部
110 110
     GroupPraise, // 近三十天各小组好评率排行榜
111
-    GroupPerformance, // 近三十天各小组完成以及异常工单数
111
+    GroupPerformance, // 科室当日建单TOP10
112 112
     OnDutyToday, // 今日当班情况
113 113
     TodayWorkOrder, // 当日工单趋势图
114 114
     PointsRanking, // 今日积分前三人员