Explorar o código

驾驶舱问题整改数据全是0时,界面显示有问题

jiawuxian hai 1 ano
pai
achega
54a3c67269
Modificáronse 1 ficheiros con 36 adicións e 14 borrados
  1. 36 14
      src/views/board/charts/question/report.vue

+ 36 - 14
src/views/board/charts/question/report.vue

@@ -146,40 +146,62 @@ export default {
 
       // 基于准备好的dom,初始化echarts实例
       this.myChart = echarts.init(document.getElementById("question_Chart"));
-
+      let { unconfirm, dissent, closed, unreform, reformed, overdue } =
+        this.data;
+      if (
+        !unconfirm &&
+        !dissent &&
+        !closed &&
+        !unreform &&
+        !reformed &&
+        !overdue
+      ) {
+        unconfirm = 1;
+        dissent = 1;
+        closed = 1;
+        unreform = 1;
+        reformed = 1;
+        overdue = 1;
+      }
       let chartData = [
         {
           name: "待确认",
-          value: this.data.unconfirm,
+          origin: this.data.unconfirm,
+          value: unconfirm,
         },
         {
           name: "有异议",
-          value: this.data.dissent,
+          origin: this.data.dissent,
+          value: dissent,
         },
         {
           name: "已关闭",
-          value: this.data.closed,
+          origin: this.data.closed,
+          value: closed,
         },
         {
           name: "待整改",
-          value: this.data.unreform,
+          origin: this.data.unreform,
+          value: unreform,
         },
         {
           name: "已整改",
-          value: this.data.reformed,
+          origin: this.data.reformed,
+          value: reformed,
         },
         {
           name: "已逾期",
-          value: this.data.overdue,
+          origin: this.data.overdue,
+          value: overdue,
         },
         {
           value: this.sum(
-            this.data.unconfirm,
-            this.data.dissent,
-            this.data.closed,
-            this.data.unreform,
-            this.data.reformed,
-            this.data.overdue
+            unconfirm,
+            dissent,
+            closed,
+            unreform,
+            reformed,
+            overdue
           ),
           itemStyle: {
             color: "none",
@@ -260,7 +282,7 @@ export default {
               fontSize: 12,
               formatter: function (param) {
                 if (param.name) {
-                  return `${param.name}(${Math.round(param.value * 100)}%)`;
+                  return `${param.name}(${Math.round(param.data.origin * 100)}%)`;
                 } else {
                   return "";
                 }