Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kanban-nanjing-11
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
caolun
kanban-nanjing-11
Commits
53af05fa
Commit
53af05fa
authored
Jun 02, 2024
by
xcc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加工位选择
parent
11da8045
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
168 additions
and
164 deletions
+168
-164
index1.html
index1.html
+168
-164
No files found.
index1.html
View file @
53af05fa
...
...
@@ -59,6 +59,7 @@
<script>
let
codeDianshi
=
'
1194168167242801152
'
new
Vue
({
el
:
'
#app
'
,
vuetify
:
new
Vuetify
(),
...
...
@@ -150,17 +151,174 @@
]
}),
created
(){
this
.
getSite
();
},
methods
:
{
// 工位切换
gongweiFunc
(
o
,
i
){
getSite
(){
fetch
(
'
http://127.0.0.1:8180/stage-api/base/site/selectListSite
'
,
{
method
:
'
GET
'
,
headers
:
{
'
Authorization
'
:
'
Bearer_
b3e1b7b2-51c8-451b-944b-dccf3491ad32
'
}})
{
method
:
'
GET
'
,
headers
:
{
'
Authorization
'
:
'
Bearer_
4b33504b-9b9a-4b93-8f1c-87729b9282d1
'
}})
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
this
.
gongweiList
=
data
.
data
.
map
((
o
)
=>
Object
.
assign
({},
o
,{
active
:
false
,
lable
:
o
.
siteName
}));
})
.
catch
(
error
=>
console
.
error
(
'
Error:
'
,
error
));
// this.gongweiList= ( JSON.parse(JSON.stringify(this.gongweiList)) ).map((o)=> Object.assign({},o,{active:false}) )
},
initWebSocket
(){
console
.
log
(
'
1111+++=
'
+
codeDianshi
)
var
iframe1
=
document
.
getElementById
(
'
myiframe1
'
).
contentWindow
;
var
iframe2
=
document
.
getElementById
(
'
myiframe2
'
).
contentWindow
;
var
iframe3
=
document
.
getElementById
(
'
myiframe3
'
).
contentWindow
;
let
bwsState
=
0
;
// bwsWebSocket 状态
let
wsState
=
0
;
// wsWebSocket 状态
function
initUlocWebsocketFunc
()
{
// 生产工位websocket
// 初始化
const
ws
=
new
WebSocket
(
'
ws://127.0.0.1:10001/order/ulocScreen/
'
+
codeDianshi
);
//监听是否连接成功
ws
.
onopen
=
function
()
{
wsState
=
ws
.
readyState
// console.log('ws连接状态:' + ws.readyState);
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
false
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
}
// 接听服务器发回的信息并处理展示
ws
.
onmessage
=
function
(
option
=
{})
{
// console.log('ws收到消息');
// console.log('ws连接状态:' + ws.readyState);
wsState
=
ws
.
readyState
const
{
data
=
"
{}
"
}
=
option
const
_data
=
JSON
.
parse
(
data
)
// console.log(_data);
iframe1
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
}
// 监听连接关闭事件
ws
.
onclose
=
function
()
{
wsState
=
ws
.
readyState
// 监听整个过程中websocket的状态
// console.log('ws连接关闭状态:' + ws.readyState);
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
true
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
}
// 监听并处理error事件
ws
.
onerror
=
function
(
error
)
{
wsState
=
ws
.
readyState
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
true
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
// console.log('错误error' + error);
// console.log('错误:ws连接状态:' + ws.readyState);
}
}
function
initBroadcastWebsocketFunc
()
{
// 公告消息websocket
// 初始化
const
broadcastWs
=
new
WebSocket
(
'
ws://127.0.0.1:10001/base/ulocBroadcastWebsocket/
'
+
codeDianshi
);
//监听是否连接成功
broadcastWs
.
onopen
=
function
()
{
bwsState
=
broadcastWs
.
readyState
;
// console.log('bws连接状态:' + broadcastWs.readyState);
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
false
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
}
// 接听服务器发回的信息并处理展示
broadcastWs
.
onmessage
=
function
(
option
=
{})
{
// console.log('bws收到信息');
// console.log('bws连接状态:' + broadcastWs.readyState);
bwsState
=
broadcastWs
.
readyState
const
{
data
=
"
{}
"
}
=
option
const
_data
=
JSON
.
parse
(
data
)
// console.log(_data);
iframe1
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
}
// 监听连接关闭事件
broadcastWs
.
onclose
=
function
()
{
bwsState
=
broadcastWs
.
readyState
// 监听整个过程中websocket的状态
// console.log('bws连接关闭状态:' + broadcastWs.readyState);
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
true
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
}
// 监听并处理error事件
broadcastWs
.
onerror
=
function
(
error
)
{
bwsState
=
broadcastWs
.
readyState
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
true
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
// console.log('错误error' + error);
// console.log('错误:bws连接状态:' + broadcastWs.readyState);
}
}
// websokes 连接
function
WebSocketInitHandle
()
{
//清除interval定时器
if
(
window
.
IntervalItemCenter13
)
{
clearInterval
(
window
.
IntervalItemCenter13
);
}
setTimeout
(()
=>
{
initUlocWebsocketFunc
()
// 初始化
initBroadcastWebsocketFunc
()
// 初始化
// $("#selectCodeContainer").css("z-index",-999)
window
.
IntervalItemCenter13
=
setInterval
(()
=>
{
// console.log('111==='+wsState+'222==='+bwsState);
if
(
wsState
!=
1
||
bwsState
!=
1
)
{
initUlocWebsocketFunc
()
// 初始化
initBroadcastWebsocketFunc
()
// 初始化
}
},
(
1000
*
10
))
},
500
)
}
// 初始化
setTimeout
(()
=>
{
WebSocketInitHandle
()
},
500
);
},
// 工位切换
gongweiFunc
(
o
,
i
){
this
.
gongweiList
=
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
gongweiList
))
).
map
((
o
)
=>
Object
.
assign
({},
o
,{
active
:
false
})
)
this
.
$nextTick
(()
=>
{
const
_data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
gongweiList
))
...
...
@@ -178,14 +336,10 @@
},
// 确定
submit1
(){
const
_data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
gongweiList
)).
filter
(
o
=>
o
.
active
)
// 选中值
console
.
log
(
_data
)
this
.
showDilog
=
false
codeDianshi
=
_data
[
0
].
tmBasSiteId
;
this
.
initWebSocket
();
this
.
showDilog
=
false
;
this
.
$nextTick
(()
=>
{
// 显示第一个 ifream
$
(
"
#myiframe1
"
).
removeClass
(
"
hidden
"
)
...
...
@@ -194,165 +348,15 @@
}
}
})
</script>
$
(
document
).
ready
(
function
()
{
<script>
$
(
document
).
ready
(
function
()
{
var
iframe1
=
document
.
getElementById
(
'
myiframe1
'
).
contentWindow
;
var
iframe2
=
document
.
getElementById
(
'
myiframe2
'
).
contentWindow
;
var
iframe3
=
document
.
getElementById
(
'
myiframe3
'
).
contentWindow
;
const
codeDianshi
=
'
1194168167242801152
'
let
bwsState
=
0
;
// bwsWebSocket 状态
let
wsState
=
0
;
// wsWebSocket 状态
});
function
initUlocWebsocketFunc
()
{
// 生产工位websocket
// 初始化
const
ws
=
new
WebSocket
(
'
ws://127.0.0.1:10001/order/ulocScreen/
'
+
codeDianshi
);
//监听是否连接成功
ws
.
onopen
=
function
()
{
wsState
=
ws
.
readyState
console
.
log
(
'
ws连接状态:
'
+
ws
.
readyState
);
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
false
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
}
// 接听服务器发回的信息并处理展示
ws
.
onmessage
=
function
(
option
=
{})
{
console
.
log
(
'
ws收到消息
'
);
console
.
log
(
'
ws连接状态:
'
+
ws
.
readyState
);
wsState
=
ws
.
readyState
const
{
data
=
"
{}
"
}
=
option
const
_data
=
JSON
.
parse
(
data
)
console
.
log
(
_data
);
iframe1
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
}
// 监听连接关闭事件
ws
.
onclose
=
function
()
{
wsState
=
ws
.
readyState
// 监听整个过程中websocket的状态
console
.
log
(
'
ws连接关闭状态:
'
+
ws
.
readyState
);
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
true
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
}
// 监听并处理error事件
ws
.
onerror
=
function
(
error
)
{
wsState
=
ws
.
readyState
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
true
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
console
.
log
(
'
错误error
'
+
error
);
console
.
log
(
'
错误:ws连接状态:
'
+
ws
.
readyState
);
}
}
function
initBroadcastWebsocketFunc
()
{
// 公告消息websocket
// 初始化
const
broadcastWs
=
new
WebSocket
(
'
ws://127.0.0.1:10001/base/ulocBroadcastWebsocket/
'
+
codeDianshi
);
//监听是否连接成功
broadcastWs
.
onopen
=
function
()
{
bwsState
=
broadcastWs
.
readyState
;
console
.
log
(
'
bws连接状态:
'
+
broadcastWs
.
readyState
);
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
false
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
}
// 接听服务器发回的信息并处理展示
broadcastWs
.
onmessage
=
function
(
option
=
{})
{
console
.
log
(
'
bws收到信息
'
);
console
.
log
(
'
bws连接状态:
'
+
broadcastWs
.
readyState
);
bwsState
=
broadcastWs
.
readyState
const
{
data
=
"
{}
"
}
=
option
const
_data
=
JSON
.
parse
(
data
)
console
.
log
(
_data
);
iframe1
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_data
),
'
*
'
);
}
// 监听连接关闭事件
broadcastWs
.
onclose
=
function
()
{
bwsState
=
broadcastWs
.
readyState
// 监听整个过程中websocket的状态
console
.
log
(
'
bws连接关闭状态:
'
+
broadcastWs
.
readyState
);
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
true
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
}
// 监听并处理error事件
broadcastWs
.
onerror
=
function
(
error
)
{
bwsState
=
broadcastWs
.
readyState
var
_json1
=
{
type
:
'
conStatusChange
'
,
newStatus
:
true
}
iframe1
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe2
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
iframe3
.
postMessage
(
JSON
.
stringify
(
_json1
),
'
*
'
);
console
.
log
(
'
错误error
'
+
error
);
console
.
log
(
'
错误:bws连接状态:
'
+
broadcastWs
.
readyState
);
}
}
// websokes 连接
function
WebSocketInitHandle
()
{
//清除interval定时器
if
(
window
.
IntervalItemCenter13
)
{
clearInterval
(
window
.
IntervalItemCenter13
);
}
setTimeout
(()
=>
{
initUlocWebsocketFunc
()
// 初始化
initBroadcastWebsocketFunc
()
// 初始化
// $("#selectCodeContainer").css("z-index",-999)
window
.
IntervalItemCenter13
=
setInterval
(()
=>
{
console
.
log
(
'
111===
'
+
wsState
+
'
222===
'
+
bwsState
);
if
(
wsState
!=
1
||
bwsState
!=
1
)
{
initUlocWebsocketFunc
()
// 初始化
initBroadcastWebsocketFunc
()
// 初始化
}
},
(
1000
*
10
))
},
500
)
</script>
}
// 初始化
setTimeout
(()
=>
{
WebSocketInitHandle
()
},
500
);
});
</script>
</body>
</html>
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