微工厂大屏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>
<html lang="" class="dark">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="shortcut icon" href="/bt_favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<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>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="shortcut icon" href="/bt_favicon.ico">
<meta http-equiv="pragram" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="expires" content="0">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
</head>
<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>

View File

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

View File

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