Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
卡
卡车调度系统
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
caicaicai
卡车调度系统
Commits
648e0332
Commit
648e0332
authored
Apr 14, 2022
by
caicaicai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
176ac645
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
index.vue
...iews/MLargeScreen/components/intelligentSchedul/index.vue
+29
-5
No files found.
src/views/MLargeScreen/components/intelligentSchedul/index.vue
View file @
648e0332
...
@@ -135,6 +135,7 @@ import * as echarts from 'echarts';
...
@@ -135,6 +135,7 @@ import * as echarts from 'echarts';
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
heartbeatTimer
:
null
,
websocket
:
null
,
websocket
:
null
,
whetherShow
:
false
,
whetherShow
:
false
,
selectCarFleet
:
''
,
//搜索对应车队
selectCarFleet
:
''
,
//搜索对应车队
...
@@ -149,10 +150,7 @@ export default {
...
@@ -149,10 +150,7 @@ export default {
dispatchBtnTitle1
:
'
人工调度
'
,
dispatchBtnTitle1
:
'
人工调度
'
,
}
}
},
},
created
(){
created
(){
},
//页面刚进入时开启长连接
this
.
initWebSocket
();
},
mounted
()
{
},
mounted
()
{
},
methods
:
{
methods
:
{
//获取总数据
//获取总数据
...
@@ -204,6 +202,13 @@ export default {
...
@@ -204,6 +202,13 @@ export default {
//车辆区域分布Echarts
//车辆区域分布Echarts
this
.
carsAreaDistributionEcharts
();
this
.
carsAreaDistributionEcharts
();
})
})
//页面刚进入时开启长连接
this
.
initWebSocket
();
this
.
heartbeatTimer
=
setInterval
(()
=>
{
this
.
reconnect
();
},
10000
)
}
else
{
}
else
{
this
.
whetherShow
=
false
;
this
.
whetherShow
=
false
;
}
}
...
@@ -399,12 +404,13 @@ export default {
...
@@ -399,12 +404,13 @@ export default {
//初始化weosocket
//初始化weosocket
initWebSocket
(){
initWebSocket
(){
//const wsuri = "ws://114.116.108.246:81/websocket/socketServer?userId="+userId;//连接地址,可加参数
//const wsuri = "ws://114.116.108.246:81/websocket/socketServer?userId="+userId;//连接地址,可加参数
const
wsuri
=
process
.
env
.
VUE_APP_WS_API
+
"
/
"
+
7
;
const
wsuri
=
process
.
env
.
VUE_APP_WS_API
+
"
/
"
+
'
pcBigScreen
'
;
this
.
websocket
=
new
WebSocket
(
wsuri
);
this
.
websocket
=
new
WebSocket
(
wsuri
);
this
.
websocket
.
onopen
=
this
.
websocketonopen
;
this
.
websocket
.
onopen
=
this
.
websocketonopen
;
this
.
websocket
.
onerror
=
this
.
websocketonerror
;
this
.
websocket
.
onerror
=
this
.
websocketonerror
;
this
.
websocket
.
onmessage
=
this
.
websocketonmessage
;
this
.
websocket
.
onmessage
=
this
.
websocketonmessage
;
this
.
websocket
.
onclose
=
this
.
websocketclose
;
this
.
websocket
.
onclose
=
this
.
websocketclose
;
this
.
websocketonmessage
();
},
},
//WebSocket连接成功
//WebSocket连接成功
websocketonopen
()
{
websocketonopen
()
{
...
@@ -429,11 +435,29 @@ export default {
...
@@ -429,11 +435,29 @@ export default {
websocketclose
(
e
){
websocketclose
(
e
){
console
.
log
(
"
connection closed (
"
+
e
.
code
+
"
)
"
);
console
.
log
(
"
connection closed (
"
+
e
.
code
+
"
)
"
);
},
},
//WebSocket重连
reconnect
(){
var
This
=
this
;
if
(
this
.
websocket
.
readyState
===
1
)
{
// that.websock.readyState = 1 表示连接成功,可以立即发送信息
This
.
websocketonmessage
();
}
else
if
(
this
.
websocket
.
readyState
===
0
)
{
// 表示正在连接,设置300ms后发送信息
setTimeout
(
function
()
{
This
.
websocketonmessage
();
},
300
);
}
else
{
// 连接未创建或者创建失败,则重新创建连接,并设置500ms后发送信息
This
.
initWebSocket
();
setTimeout
(
function
()
{
This
.
websocketonmessage
();
},
500
);
}
},
},
},
destroyed
:
function
()
{
destroyed
:
function
()
{
//页面销毁时关闭长连接
//页面销毁时关闭长连接
this
.
websocketclose
();
this
.
websocketclose
();
//关闭心跳
this
.
heartbeatTimer
=
null
;
},
},
}
}
</
script
>
</
script
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment