From 0091dd076ed7d6dfb06fa820dabd9cf5e738514c Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期四, 07 十一月 2024 17:15:13 +0800
Subject: [PATCH] 仿真评估检查模型时,总体工况模型里未使用的节点,不检查其模型是否存在。

---
 web/src/views/modules/taskReliability/SchemeCompar.vue |  338 +++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 215 insertions(+), 123 deletions(-)

diff --git a/web/src/views/modules/taskReliability/SchemeCompar.vue b/web/src/views/modules/taskReliability/SchemeCompar.vue
index 7efb8d0..10efed1 100644
--- a/web/src/views/modules/taskReliability/SchemeCompar.vue
+++ b/web/src/views/modules/taskReliability/SchemeCompar.vue
@@ -1,69 +1,103 @@
 <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">
-          <zt-form-item label="浜у搧鑺傜偣" prop="productId" width="100px">
-            <zt-select v-model="dataForm.productId" :datas="productList" @change="onProductSelected"/>
-          </zt-form-item>
-          <zt-form-item label="鍙潬鎬ф柟妗�" prop="taskModelId" width="500px">
-            <zt-select style="width: 400px" v-model="dataForm.name" :datas="schemeList"
-                       @change="onSchemeSelected" :multiple="true"/>
-          </zt-form-item>
-          <zt-form-item>
-            <zt-button @click="compair()">鏂规瀵规瘮</zt-button>
-          </zt-form-item>
-        </el-form>
-        <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;position: relative;height: 600px">
-              <div v-if="isShow">
-                <el-button v-if="isZk" type="info" size="small" icon="el-icon-caret-bottom"
-                           style="position: absolute;right: 10%;top: 10%;z-index: 1" @click="zk()"></el-button>
-                <el-button v-if="!isZk" type="info" size="small" icon="el-icon-caret-right"
-                           style="position: absolute;right: 10%;top: 10%;z-index: 1" @click="zk()"></el-button>
-                <div v-if="isZk" style="position: absolute;right: 10%;top: 15%">
-                  <el-table :data="tableData" border style="width: 400px">
-                    <el-table-column
-                      prop="name"
-                      label="鏂规鍚嶇О"
-                    >
-                    </el-table-column>
-                    <el-table-column
-                      prop="MTBF"
-                      label="MTBF"
-                      width="80px"
-                      align="right">
-                    </el-table-column>
-                    <el-table-column
-                      prop="MTTR"
-                      label="MTTR"
-                      width="80px"
-                      align="right">
-                    </el-table-column>
-                    <el-table-column
-                      prop="MSR"
-                      label="MSR"
-                      width="80px"
-                      align="right">
-                    </el-table-column>
-                  </el-table>
-                </div>
-              </div>
-              <div :disabled="isShow">
-                <div class="echart" id="myChart" :style="myChartStyle"></div>
-              </div>
-            </div>
-          </el-col>
+      <el-form :inline="true" :model="dataForm" ref="dataForm" :disabled="dataForm.disabled">
+        <zt-form-item label="浜у搧鑺傜偣" prop="productId" width="100px">
+          <zt-select v-model="dataForm.productId" :datas="productList" @change="onProductSelected"/>
+        </zt-form-item>
+        <zt-form-item label="鍙潬鎬ф柟妗�" prop="taskModelId" width="500px">
+          <zt-select style="width: 400px" v-model="dataForm.taskModelId" :datas="schemeList"
+                     @change="onTaskSelected" :multiple="true"/>
+        </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>
+        <zt-form-item>
+          <zt-button @click="compair()">鏂规瀵规瘮</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>
-      </div>
+      </el-col>
+      <el-col :span="20">
+        <div class="fa-card-a" style="position: relative;height: calc(100vh - 230px)">
+          <div v-if="Show">
+            <el-button v-if="isZk" type="info" size="small" icon="el-icon-caret-bottom"
+                       style="position: absolute;right: 0;top: 0;z-index: 1" @click="zk()"></el-button>
+            <el-button v-if="!isZk" type="info" size="small" icon="el-icon-caret-right"
+                       style="position: absolute;right: 0;top: 0;z-index: 1" @click="zk()"></el-button>
+            <div v-if="isZk" style="position: absolute;right: 0;top: 5%">
+              <el-table :data="tableData" border style="width: 500px">
+                <el-table-column
+                  prop="name"
+                  label="鏂规鍚嶇О"
+                >
+                </el-table-column>
+                <el-table-column
+                  prop="mtbf"
+                  label="MTTF"
+                  width="100px"
+                  align="right">
+                  <template slot-scope="scope">
+                    <span>{{  keepNumberBy2(scope.row.mtbf) }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="mttr"
+                  label="MTTR"
+                  width="100px"
+                  align="right">
+                  <template slot-scope="scope">
+                    <span>{{  keepNumberBy2(scope.row.mttr) }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="msr"
+                  label="MSR"
+                  width="100px"
+                  align="right">
+                  <template slot-scope="scope">
+                    <span>{{  keepNumberBy4(scope.row.msr) }}</span>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+          </div>
+          <div :disabled="isShow">
+            <div class="echart" id="SchemeCompar" :style="myChartStyle"></div>
+          </div>
+        </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>
   </div>
 </template>
 
@@ -78,61 +112,65 @@
         myChartStyle: {float: "left", width: "100%", height: "600px"}, //鍥捐〃鏍峰紡
         isSelect: false,
         isShow: false,
+        Show: false,
         isZk: true,
         productList: [],
-        schemeList: [
-          {
-            id: 1,
-            name: '鏂规涓�'
-          }, {
-            id: 2,
-            name: '鏂规浜�'
-          }, {
-            id: 3,
-            name: '鏂规涓�'
-          }
-        ],
+        schemeList: [],
         dataForm: {
           id: '',
-          pid: '',
+          taskModelId: [],
           productId: '',
           showProductId: '',
-          taskModelId: '',
           dataType: 'fz',
+          samplPeriod: '10',
+          simulatFrequency: 500,
         },
-        tableData: [
-          {
-            name: '鏂规涓�',
-            MTBF: '68.74',
-            MTTR: '0.43',
-            MSR: '0.85'
-          }, {
-            name: '鏂规浜�',
-            MTBF: '78.74',
-            MTTR: '0.52',
-            MSR: '0.86'
-          }, {
-            name: '鏂规涓�',
-            MTBF: '69.84',
-            MTTR: '0.62',
-            MSR: '0.88'
-          }
-        ],
+        percentage: 2,
+        xDataList: [],
+        seriesList: [],
+        tableData: [],
+        taskList: [],
+        fzIdList: [],
+        dialogVisible: false,
+        modelCheckResult: [],
       }
     },
     mounted() {
       this.getProductList()
     },
+    computed: {
+      keepNumberBy4() { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
+        return function (val) {		// 瀵硅绠楀睘鎬ц繘琛屼紶鍙�
+          const numM = Number(val).toFixed(5);
+          return numM.substring(0, numM.length - 1);
+        }
+      },
+      keepNumberBy2() { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
+        return function (val) {		// 瀵硅绠楀睘鎬ц繘琛屼紶鍙�
+          const numM = Number(val).toFixed(3);
+          return numM.substring(0, numM.length - 1);
+        }
+      },
+    },
     components: {
       ProductModelTree,
     },
-
+    watch: {
+      // percentage() {
+      //   if (this.percentage === 100) {
+      //     this.getEcharts();
+      //   }
+      // }
+    },
     methods: {
       onTreeSelected(data) {
-        if (this.dataForm.id) {
+        if (this.dataForm.taskModelId.length > 0) {
+          console.log(this.dataForm.taskModelId)
           console.log(data, 'onProductSelected')
           this.dataForm.showProductId = data.id
-          this.$refs.SimulatCurve.getProductEcharts(this.dataForm);
+          this.$nextTick(() => {
+            this.getEcharts()
+          })
         }
       },
       // 鑾峰彇淇℃伅
@@ -140,12 +178,16 @@
         this.isSelect = true
         console.log(data, ' onProductSelected(data)')
         this.dataForm.productId = data.id
+        this.getTaskList()
         this.$nextTick(() => {
           this.$refs.ProductModelTree.getProductList()
         })
       },
-      onSchemeSelected(data) {
-        this.dataForm.id = data.id
+      onTaskSelected(data) {
+        console.log(data, 'onTaskSelected(data)')
+        for (let item of data) {
+          this.taskList.push(item.name)
+        }
       },
       zk() {
         this.isZk = !this.isZk;
@@ -155,42 +197,92 @@
         this.productList = res.data
         this.onProductSelected(this.productList[0])
       },
-      compair() {
+      async getTaskList() {
+        let params = {
+          productId: this.dataForm.productId
+        }
+        let res = await this.$http.get('/taskReliability/Task/getTaskList', {params: params})
+        console.log(res.data)
+        this.schemeList = res.data
+      },
+      async getStroke() {
+        let param = {
+          taskList: this.fzIdList
+        }
+        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
+              await this.getEcharts();
+            }
+          }
+        } else {
+          clearInterval(this.timers)
+          this.percentage = 0
+        }
+      },
+      async compair() {
         this.isShow = true
+        this.dialogVisible = false
+        this.modelCheckResult = []
+        let params = {
+          taskList: this.dataForm.taskModelId,
+          showProductId: this.dataForm.productId,
+          samplPeriod: this.dataForm.samplPeriod,
+          simulatFrequency: this.dataForm.simulatFrequency
+        }
+        console.log(this.dataForm.taskModelId, 'this.dataForm.taskModelId')
+        this.percentage = 0
+        let res = await this.$http.get('/taskReliability/SimulatAssess/SchemeCompar', {params: params})
+        console.log(res.data, "res")
+        if (res.success) {
+          if (res.data.type=="errorList") {
+            this.modelCheckResult = res.data.errList
+            this.dialogVisible = true
+            this.isShow = false
+          } else {
+            this.fzIdList = res.data.idList
+            this.timers = window.setInterval(this.getStroke, 1000)
+          }
+        }
+      },
+      async getEcharts() {
+        let params = {
+          taskList: this.dataForm.taskModelId,
+          showProductId: this.dataForm.showProductId
+        }
+        let res = await this.$http.get('/taskReliability/SimulatAssess/getEcharts', {params: params})
+        console.log(res.data, "res")
+        this.xDataList = res.data.xdataList
+        this.seriesList = res.data.curveList
+        this.tableData = res.data.dataList
+
+        this.Show = true
         this.option = {
           xAxis: {
-            data: [0.0, 50.0, 100.0, 150.0, 200.0, 250.0, 300.0, 350.0, 400.0, 450.0, 500.0, 550.0],
-            name: '浠跨湡鎬绘椂闀�'
+            data: this.xDataList,
+            name: '浠跨湡鎬绘椂闀�',
+            type: 'category',
+            axisLabel: {
+              formatter: function (value) {
+                // 灏� X 杞村埢搴﹀�兼牸寮忓寲涓轰繚鐣欎袱浣嶅皬鏁扮殑瀛楃涓�
+                return parseFloat(value).toFixed(2);
+              }
+            }
           },
           yAxis: {
             type: 'value',
             name: '鍙潬搴�',
           },
           legend: {
-            data: ['鏂规涓�', '鏂规浜�', '鏂规涓�']
+            data: this.taskList
           },
-          series: [
-            {
-              name: '鏂规涓�',
-              type: 'line',
-              smooth: true,
-              data: [1.0, 0.6, 0.39, 0.39, 0.24, 0.14, 0.08, 0.06, 0.06, 0.04, 0.02, 0.01, 0.01, 0.0, 0.0]
-            },
-            {
-              name: '鏂规浜�',
-              type: 'line',
-              smooth: true,
-              data: [1.0, 0.8, 0.59, 0.58, 0.34, 0.35, 0.18, 0.16, 0.16, 0.04, 0.04, 0.02, 0.01, 0.1, 0.0]
-            },
-            {
-              name: '鏂规涓�',
-              type: 'line',
-              smooth: true,
-              data: [1.0, 0.7, 0.45, 0.44, 0.38, 0.38, 0.15, 0.08, 0.08, 0.02, 0.02, 0.01, 0.01, 0.1, 0.0]
-            }
-          ]
+          series: this.seriesList
         };
-        this.myChart = echart.init(document.getElementById("myChart"));
+        this.myChart = echart.init(document.getElementById("SchemeCompar"));
         console.log(this.option, ' this.option ')
         this.myChart.setOption(this.option);
         //闅忕潃灞忓箷澶у皬璋冭妭鍥捐〃

--
Gitblit v1.9.1