From 1d201842264ce4065af198f69d44f3a8c56912ee Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期五, 19 七月 2024 10:59:24 +0800
Subject: [PATCH] 修改

---
 web/src/views/modules/baseReliability/ParamDataBasic.vue |   49 +++++++++++++++++-------
 web/src/views/modules/taskReliability/OperatCondit.vue   |    2 
 web/src/views/modules/basicInfo/ParamData.vue            |   24 ++++++++---
 3 files changed, 53 insertions(+), 22 deletions(-)

diff --git a/web/src/views/modules/baseReliability/ParamDataBasic.vue b/web/src/views/modules/baseReliability/ParamDataBasic.vue
index 1d74d4f..cab88f5 100644
--- a/web/src/views/modules/baseReliability/ParamDataBasic.vue
+++ b/web/src/views/modules/baseReliability/ParamDataBasic.vue
@@ -25,27 +25,28 @@
                       :expand-row-keys="defultKey"
                       :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
                       :header-cell-style="{'text-align':'center'}"
+                      :cell-style="cellStyle"
                       border @selection-change="table.selectionChangeHandle">
               <!--<el-table-column type="selection" width="40"/>-->
               <el-table-column prop="name" label="鍚嶇О"/>
               <el-table-column prop="basicMtbfRegulate" label="MTBF" align="right">
                 <template slot-scope="scope">
-                  <span>{{ scope.row.basicMtbfRegulate | keepNumber }}</span>
+                  <span>{{  keepNumber(scope.row.basicMtbfRegulate) }}</span>
                 </template>
               </el-table-column>
               <el-table-column prop="repairMttcr" label="MTTR" align="right">
                 <template slot-scope="scope">
-                  <span>{{ scope.row.repairMttcr | keepNumber }}</span>
+                  <span>{{  keepNumber(scope.row.repairMttcr) }}</span>
                 </template>
               </el-table-column>
               <el-table-column prop="basicMtbfOperatingRatio" label="杩愯姣�" align="right">
                 <template slot-scope="scope">
-                  <span>{{ scope.row.basicMtbfOperatingRatio | keepNumber }}</span>
+                  <span>{{keepNumber(scope.row.basicMtbfOperatingRatio) }}</span>
                 </template>
               </el-table-column>
               <el-table-column prop="ai" label="鍙敤搴�" align="right">
                 <template slot-scope="scope">
-                  <span>{{ scope.row.ai | keepNumber }}</span>
+                  <span>{{keepNumber(scope.row.ai)}}</span>
                 </template>
               </el-table-column>
             </el-table>
@@ -75,17 +76,12 @@
     components: {
       ProductModelTree,
     },
-    filters: {
-      keepNumber(value) { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
-        const numM = Number(value).toFixed(5);
-        if (numM === "NaN") {
-          return "0.0000";
+    computed: {
+      keepNumber() { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
+        return function (val) {		// 瀵硅绠楀睘鎬ц繘琛屼紶鍙�
+          const numM = Number(val).toFixed(5);
+          return numM.substring(0, numM.length - 1);
         }
-        if (numM === '0.0000' && value > 0) {
-
-        }
-        const realVal = numM.substring(0, numM.length - 1);
-        return realVal;
       },
     },
     methods: {
@@ -115,6 +111,31 @@
           this.$refs.tableObj.query()
         })
       },
+      cellStyle({row, column, rowIndex, columnIndex}) {
+        let warningColor = false;
+        //   console.log(row, column, rowIndex, columnIndex);
+        //console.log(row, "row");
+        Object.keys(row).forEach((key, index) => {
+          //閬嶅巻姣忚涓瘡涓暟鎹殑state
+          if (key === "repairMttcr" || key === "basicMtbfRegulate") {
+            //console.log(key, "row key");
+            let val = row[key]
+            const numM = Number(val).toFixed(5);
+            if (numM.substring(0, numM.length - 1) === '0.0000' && val > 0) {
+              //瀹氫綅璇ユ暟鎹殑鍧愭爣
+              if (columnIndex === 2) {
+                warningColor = true;
+              }
+            }
+          }
+        });
+
+        if (warningColor) {
+          // red涓烘兂鍙樻垚鐨勫崟鍏冩牸鏍峰紡
+          return 'color : red'
+        }
+        return "";
+      },
     }
   }
 </script>
diff --git a/web/src/views/modules/basicInfo/ParamData.vue b/web/src/views/modules/basicInfo/ParamData.vue
index 90f1f30..4bba40e 100644
--- a/web/src/views/modules/basicInfo/ParamData.vue
+++ b/web/src/views/modules/basicInfo/ParamData.vue
@@ -1,12 +1,12 @@
 <template>
   <div>
     <el-row :gutter="5">
-      <el-col :span="5">
+      <el-col :span="4">
         <div class="fa-card-a" style="margin-right: 5px;height: calc(100vh - 123px)">
           <product-model-tree @on-selected="onProductSelected" showXdy="false" :isShow="false"/>
         </div>
       </el-col>
-      <el-col :span="19">
+      <el-col :span="20">
         <div class="mod-basicInfo-paramData fa-card-a" style="margin-left: 5px;">
           <zt-table-wraper ref="tableObj" defaultNotQuery="true" query-url="/basicInfo/ParamData/page"
                            delete-url="/basicInfo/ParamData/"
@@ -95,10 +95,10 @@
                                      :typeColor="typeColor" :size="size" :effect="effect" :hit="hit"/>
                       </template>
                     </el-table-column>
-                    <el-table-column prop="basicMtbfRegulate" :key="7" label="MTBF" align="right" width="100">
+                    <el-table-column prop="basicMtbfRegulate" :key="7" label="MTBF" align="right" width="110">
                       <template slot-scope="scope">
                         <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfRegulate"></el-input>
-                        <span v-else v-text="scope.row.basicMtbfRegulate"></span>
+                        <span v-else >{{scope.row.basicMtbfRegulate | keepNumber}}</span>
                       </template>
                     </el-table-column>
                     <!--<el-table-column prop="basicMtbfAccept" :key="8" label="鍙帴鍙楃殑MTBF" width="100">
@@ -167,10 +167,10 @@
 
                   <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='4'" :key="15"
                                    label="浠诲姟鍙潬鎬ц绠�">
-                    <el-table-column prop="taskMtbcfRegulate" :key="16" label="MTBCF" width="100" align="right">
+                    <el-table-column prop="taskMtbcfRegulate" :key="16" label="MTBCF" width="110" align="right">
                       <template slot-scope="scope">
                         <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfRegulate"></el-input>
-                        <span v-else v-text="scope.row.taskMtbcfRegulate"></span>
+                        <span v-else>{{scope.row.taskMtbcfRegulate | keepNumber}}</span>
                       </template>
                     </el-table-column>
                     <!--<el-table-column prop="taskMtbcfAccept" :key="17" label="鍙帴鍙楃殑MTBCF" width="100">
@@ -246,7 +246,7 @@
                     <el-table-column prop="repairMttcr" label="MTTCR" :key="25" width="100" align="right">
                       <template slot-scope="scope">
                         <el-input v-if="scope.row.isEdit" v-model="scope.row.repairMttcr"></el-input>
-                        <span v-else v-text="scope.row.repairMttcr"></span>
+                        <span v-else >{{scope.row.repairMttcr | keepNumber}}</span>
                       </template>
                     </el-table-column>
                     <el-table-column prop="repairMttcrOtherParams2" :key="26" label="MTTCR鍏朵粬鍙傛暟2" align="right">
@@ -346,6 +346,16 @@
         originalData: null, // 璁板綍淇敼鍓嶇殑鏁版嵁
       }
     },
+    filters: {
+      keepNumber(value) { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
+        const numM = Number(value).toFixed(5);
+        if (numM === "NaN") {
+          return "0.0000";
+        }
+        const realVal = numM.substring(0, numM.length - 1);
+        return realVal;
+      },
+    },
     // 鍦ㄧ粍浠朵腑瀹氫箟 beforeRouteLeave 瀵艰埅瀹堝崼
     beforeRouteLeave(to, from, next) {
       console.log(this.$store.state.contentTabs, 'this.$store.state.contentTabsActiveName')
diff --git a/web/src/views/modules/taskReliability/OperatCondit.vue b/web/src/views/modules/taskReliability/OperatCondit.vue
index 9004898..a55d99a 100644
--- a/web/src/views/modules/taskReliability/OperatCondit.vue
+++ b/web/src/views/modules/taskReliability/OperatCondit.vue
@@ -9,7 +9,7 @@
                          @change="onProductSelected"/>
             </div>
             <zt-table-wraper ref="tableObj" query-url="/taskReliability/OperatCondit/page" defaultNotQuery="true"
-                             delete-url="/taskReliability/OperatCondit"
+                             delete-url="/taskReliability/OperatCondit/"
                              v-slot="{ table }" :paging='false'>
               <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()">
                 <el-form-item>

--
Gitblit v1.9.1