yijianjun 1 month ago
parent
commit
7545711fe1
1 changed files with 65 additions and 29 deletions
  1. 65 29
      src/views/distributionnetwork/quantity-of-work/index.vue

+ 65 - 29
src/views/distributionnetwork/quantity-of-work/index.vue

@@ -187,10 +187,9 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span
-                :class="{ isRed: scope.row.lineCableNewAccuQtWork == null }"
-                >{{ scope.row.lineCableNewAccuQt }}</span
-              ></template
+              <span :class="{ isRed: isRed(scope.row, 1) }">{{
+                scope.row.lineCableNewAccuQt
+              }}</span></template
             >
           </el-table-column>
 
@@ -209,7 +208,7 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span :class="{ isRed: scope.row.lineCableNewAccuQt == null }">{{
+              <span :class="{ isRed: isRed(scope.row, 1) }">{{
                 scope.row.lineCableNewAccuQtWork
               }}</span></template
             >
@@ -241,10 +240,9 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span
-                :class="{ isRed: scope.row.lineOverhdNewAccuQtWork == null }"
-                >{{ scope.row.lineOverhdNewAccuQt }}</span
-              ></template
+              <span :class="{ isRed: isRed(scope.row, 2) }">{{
+                scope.row.lineOverhdNewAccuQt
+              }}</span></template
             >
           </el-table-column>
 
@@ -263,7 +261,7 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span :class="{ isRed: scope.row.lineOverhdNewAccuQt == null }">{{
+              <span :class="{ isRed: isRed(scope.row, 2) }">{{
                 scope.row.lineOverhdNewAccuQtWork
               }}</span></template
             >
@@ -294,10 +292,9 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span
-                :class="{ isRed: scope.row.distTransNewAccuQtWork == null }"
-                >{{ scope.row.distTransNewAccuQt }}</span
-              ></template
+              <span :class="{ isRed: isRed(scope.row, 3) }">{{
+                scope.row.distTransNewAccuQt
+              }}</span></template
             >
           </el-table-column>
 
@@ -316,7 +313,7 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span :class="{ isRed: scope.row.distTransNewAccuQt == null }">{{
+              <span :class="{ isRed: isRed(scope.row, 3) }">{{
                 scope.row.distTransNewAccuQtWork
               }}</span></template
             >
@@ -348,10 +345,9 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span
-                :class="{ isRed: scope.row.lowVoltLineAccuQtWork == null }"
-                >{{ scope.row.lowVoltLineAccuQt }}</span
-              ></template
+              <span :class="{ isRed: isRed(scope.row, 4) }">{{
+                scope.row.lowVoltLineAccuQt
+              }}</span></template
             >
           </el-table-column>
 
@@ -369,7 +365,7 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span :class="{ isRed: scope.row.lowVoltLineAccuQt == null }">{{
+              <span :class="{ isRed: isRed(scope.row, 4) }">{{
                 scope.row.lowVoltLineAccuQtWork
               }}</span></template
             >
@@ -401,7 +397,7 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span :class="{ isRed: scope.row.towerAccuQtWork == null }">{{
+              <span :class="{ isRed: isRed(scope.row, 5) }">{{
                 scope.row.towerAccuQt
               }}</span></template
             >
@@ -422,7 +418,7 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span :class="{ isRed: scope.row.towerAccuQt == null }">{{
+              <span :class="{ isRed: isRed(scope.row, 5) }">{{
                 scope.row.towerAccuQtWork
               }}</span></template
             >
@@ -453,10 +449,9 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span
-                :class="{ isRed: scope.row.ringCabinetAccuQtWork == null }"
-                >{{ scope.row.ringCabinetAccuQt }}</span
-              ></template
+              <span :class="{ isRed: isRed(scope.row, 6) }">{{
+                scope.row.ringCabinetAccuQt
+              }}</span></template
             >
           </el-table-column>
 
@@ -475,7 +470,7 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span :class="{ isRed: scope.row.ringCabinetAccuQt == null }">{{
+              <span :class="{ isRed: isRed(scope.row, 6) }">{{
                 scope.row.ringCabinetAccuQtWork
               }}</span></template
             >
@@ -506,7 +501,7 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span :class="{ isRed: scope.row.poleTabAccuQtWork == null }">{{
+              <span :class="{ isRed: isRed(scope.row, 7) }">{{
                 scope.row.poleTabAccuQt
               }}</span></template
             >
@@ -527,7 +522,7 @@
             :show-overflow-tooltip="true"
           >
             <template scope="scope">
-              <span :class="{ isRed: scope.row.poleTabAccuQt == null }">{{
+              <span :class="{ isRed: isRed(scope.row, 7) }">{{
                 scope.row.poleTabAccuQtWork
               }}</span></template
             >
@@ -642,6 +637,47 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
+    isRed(row, type) {
+      switch (type) {
+        case 1:
+          if (!row.lineCableNewAccuQt && !row.lineCableNewAccuQtWork) {
+            return false;
+          }
+          return !row.lineCableNewAccuQt || !row.lineCableNewAccuQtWork;
+        case 2:
+          if (!row.lineOverhdNewAccuQt && !row.lineOverhdNewAccuQtWork) {
+            return false;
+          }
+          return !row.lineOverhdNewAccuQt || !row.lineOverhdNewAccuQtWork;
+        case 3:
+          if (!row.distTransNewAccuQt && !row.distTransNewAccuQtWork) {
+            return false;
+          }
+          return !row.distTransNewAccuQt || !row.distTransNewAccuQtWork;
+        case 4:
+          if (!row.lowVoltLineAccuQt && !row.lowVoltLineAccuQtWork) {
+            return false;
+          }
+          return !row.lowVoltLineAccuQt || !row.lowVoltLineAccuQtWork;
+        case 5:
+          if (!row.towerAccuQt && !row.towerAccuQtWork) {
+            return false;
+          }
+          return !row.towerAccuQt || !row.towerAccuQtWork;
+        case 6:
+          if (!row.ringCabinetAccuQt && !row.ringCabinetAccuQtWork) {
+            return false;
+          }
+          return !row.ringCabinetAccuQt || !row.ringCabinetAccuQtWork;
+        case 7:
+          if (!row.poleTabAccuQt && !row.poleTabAccuQtWork) {
+            return false;
+          }
+          return !row.poleTabAccuQt || !row.poleTabAccuQtWork;
+        default:
+          return false;
+      }
+    },
     tableRowClassName({ row }) {
       if (row.excType == 1) {
         return "highlight-row";