Commit 42b4b288 authored by caicaicai's avatar caicaicai

修改

parent 7ca50854
...@@ -3,7 +3,7 @@ ENV = 'development' ...@@ -3,7 +3,7 @@ ENV = 'development'
# 接口地址 # 接口地址
#VUE_APP_BASE_API = 'http://localhost:8000' #VUE_APP_BASE_API = 'http://localhost:8000'
VUE_APP_BASE_API = 'http://192.168.0.110:8001' VUE_APP_BASE_API = 'http://192.168.0.110:8001'
VUE_APP_WS_API = 'ws://192.168.0.111:8001/webSocket' VUE_APP_WS_API = 'ws://192.168.0.111:9090/webSocket'
VUE_APP_LOCAL_API = 'http://192.168.0.110:8001' VUE_APP_LOCAL_API = 'http://192.168.0.110:8001'
VUE_APP_LOCAL_API2 = 'http://192.168.0.110:8001' VUE_APP_LOCAL_API2 = 'http://192.168.0.110:8001'
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<dd v-for="(item,index) in recentNoticeData" :key="index"> <dd v-for="(item,index) in recentNoticeData" :key="index">
<div>{{item.noticeClass}}</div> <div>{{item.noticeClass}}</div>
<div>{{item.createTime}}</div> <div>{{item.createTime}}</div>
<div style="cursor: pointer;text-decoration:underline;" @click="playSoundRecordingFn(item.id)">录音播放</div> <div style="cursor: pointer;text-decoration:underline;" @click="selectSituation(item)">录音播放</div>
</dd> </dd>
</dl> </dl>
</div> </div>
...@@ -171,6 +171,17 @@ ...@@ -171,6 +171,17 @@
<slot name="bottom"></slot> <slot name="bottom"></slot>
</div> </div>
<audio controls currentTime autoplay :src='srcUrl' style="display:none;"></audio>
<!-- 语音发起dialog -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="30%">
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="recStart" style="font-size:18px;" :disabled='tonghuadisabled'>录制语音</el-button>
<el-button type="primary" @click="recStop" style="font-size:18px;">结束语音</el-button>
<el-button type="primary" @click="recUploadLast" style="font-size:18px;" :disabled='tonghuadisabled'>上传语音</el-button>
<el-button @click="dialogVisible = false" style="font-size:18px;" :disabled='tonghuadisabled'>取 消</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
...@@ -205,6 +216,11 @@ export default { ...@@ -205,6 +216,11 @@ export default {
guangbo1:'广播', guangbo1:'广播',
jinzhitongzhi1:'紧急通知', jinzhitongzhi1:'紧急通知',
tonghua1:'通话', tonghua1:'通话',
dialogTitle:'',
dialogTitle1:'',
dialogVisible:false,
tonghuadisabled:false,
srcUrl:null,
type:"mp3", type:"mp3",
bitRate:16, bitRate:16,
...@@ -224,6 +240,7 @@ export default { ...@@ -224,6 +240,7 @@ export default {
loadData(text){ loadData(text){
if(text == true){ if(text == true){
this.whetherShow = true; this.whetherShow = true;
this.srcUrl = null;
this.selectCarFleet = ''; this.selectCarFleet = '';
this.selectCarRadioArray = []; this.selectCarRadioArray = [];
...@@ -271,16 +288,11 @@ export default { ...@@ -271,16 +288,11 @@ export default {
}) })
//开启录音 //开启录音
this.recOpen(); this.recOpen();
//页面刚进入时开启长连接
// this.initWebSocket();
// this.heartbeatTimer = setInterval(() => {
// this.reconnect();
// }, 10000)
}else{ }else{
//关闭录音 //关闭录音
this.recClose(); this.recClose();
this.whetherShow = false; this.whetherShow = false;
this.srcUrl = null;
} }
}, },
//获取车辆信息 //获取车辆信息
...@@ -296,6 +308,22 @@ export default { ...@@ -296,6 +308,22 @@ export default {
}; };
}) })
}, },
//页面刚进入时开启长连接
loadData3(){
this.initWebSocket();
this.heartbeatTimer = setInterval(() => {
this.reconnect();
}, 20000)
},
//关闭心跳以及关闭长连接
xintiaoCloseFn(){
//页面销毁时关闭长连接
this.websocketclose();
//关闭心跳
if(this.heartbeatTimer) {
clearInterval(this.heartbeatTimer);
}
},
//车辆多选取消 //车辆多选取消
cancelSelect(index){ cancelSelect(index){
let handleArray = [...this.selectCarRadioArray]; let handleArray = [...this.selectCarRadioArray];
...@@ -308,27 +336,9 @@ export default { ...@@ -308,27 +336,9 @@ export default {
}, },
//发起通知 //发起通知
toNoticeFn(text){ toNoticeFn(text){
HttpReq.truckDispatching.recentNoticeAdd({noticeClass:text,flag:1}).then((res) => { this.dialogTitle = '发起' + text;
if(res.code == 200){ this.dialogTitle1 = text;
this.$notify({ this.dialogVisible = true;
title: text + '发起成功!',
type: 'success',
duration: 2500
});
//近期通知列表
HttpReq.truckDispatching.recentNoticeQuery({size:50,sort:'id,desc',}).then((res) => {
if(res.code == 200){
this.recentNoticeData = res.data.content;
};
})
}else{
this.$notify({
title: res.msg,
type: 'error',
duration: 2500
})
}
}).catch(function(error) { });
}, },
//人工调度和智能调度切换 //人工调度和智能调度切换
todispatchChange(){ todispatchChange(){
...@@ -492,11 +502,32 @@ export default { ...@@ -492,11 +502,32 @@ export default {
}, },
//WebSocket数据接收 //WebSocket数据接收
websocketonmessage(e){ websocketonmessage(e){
console.log("ee",e); console.log("e",e);
if(e == undefined){
return
}else{
let obj1 = JSON.parse(e.data);
HttpReq.truckDispatching.recentNoticeAdd({noticeClass:obj1.fromUserId,flag:1,videoContent:obj1.contentText}).then((res) => {
if(res.code == 200){
//近期通知列表
HttpReq.truckDispatching.recentNoticeQuery({size:50,sort:'id,desc',}).then((res) => {
if(res.code == 200){
this.recentNoticeData = res.data.content;
};
})
}else{
this.$notify({
title: res.msg,
type: 'error',
duration: 2500
})
}
}).catch(function(error) { });
}
}, },
//WebSocket数据发送 //WebSocket数据发送
websocketsend(agentData){ websocketsend(agentData){
this.websock.send(agentData); this.websocket.send(agentData);
}, },
//WebSocket关闭 //WebSocket关闭
websocketclose(e){ websocketclose(e){
...@@ -578,6 +609,7 @@ export default { ...@@ -578,6 +609,7 @@ export default {
type: 'success', type: 'success',
duration: 5000 duration: 5000
}); });
this.tonghuadisabled = true;
}, },
recPause:function(){ recPause:function(){
...@@ -627,6 +659,7 @@ export default { ...@@ -627,6 +659,7 @@ export default {
This.reclog("录音失败:"+s,1); This.reclog("录音失败:"+s,1);
}); });
this.recOpen(); this.recOpen();
this.tonghuadisabled = false;
}, },
...@@ -645,7 +678,6 @@ export default { ...@@ -645,7 +678,6 @@ export default {
}) })
carNumberString = carNumberString + 'pcBigScreen'; carNumberString = carNumberString + 'pcBigScreen';
this.carAllNumberString = carNumberString; this.carAllNumberString = carNumberString;
var This=this; var This=this;
if(!this.recLogLast){ if(!this.recLogLast){
this.reclog("请先录音,然后停止后再上传",1); this.reclog("请先录音,然后停止后再上传",1);
...@@ -692,8 +724,24 @@ export default { ...@@ -692,8 +724,24 @@ export default {
// xhr.send(postData); // xhr.send(postData);
//发送语音数据 //发送语音数据
if (This.websocket.readyState === 1) { // that.websock.readyState = 1 表示连接成功,可以立即发送信息 if (This.websocket.readyState === 1) { // that.websock.readyState = 1 表示连接成功,可以立即发送信息
//console.log(`{"toUserId":"${This.userName1}","contentText":"${postData}"}`); This.websocketsend(`{"toUserId":"${This.carAllNumberString}","contentText":"${postData}","fromUserId":"${This.dialogTitle1}"}`);
This.websocketsend(`{"toUserId":"${This.carAllNumberString}","contentText":"${postData}","fromUserId":"调度中心大屏"}`); //上传到数据库
HttpReq.truckDispatching.recentNoticeAdd({noticeClass:This.dialogTitle1,flag:1,videoContent:postData}).then((res) => {
if(res.code == 200){
//近期通知列表
HttpReq.truckDispatching.recentNoticeQuery({size:50,sort:'id,desc',}).then((res) => {
if(res.code == 200){
This.recentNoticeData = res.data.content;
};
})
}else{
this.$notify({
title: res.msg,
type: 'error',
duration: 2500
})
}
}).catch(function(error) { });
This.$notify({ This.$notify({
title: '上传成功!', title: '上传成功!',
type: 'success', type: 'success',
...@@ -702,7 +750,23 @@ export default { ...@@ -702,7 +750,23 @@ export default {
} else if (This.websocket.readyState === 0) { // 表示正在连接,设置300ms后发送信息 } else if (This.websocket.readyState === 0) { // 表示正在连接,设置300ms后发送信息
setTimeout(function () { setTimeout(function () {
This.websocketsend(`{"toUserId":"${This.carAllNumberString}","contentText":"${postData}","fromUserId":"调度中心大屏"}`); This.websocketsend(`{"toUserId":"${This.carAllNumberString}","contentText":"${postData}","fromUserId":"${This.dialogTitle1}"}`);
HttpReq.truckDispatching.recentNoticeAdd({noticeClass:This.dialogTitle1,flag:1,videoContent:postData}).then((res) => {
if(res.code == 200){
//近期通知列表
HttpReq.truckDispatching.recentNoticeQuery({size:50,sort:'id,desc',}).then((res) => {
if(res.code == 200){
This.recentNoticeData = res.data.content;
};
})
}else{
this.$notify({
title: res.msg,
type: 'error',
duration: 2500
})
}
}).catch(function(error) { });
This.$notify({ This.$notify({
title: '上传成功!', title: '上传成功!',
type: 'success', type: 'success',
...@@ -712,7 +776,23 @@ export default { ...@@ -712,7 +776,23 @@ export default {
} else { // 连接未创建或者创建失败,则重新创建连接,并设置500ms后发送信息 } else { // 连接未创建或者创建失败,则重新创建连接,并设置500ms后发送信息
This.initWebSocket(); This.initWebSocket();
setTimeout(function () { setTimeout(function () {
This.websocketsend(`{"toUserId":"${This.carAllNumberString}","contentText":"${postData}","fromUserId":"调度中心大屏"}`); This.websocketsend(`{"toUserId":"${This.carAllNumberString}","contentText":"${postData}","fromUserId":"${This.dialogTitle1}"}`);
HttpReq.truckDispatching.recentNoticeAdd({noticeClass:This.dialogTitle1,flag:1,videoContent:postData}).then((res) => {
if(res.code == 200){
//近期通知列表
HttpReq.truckDispatching.recentNoticeQuery({size:50,sort:'id,desc',}).then((res) => {
if(res.code == 200){
This.recentNoticeData = res.data.content;
};
})
}else{
this.$notify({
title: res.msg,
type: 'error',
duration: 2500
})
}
}).catch(function(error) { });
This.$notify({ This.$notify({
title: '上传成功!', title: '上传成功!',
type: 'success', type: 'success',
...@@ -722,6 +802,7 @@ export default { ...@@ -722,6 +802,7 @@ export default {
} }
}; };
reader.readAsDataURL(blob); reader.readAsDataURL(blob);
this.dialogVisible = false;
}, },
...@@ -813,10 +894,11 @@ export default { ...@@ -813,10 +894,11 @@ export default {
this.waitDialogClickFn(); this.waitDialogClickFn();
}, },
selectSituation(item){ selectSituation(item){
this.recClose(); console.log(item);
//this.recClose();
// Blobdata 就是后端返回给你的Blob数据 // Blobdata 就是后端返回给你的Blob数据
const reader = new FileReader(); const reader = new FileReader();
const booo = new Blob([item.contentText]); const booo = new Blob([item.videoContent]);
reader.readAsArrayBuffer(booo); reader.readAsArrayBuffer(booo);
reader.onload = (e) => { reader.onload = (e) => {
const bufer = e.srcElement.result; const bufer = e.srcElement.result;
...@@ -897,11 +979,11 @@ export default { ...@@ -897,11 +979,11 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
//页面销毁时关闭长连接 //页面销毁时关闭长连接
this.websocketclose(); // this.websocketclose();
//关闭心跳 //关闭心跳
if(this.heartbeatTimer) { // if(this.heartbeatTimer) {
clearInterval(this.heartbeatTimer); // clearInterval(this.heartbeatTimer);
} // }
}, },
} }
</script> </script>
......
...@@ -122,8 +122,11 @@ export default { ...@@ -122,8 +122,11 @@ export default {
this.topSmallTitleRightData = rightTemporaryData; this.topSmallTitleRightData = rightTemporaryData;
} }
}) })
//开启websocket
this.$refs.intelligentSchedulMethod.loadData3();
}) })
}, },
//选择展示模块
changeOver(item){ changeOver(item){
this.selectModule = item.componentName; this.selectModule = item.componentName;
if(item.componentName == 'dataScreening'){ if(item.componentName == 'dataScreening'){
...@@ -313,7 +316,10 @@ export default { ...@@ -313,7 +316,10 @@ export default {
}, },
beforeDestroy(){ beforeDestroy(){
this.timer = null; this.$refs.intelligentSchedulMethod.xintiaoCloseFn();
if(this.timer) {
clearInterval(this.timer);
}
} }
} }
</script> </script>
......
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