| | |
| | | <template> |
| | | <div> |
| | | <el-row :gutter="10"> |
| | | <el-col :span="6"> |
| | | <div class="fa-card-a"> |
| | | <div class="mod-taskReliability-simulatAssess"> |
| | | <el-form :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="task"> |
| | | <zt-select v-model="dataForm.task" :datas="taskList" @change="onTaskSelected"/> |
| | | </zt-form-item> |
| | | <!-- <zt-form-item label="任务时长" prop="simulatTime"> |
| | | <el-input type="number" :min="1" v-model="dataForm.simulatTime"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </zt-form-item>--> |
| | | <zt-form-item label="数据类型" prop="dataType"> |
| | | <zt-dict v-model="dataForm.dataType" dict="dataType"></zt-dict> |
| | | </zt-form-item> |
| | | <zt-form-item label="是否可修" prop="isRepair"> |
| | | <zt-dict v-model="dataForm.isRepair" dict="is_or_not"></zt-dict> |
| | | </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-button @click="getresult()">分析结果</zt-button> |
| | | </zt-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="fa-card-a"> |
| | | <el-row :gutter="5"> |
| | | <div class="mod-taskReliability-simulatAssess"> |
| | | <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> |
| | | <div> |
| | | <el-col :span="4"> |
| | | <div style="margin-right: 5px;height: calc(88vh - 100px)" 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 style="margin-top: 20px"> |
| | | <div> |
| | | <SimulatCurve ref="SimulatCurve"></SimulatCurve> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="18"> |
| | | <div class="fa-card-a"> |
| | | <SimulatCurve ref="SimulatCurve"></SimulatCurve> |
| | | <SimulatData ref="SimulatData"></SimulatData> |
| | | </div> |
| | | </el-col> |
| | | </div> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import SimulatCurve from "./SimulatCurve"; |
| | | import SimulatData from "./SimulatData"; |
| | | import ProductModelTree from "../basicInfo/ProductModelTree"; |
| | | |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | timers: '', |
| | | isSelect: false, |
| | | isShow: false, |
| | | percentage: 0, |
| | | productList: [], |
| | | taskList: [], |
| | | MTBF: '', |
| | | MTTR: '', |
| | | dataForm: { |
| | | id: '', |
| | | pid: '', |
| | | productId: '', |
| | | task: '', |
| | | dataType: '', |
| | | isRepair: '', |
| | | showProductId: '', |
| | | taskModelId: '', |
| | | dataType: 'fz', |
| | | samplPeriod: '', |
| | | simulatFrequency: '', |
| | | simulatTime:'' |
| | | simulatTime: '' |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getProductList() |
| | | }, |
| | | watch: { |
| | | percentage() { |
| | | if (this.percentage === 100) { |
| | | this.$refs.SimulatCurve.initEcharts(this.dataForm); |
| | | } |
| | | } |
| | | }, |
| | | components: { |
| | | ProductModelTree, |
| | | SimulatCurve, |
| | | SimulatData |
| | | }, |
| | | |
| | | 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.task = data.id |
| | | 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 = { |
| | |
| | | console.log(res.data) |
| | | this.taskList = res.data |
| | | }, |
| | | getresult(){ |
| | | this.$refs.SimulatData.init(); |
| | | 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() { |
| | | /* let res = await this.$http.post('/taskReliability/SimulatAssess/analyze', this.dataForm) |
| | | 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) { |
| | | let stopPolling = false |
| | | if (!stopPolling) { |
| | | let timer = setInterval(async () => { |
| | | let res2 = await this.$http.get(`/taskReliability/SimulatAssess/${res.data}`) |
| | | if (res2.data) { |
| | | if (res2.data.code === '0' || res2.data.errorMsg === '0') { |
| | | stopPolling = true |
| | | // 中止轮询 |
| | | clearInterval(timer) |
| | | alert('已获取')*/ |
| | | this.$refs.SimulatCurve.initEcharts(); |
| | | // 清除定时器 |
| | | /* } else { |
| | | stopPolling = true |
| | | // 中止轮询 |
| | | clearInterval(timer) |
| | | alert('数据有误,重新输入') |
| | | } |
| | | } |
| | | }, 400) |
| | | } |
| | | |
| | | }*/ |
| | | this.timers = window.setInterval(this.getStroke, 1000) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style> |
| | | .mod-taskReliability-simulatAssess { |
| | | height: calc(100vh - 175px); |
| | | } |
| | | |
| | | .mod-taskReliability-simulatAssess .el-form-item__label { |
| | | line-height: calc((100vh - 175px) / 7); |
| | | } |
| | | |
| | | .mod-taskReliability-simulatAssess .el-form-item__content { |
| | | line-height: calc((100vh - 175px) / 7); |
| | | } |
| | | |
| | | .mod-taskReliability-simulatAssess .el-form-item__content > .el-input-group--append { |
| | | vertical-align: baseline; |
| | | } |
| | | |
| | | div.el-col.el-col-17 { |
| | | background: white; |
| | | } |
| | | div.el-select-dropdown.el-popper{ |
| | | /*top: calc((100vh - 155px) / 4) !important;*/ |
| | | } |
| | | </style> |