web/src/views/modules/basicInfo/ParamData.vue
@@ -3,7 +3,7 @@
    <el-row :gutter="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"/>
          <product-model-tree ref="modelTree" @on-selected="onProductSelected" @on-default="onDefault" showXdy="false" :isShow="false"/>
        </div>
      </el-col>
      <el-col :span="20">
@@ -12,7 +12,8 @@
                           delete-url="/basicInfo/ParamData/"
                           @dataLoaded="dataLoaded"
                           v-slot="{ table }"
                           :paging='false'>
                           :paging='false'
          >
            <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()">
              <el-form-item>
                <zt-dict v-model="dataForm.basicJoinCompute" dict="is_or_not" placeholder="是否参与计算" clearable></zt-dict>
@@ -31,7 +32,7 @@
              <el-form-item>
                <zt-button v-if="dataForm.srcId" type="warning" @click="handleSaveRows">保存</zt-button>
                <zt-button v-if="dataForm.srcId" type="query" @click="table.query()"/>
                <zt-button type="add" v-if="dataForm.productType==='3'" @click="add()"/>
               <!-- <zt-button type="add" v-if="dataForm.productType==='3'" @click="add()"/>-->
                <zt-button v-if="dataForm.srcId" type="delete" @click="table.deleteHandle()"/>
              </el-form-item>
            </el-form>
@@ -39,14 +40,15 @@
              <el-tab-pane label="基本可靠性" name="first">
                <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px"
                          v-adaptive="{bottomOffset:30}"
                          :header-cell-style="{'text-align':'center'}"
                          class="paramsDataTable"
                          @selection-change="table.selectionChangeHandle">
                  <el-table-column type="selection" :key="1" width="40" align="center"/>
                  <el-table-column prop="name" :key="2" label="名称" fixed="left" width="120"/>
                  <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'"
                  <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='4'"
                                   prop="reliabDistribType"
                                   label="可靠性分布类型" :key="27"
                                   width="100">
                                   align="center">
                    <template v-slot="{ row }">
                      <el-select v-if="row.isEdit" v-model="row.reliabDistribType"
                                 placeholder="请选择">
@@ -61,24 +63,25 @@
                                   :hit="hit"/>
                    </template>
                  </el-table-column>
                  <el-table-column v-if="dataForm.productType==='4'" :key="3" prop="baseOperatRatio" label="基本可靠性运行比">
                  <el-table-column v-if="dataForm.productType==='2'" :key="3" prop="baseOperatRatio" label="基本可靠性运行比"
                                   align="right">
                    <template slot-scope="scope">
                      <el-input v-if="scope.row.isEdit" v-model="scope.row.baseOperatRatio"></el-input>
                      <span v-else v-text="scope.row.baseOperatRatio"></span>
                    </template>
                  </el-table-column>
                  <el-table-column v-if="dataForm.productType==='5'||dataForm.productType==='4'" :key="4"
                  <el-table-column v-if="dataForm.productType==='1'||dataForm.productType==='2'" :key="4"
                                   prop="actualRunTime"
                                   label="实际运行时间">
                                   label="实际运行时间" align="right">
                    <template slot-scope="scope">
                      <el-input v-if="scope.row.isEdit" v-model="scope.row.actualRunTime"></el-input>
                      <span v-else v-text="scope.row.actualRunTime"></span>
                    </template>
                  </el-table-column>
                  <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" :key="5"
                  <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='4'" :key="5"
                                   label="基本可靠性计算">
                    <!--                <zt-table-column-dict prop="joinCompute" :keys="6" label="参加计算" width="100" dict="is_or_not"/>-->
                    <el-table-column prop="basicJoinCompute" label="参加计算" :key="6">
                    <el-table-column prop="basicJoinCompute" label="参加计算" :key="6" width="100" align="center">
                      <template v-slot="{ row }">
                        <el-select v-if="row.isEdit" v-model="row.basicJoinCompute"
                                   placeholder="参加计算">
@@ -93,49 +96,49 @@
                                     :typeColor="typeColor" :size="size" :effect="effect" :hit="hit"/>
                      </template>
                    </el-table-column>
                    <el-table-column prop="basicMtbfRegulate" :key="7" label="规定MTBF">
                    <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">
                    <!--<el-table-column prop="basicMtbfAccept" :key="8" label="可接受的MTBF" width="100">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfAccept"></el-input>
                        <span v-else v-text="scope.row.basicMtbfAccept"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="basicMtbfRegulSuccRate" :key="9" label="MTBF规定成功率">
                    </el-table-column>-->
                    <el-table-column prop="basicMtbfRegulSuccRate" :key="9" label="成功率" align="right">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfRegulSuccRate"></el-input>
                        <span v-else v-text="scope.row.basicMtbfRegulSuccRate"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="basicMtbfAcceptSuccRate" :key="10" label="MTBF可接受成功率" width="140">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfAcceptSuccRate"></el-input>
                        <span v-else v-text="scope.row.basicMtbfAcceptSuccRate"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="basicUnitNum" label="单元数量" :key="11" width="100">
                    <!-- <el-table-column prop="basicMtbfAcceptSuccRate" :key="10" label="MTBF可接受成功率" width="120">
                       <template slot-scope="scope">
                         <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfAcceptSuccRate"></el-input>
                         <span v-else v-text="scope.row.basicMtbfAcceptSuccRate"></span>
                       </template>
                     </el-table-column>-->
              <!--      <el-table-column prop="basicUnitNum" label="单元数量" :key="11" width="100" align="center">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.basicUnitNum"></el-input>
                        <span v-else v-text="scope.row.basicUnitNum"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="basicRunsNum" label="运行次数" :key="12" width="100">
                    </el-table-column>-->
                    <el-table-column prop="basicRunsNum" label="运行次数" :key="12" width="100" align="center">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.basicRunsNum"></el-input>
                        <span v-else v-text="scope.row.basicRunsNum"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="basicMtbfOperatingRatio" :key="13" label="MTBF运行比" width="80">
                    <el-table-column prop="basicMtbfOperatingRatio" :key="13" label="运行比" align="right">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfOperatingRatio"></el-input>
                        <span v-else v-text="scope.row.basicMtbfOperatingRatio"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="basicSingleRunTime" :key="14" label="运行时间" width="100">
                    <el-table-column prop="basicSingleRunTime" :key="14" label="运行时间" align="right" width="100">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.basicSingleRunTime"></el-input>
                        <span v-else v-text="scope.row.basicSingleRunTime"></span>
@@ -154,56 +157,64 @@
              </el-tab-pane>
              <el-tab-pane label="任务可靠性" name="second" v-if="dataForm.productType==='3'||dataForm.productType==='2'">
              <el-tab-pane label="任务可靠性" name="second" v-if="dataForm.productType==='3'||dataForm.productType==='4'">
                <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px"
                          v-adaptive="{bottomOffset:30}"
                          class="paramsDataTable"
                          @selection-change="table.selectionChangeHandle">
                          @selection-change="table.selectionChangeHandle"
                          :header-cell-style="{'text-align':'center'}">
                  <el-table-column type="selection" :key="1" width="40" align="center"/>
                  <el-table-column prop="name" :key="2" label="名称" fixed="left" width="120"/>
                  <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" :key="15"
                  <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">
                    <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">
                    <!--<el-table-column prop="taskMtbcfAccept" :key="17" label="可接受的MTBCF" width="100">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfAccept"></el-input>
                        <span v-else v-text="scope.row.taskMtbcfAccept"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="taskMtbcfRegulSuccRate" :key="18" label="MTBCF规定成功率" width="120">
                    </el-table-column>-->
                    <el-table-column prop="taskMtbcfRegulSuccRate" :key="18" label="成功率" align="right">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfRegulSuccRate"></el-input>
                        <span v-else v-text="scope.row.taskMtbcfRegulSuccRate"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="taskMtbcfAcceptSuccRate" :key="19" label="MTBCF可接受成功率" width="140">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfAcceptSuccRate"></el-input>
                        <span v-else v-text="scope.row.taskMtbcfAcceptSuccRate"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="taskMtbcfOperatingRatio" :key="20" label="MTBCF运行比" width="100">
                    <!-- <el-table-column prop="taskMtbcfAcceptSuccRate" :key="19" label="MTBCF可接受成功率" width="100">
                       <template slot-scope="scope">
                         <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfAcceptSuccRate"></el-input>
                         <span v-else v-text="scope.row.taskMtbcfAcceptSuccRate"></span>
                       </template>
                     </el-table-column>-->
                    <el-table-column prop="taskMtbcfOperatingRatio" :key="20" label="运行比" align="right">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfOperatingRatio"></el-input>
                        <span v-else v-text="scope.row.taskMtbcfOperatingRatio"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="taskMtbcfOtherParams" :key="21" label="MTBCF其他参数">
                    <el-table-column prop="taskMtbcfOtherParams2" :key="21" label="其他参数2" align="right">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfOtherParams"></el-input>
                        <span v-else v-text="scope.row.taskMtbcfOtherParams"></span>
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfOtherParams2"></el-input>
                        <span v-else v-text="scope.row.taskMtbcfOtherParams2"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="taskMtbcfOtherParams3" :key="30" label="其他参数3" align="right">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfOtherParams3"></el-input>
                        <span v-else v-text="scope.row.taskMtbcfOtherParams3"></span>
                      </template>
                    </el-table-column>
                  </el-table-column>
                  <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" :key="22" label="维修分布">
                  <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='4'" :key="22" label="维修分布"
                                   align="center">
                    <!--                <zt-table-column-dict prop="repairable" :keys="23" label="可维修" dict="is_or_not"/>-->
                    <el-table-column prop="repairable" label="可维修" :key="23">
                    <el-table-column prop="repairable" label="可维修" :key="23" width="80" align="center">
                      <template v-slot="{ row }">
                        <el-select v-if="row.isEdit" v-model="row.repairable"
                                   placeholder="请选择">
@@ -219,7 +230,7 @@
                      </template>
                    </el-table-column>
                    <!--                <zt-table-column-dict prop="repairDistribType" :keys="24" label="维修分布类型" width="140" dict="RepairDistribType"/>-->
                    <el-table-column prop="repairDistribType" label="维修分布类型" :key="24" width="100">
                    <el-table-column prop="repairDistribType" label="维修分布类型" :key="24" width="130" align="center">
                      <template v-slot="{ row }">
                        <el-select v-if="row.isEdit" v-model="row.repairDistribType"
                                   placeholder="请选择">
@@ -234,16 +245,22 @@
                                     :typeD="typeD" :typeColor="typeColor" :size="size" :effect="effect" :hit="hit"/>
                      </template>
                    </el-table-column>
                    <el-table-column prop="repairMttcr" label="MTTCR" :key="25" width="100">
                    <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="repairMttcrOtherParams" :key="26" label="MTTCR其他参数" width="120">
                    <el-table-column prop="repairMttcrOtherParams2" :key="26" label="其他参数2" align="right">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.repairMttcrOtherParams"></el-input>
                        <span v-else v-text="scope.row.repairMttcrOtherParams"></span>
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.repairMttcrOtherParams2"></el-input>
                        <span v-else v-text="scope.row.repairMttcrOtherParams2"></span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="repairMttcrOtherParams3" :key="27" label="其他参数3" align="right">
                      <template slot-scope="scope">
                        <el-input v-if="scope.row.isEdit" v-model="scope.row.repairMttcrOtherParams3"></el-input>
                        <span v-else v-text="scope.row.repairMttcrOtherParams3"></span>
                      </template>
                    </el-table-column>
                  </el-table-column>
@@ -287,19 +304,21 @@
        effect: '',
        hit: false,
        dataForm: {
          pageCode: this.$route.query.pageCode,
          id: '',
          pid: '',
          srcId: '',
          name: '',
          dataThreeList: null,
          productType: '5',
          productType: '1',
          basicJoinCompute: '',
          repairable: '',
          repairDistribType: '',
          reliabDistribType: ''
        },
        isOrNot: [{
          value: 0,
          label: '否'
        },{
          value: 1,
          label: '是'
        }],
@@ -316,20 +335,31 @@
          {
            value: 1,
            label: '指数分布'
          }, {
          },
          {
            value: 2,
            label: '二项分布'
            label: '威布尔分布'
          },
          {
            value: 3,
            label: '威布尔分布'
          },
            label: '二项分布'
          }
        ],
        // editingCell:null,
        dataList: [],
        originalTableData: [],
        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) {
@@ -354,19 +384,14 @@
      SelectTyModel
    },
    mounted() {
      this.pageCode = this.$route.query.pageCode
      this.dataForm.pageCode = this.$route.query.pageCode
      console.log(this.pageCode, 'this.pageCode this.pageCode')
      this.$refs.modelTree.getProductList()
    },
    methods: {
      handleClick() {
      },
      add() {
        this.$refs.SelectTyModel.$refs.dialog.init(null, {
          type: this.dataForm.productType - 1,
          type: this.dataForm.productType + 1,
          id: this.dataForm.srcId,
          pageCode: this.pageCode
          pageCode: 'expect'
        })
        console.log(this.dataForm.srcId, 'add')
      },
@@ -422,6 +447,14 @@
          this.$refs.tableObj.query()
        })
      },
      onDefault(defaultId) {
        this.dataForm.srcId = defaultId
        this.dataForm.productType = '1'
        this.activeName = 'first'
        this.$nextTick(() => {
          this.$refs.tableObj.query()
        })
      },
      dataLoaded(data) {
        this.dataList = data
        for (let dataList of data) {