瀏覽代碼

修改--专业报告对比

plg 4 月之前
父節點
當前提交
04b8cf1e29
共有 1 個文件被更改,包括 19 次插入13 次删除
  1. 19 13
      src/components/ComparePlanProfession.vue

+ 19 - 13
src/components/ComparePlanProfession.vue

@@ -213,12 +213,12 @@
             ></td>
           </tr>
           <tr>
-            <td class="first">健康异常人数</td>
+            <td class="first">心理异常人数</td>
             <td>{{ unHealthNum1 }}</td>
             <td>{{ unHealthNum2 }}</td>
           </tr>
           <tr>
-            <td class="first">健康异常占比</td>
+            <td class="first">心理异常占比</td>
             <td :class="{ warn: isRed(5, 1) }">{{ getUnHealthRate(1) }}</td>
             <td :class="{ warn: isRed(5, 2) }">{{ getUnHealthRate(2) }}</td>
           </tr>
@@ -425,7 +425,7 @@ export default {
     },
     //计划下---组织改变--触发的方法
     orgChangeOne(val) {
-    console.log(val)
+      console.log(val);
       //设置该处选择的对象
       //设置当前选择的对象
       //获取val 为ID
@@ -452,7 +452,6 @@ export default {
       //设置的话触发一次对比
     },
     orgChangeTwo(val) {
-
       let list1 = [];
       list1 = this.organizationsList.filter((item) => {
         return item.id == val;
@@ -636,10 +635,10 @@ export default {
     },
     compareHandle() {
       if (this.firstParams == 1) {
-        this.options.dataset.source[0][1] = this.compareOptionsOrg1.orgName+' ';
+        this.options.dataset.source[0][1] = this.compareOptionsOrg1.orgName + " ";
         this.options.dataset.source[0][2] = this.compareOptionsOrg2.orgName;
       } else {
-        this.options.dataset.source[0][1] = this.compareOptionsPlan1.planName+' ';
+        this.options.dataset.source[0][1] = this.compareOptionsPlan1.planName + " ";
         this.options.dataset.source[0][2] = this.compareOptionsPlan2.planName;
       }
       if (this.firstParams == 1) {
@@ -700,17 +699,24 @@ export default {
 
     // 健康异常占比计算
     getUnHealthRate(i) {
-      let rate = parseInt(
-        (this[`unHealthNum${i}`] / (this[`unComplete${i}`] + this[`completeNum${i}`])) *
-          100
-      );
-      return rate > 0 ? `${rate}%` : rate;
+      let rate =
+        this[`unComplete${i}`] + this[`completeNum${i}`] == 0
+          ? 0
+          : parseInt(
+              (this[`unHealthNum${i}`] /
+                (this[`unComplete${i}`] + this[`completeNum${i}`])) *
+                100
+            );
+      return rate > 0 ? `${rate}%` :  `${rate}%`;
     },
 
     // 其他占比计算
     getOtherRate(name, i, m) {
       let tempNum = this[`dimensionList${i}`][m][name];
-      let rate = parseInt((tempNum / this[`completeNum${i}`]) * 100);
+      let rate =
+        this[`completeNum${i}`] == 0
+          ? 0
+          : parseInt((tempNum / this[`completeNum${i}`]) * 100);
       // if (rate > 0 && rate <= 50) {
       //   rate = `<span>${rate}%</span>`
       // } else if (rate > 50 && rate <= 75) {
@@ -718,7 +724,7 @@ export default {
       // } else if (rate > 75) {
       //   rate = `<span style='color: red'>${rate}%</span>`
       // }
-      return rate > 0 ? `${rate}%` : rate;
+      return rate > 0 ? `${rate}%` : `${rate}%`;
     },
   },
 };