|  |  |  | 
|---|
|  |  |  | <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"> | 
|---|
|  |  |  | <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"> | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | </el-col> | 
|---|
|  |  |  | <el-col :span="20"> | 
|---|
|  |  |  | <div  class="fa-card-a" style="height: calc(100vh - 230px)"> | 
|---|
|  |  |  | <SimulatCurve ref="SimulatCurve"></SimulatCurve> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </el-col> | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | <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 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, | 
|---|
|  |  |  | 
|---|
|  |  |  | dataType: 'fz', | 
|---|
|  |  |  | samplPeriod: '10', | 
|---|
|  |  |  | simulatFrequency: 500, | 
|---|
|  |  |  | simulatTime: '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | simulatTime: '', | 
|---|
|  |  |  | repairDiracFlag: false | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | dialogVisible: false, | 
|---|
|  |  |  | modelCheckResult: [], | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | mounted() { | 
|---|
|  |  |  | this.getProductList() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | watch: { | 
|---|
|  |  |  | percentage() { | 
|---|
|  |  |  | if (this.percentage === 100) { | 
|---|
|  |  |  | this.$refs.SimulatCurve.initEcharts(this.dataForm); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // percentage() { | 
|---|
|  |  |  | //   if (this.percentage === 100) { | 
|---|
|  |  |  | //     this.$refs.SimulatCurve.initEcharts(this.dataForm); | 
|---|
|  |  |  | //   } | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | components: { | 
|---|
|  |  |  | ProductModelTree, | 
|---|
|  |  |  | SimulatCurve, | 
|---|
|  |  |  | Process, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | onTreeSelected(data) { | 
|---|
|  |  |  | if (this.dataForm.id){ | 
|---|
|  |  |  | if (this.dataForm.id) { | 
|---|
|  |  |  | console.log(data, 'onProductSelected') | 
|---|
|  |  |  | this.dataForm.showProductId = data.id | 
|---|
|  |  |  | this.$refs.SimulatCurve.getProductEcharts(this.dataForm); | 
|---|
|  |  |  | 
|---|
|  |  |  | console.log(data, ' onProductSelected(data)') | 
|---|
|  |  |  | this.dataForm.productId = data.id | 
|---|
|  |  |  | this.getTaskList() | 
|---|
|  |  |  | this.dataForm.taskModelId = '' | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | this.$refs.ProductModelTree.getProductList() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | console.log(res.data) | 
|---|
|  |  |  | this.taskList = res.data | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getStroke() { | 
|---|
|  |  |  | if (this.percentage < 100) { | 
|---|
|  |  |  | this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress?taskId=${this.dataForm.id}`).then( | 
|---|
|  |  |  | res => { | 
|---|
|  |  |  | 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) { | 
|---|
|  |  |  | // let chkResult = res.data | 
|---|
|  |  |  | // console.log(chkResult) | 
|---|
|  |  |  | // if (chkResult.length == 0) { | 
|---|
|  |  |  | 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() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|