浏览代码

6.29改websocket

liuqiao 2 年之前
父节点
当前提交
5d75fbe217
共有 3 个文件被更改,包括 43 次插入11 次删除
  1. 19 2
      src/views/index/FEMLab/fem.vue
  2. 5 0
      src/views/index/HCFDLab/index.vue
  3. 19 9
      src/views/index/index.vue

+ 19 - 2
src/views/index/FEMLab/fem.vue

@@ -2029,7 +2029,8 @@ export default {
         leixing:'',
         level:'1',
         bmScalars:[],
-        nameTypes:''
+        nameTypes:'',
+        scalarmax:'',
      },
     vSalar: "",
     velementCheckeds: ["Contour"],
@@ -2407,7 +2408,7 @@ export default {
         bxlist:[
                {value:'0',name:'静力分析'},
                {value:'1',name:'模态分析'},
-               {value:'2',name:'传热分析'},
+              //  {value:'2',name:'传热分析'},
                {value:'3',name:'瞬态响应分析'},
         ],
          bxval:'0',
@@ -2652,6 +2653,7 @@ outlinedata(val){
   let ytdata= JSON.parse(val);
   this.outlineobj.scalarName=ytdata.scalarName;
   this.vSalar=ytdata.scalarName;
+  this.outlineobj.scalarmax=ytdata.scalarrange;
    this.outlineobj.range0=ytdata.range0;
    this.outlineobj.range1=ytdata.range1;
   let ress=ytdata.scalarNames;
@@ -2667,6 +2669,17 @@ if(ress==undefined){
 
 }
  
+},
+// 获取轮廓数据的最大值和最小值
+outlinemax(val){
+let arrmax=Array.from( this.outlineobj.scalarmax.split(","));
+arrmax.forEach((item,index)=>{
+ let arrval= arrmax[index].split("#");
+  if(arrval.includes(val)){
+  this.outlineobj.range0=arrval[1];
+   this.outlineobj.range1=arrval[2];
+ }
+})
 },
 //矢量数据
 vectordata(){
@@ -2858,6 +2871,7 @@ strnumchange(val){
 bmScalarschange(val){
     this.outlineobj.scalarName=this.vSalar;
     this.strnumchange(this.outlineobj.nameTypes);
+        this.outlinemax(this.vSalar)
 
 },
 //接口返回的颜色
@@ -3209,6 +3223,9 @@ line-height: 30px;
       flex: 1;
     text-align: center;
 }
+.el-form-item{
+margin-bottom:5px !important;
+}
 .imgzong{
     padding-top: 4px;
     .radiocontent{

+ 5 - 0
src/views/index/HCFDLab/index.vue

@@ -2414,6 +2414,10 @@
           <el-checkbox :label="item"  :key="item"  v-model="checked" @change="zoomList(item)">hide</el-checkbox>
       </li>
     </ul>
+     <!-- <el-checkbox-group v-model="checkList" @change="zoomList(item)">
+        <span  class="zoomclass">{{item}}</span>
+    <el-checkbox  :label="item"  v-for="(item,key) in animationobj.zoomarr" :key="key"  >hide</el-checkbox>
+  </el-checkbox-group> -->
       </div>
   
   </div>
@@ -2838,6 +2842,7 @@ export default {
         nameTypes:'',
         scalarmax:'',
      },
+     checkList:[],
      animationobj:{
         firststep:'',
         laststep:'',

+ 19 - 9
src/views/index/index.vue

@@ -196,7 +196,7 @@ export default {
   data() {
     return {
       // 心跳包的参数
-      ws:null,//建立连接
+      websock:null,//建立连接
       lockReconnect:false,//是否真正建立连接
       timeout:28*1000,//30秒一次心跳
       timeoutObj:null,//心跳倒计时
@@ -393,6 +393,21 @@ created(){
   this.pid=this.$route.query.pid;
   this.init();
 },
+beforeDestroy() { 
+  this.websock.close()
+  // 清除时间
+  clearTimeout(this.timeoutObj)
+  clearTimeout(this.serverTimeoutObj)
+},
+destroyed() { 
+  this.websock.close()
+  //this.websock=null;
+    console.log("销毁了")
+    //console.log( this.websock.close());
+  // 清除时间
+  clearTimeout(this.timeoutObj)
+  clearTimeout(this.serverTimeoutObj)
+},
 mounted(){
       let curcolor  = this.$store.state.themecolor;
       this.classH2 = 'custome-' + curcolor;
@@ -753,12 +768,7 @@ reconnect(){
         }, this.timeout)
     },  
 // }, 
-beforeDestroy() { 
-  this.websock.close()
-  // 清除时间
-  clearTimeout(this.timeoutObj)
-  clearTimeout(this.serverTimeoutObj)
-},
+
     // // 文件渲染websoket图片的渲染
     initWebSocket(){ //初始化weosocket
      
@@ -910,9 +920,9 @@ beforeDestroy() {
         this.websock.send(Data);
       },
       websocketclose(e){  //关闭
-      this.websock.close();
+      ///this.websock.close();
            this.loadingend(this.loadingopen());
-          this.reconnect();
+          //this.reconnect();
       },
 }
 }