Commit 7766f2ac authored by caicaicai's avatar caicaicai

修改

parent 8780570f
...@@ -70,6 +70,12 @@ export default { ...@@ -70,6 +70,12 @@ export default {
}) })
}, },
//关闭清除定时器
dingshiqiCloseFn(){
if(this.sonTimer1) { //如果定时器还在运行 或者直接关闭,不用判断
clearInterval(this.sonTimer1); //关闭
}
},
//查询是否有卸车 //查询是否有卸车
loadData2(){ loadData2(){
httpGet(vehicleInformationQuery,{number:this.carnumber}).then((res) => { httpGet(vehicleInformationQuery,{number:this.carnumber}).then((res) => {
...@@ -171,9 +177,9 @@ export default { ...@@ -171,9 +177,9 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
if(this.sonTimer1) { //如果定时器还在运行 或者直接关闭,不用判断 // if(this.sonTimer1) { //如果定时器还在运行 或者直接关闭,不用判断
clearInterval(this.sonTimer1); //关闭 // clearInterval(this.sonTimer1); //关闭
} // }
} }
} }
</script> </script>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<div class="voiceAppContent_2_content"> <div class="voiceAppContent_2_content">
<el-checkbox-group v-model="selectCarRadioArray"> <el-checkbox-group v-model="selectCarRadioArray">
<el-checkbox v-for="(item,index) in carsInforData" :label="item" :key="index" style="margin-top:10px;"> <el-checkbox v-for="(item,index) in carsInforData" :label="item" :key="index" style="margin-top:10px;">
<div style="width:20vw;text-align: center;">{{item.number}}</div> <div style="width:20vw;text-align: center;">{{item.number == 'pcBigScreen' ? '调度中心' : item.number}}</div>
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</div> </div>
<div class="voiceAppContent_2_3_content"> <div class="voiceAppContent_2_3_content">
<div v-for="(item,index) in selectCarRadioArray" :key="index" class="voiceAppContent_2_content_selectCar"> <div v-for="(item,index) in selectCarRadioArray" :key="index" class="voiceAppContent_2_content_selectCar">
<div>车牌号:{{item.number}}</div> <div>车牌号:{{item.number == 'pcBigScreen' ? '调度中心' : item.number}}</div>
<div style="width:27px;height:27px;background-color: rgb(4,112,171);text-align: center;font-size:40px;" @click="cancelSelect(index)"> <div style="width:27px;height:27px;background-color: rgb(4,112,171);text-align: center;font-size:40px;" @click="cancelSelect(index)">
<span>×</span> <span>×</span>
</div> </div>
...@@ -192,11 +192,12 @@ export default { ...@@ -192,11 +192,12 @@ export default {
}); });
this.loadData2(); this.loadData2();
//页面刚进入时开启长连接 //页面刚进入时开启长连接
this.initWebSocket(); // this.initWebSocket();
this.heartbeatTimer = setInterval(() => { // this.heartbeatTimer = setInterval(() => {
this.reconnect(); // this.reconnect();
}, 10000) // }, 10000)
}, },
//获取车辆数据
loadData2() { loadData2() {
let query = {}; let query = {};
query.size = 9999; query.size = 9999;
...@@ -206,10 +207,21 @@ export default { ...@@ -206,10 +207,21 @@ export default {
//车辆 //车辆
httpGet(vehicleInformationQuery,query).then((res) => { httpGet(vehicleInformationQuery,query).then((res) => {
if(res.code == 200){ if(res.code == 200){
let obj1 = res.data.content;
obj1.unshift({number:'pcBigScreen'});
this.carsInforData = res.data.content; this.carsInforData = res.data.content;
} }
}); });
}, },
//页面刚进入时开启长连接
loadData3(value){
this.userName1 = value; //车牌号
this.initWebSocket();
this.heartbeatTimer = setInterval(() => {
this.reconnect();
}, 10000)
},
//关闭语音申请组件
voiceAppCloseFn(){ voiceAppCloseFn(){
this.showDecide = false; this.showDecide = false;
this.selectCarFleet = ''; this.selectCarFleet = '';
...@@ -218,6 +230,15 @@ export default { ...@@ -218,6 +230,15 @@ export default {
this.situationWhich = 10000; this.situationWhich = 10000;
this.recClose(); this.recClose();
//页面销毁时关闭长连接 //页面销毁时关闭长连接
// this.websocketclose();
//关闭心跳
// if(this.heartbeatTimer) {
// clearInterval(this.heartbeatTimer);
// }
},
//关闭心跳以及关闭长连接
xintiaoCloseFn(){
//页面销毁时关闭长连接
this.websocketclose(); this.websocketclose();
//关闭心跳 //关闭心跳
if(this.heartbeatTimer) { if(this.heartbeatTimer) {
...@@ -697,11 +718,11 @@ export default { ...@@ -697,11 +718,11 @@ export default {
}, },
beforeDestroy(){ beforeDestroy(){
//页面销毁时关闭长连接 //页面销毁时关闭长连接
this.websocketclose(); // this.websocketclose();
//关闭心跳 //关闭心跳
if(this.heartbeatTimer) { // if(this.heartbeatTimer) {
clearInterval(this.heartbeatTimer); // clearInterval(this.heartbeatTimer);
} // }
} }
} }
</script> </script>
......
...@@ -144,6 +144,7 @@ export default { ...@@ -144,6 +144,7 @@ export default {
this.carnumber = res.data.content[0].car; this.carnumber = res.data.content[0].car;
this.personalName = res.data.content[0].name; this.personalName = res.data.content[0].name;
this.$refs.startOrderReceivingMethod.loadData(this.carnumber); this.$refs.startOrderReceivingMethod.loadData(this.carnumber);
this.$refs.voiceApplicationMethod.loadData3(this.carnumber);
httpGet(vehicleInformationQuery,{number:this.carnumber}).then((res) => { httpGet(vehicleInformationQuery,{number:this.carnumber}).then((res) => {
if(res.code == 200){ if(res.code == 200){
...@@ -385,6 +386,8 @@ export default { ...@@ -385,6 +386,8 @@ export default {
}, },
}, },
beforeDestroy(){ beforeDestroy(){
this.$refs.voiceApplicationMethod.xintiaoCloseFn();
this.$refs.startOrderReceivingMethod.dingshiqiCloseFn();
if(this.zongTimer1) { if(this.zongTimer1) {
clearInterval(this.zongTimer1); clearInterval(this.zongTimer1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment