|
@@ -190,10 +190,18 @@ import echartsHFCD from "./HCFDLab/echartsHFCD.vue";
|
|
import { number } from 'echarts/lib/export'
|
|
import { number } from 'echarts/lib/export'
|
|
import TFileStream from "./compoents/TFileStreamhcfd.vue";
|
|
import TFileStream from "./compoents/TFileStreamhcfd.vue";
|
|
import tool1 from "./compoents/tool1.vue";
|
|
import tool1 from "./compoents/tool1.vue";
|
|
|
|
+import { clear } from 'echarts/lib/util/throttle'
|
|
export default {
|
|
export default {
|
|
components:{geometry,meshindex,Geometryandclass,Materials,touch,initial,boundary,Meshauto,loadcase,zuoye,echartsHFCD,result,caozuo,toolindex,hcfd,fem,TFileStream,tool1,fem2},
|
|
components:{geometry,meshindex,Geometryandclass,Materials,touch,initial,boundary,Meshauto,loadcase,zuoye,echartsHFCD,result,caozuo,toolindex,hcfd,fem,TFileStream,tool1,fem2},
|
|
data() {
|
|
data() {
|
|
return {
|
|
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,
|
|
tl1,tl2,tl3,tl4,tl5,tl6,tl7,tl8,tl9,tl10,
|
|
tl11,tl12,tl13,tl14,tl15,tl16,
|
|
tl11,tl12,tl13,tl14,tl15,tl16,
|
|
ytdata:{},
|
|
ytdata:{},
|
|
@@ -508,14 +516,9 @@ linezhexian(num){
|
|
if(canshu==''){
|
|
if(canshu==''){
|
|
this.startimg("init",'loaddata');
|
|
this.startimg("init",'loaddata');
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- .catch((err) => {
|
|
|
|
- })
|
|
|
|
|
|
|
|
},
|
|
},
|
|
solverchange(val){
|
|
solverchange(val){
|
|
@@ -708,10 +711,48 @@ let params = {
|
|
this.loadingend(this.loadingopen());
|
|
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图片的渲染
|
|
// // 文件渲染websoket图片的渲染
|
|
initWebSocket(){ //初始化weosocket
|
|
initWebSocket(){ //初始化weosocket
|
|
-
|
|
|
|
|
|
+
|
|
// const wsuri = "ws://192.168.0.43:8087//websocket?projectId="+this.pid;
|
|
// 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;
|
|
const wsuri = "ws://"+process.env.VUE_APP_BASE_websokt+"//websocket?projectId="+this.pid;
|
|
this.websock = new WebSocket(wsuri);
|
|
this.websock = new WebSocket(wsuri);
|
|
@@ -719,18 +760,21 @@ let params = {
|
|
this.websock.onopen = this.websocketonopen;
|
|
this.websock.onopen = this.websocketonopen;
|
|
this.websock.onerror = this.websocketonerror;
|
|
this.websock.onerror = this.websocketonerror;
|
|
this.websock.onclose = this.websocketclose;
|
|
this.websock.onclose = this.websocketclose;
|
|
-
|
|
|
|
- console.log(wsuri)
|
|
|
|
|
|
+
|
|
|
|
+
|
|
},
|
|
},
|
|
websocketonopen(e){ //连接建立之后执行send方法发送数据
|
|
websocketonopen(e){ //连接建立之后执行send方法发送数据
|
|
this.startimg("init",'loaddata');
|
|
this.startimg("init",'loaddata');
|
|
-
|
|
|
|
|
|
+ console.log(e);
|
|
|
|
+ this.start();
|
|
},
|
|
},
|
|
websocketonerror(){//连接建立失败重连
|
|
websocketonerror(){//连接建立失败重连
|
|
this.websock.close()
|
|
this.websock.close()
|
|
|
|
+ this.reconnect();
|
|
},
|
|
},
|
|
websocketonmessage(e){ //数据接收
|
|
websocketonmessage(e){ //数据接收
|
|
this.loadingopen();
|
|
this.loadingopen();
|
|
|
|
+ this.reset();
|
|
try{
|
|
try{
|
|
|
|
|
|
let eadata=e.data
|
|
let eadata=e.data
|
|
@@ -774,6 +818,9 @@ let params = {
|
|
if(data.msgType=='solidsurface_param'){
|
|
if(data.msgType=='solidsurface_param'){
|
|
//this.$refs.hcfd.colorval(JSON.stringify(data))
|
|
//this.$refs.hcfd.colorval(JSON.stringify(data))
|
|
}
|
|
}
|
|
|
|
+ if(data.msgType=='animation_param'){
|
|
|
|
+ this.$refs.hcfd.zoomanimation(JSON.stringify(data))
|
|
|
|
+ }
|
|
}else if(rdata.action=='LineDisplay'){
|
|
}else if(rdata.action=='LineDisplay'){
|
|
this.ytdata=rdata;
|
|
this.ytdata=rdata;
|
|
}else if(rdata.action=='SliceDisplayAdd'){
|
|
}else if(rdata.action=='SliceDisplayAdd'){
|
|
@@ -845,21 +892,21 @@ let params = {
|
|
this.loadingend(this.loadingopen());
|
|
this.loadingend(this.loadingopen());
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
},
|
|
},
|
|
websocketsend(Data){//数据发送
|
|
websocketsend(Data){//数据发送
|
|
this.websock.send(Data);
|
|
this.websock.send(Data);
|
|
},
|
|
},
|
|
websocketclose(e){ //关闭
|
|
websocketclose(e){ //关闭
|
|
this.websock.close();
|
|
this.websock.close();
|
|
- Message({
|
|
|
|
- type: "error",
|
|
|
|
- message: "websock断开连接",
|
|
|
|
- });
|
|
|
|
|
|
+ // Message({
|
|
|
|
+ // type: "error",
|
|
|
|
+ // message: "websock断开连接",
|
|
|
|
+ // });
|
|
this.loadingend(this.loadingopen());
|
|
this.loadingend(this.loadingopen());
|
|
-
|
|
|
|
|
|
+ this.reconnect();
|
|
},
|
|
},
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
<style lang="scss">
|
|
<style lang="scss">
|