jinlin
2024-12-02 18f682f736914e427070b9bb769df538ad9f6d1c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<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="name">
          <el-input v-model="dataForm.name" placeholder="请输入名称" clearable></el-input>
        </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>
        </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>
    <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: null,
        isSelect: false,
        isShow: false,
        percentage: 0,
        productList: [],
        taskList: [],
        MTBF: '',
        MTTR: '',
        dataForm: {
          id: '',
          pid: '',
          name:'',
          productId: '',
          showProductId: '',
          taskModelId: '',
          dataType: 'fz',
          samplPeriod: '10',
          simulatFrequency: 500,
          simulatTime: '',
          repairDiracFlag: false
        },
        dialogVisible: false,
        modelCheckResult: [],
      }
    },
    mounted() {
      this.getProductList()
    },
    components: {
      ProductModelTree,
      SimulatCurve,
      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)')
        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
      },
      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) {
          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)
          }
        }
      },
      displayProcess() {
        this.$refs.process.$refs.dialog.init()
      }
    }
  }
</script>
<style>
 
</style>