<template>
|
<div class="fa-card-a">
|
<el-row :gutter="5">
|
<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="samplPeriod">
|
<el-input type="number" :min="1" v-model="dataForm.samplPeriod">
|
<template slot="append">分钟</template>
|
</el-input>
|
</zt-form-item>
|
<zt-form-item label="仿真次数" prop="simulatFrequency">
|
<el-input type="number" :min="1" v-model="dataForm.simulatFrequency">
|
<template slot="append">次数</template>
|
</el-input>
|
</zt-form-item>
|
<zt-form-item>
|
<zt-button @click="analyze()">仿真分析</zt-button>
|
</zt-form-item>
|
</el-form>
|
<el-progress v-if="isShow" :percentage="percentage"></el-progress>
|
<el-col :span="4">
|
<div style="margin-right: 5px;height: calc(100vh - 230px)" v-if="isSelect">
|
<product-model-tree @on-selected="onTreeSelected" showXdy="false"
|
ref="ProductModelTree" :isShow="false" basic="4" :productId="dataForm.productId"/>
|
</div>
|
</el-col>
|
<el-col :span="20">
|
<div class="fa-card-a" style="height: calc(100vh - 230px)">
|
<SimulatCurve ref="SimulatCurve"></SimulatCurve>
|
</div>
|
</el-col>
|
</el-row>
|
</div>
|
</template>
|
|
<script>
|
import SimulatCurve from "./SimulatCurve";
|
import ProductModelTree from "../basicInfo/ProductModelTree";
|
|
|
export default {
|
data() {
|
return {
|
timers: '',
|
isSelect: false,
|
isShow: false,
|
percentage: 0,
|
productList: [],
|
taskList: [],
|
MTBF: '',
|
MTTR: '',
|
dataForm: {
|
id: '',
|
pid: '',
|
productId: '',
|
showProductId: '',
|
taskModelId: '',
|
dataType: 'fz',
|
samplPeriod: '10',
|
simulatFrequency: 500,
|
simulatTime: ''
|
}
|
}
|
},
|
mounted() {
|
this.getProductList()
|
},
|
watch: {
|
percentage() {
|
if (this.percentage === 100) {
|
this.$refs.SimulatCurve.initEcharts(this.dataForm);
|
}
|
}
|
},
|
components: {
|
ProductModelTree,
|
SimulatCurve,
|
},
|
|
methods: {
|
onTreeSelected(data) {
|
if (this.dataForm.id){
|
console.log(data, 'onProductSelected')
|
this.dataForm.showProductId = data.id
|
this.$refs.SimulatCurve.getProductEcharts(this.dataForm);
|
}
|
},
|
// 获取信息
|
onProductSelected(data) {
|
this.isSelect = true
|
console.log(data, ' onProductSelected(data)')
|
this.dataForm.productId = data.id
|
this.getTaskList()
|
this.$nextTick(() => {
|
this.$refs.ProductModelTree.getProductList()
|
})
|
},
|
onTaskSelected(data) {
|
console.log(data, ' onProductSelected(data)')
|
this.dataForm.taskModelId = data.id
|
},
|
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
|
},
|
getStroke() {
|
//console.log('getStroke:',this.progress.start,",",this.progress.speed)
|
if (this.percentage < 100) {
|
//console.log('getStroke2')
|
this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress?taskId=${this.dataForm.id}`).then(
|
res => {
|
// console.log(res.data, 'res.data')
|
if (res.data) {
|
this.percentage = parseFloat(res.data)
|
}
|
}
|
)
|
} else {
|
clearInterval(this.timers)
|
this.percentage = 0
|
}
|
},
|
async analyze() {
|
this.isShow = true
|
let result = await this.$http.get(`/basicInfo/TyProductModel/getUuid`)
|
this.dataForm.id = result.data
|
let res = await this.$http.post('/taskReliability/SimulatAssess/analyze', this.dataForm)
|
if (res.success) {
|
this.timers = window.setInterval(this.getStroke, 1000)
|
}
|
}
|
}
|
}
|
</script>
|
<style>
|
|
</style>
|