微工厂大屏update

This commit is contained in:
hzz 2023-12-14 16:48:15 +08:00
parent 179580ae87
commit 93f83084b2
3 changed files with 49 additions and 27 deletions

View File

@ -1,17 +1,26 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="" class="dark"> <html lang="" class="dark">
<head>
<meta charset="utf-8"> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="/bt_favicon.ico"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><%= htmlWebpackPlugin.options.title %></title> <link rel="shortcut icon" href="/bt_favicon.ico">
</head> <meta http-equiv="pragram" content="no-cache">
<body> <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
<noscript> <meta http-equiv="expires" content="0">
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <title>
</noscript> <%= htmlWebpackPlugin.options.title %>
<div id="app"></div> </title>
<!-- built files will be auto injected --> </head>
</body>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html> </html>

View File

@ -28,9 +28,7 @@
<div style="width: 50%;height: 100%;display: flex;justify-content: center;align-items: center;"> <div style="width: 50%;height: 100%;display: flex;justify-content: center;align-items: center;">
<div <div
style="width:24px;height:24px;border-radius: 50%;" style="width:24px;height:24px;border-radius: 50%;"
:style="{ :style="{backgroundColor: status_color[i.status]}"
backgroundColor: status_color[i.status]
}"
> >
</div> </div>
</div> </div>

View File

@ -158,7 +158,7 @@ function getmDevList() {
if (devObj.hasOwnProperty(key)) { if (devObj.hasOwnProperty(key)) {
let online = 0; let online = 0;
devObj[key].list = data[key].map((item: any, i: number) => { devObj[key].list = data[key].map((item: any, i: number) => {
if (item.status != 'false' || item.status != '0') { if (item.status != 'false' && item.status != '0') {
online++ online++
} }
let temp = item.status let temp = item.status
@ -175,7 +175,7 @@ function getmDevList() {
if (key == '后整设备') { if (key == '后整设备') {
let online = 0; let online = 0;
hzdata.value = data[key].map((item: any, i: number) => { hzdata.value = data[key].map((item: any, i: number) => {
if (item.status != 'false' || item.status != '0') { if (item.status != 'false' && item.status != '0') {
online++ online++
} }
let temp = item.status let temp = item.status
@ -225,12 +225,12 @@ function changestatus(val) {
return item.num == val.num return item.num == val.num
}) })
if (hzdataIndex !== -1 && hzdata.value[hzdataIndex].status != val.status) { if (hzdataIndex !== -1 && hzdata.value[hzdataIndex].status != val.status) {
hzdata.value[hzdataIndex].status = val.status if (hzdata.value[hzdataIndex].status != 0 && val.status == '0') {
if (val.status == '0') {
stepList[3].online -= 1 stepList[3].online -= 1
} else { } else if (hzdata.value[hzdataIndex].status == 0 && val.status != '0') {
stepList[3].online += 1 stepList[3].online += 1
} }
hzdata.value[hzdataIndex].status = val.status
} }
} else { } else {
@ -238,12 +238,13 @@ function changestatus(val) {
return item[2] == val.num return item[2] == val.num
}) })
if (dataIndex !== -1 && devObj[val.step].list[dataIndex][3] != val.status) { if (dataIndex !== -1 && devObj[val.step].list[dataIndex][3] != val.status) {
devObj[val.step].list[dataIndex][3] = val.status if (devObj[val.step].list[dataIndex][3] != 0 && val.status == '0') {
if (val.status == '0') {
stepList[statusObj[val.step]].online -= 1 stepList[statusObj[val.step]].online -= 1
} else { } else if (devObj[val.step].list[dataIndex][3] == 0 && val.status != '0') {
stepList[statusObj[val.step]].online += 1 stepList[statusObj[val.step]].online += 1
} }
devObj[val.step].list[dataIndex][3] = val.status
} }
} }
} }
@ -275,12 +276,26 @@ function errWebsocket(val) {
onMounted(() => { onMounted(() => {
getDeviceProduction() getDeviceProduction()
getmDevList() getmDevList()
timer = setInterval(() => { timer = setInterval(() => {
getDeviceProduction() getDeviceProduction()
getmDevList() getmDevList()
}, 60*1000) }, 60 * 1000)
// setInterval(() => {
// let status = Math.round(Math.random() * 3)
// let val = {
// step: '',
// num: 31,
// status: status
// }
// changestatus(val)
// }, 5000)
connectWebsocket(null, null, getWebsocket, errWebsocket) connectWebsocket(null, null, getWebsocket, errWebsocket)
document.getElementById('app').style.backgroundColor = 'rgba(0, 11, 18, 1)' document.getElementById('app').style.backgroundColor = 'rgba(0, 11, 18, 1)'
}) })