|
@@ -655,7 +655,7 @@
|
|
|
<el-button @click="dialog.mesh_generation = false">{{ $t("HCFD.file.cancel")}}</el-button>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
- @click="meshSplitok()"
|
|
|
+ @click="meshSplitok();dialog.mesh_generation = false"
|
|
|
>网格划分</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
@@ -2528,6 +2528,13 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 心跳包的参数
|
|
|
+ websock: null, //建立连接
|
|
|
+ lockReconnect: false, //是否真正建立连接
|
|
|
+ timeout: 28 * 1000, //30秒一次心跳
|
|
|
+ timeoutObj: null, //心跳倒计时
|
|
|
+ serverTimeout0bj: null, //
|
|
|
+ timeoutnum: null, //断开重连倒计时
|
|
|
objmesh:{
|
|
|
strResultFormat:".vtk",
|
|
|
surfParam:{
|
|
@@ -3570,6 +3577,12 @@ let b=(Number(this.colorobj.B)/255).toFixed(4);
|
|
|
handleClick(tab, event) {
|
|
|
let tabindex=tab.index;
|
|
|
this.activecleer();
|
|
|
+ console.log(this.activeName);
|
|
|
+ if(this.activeName=='one'){
|
|
|
+ this.$parent.startimg("init",'geometryFileShow');
|
|
|
+ }else if(this.activeName=='twos'){
|
|
|
+ this.$parent.startimg("init",'loaddata');
|
|
|
+ }
|
|
|
},
|
|
|
activecleer(){
|
|
|
this.active=11;
|
|
@@ -3834,6 +3847,46 @@ setpnum(){
|
|
|
console.log(res)
|
|
|
})
|
|
|
},
|
|
|
+ // 心跳包
|
|
|
+ reconnect() {
|
|
|
+ var that = this;
|
|
|
+ if (that.lockReconnect) return;
|
|
|
+ that.lockReconnect = true;
|
|
|
+ //没连接上会一直重连,设置延迟避免请求过多
|
|
|
+ that.timeoutnum && clearTimeout(that.timeoutnum);
|
|
|
+ that.timeoutnum = setTimeout(function () {
|
|
|
+ //新连接
|
|
|
+ that.getwebsocket();
|
|
|
+ that.lockReconnect = false;
|
|
|
+ }, 5000);
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ //重置心跳
|
|
|
+ var that = this;
|
|
|
+ clearTimeout(this.timeoutObj);
|
|
|
+ clearTimeout(this.serverTimeoutObj);
|
|
|
+ that.start();
|
|
|
+ },
|
|
|
+ start() {
|
|
|
+ //开启心跳
|
|
|
+ var self = this;
|
|
|
+ self.timeoutObj && clearTimeout(self.timeoutObj);
|
|
|
+ self.serverTimeoutObj && clearTimeout(self.serverTimeoutObj);
|
|
|
+ self.timeoutObj = setTimeout(function () {
|
|
|
+ //这里发送一个心跳,后端收到后,返回一个心跳消息
|
|
|
+ if (self.websock.readyState == 1) {
|
|
|
+ //如果连接正常
|
|
|
+ self.websock.send("heartCheck");
|
|
|
+ } else {
|
|
|
+ //否则重连
|
|
|
+ self.reconnect();
|
|
|
+ }
|
|
|
+ self.serverTimeoutObj = setTimeout(function () {
|
|
|
+ // 超时关闭
|
|
|
+ self.websock.close(); //如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
|
|
|
+ }, self.timeout);
|
|
|
+ }, this.timeout);
|
|
|
+ },
|
|
|
// websocket
|
|
|
getwebsocket() {
|
|
|
// 初始化weosocket
|
|
@@ -3848,7 +3901,7 @@ setpnum(){
|
|
|
|
|
|
},
|
|
|
websocketonopen(e) {
|
|
|
-
|
|
|
+ this.start();
|
|
|
//连接建立之后执行send方法发送数据this.newlog();
|
|
|
// if(this.lsolverState=='1'||this.numzhexian=='1'){
|
|
|
|
|
@@ -3864,11 +3917,12 @@ setpnum(){
|
|
|
websocketonerror() {
|
|
|
//连接建立失败重连
|
|
|
this.websock.close();
|
|
|
- this.$emit("exlodingfalse",false)
|
|
|
+ this.$emit("exlodingfalse",false);
|
|
|
+ this.reconnect();
|
|
|
},
|
|
|
websocketonmessage(e) {
|
|
|
//数据接收
|
|
|
- console.log(e);
|
|
|
+ this.reset();
|
|
|
try{
|
|
|
const redata = JSON.parse(e.data);
|
|
|
if(redata.type == "log"){
|
|
@@ -3886,10 +3940,10 @@ setpnum(){
|
|
|
},
|
|
|
websocketclose(e) {
|
|
|
//关闭
|
|
|
- Message({
|
|
|
- type: "error",
|
|
|
- message: "websock断开连接",
|
|
|
- });
|
|
|
+ // Message({
|
|
|
+ // type: "error",
|
|
|
+ // message: "websock断开连接",
|
|
|
+ // });
|
|
|
this.$emit("exlodingfalse",false)
|
|
|
this.websock.close();
|
|
|
|
|
@@ -4094,6 +4148,10 @@ this.bStepok("animation",'','')
|
|
|
// timer(2000);
|
|
|
|
|
|
},
|
|
|
+ // 几何导入
|
|
|
+ geometryup(){
|
|
|
+ this.$parent.startimg("init",'geometryFileShow');
|
|
|
+ },
|
|
|
// 最后一张
|
|
|
Endclick(){
|
|
|
this.jiekou(this.animationobj.laststep);
|
|
@@ -4199,6 +4257,25 @@ this.bStepok("animation",'','')
|
|
|
})
|
|
|
.catch((err) => {});
|
|
|
},
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ if(this.websock!=null){
|
|
|
+ this.websock.close();
|
|
|
+ // 清除时间
|
|
|
+ clearTimeout(this.timeoutObj);
|
|
|
+ clearTimeout(this.serverTimeoutObj);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ destroyed() {
|
|
|
+ if(this.websock!=null){
|
|
|
+ this.websock.close();
|
|
|
+ //this.websock=null;
|
|
|
+ //console.log( this.websock.close());
|
|
|
+ // 清除时间
|
|
|
+ clearTimeout(this.timeoutObj);
|
|
|
+ clearTimeout(this.serverTimeoutObj);
|
|
|
+ console.log("关闭了websocket")
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
'animationobj.currentstep' () {
|