liuqiao преди 2 години
родител
ревизия
8360409fe2
променени са 2 файла, в които са добавени 113 реда и са изтрити 25 реда
  1. 49 8
      src/views/index/HCFDLab/index.vue
  2. 64 17
      src/views/index/index.vue

+ 49 - 8
src/views/index/HCFDLab/index.vue

@@ -2337,10 +2337,10 @@
       <div class="linetext">动画</div>
     </div> 
      <div class="listbtn anbtn"> 
-       <el-button plain class="anniu"  @click="animationclick()">轮廓显示</el-button>
-        <el-button plain class="anniu" @click="animationclick()">线</el-button>
-        <el-button plain class="anniu" @click="animationclick()">矢量</el-button>
-          <el-button plain class="anniu" @click="animationclick()">实体表面</el-button>
+       <el-button plain class="anniu"  @click="animationclick('contour')">轮廓显示</el-button>
+        <el-button plain class="anniu" @click="animationclick('line')">线</el-button>
+        <el-button plain class="anniu" @click="animationclick('vector')">矢量</el-button>
+          <el-button plain class="anniu" @click="animationclick('solidSurface')">实体表面</el-button>
       </div>
           <div class="yiinpu loadclass" >
              <el-button plain class="anniu">Lode</el-button>
@@ -2408,10 +2408,14 @@
  </div>
         <div class='selecttype'>
         <span class="texttype">zoom</span>
+          <ul>
+      <li v-for="(item,key) in animationobj.zoomarr" :key="key">
+        <span  class="zoomclass">{{item}}</span>
+          <el-checkbox :label="item"  :key="item"  v-model="checked" @change="zoomList(item)">hide</el-checkbox>
+      </li>
+    </ul>
       </div>
-    <!-- <span class="demonstration">Low</span>
-    <el-slider v-model="value1"></el-slider>
-    <span class="demonstration">Quick</span> -->
+  
   </div>
  </div> 
   </el-form>
@@ -2838,6 +2842,7 @@ export default {
         firststep:'',
         laststep:'',
         currentstep:'',
+        zoomarr:[],
      },
     colorobj:{
       R:'0',
@@ -4019,6 +4024,17 @@ vectordata(data){
     this.vectorobj.dataWarr=dataw.split(",");
     this.vectorobj.scaleFactor=vectorparam.scaleFactor;
 
+},
+  // zoom
+  zoomanimation(data) {
+       let zoomparam= JSON.parse(data);
+        this.animationobj.zoomarr=(zoomparam.zonename).split(",");
+        console.log( this.animationobj.zoomarr);
+  },
+//拿到勾选数据
+zoomList(val){
+  console.log(val);
+
 },
 // 矢量的OK按钮
 vectorOK(){
@@ -4253,9 +4269,30 @@ this.styX.left=e.clientX+'px';
   }
 
   },
-  animationclick(){
+  animationclick(val){
+    switch(val){
+       case 'contour':
+         
+        this.active='five7-0';
+        this.dialog.contour_visiable = true;
+      break;
+       case 'line':
+          this.active='five7-1';
+        this.dialog.Line_visiable = true;
+      break;
+       case 'vector':
+           this.active='five7-2';
+       this.dialog.Vector_visiable = true;
+      break;
+       case 'solidSurface':
+         this.active='five8-0';
+         this.dialog.Solid_Surface = true;
+      break;
+
+    }
 
   },
+
     //清除相关信息
     clearAll() {
       this.showUgridflag = false; //ugrid 是否显示过
@@ -5855,4 +5892,8 @@ vertical-align:middle;
     width: 33px;
     padding: 3px;
   }
+  .zoomclass{
+      display: inline-block;
+    width: 50%;
+  }
 </style>

+ 64 - 17
src/views/index/index.vue

@@ -190,10 +190,18 @@ import echartsHFCD from "./HCFDLab/echartsHFCD.vue";
 import { number } from 'echarts/lib/export'
 import TFileStream from "./compoents/TFileStreamhcfd.vue";
 import tool1 from "./compoents/tool1.vue";
+import { clear } from 'echarts/lib/util/throttle'
 export default {
   components:{geometry,meshindex,Geometryandclass,Materials,touch,initial,boundary,Meshauto,loadcase,zuoye,echartsHFCD,result,caozuo,toolindex,hcfd,fem,TFileStream,tool1,fem2},
   data() {
     return {
+      // 心跳包的参数
+      ws:null,//建立连接
+      lockReconnect:false,//是否真正建立连接
+      timeout:28*1000,//30秒一次心跳
+      timeoutObj:null,//心跳倒计时
+      serverTimeout0bj:null,//
+      timeoutnum: null ,//断开重连倒计时
       tl1,tl2,tl3,tl4,tl5,tl6,tl7,tl8,tl9,tl10,
      tl11,tl12,tl13,tl14,tl15,tl16,
      ytdata:{},
@@ -508,14 +516,9 @@ linezhexian(num){
              if(canshu==''){
                     this.startimg("init",'loaddata');
          }  
-        }else{
-          
         }
-            }else{
             }
           })
-          .catch((err) => {
-          })
         
       },
       solverchange(val){
@@ -708,10 +711,48 @@ let params = {
            this.loadingend(this.loadingopen());
         }); 
   },
-    
+    // 心跳包
+reconnect(){
+  // var that=this;
+  //   if(that.lockReconnect) return;
+  //   that.lockReconnect = true;
+  //   //没连接上会一直重连,设置延迟避免请求过多
+  //   that.timeoutnum&&clearTimeout(that.timeoutnum);
+  //   that.timeoutnum= setTimeout(function () {
+  //     //新连接
+  //     this.initWebSocket();
+  //     that.lockReconnect = false;
+  //   },5000);
+  },
+ reset(){//重置心跳
+//         var that=this;
+//         clearTimeout(this.timeoutObj);
+//         clearTimeout(this.serverTimeoutObj);
+//      that.start();
+    },
+    start(){//开启心跳
+    // console.log(11111)
+    //     var self = this;
+    //     self.timeoutObj&&clearTimeout(self.timeoutObj);
+    //     self.serverTimeoutObj&&clearTimeout(self.serverTimeoutObj);
+    //     self.timeoutObj = setTimeout(function(){
+    //         self.ws.send("heartCheck");
+    //       //这里发送一个心跳,后端收到后,返回一个心跳消息
+    //       // if(self.ws.readyState==1){//如果连接正常
+    //       //       self.ws.send("heartCheck");
+    //       // }else{//否则重连
+    //       //     self.reconnect()
+    //       // }
+    //         self.serverTimeoutObj = setTimeout(function(){
+    //          // 超时关闭
+    //           self.ws.close();//如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
+    //         }, self.timeout)
+    //     }, this.timeout)
+    },  
+// }, 
     // // 文件渲染websoket图片的渲染
     initWebSocket(){ //初始化weosocket
-
+     
        // const wsuri = "ws://192.168.0.43:8087//websocket?projectId="+this.pid;
          const wsuri = "ws://"+process.env.VUE_APP_BASE_websokt+"//websocket?projectId="+this.pid;
         this.websock = new WebSocket(wsuri);
@@ -719,18 +760,21 @@ let params = {
         this.websock.onopen = this.websocketonopen;
         this.websock.onerror = this.websocketonerror;
         this.websock.onclose = this.websocketclose;
-  
-    console.log(wsuri)
+        
+         
       },
       websocketonopen(e){ //连接建立之后执行send方法发送数据
         this.startimg("init",'loaddata');
-        
+        console.log(e);
+        this.start();
       },
       websocketonerror(){//连接建立失败重连
               this.websock.close() 
+              this.reconnect();
       },
       websocketonmessage(e){ //数据接收
            this.loadingopen();
+            this.reset();
         try{
     
              let eadata=e.data
@@ -774,6 +818,9 @@ let params = {
                       if(data.msgType=='solidsurface_param'){
                           //this.$refs.hcfd.colorval(JSON.stringify(data))
                       }
+                       if(data.msgType=='animation_param'){
+                         this.$refs.hcfd.zoomanimation(JSON.stringify(data))
+                      }
               }else if(rdata.action=='LineDisplay'){
                           this.ytdata=rdata;
               }else if(rdata.action=='SliceDisplayAdd'){
@@ -845,21 +892,21 @@ let params = {
           this.loadingend(this.loadingopen());
           return false;
         }
+         
       },
       websocketsend(Data){//数据发送
         this.websock.send(Data);
       },
       websocketclose(e){  //关闭
       this.websock.close();
-        Message({
-            type: "error",
-            message: "websock断开连接",
-          });
+        // Message({
+        //     type: "error",
+          //   message: "websock断开连接",
+          // });
            this.loadingend(this.loadingopen());
-      
+          this.reconnect();
       },
-
-      }
+}
 }
 </script>
 <style lang="scss">