| | |
| | | <template> |
| | | <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 :isShow="false"></product-model-tree> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="20"> |
| | | <div style="margin-top: 20px"> |
| | | <div style="margin-left: 400px" v-if="isShow"> |
| | | <el-tag type="info" effect="dark" style="font-size: 20px">MTBF:{{MTBF}}</el-tag> |
| | | <el-tag type="info" effect="dark" style="margin-left: 50px;font-size: 20px">MTTR:{{MTTR}}</el-tag> |
| | | </div> |
| | | <div> |
| | | <SimulatCurve ref="SimulatCurve"></SimulatCurve> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | <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" |
| | | style="width: 150px;vertical-align: baseline;"> |
| | | <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" |
| | | style="width: 150px;vertical-align: baseline;"> |
| | | <template slot="append">次数</template> |
| | | </el-input> |
| | | </zt-form-item> |
| | | <el-form-item prop="repairDiracFlag" label-width="150px" style="margin-left: 20px"> |
| | | <el-checkbox v-model="dataForm.repairDiracFlag">可修设备可靠度为1</el-checkbox> |
| | | </el-form-item> |
| | | <zt-form-item style="margin-left: 10px"> |
| | | <zt-button @click="analyze()">仿真分析</zt-button> |
| | | <zt-button @click="displayProcess()">算法库进程</zt-button> |
| | | <el-dropdown style="margin-left: 10px" @command="download"> |
| | | <el-button type="primary"> |
| | | 下载xml<i class="el-icon-arrow-down el-icon--right"></i> |
| | | </el-button> |
| | | <el-dropdown-menu slot="dropdown"> |
| | | <el-dropdown-item command="1">输入xml</el-dropdown-item> |
| | | <el-dropdown-item command="2">输出xml</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | </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> |
| | | </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> |
| | | <el-dialog v-dialogDrag :close-on-click-modal="false" top="8vh" :visible.sync="dialogVisible" title="模型检查" |
| | | width="60%" @close="dialogVisible = false"> |
| | | <el-tag type="danger" style="margin-bottom: 10px">模型定义/参数配置里存在以下问题:</el-tag> |
| | | <el-table :data="modelCheckResult" height="350" |
| | | :header-cell-style="{'text-align':'center'}"> |
| | | <el-table-column prop="category" label="检查结果" align="center" width="150"/> |
| | | <el-table-column prop="taskName" label="任务名称" align="center"/> |
| | | <el-table-column prop="taskPhaseName" label="任务阶段名称" align="center"/> |
| | | <el-table-column prop="gkName" label="工况名称" align="center"/> |
| | | <el-table-column prop="nodeName" label="节点名称" align="center"/> |
| | | <el-table-column prop="modelName" label="模型名称" align="center"/> |
| | | <el-table-column prop="deviceName" label="设备名称" align="center"/> |
| | | <el-table-column prop="paramName" label="参数名称" align="center"/> |
| | | </el-table> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="dialogVisible = false">关 闭</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <Process ref="process"></Process> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import SimulatCurve from "./SimulatCurve"; |
| | | import SimulatData from "./SimulatData"; |
| | | import ProductModelTree from "../basicInfo/ProductModelTree"; |
| | | import Process from "./Process"; |
| | | import qs from "qs"; |
| | | import Cookies from "js-cookie"; |
| | | |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | timers: '', |
| | | timers: null, |
| | | isSelect: false, |
| | | isShow: false, |
| | | percentage: 0, |
| | |
| | | id: '', |
| | | pid: '', |
| | | productId: '', |
| | | showProductId: '', |
| | | taskModelId: '', |
| | | dataType: '', |
| | | isRepair: '', |
| | | samplPeriod: '', |
| | | simulatFrequency: '', |
| | | simulatTime: '' |
| | | } |
| | | dataType: 'fz', |
| | | samplPeriod: '10', |
| | | simulatFrequency: 500, |
| | | simulatTime: '', |
| | | repairDiracFlag: false |
| | | }, |
| | | dialogVisible: false, |
| | | modelCheckResult: [], |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getProductList() |
| | | }, |
| | | watch: { |
| | | percentage() { |
| | | if (this.percentage === 100) { |
| | | this.$refs.SimulatCurve.initEcharts(this.dataForm.id,this.dataForm.taskModelId, this.dataForm.samplPeriod); |
| | | } |
| | | } |
| | | // percentage() { |
| | | // if (this.percentage === 100) { |
| | | // this.$refs.SimulatCurve.initEcharts(this.dataForm); |
| | | // } |
| | | // } |
| | | }, |
| | | components: { |
| | | ProductModelTree, |
| | | SimulatCurve, |
| | | SimulatData |
| | | Process, |
| | | }, |
| | | |
| | | 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.dataForm.taskModelId = '' |
| | | this.$nextTick(() => { |
| | | this.$refs.ProductModelTree.getProductList() |
| | | }) |
| | | }, |
| | | onTaskSelected(data) { |
| | | console.log(data, ' onProductSelected(data)') |
| | |
| | | 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 |
| | | }, |
| | | 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) |
| | | } |
| | | async getStroke() { |
| | | let param = { |
| | | taskList: [this.dataForm.id] |
| | | } |
| | | let res = await this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress`, {params: param}) |
| | | if (res.success) { |
| | | if (res.data) { |
| | | this.percentage = parseFloat(res.data) |
| | | if (this.percentage >= 100) { |
| | | clearInterval(this.timers) |
| | | this.percentage = 0 |
| | | this.$refs.SimulatCurve.initEcharts(this.dataForm); |
| | | } |
| | | ) |
| | | } |
| | | } else { |
| | | clearInterval(this.timers) |
| | | this.percentage = 0 |
| | | } |
| | | }, |
| | | async analyze() { |
| | | this.dialogVisible = false |
| | | this.modelCheckResult = [] |
| | | this.isShow = true |
| | | let result = await this.$http.get(`/basicInfo/TyProductModel/getUuid`) |
| | | this.dataForm.id = result.data |
| | | this.percentage = 0 |
| | | let res = await this.$http.post('/taskReliability/SimulatAssess/analyze', this.dataForm) |
| | | if (res.success) { |
| | | this.timers = window.setInterval(this.getStroke, 1000) |
| | | console.log(res.data, 'res.data') |
| | | if (res.data && res.data.length > 0) { |
| | | this.modelCheckResult = res.data |
| | | this.dialogVisible = true |
| | | } else { |
| | | this.timers = window.setInterval(this.getStroke, 1000) |
| | | } |
| | | } |
| | | }, |
| | | async download(selsect) { |
| | | if(this.dataForm.id){ |
| | | let param = qs.stringify({ |
| | | 'token': Cookies.get('token'), |
| | | type: 'fz', |
| | | xml:selsect, |
| | | id: this.dataForm.id |
| | | }) |
| | | let apiURL = `/taskReliability/SimulatAssess/downloadXml` |
| | | window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${param}` |
| | | }else{ |
| | | this.$alert('还未进行仿真操作') |
| | | } |
| | | |
| | | }, |
| | | displayProcess() { |
| | | this.$refs.process.$refs.dialog.init() |
| | | } |
| | | } |
| | | } |