<template>
|
<div>
|
<el-row :gutter="5">
|
<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" :isShow="false"/>
|
</div>
|
</el-col>
|
<el-col :span="19">
|
<div class="mod-baseReliability-paramDataBasic fa-card-a" style="margin-left: 5px;">
|
<zt-table-wraper :defaultNotQuery='true' ref="tableObj" query-url="/baseReliability/ParamDataBasic/page"
|
delete-url="/baseReliability/ParamDataBasic"
|
v-slot="{ table }" :paging='false'>
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()">
|
<el-form-item>
|
<!--<zt-button type="query" @click="table.query()"/>
|
<zt-button type="add" perm="baseReliability:add" @click="table.editHandle()"/>
|
<zt-button type="delete" perm="baseReliability:delete" @click="table.deleteHandle()"/>-->
|
<zt-button type="primary" @click="recalculate()">重新计算</zt-button>
|
</el-form-item>
|
</el-form>
|
<el-table v-loading="table.dataLoading" :data="table.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'}"
|
: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="basicUnitNum" label="单元数量" align="center" width="100"/>
|
<el-table-column prop="basicMtbfRegulate" label="MTBF" align="right" width="120">
|
<template slot-scope="scope">
|
<span>{{ keepNumber(scope.row.basicMtbfRegulate) }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="repairMttcr" label="MTTR" align="right" width="120">
|
<template slot-scope="scope">
|
<span>{{ keepNumber(scope.row.repairMttcr) }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="basicMtbfRegulSuccRate" label="成功率" align="right" width="100">
|
<template slot-scope="scope">
|
<span>{{keepNumber(scope.row.basicMtbfRegulSuccRate) }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="basicRunsNum" label="运行次数" align="right" width="100">
|
<template slot-scope="scope">
|
<span>{{scope.row.basicRunsNum}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="basicMtbfOperatingRatio" label="运行比" align="right" width="100">
|
<template slot-scope="scope">
|
<span>{{keepNumber(scope.row.basicMtbfOperatingRatio) }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="ai" label="可用度" align="right" width="100">
|
<template slot-scope="scope">
|
<span>{{keepNumber(scope.row.ai)}}</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
</zt-table-wraper>
|
</div>
|
</el-col>
|
</el-row>
|
</div>
|
</template>
|
<script>
|
import ProductModelTree from "../basicInfo/ProductModelTree";
|
|
export default {
|
data() {
|
return {
|
dataForm: {
|
shipId: '',
|
isRecal: 0,
|
basicMtbfRegulate: '',
|
repairMttcr: '',
|
basicMtbfOperatingRatio: '',
|
ai: '',
|
basicMtbfRegulSuccRate:'',
|
basicRunsNum:''
|
},
|
defultKey: []
|
}
|
},
|
components: {
|
ProductModelTree,
|
},
|
computed: {
|
keepNumber() { //过滤器保留4为小数
|
return function (val) { // 对计算属性进行传参
|
let numM = 0.0
|
if (val){
|
numM = Number(val).toFixed(4);
|
numM.substring(0, numM.length - 1)
|
}
|
return numM;
|
}
|
},
|
},
|
mounted() {
|
this.$refs.modelTree.getProductList()
|
},
|
methods: {
|
onProductSelected(data) {
|
this.defultKey = []
|
this.dataForm.shipId = data.id
|
this.dataForm.productType = data.productType
|
console.log(data, 'onProductSelected(data)')
|
this.$nextTick(() => {
|
this.$refs.tableObj.query()
|
this.setDefultKey()
|
})
|
},
|
setDefultKey() {
|
this.defultKey.push(this.dataForm.shipId + "")
|
},
|
onDefault(defaultId) {
|
this.dataForm.shipId = defaultId
|
this.$nextTick(() => {
|
this.$refs.tableObj.query()
|
this.setDefultKey()
|
})
|
},
|
async recalculate() {
|
this.dataForm.isRecal = 1
|
this.$nextTick(() => {
|
this.$refs.tableObj.query()
|
})
|
},
|
cellStyle({row, column, rowIndex, columnIndex}) {
|
const numM1 = Number(row.repairMttcr).toFixed(5);
|
const numM2 = Number(row.basicMtbfRegulate).toFixed(5);
|
console.log(numM1,numM2,'234')
|
if (numM1.substring(0, numM1.length - 1) === '0.0000' && row.repairMttcr > 0 && column.property ==="repairMttcr") {
|
return 'color : red'
|
} else if (numM2.substring(0, numM1.length - 1) === '0.0000' && row.basicMtbfRegulate > 0 && column.property ==="basicMtbfRegulate") {
|
return 'color : red'
|
}else {
|
return ''
|
}
|
// 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;
|
// }
|
// }
|
// }
|
// });
|
},
|
}
|
}
|
</script>
|