wente
2024-10-12 7bfdb4f9eba9bd46dc0d3c194078910f7b411e15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<template>
  <div>
    <div class="mod-baseReliability-paramDataBasic fa-card-a" style="margin-left: 5px;">
      <zt-table-wraper :defaultNotQuery='true' ref="tableObj" v-slot="{ table }" :paging='false'>
        <el-form :inline="true" :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="80px">
          <zt-form-item label="产品节点" prop="productId">
            <zt-select v-model="dataForm.productId" :datas="productList" @change="onProductSelected"/>
          </zt-form-item>
          <zt-form-item label="试验方案" prop="taskModelId">
            <zt-select v-model="dataForm.taskModelId" :datas="taskList" @change="onTaskSelected"/>
          </zt-form-item>
          <zt-form-item label="仿真记录" prop="simulatHis">
            <zt-select v-model="dataForm.fzId" :datas="simulatList" @change="onSimulatSelected"/>
          </zt-form-item>
        </el-form>
        <el-table v-loading="table.dataLoading" :data="dataList" height="100px" v-adaptive="{bottomOffset:70}"
                  row-key="id"
                  :expand-row-keys="defultKey"
                  :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
                  :header-cell-style="{'text-align':'center'}"
                  :row-style="rowStyle"
                  border @selection-change="table.selectionChangeHandle">
          <el-table-column prop="name" label="名称"/>
          <el-table-column prop="mtbf" label="MTTF(任务可靠性)" align="right">
            <template slot-scope="scope">
              <span>{{  keepNumber(scope.row.mtbf) }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="mttr" label="MTTR(任务可靠性)" align="right">
            <template slot-scope="scope">
              <span>{{  keepNumber(scope.row.mttr) }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="msr" label="任务成功度" align="right">
            <template slot-scope="scope">
              <span>{{keepNumber(scope.row.msr) }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="timeRate" label="任务时间比" align="right">
            <template slot-scope="scope">
              <span>{{  keepNumber(scope.row.timeRate) }}</span>
            </template>
          </el-table-column>
        </el-table>
      </zt-table-wraper>
    </div>
  </div>
</template>
<script>
 
  export default {
    data() {
      return {
        productList: [],
        simulatList: [],
        dataList: [],
        taskList: [],
        dataForm: {
          name: '',
          fzId: '',
          shipId: '',
          mtbf: '',
          mttr: '',
          msr: '',
          timeRate: ''
        },
        defultKey: []
      }
    },
    computed: {
      keepNumber() { //过滤器保留4为小数
        return function (val) {        // 对计算属性进行传参
          const numM = Number(val).toFixed(5);
          return numM.substring(0, numM.length - 1);
        }
      },
    },
    mounted() {
      this.getProductList()
    },
    methods: {
      async getProductList() {
        let res = await this.$http.get('/basicInfo/XhProductModel/getTaskProductList')
        this.productList = res.data
        this.onProductSelected(this.productList[0])
      },
      async getTaskList() {
        let params = {
          productId: this.dataForm.productId
        }
        let res = await this.$http.get('/taskReliability/Task/getTaskList', {params: params})
        console.log(res.data)
        this.taskList = res.data
        this.onTaskSelected(this.taskList[0])
      },
      async getSimulatList() {
        let params = {
          productId: this.dataForm.productId,
          taskModelId: this.dataForm.taskModelId
        }
        let res = await this.$http.get('/taskReliability/SimulatAssess/getSimulatList', {params: params})
        console.log(res.data)
        this.simulatList = res.data
        this.$nextTick(() => {
          this.onSimulatSelected(this.simulatList[0])
        })
      },
      // 获取信息
      onProductSelected(data) {
        this.isSelect = true
        console.log(data, ' onProductSelected(data)')
        this.dataForm.productId = data.id
        this.getTaskList()
        this.dataForm.taskModelId = ''
      },
      onTaskSelected(data) {
        console.log(data, ' onProductSelected(data)')
        this.dataForm.taskModelId = data.id
        this.getSimulatList()
        this.dataForm.fzId = ''
      },
      setDefultKey() {
        this.defultKey.push(this.dataForm.productId + "")
      },
      async onSimulatSelected(data) {
        this.dataForm.fzId = data.id
        this.dataForm.samplPeriod = data.samplPeriod
        let params = {
          fzId: this.dataForm.fzId,
          taskId:this.dataForm.taskModelId,
          productId:this.dataForm.productId
        }
        let res = await this.$http.get('/taskReliability/SimulatAssess/ReliabilityWeakness', {params: params})
        this.dataList = res.data
        this.setDefultKey()
        console.log(this.dataList)
      },
      rowStyle({row,rowIndex}) {
        console.log(row)
        if (row.isWeak===1){
          console.log(row.isWeak,"console.log(row)")
          return {color: 'red'}
        }
      },
    }
  }
</script>