Browse Source

服务台绩效修改

seimin 2 years ago
parent
commit
55f7adf7c9

+ 209 - 0
assets/js/controllers/report/servicePerformanceCtrl.js

@@ -75,6 +75,9 @@ app.controller("servicePerformanceCtrl", [
75 75
             if ((response.status = 200)) {
76 76
               $scope.isMaskground = false;
77 77
               $scope.charginrow = response.data;
78
+              // 图表
79
+              barechart6(response.data);
80
+              barechart7(response.data);
78 81
               var totalScore = $scope.charginrow.reduce((pre,cur)=>{
79 82
                 return pre + cur.score;
80 83
               },0)
@@ -247,5 +250,211 @@ app.controller("servicePerformanceCtrl", [
247 250
         },
248 251
       });
249 252
     }
253
+
254
+    // 饼图
255
+    function barechart6(datas) {
256
+      var dom = document.getElementById("XYSJ");
257
+      var option = null;
258
+      var myChart = echarts.init(dom);
259
+      var data = datas.map(v=>({name: v.userName, value: v.score}));
260
+      option = {
261
+        color: ["#91c7ae", "#61a0a8", "#2f4554", "#c23531", "#d48265"],
262
+        title: {
263
+          text: "积分占比",
264
+          // subtext: datas.pieChartSum,
265
+          // textAlign: "center",
266
+          textStyle: {
267
+            color: "#333",
268
+            fontSize: 16,
269
+            align: 'center',
270
+          },
271
+          // subtextStyle: {
272
+          //   fontSize: 14,
273
+          //   color: ["#005395"],
274
+          //   fontWeight: "bolder",
275
+          //   // align: 'center'
276
+          // },
277
+          // x: "34.5%",
278
+          // y: "50%",
279
+        },
280
+        tooltip: {
281
+          trigger: "item",
282
+          formatter: function (a) {
283
+            return a["data"]["name"] + ":" + a["data"]["value"];
284
+          },
285
+          position: ["50%", "30%"],
286
+        },
287
+        grid: {
288
+          bottom: 150,
289
+          left: 100,
290
+          right: "10%",
291
+        },
292
+        legend: {
293
+          orient: "vertical",
294
+          top: "middle",
295
+          right: "5%",
296
+          textStyle: {
297
+            color: "#333",
298
+            fontSize: 12,
299
+          },
300
+          itemWidth: 8,
301
+          itemHeight: 8,
302
+          icon: "roundRect",
303
+          data: data,
304
+        },
305
+        series: [
306
+          // 主要展示层的
307
+          {
308
+            radius: ["50%", "65%"],
309
+            center: ["35%", "60%"],
310
+            type: "pie",
311
+            label: {
312
+              normal: {
313
+                show: true,
314
+                formatter: "{d}%",
315
+                textStyle: {
316
+                  fontSize: 14,
317
+                },
318
+                position: "outside",
319
+              },
320
+              emphasis: {
321
+                show: true,
322
+              },
323
+            },
324
+            labelLine: {
325
+              normal: {
326
+                show: true,
327
+                length: 5,
328
+                length2: 25,
329
+              },
330
+              emphasis: {
331
+                show: true,
332
+              },
333
+            },
334
+            name: "",
335
+            data: data,
336
+          },
337
+        ],
338
+      };
339
+      if (option && typeof option === "object") {
340
+        myChart.setOption(option);
341
+        myChart.hideLoading();
342
+      }
343
+    }
344
+    // 柱形图
345
+    function barechart7(datas) {
346
+      console.log(datas);
347
+      var datas_obj = {name:[], '处理工单总数':[]};
348
+      // 处理数据 start
349
+      datas.forEach(v=>{
350
+        datas_obj.name.push(v.userName);
351
+        datas_obj['处理工单总数'].push(v.total);
352
+      })
353
+      datas = datas_obj;
354
+      console.log(datas);
355
+      // 处理数据 end
356
+      var name = [];
357
+      var series = [];
358
+      for (var key in datas) {
359
+        if (key !== "name") {
360
+          name.push(key);
361
+          series.push({
362
+            name: key,
363
+            type: "bar",
364
+            stack: "1",
365
+            // barWidth: 40,
366
+            itemStyle: {
367
+              normal: {},
368
+            },
369
+            data: datas[key],
370
+          });
371
+        }
372
+      }
373
+      var dom = document.getElementById("jjmyd");
374
+      var myChart = echarts.init(dom);
375
+      var option = null;
376
+      myChart.showLoading({
377
+        text: "数据加载中...",
378
+        color: "#c23531",
379
+        textColor: "#fff",
380
+        maskColor: "rgba(255,255,255,0)",
381
+        zlevel: 0,
382
+      });
383
+      myChart.hideLoading();
384
+      option = {
385
+        tooltip: {
386
+          trigger: "axis",
387
+          axisPointer: {
388
+            // 坐标轴指示器,坐标轴触发有效
389
+            type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
390
+          },
391
+        },
392
+        legend: {
393
+          data: name,
394
+          align: "left",
395
+          // itemWidth:10,
396
+          // itemHeight:10,
397
+          bottom: 0,
398
+        },
399
+        grid: {
400
+          top: "15%",
401
+          left: "2%",
402
+          right: "1.5%",
403
+          bottom: "15%",
404
+          containLabel: true,
405
+        },
406
+        xAxis: [
407
+          {
408
+            type: "category",
409
+            axisTick: {
410
+                alignWithLabel: true
411
+            },
412
+            axisLabel: {
413
+              interval: 0,
414
+              textStyle: {
415
+                color: "#7B7B7B",
416
+                // fontSize: '14',
417
+              },
418
+            },
419
+            axisLine: {
420
+              show: true,
421
+              lineStyle: {
422
+                color: "#7B7B7B",
423
+                // type: 'dotted'
424
+              },
425
+            },
426
+            data: datas.name,
427
+          },
428
+        ],
429
+        yAxis: [
430
+          {
431
+            type: "value",
432
+            scale: true,
433
+            name: "处理工单总数",
434
+            min: 0,
435
+            boundaryGap: [0.2, 0.2],
436
+            axisLabel: {
437
+              formatter: "{value}",
438
+              textStyle: {
439
+                color: "#7B7B7B",
440
+                // fontSize: '14',
441
+              },
442
+            },
443
+            axisLine: {
444
+              show: true,
445
+              lineStyle: {
446
+                color: "#7B7B7B",
447
+                // type: 'dotted'
448
+              },
449
+            },
450
+          },
451
+        ],
452
+        series: series,
453
+      };
454
+      if (option && typeof option === "object") {
455
+        myChart.setOption(option);
456
+        myChart.hideLoading();
457
+      }
458
+    }
250 459
   },
251 460
 ]);

File diff suppressed because it is too large
+ 48 - 8
assets/views/report/servicePerformance.html