jinlin
2024-07-19 1d201842264ce4065af198f69d44f3a8c56912ee
修改
3个文件已修改
75 ■■■■ 已修改文件
web/src/views/modules/baseReliability/ParamDataBasic.vue 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/basicInfo/ParamData.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/OperatCondit.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
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')
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>