|  |  | 
 |  |  |       <el-col :span="5"> | 
 |  |  |         <div class="fa-card-a" style="margin-right: 5px;height: calc(100vh - 123px)"> | 
 |  |  |           <product-model-tree ref="modelTree" @on-selected="onProductSelected" @on-default="onDefault" showXdy="false" | 
 |  |  |                               basic="3"/> | 
 |  |  |                               basic="3" :isShow="false"/> | 
 |  |  |         </div> | 
 |  |  |       </el-col> | 
 |  |  |       <el-col :span="19"> | 
 |  |  | 
 |  |  |                       row-key="id" | 
 |  |  |                       :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> | 
 |  |  | 
 |  |  |     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: { | 
 |  |  | 
 |  |  |         }) | 
 |  |  |       }, | 
 |  |  |       setDefultKey() { | 
 |  |  |         console.log(this.$refs.tableObj.dataList[0].id,'this.$refs.tableObj.dataList[0].id') | 
 |  |  |         this.defultKey.push(this.dataForm.shipId + "") | 
 |  |  |       }, | 
 |  |  |       onDefault(defaultId) { | 
 |  |  | 
 |  |  |           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> |