From 1696a5ccc97a923f65eaf3a554eabce2436bc510 Mon Sep 17 00:00:00 2001
From: wente <329538422@qq.com>
Date: 星期二, 05 十一月 2024 16:20:00 +0800
Subject: [PATCH] 滚轮在页面加载之前报错报错问题

---
 web/src/views/modules/taskReliability/SimulatAssess.vue |  115 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 81 insertions(+), 34 deletions(-)

diff --git a/web/src/views/modules/taskReliability/SimulatAssess.vue b/web/src/views/modules/taskReliability/SimulatAssess.vue
index e957d47..7b59686 100644
--- a/web/src/views/modules/taskReliability/SimulatAssess.vue
+++ b/web/src/views/modules/taskReliability/SimulatAssess.vue
@@ -9,35 +9,51 @@
           <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 :close-on-click-modal="false" :visible.sync="dialogVisible" title="妯″瀷妫�鏌�" width="60%" @close="dialogVisible = false">
-      <el-tag type="danger">妯″瀷瀹氫箟/鍙傛暟閰嶇疆閲屽瓨鍦ㄤ互涓嬮棶棰橈細</el-tag>
-      <el-table :data="modelCheckResult" height="100px" v-adaptive="{bottomOffset:30}"
+    <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"/>
@@ -52,18 +68,22 @@
         <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,
@@ -81,6 +101,7 @@
           samplPeriod: '10',
           simulatFrequency: 500,
           simulatTime: '',
+          repairDiracFlag: false
         },
         dialogVisible: false,
         modelCheckResult: [],
@@ -90,20 +111,21 @@
       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);
@@ -115,6 +137,7 @@
         console.log(data, ' onProductSelected(data)')
         this.dataForm.productId = data.id
         this.getTaskList()
+        this.dataForm.taskModelId = ''
         this.$nextTick(() => {
           this.$refs.ProductModelTree.getProductList()
         })
@@ -136,15 +159,20 @@
         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
@@ -156,16 +184,35 @@
         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)
-          if (res.data != null && res.data.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()
       }
     }
   }

--
Gitblit v1.9.1