代码提交

This commit is contained in:
luoshiwen 2025-06-04 11:25:09 +08:00
parent 54a967b8b9
commit bb61d5f03b
33 changed files with 650 additions and 469 deletions

BIN
dist.zip Normal file

Binary file not shown.

BIN
dist1.zip Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
172.16.1.106:5005 172.16.1.117:5005

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,123 +1,120 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head>
<head> <meta charset="utf-8">
<meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Unity WebGL Player | U3D_TobaccoWarehouseISMDTSystem</title>
<title>Unity WebGL Player | U3D_TobaccoWarehouseISMDTSystem</title> <link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="shortcut icon" href="TemplateData/favicon.ico"> <link rel="stylesheet" href="TemplateData/style.css">
<link rel="stylesheet" href="TemplateData/style.css"> </head>
</head> <body>
<div id="unity-container" class="unity-desktop" style="width: 100%;height: 100%;">
<body> <canvas id="unity-canvas" style="width: 100%;height: 100%;" tabindex="-1"></canvas>
<div id="unity-container" class="unity-desktop" style="width: 100%;height: 100%;"> <div id="unity-loading-bar">
<canvas id="unity-canvas" style="width: 100%;height: 100%;" tabindex="-1"></canvas> <div id="unity-logo"></div>
<div id="unity-loading-bar"> <div id="unity-progress-bar-empty">
<div id="unity-logo"></div> <div id="unity-progress-bar-full"></div>
<div id="unity-progress-bar-empty"> </div>
<div id="unity-progress-bar-full"></div> </div>
<div id="unity-warning"> </div>
<div id="unity-footer">
<div id="unity-webgl-logo"></div>
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title">U3D_TobaccoWarehouseISMDTSystem</div>
</div> </div>
</div> </div>
<div id="unity-warning"> </div> <script>
<!-- <div id="unity-footer">
<div id="unity-webgl-logo"></div>
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title">U3D_TobaccoWarehouseISMDTSystem</div>
</div> -->
</div>
<script>
var container = document.querySelector("#unity-container"); var container = document.querySelector("#unity-container");
var canvas = document.querySelector("#unity-canvas"); var canvas = document.querySelector("#unity-canvas");
var loadingBar = document.querySelector("#unity-loading-bar"); var loadingBar = document.querySelector("#unity-loading-bar");
var progressBarFull = document.querySelector("#unity-progress-bar-full"); var progressBarFull = document.querySelector("#unity-progress-bar-full");
var fullscreenButton = document.querySelector("#unity-fullscreen-button"); var fullscreenButton = document.querySelector("#unity-fullscreen-button");
var warningBanner = document.querySelector("#unity-warning"); var warningBanner = document.querySelector("#unity-warning");
var unity
// Shows a temporary message banner/ribbon for a few seconds, or // Shows a temporary message banner/ribbon for a few seconds, or
// a permanent error message on top of the canvas if type=='error'. // a permanent error message on top of the canvas if type=='error'.
// If type=='warning', a yellow highlight color is used. // If type=='warning', a yellow highlight color is used.
// Modify or remove this function to customize the visually presented // Modify or remove this function to customize the visually presented
// way that non-critical warnings and error messages are presented to the // way that non-critical warnings and error messages are presented to the
// user. // user.
function unityShowBanner(msg, type) { function unityShowBanner(msg, type) {
function updateBannerVisibility() { function updateBannerVisibility() {
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none'; warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
}
var div = document.createElement('div');
div.innerHTML = msg;
warningBanner.appendChild(div);
if (type == 'error') div.style = 'background: red; padding: 10px;';
else {
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
setTimeout(function() {
warningBanner.removeChild(div);
updateBannerVisibility();
}, 5000);
}
updateBannerVisibility();
} }
var div = document.createElement('div');
div.innerHTML = msg; var buildUrl = "Build";
warningBanner.appendChild(div); var loaderUrl = buildUrl + "/爆炸图.loader.js";
if (type == 'error') div.style = 'background: red; padding: 10px;'; var config = {
else { dataUrl: buildUrl + "/爆炸图.data.unityweb",
if (type == 'warning') div.style = 'background: yellow; padding: 10px;'; frameworkUrl: buildUrl + "/爆炸图.framework.js.unityweb",
setTimeout(function () { codeUrl: buildUrl + "/爆炸图.wasm.unityweb",
warningBanner.removeChild(div); streamingAssetsUrl: "StreamingAssets",
updateBannerVisibility(); companyName: "DefaultCompany",
}, 5000); productName: "U3D_TobaccoWarehouseISMDTSystem",
productVersion: "0.1",
showBanner: unityShowBanner,
};
// By default, Unity keeps WebGL canvas render target size matched with
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
// Set this to false if you want to decouple this synchronization from
// happening inside the engine, and you would instead like to size up
// the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
container.className = "unity-mobile";
canvas.className = "unity-mobile";
// To lower canvas resolution on mobile devices to gain some
// performance, uncomment the following line:
// config.devicePixelRatio = 1;
} else {
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
// canvas.style.width = "960px";
// canvas.style.height = "600px";
} }
updateBannerVisibility();
}
var buildUrl = "Build"; loadingBar.style.display = "block";
var loaderUrl = buildUrl + "/爆炸图.loader.js"; var script = document.createElement("script");
var config = { script.src = loaderUrl;
dataUrl: buildUrl + "/爆炸图.data.unityweb", script.onload = () => {
frameworkUrl: buildUrl + "/爆炸图.framework.js.unityweb", createUnityInstance(canvas, config, (progress) => {
codeUrl: buildUrl + "/爆炸图.wasm.unityweb", progressBarFull.style.width = 100 * progress + "%";
streamingAssetsUrl: "StreamingAssets", }).then((unityInstance) => {
companyName: "DefaultCompany", window.unity = unityInstance
productName: "U3D_TobaccoWarehouseISMDTSystem", loadingBar.style.display = "none";
productVersion: "0.1", fullscreenButton.onclick = () => {
showBanner: unityShowBanner, unityInstance.SetFullscreen(1);
}; };
}).catch((message) => {
// By default, Unity keeps WebGL canvas render target size matched with alert(message);
// the DOM size of the canvas element (scaled by window.devicePixelRatio) });
// Set this to false if you want to decouple this synchronization from };
// happening inside the engine, and you would instead like to size up //切换小车
// the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
container.className = "unity-mobile";
canvas.className = "unity-mobile";
// To lower canvas resolution on mobile devices to gain some
// performance, uncomment the following line:
// config.devicePixelRatio = 1;
} else {
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
canvas.style.width = "100%";
canvas.style.height = "100%";
}
// loadingBar.style.display = "block";
var unity
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => {
unity = unityInstance
// loadingBar.style.display = "none";
// fullscreenButton.onclick = () => {
// unityInstance.SetFullscreen(1);
// };
}).catch((message) => {
alert(message);
});
};
//切换小车
function changeShuttlebus(data) { function changeShuttlebus(data) {
unity.SendMessage('GameObject', 'Shuttlebus', data) unity.SendMessage('GameObject', 'Shuttlebus', data)
} }
@ -159,9 +156,9 @@
function modelStatus(val) { function modelStatus(val) {
window.parent.modelStatus(val) window.parent.modelStatus(val)
} }
document.body.appendChild(script);
</script> document.body.appendChild(script);
</body>
</script>
</body>
</html> </html>

View File

@ -104,7 +104,7 @@
script.src = loaderUrl; script.src = loaderUrl;
script.onload = () => { script.onload = () => {
createUnityInstance(canvas, config, (progress) => { createUnityInstance(canvas, config, (progress) => {
// progressBarFull.style.width = 100 * progress + "%"; // progressBarFull.style.width = 100 * progress + "%";
// window.parent.getProgress(progress); // window.parent.getProgress(progress);
}).then((unityInstance) => { }).then((unityInstance) => {
unity = unityInstance unity = unityInstance
@ -116,22 +116,48 @@
alert(message); alert(message);
}); });
}; };
//切换模型 //切换小车
function changeModel(data){ function changeShuttlebus(data) {
unity.SendMessage('Controller','Displaymodel',data) unity.SendMessage('GameObject', 'Shuttlebus', data)
} }
function open(){ //提升机1
unity.SendMessage('提升机','Unfold') function changeHoister(data) {
} unity.SendMessage('GameObject', 'Hoister', data)
function close(){ }
unity.SendMessage('提升机','Restore') //提升机2
} function changeHoister2(data) {
function opencar(){ unity.SendMessage('GameObject', 'Hoister2', data)
unity.SendMessage('AGV','Unfold') }
} //快换电池
function closecar(){ function changeBattery(data) {
unity.SendMessage('AGV','Restore') unity.SendMessage('GameObject', 'Battery', data)
} }
// function open() {
// unity.SendMessage('GameObject', 'Unfold')
// }
// function close() {
// unity.SendMessage('提升机', 'Restore')
// }
//大模型爆炸
function opencar() {
unity.SendMessage('GameObject', 'Explode')
}
//大模型还原
function closecar() {
unity.SendMessage('GameObject', 'ResetPositions')
}
//小模型爆炸
function openSmall() {
unity.SendMessage('GameObject', 'Blowup')
}
//小模型还原
function closeSmall() {
unity.SendMessage('GameObject', 'Restore')
}
//接收状态
function modelStatus(val) {
window.parent.modelStatus(val)
}
document.body.appendChild(script); document.body.appendChild(script);
</script> </script>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".unity3d" mimeType="application/octet-stream" />
<mimeMap fileExtension=".unityweb" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>

View File

@ -1 +1 @@
172.16.1.106:5005 172.16.1.117:5005

View File

@ -1,6 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@ -16,218 +15,219 @@
overflow: hidden; overflow: hidden;
} }
</style> </style>
<body> <body>
<div id="unity-container" class="unity-desktop" style="width: 100%;height:100%"> <div id="unity-container" class="unity-desktop" style="width: 100%;height:100%">
<canvas id="unity-canvas" style="width: 100%;height:100%" tabindex="-1"></canvas> <canvas id="unity-canvas" style="width: 100%;height:100%" tabindex="-1"></canvas>
<div id="unity-loading-bar"> <div id="unity-loading-bar">
<div id="unity-logo"></div> <div id="unity-logo"></div>
<div id="unity-progress-bar-empty"> <div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div> <div id="unity-progress-bar-full"></div>
</div>
</div>
<div id="unity-warning"></div>
<div id="unity-footer">
<div id="unity-webgl-logo"></div>
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title">U3D_TobaccoWarehouseISMDTSystem</div>
</div> </div>
</div> </div>
<div id="unity-warning"></div>
<div id="unity-footer">
<div id="unity-webgl-logo"></div>
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title">U3D_TobaccoWarehouseISMDTSystem</div>
</div>
</div>
<button onclick="OpenHtmlMQTT()">Connect</button> <button onclick="OpenHtmlMQTT()">Connect</button>
<button onclick="publishMessage()">Publish</button> <button onclick="publishMessage()">Publish</button>
<button onclick="disconnectMQTT()">Disconnect</button> <button onclick="disconnectMQTT()">Disconnect</button>
<script src="./js/mqtt.min.js"></script> <script src="./js/mqtt.min.js"></script>
<script> <script>
var container = document.querySelector("#unity-container"); var container = document.querySelector("#unity-container");
var canvas = document.querySelector("#unity-canvas"); var canvas = document.querySelector("#unity-canvas");
var loadingBar = document.querySelector("#unity-loading-bar"); var loadingBar = document.querySelector("#unity-loading-bar");
var progressBarFull = document.querySelector("#unity-progress-bar-full"); var progressBarFull = document.querySelector("#unity-progress-bar-full");
var fullscreenButton = document.querySelector("#unity-fullscreen-button"); var fullscreenButton = document.querySelector("#unity-fullscreen-button");
var warningBanner = document.querySelector("#unity-warning"); var warningBanner = document.querySelector("#unity-warning");
// Shows a temporary message banner/ribbon for a few seconds, or // Shows a temporary message banner/ribbon for a few seconds, or
// a permanent error message on top of the canvas if type=='error'. // a permanent error message on top of the canvas if type=='error'.
// If type=='warning', a yellow highlight color is used. // If type=='warning', a yellow highlight color is used.
// Modify or remove this function to customize the visually presented // Modify or remove this function to customize the visually presented
// way that non-critical warnings and error messages are presented to the // way that non-critical warnings and error messages are presented to the
// user. // user.
function unityShowBanner(msg, type) { function unityShowBanner(msg, type) {
function updateBannerVisibility() { function updateBannerVisibility() {
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none'; warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
}
var div = document.createElement('div');
div.innerHTML = msg;
warningBanner.appendChild(div);
if (type == 'error') div.style = 'background: red; padding: 10px;';
else {
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
setTimeout(function () {
warningBanner.removeChild(div);
updateBannerVisibility();
}, 5000);
}
updateBannerVisibility();
} }
var buildUrl = "Build"; var div = document.createElement('div');
var loaderUrl = buildUrl + "/webgl.loader.js"; div.innerHTML = msg;
var config = { warningBanner.appendChild(div);
dataUrl: buildUrl + "/webgl.data.unityweb", if (type == 'error') div.style = 'background: red; padding: 10px;';
frameworkUrl: buildUrl + "/webgl.framework.js.unityweb", else {
codeUrl: buildUrl + "/webgl.wasm.unityweb", if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
streamingAssetsUrl: "StreamingAssets", setTimeout(function () {
companyName: "DefaultCompany", warningBanner.removeChild(div);
productName: "U3D_TobaccoWarehouseISMDTSystem", updateBannerVisibility();
productVersion: "0.1", }, 5000);
showBanner: unityShowBanner,
};
// By default, Unity keeps WebGL canvas render target size matched with
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
// Set this to false if you want to decouple this synchronization from
// happening inside the engine, and you would instead like to size up
// the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
container.className = "unity-mobile";
canvas.className = "unity-mobile";
// To lower canvas resolution on mobile devices to gain some
// performance, uncomment the following line:
// config.devicePixelRatio = 1;
} else {
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
// canvas.style.width = "960px";
// canvas.style.height = "600px";
} }
updateBannerVisibility();
}
var buildUrl = "Build";
var loaderUrl = buildUrl + "/webgl.loader.js";
var config = {
dataUrl: buildUrl + "/webgl.data.unityweb",
frameworkUrl: buildUrl + "/webgl.framework.js.unityweb",
codeUrl: buildUrl + "/webgl.wasm.unityweb",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "U3D_TobaccoWarehouseISMDTSystem",
productVersion: "0.1",
showBanner: unityShowBanner,
};
// By default, Unity keeps WebGL canvas render target size matched with
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
// Set this to false if you want to decouple this synchronization from
// happening inside the engine, and you would instead like to size up
// the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
container.className = "unity-mobile";
canvas.className = "unity-mobile";
// To lower canvas resolution on mobile devices to gain some
// performance, uncomment the following line:
// config.devicePixelRatio = 1;
//----------------------------------------------------------------------------------MQTT----------------------------------------------------------------------------- } else {
let client; // Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
function OpenHtmlMQTT() { // canvas.style.width = "960px";
client = mqtt.connect('ws://10.155.161.49:8083/mqtt'); // canvas.style.height = "600px";
}
client.on('connect', () => {
console.log('连接...');
const devices = [ //----------------------------------------------------------------------------------MQTT-----------------------------------------------------------------------------
"cm1",//去加盖机 let client;
Array.from({ length: 7 }, (_, i) => `elv${i + 1}`),//提升机
Array.from({ length: 7 }, (_, i) => `convoyor510${i + 1}`),//输送机
Array.from({ length: 51 }, (_, i) => `convoyor52${String(i + 1).padStart(2, '0')}`),//输送机
Array.from({ length: 30 }, (_, i) => `convoyor54${String(i + 1).padStart(2, '0')}`),//输送机
Array.from({ length: 4 }, (_, i) => `dpm${i + 1}`),//拆码垛机
Array.from({ length: 2 }, (_, i) => `fxj${i + 1}`),////机械手臂
Array.from({ length: 8 }, (_, i) => `car${i + 1}`),//小车
"fe1",//落地时提升机
Array.from({ length: 2 }, (_, i) => `qcbd${i + 1}`)//快换电池装置
];
devices.forEach(device => { function OpenHtmlMQTT() {
console.log(device); client = mqtt.connect('ws://10.155.161.49:8083/mqtt');
client.subscribe(device, {
onSuccess: () => { client.on('connect', () => {
console.log(`已订阅: ${device}`); console.log('连接...');
},
onFailure: (err) => { const devices = [
console.error(`订阅失败: ${device}:`, err); "cm1",//去加盖机
} Array.from({length: 7}, (_, i) => `elv${i + 1}`),//提升机
}); Array.from({length: 7}, (_, i) => `convoyor510${i + 1}`),//输送机
Array.from({length: 51}, (_, i) => `convoyor52${String(i + 1).padStart(2, '0')}`),//输送机
Array.from({length: 30}, (_, i) => `convoyor54${String(i + 1).padStart(2, '0')}`),//输送机
Array.from({ length: 4 }, (_, i) => `dpm${i + 1}`),//拆码垛机
Array.from({ length: 2 }, (_, i) => `fxj${i + 1}`),////机械手臂
Array.from({length: 8}, (_, i) => `car${i + 1}`),//小车
"fe1",//落地时提升机
Array.from({length: 2}, (_, i) => `qcbd${i + 1}`)//快换电池装置
];
devices.forEach(device => {
console.log(device);
client.subscribe(device, {
onSuccess: () => {
console.log(`已订阅: ${device}`);
},
onFailure: (err) => {
console.error(`订阅失败: ${device}:`, err);
}
}); });
// client.subscribe('car1', (err) => {
// if (!err) {
// console.log('Subscribed to car1');
// }
// });
//
}); });
client.on('message', (topic, message) => {
const mes = JSON.stringify({ device: topic, message: message.toString() }); // client.subscribe('car1', (err) => {
// if (!err) {
// console.log('Subscribed to car1');
// }
// });
//
// console.log(mes); });
unityInstance.SendMessage('APP', 'Message', mes) client.on('message', (topic, message) => {
}); const mes = JSON.stringify({device: topic, message: message.toString()});
client.on('error', (err) => { // console.log(mes);
console.error('Connection error: ', err);
unityInstance.SendMessage('APP', 'Message', mes)
});
client.on('error', (err) => {
console.error('Connection error: ', err);
});
}
function publishMessage() {
if (client) {
client.publish('car1', 'Hello');
}
}
function disconnectMQTT() {
if (client) {
client.end(() => {
console.log('关闭连接');
}); });
} }
}
function publishMessage() { //----------------------------------------------------------------------------------MQTT-----------------------------------------------------------------------------
if (client) {
client.publish('car1', 'Hello');
}
}
function disconnectMQTT() {
if (client) {
client.end(() => {
console.log('关闭连接');
});
}
}
//----------------------------------------------------------------------------------MQTT-----------------------------------------------------------------------------
loadingBar.style.display = "block"; loadingBar.style.display = "block";
var script = document.createElement("script"); var script = document.createElement("script");
script.src = loaderUrl; script.src = loaderUrl;
script.onload = () => { script.onload = () => {
createUnityInstance(canvas, config, (progress) => { createUnityInstance(canvas, config, (progress) => {
progressBarFull.style.width = 100 * progress + "%"; progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => { }).then((unityInstance) => {
loadingBar.style.display = "none"; loadingBar.style.display = "none";
// 为window添加unityInstance对象 // 为window添加unityInstance对象
window.unityInstance = unityInstance window.unityInstance = unityInstance
fullscreenButton.onclick = () => { fullscreenButton.onclick = () => {
unityInstance.SetFullscreen(1); unityInstance.SetFullscreen(1);
}; };
}).catch((message) => { }).catch((message) => {
alert(message); alert(message);
}); });
}; };
function openCar(data) { function openCar(data) {
// console.log(data);
unityInstance.SendMessage('Canvas', 'Popupwindow', data) unityInstance.SendMessage('Canvas', 'Popupwindow', data)
} }
function unityBoxHandle(val) { function unityBoxHandle(val) {
if (val) { if (val) {
unityInstance.SendMessage('Canvas', 'Partialhiding', val) unityInstance.SendMessage('Canvas', 'Partialhiding', val)
} else { } else {
console.log(val,'xxxxxxxxxxx');
unityInstance.SendMessage('Canvas', 'Boxshow') unityInstance.SendMessage('Canvas', 'Boxshow')
} }
} }
document.body.appendChild(script); function hideBox() {
unityInstance.SendMessage('Canvas', 'HiddenBox', '')
}
document.body.appendChild(script);
</script> </script>
</body> </body>
</html> </html>

View File

@ -221,11 +221,14 @@
if (val) { if (val) {
unityInstance.SendMessage('Canvas', 'Partialhiding', val) unityInstance.SendMessage('Canvas', 'Partialhiding', val)
} else { } else {
console.log(val,'xxxxxxxxxxx'); console.log(val, 'xxxxxxxxxxx');
unityInstance.SendMessage('Canvas', 'Boxshow') unityInstance.SendMessage('Canvas', 'Boxshow')
} }
} }
function hideBox() {
unityInstance.SendMessage('Canvas', 'HiddenBox', '')
}
document.body.appendChild(script); document.body.appendChild(script);
</script> </script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -11,6 +11,7 @@ import getPath from "@/utils/getPath";
import { fontSize } from "@/utils/common"; import { fontSize } from "@/utils/common";
const props = defineProps({ const props = defineProps({
dataMap: Object, dataMap: Object,
type:String,
}); });
const chartData = ref({}); const chartData = ref({});
watch( watch(
@ -22,7 +23,7 @@ watch(
}, },
{ deep: true } { deep: true }
); );
console.log(props.dataMap,'props.dataMap');
function initChart() { function initChart() {
let myChart = echarts.init( let myChart = echarts.init(
document.getElementById("classProportion" + props.dataMap.id) document.getElementById("classProportion" + props.dataMap.id)
@ -80,14 +81,13 @@ function initChart() {
// }, // },
{ {
type: "text", type: "text",
name:'name',
z: 100, z: 100,
left: "center", left: "center",
top: "72%", top: "72%",
style: { style: {
fill: "#fff", fill: "#fff",
textAlign: 'left', textAlign: 'left',
text: `${props.dataMap.name.length>7 ? props.dataMap.name.slice(0,7) + '...' : props.dataMap.name}`, text: `${props.dataMap.name.length>14 ? props.dataMap.name.slice(0,14) + '...' : props.dataMap.name}`,
fontSize: `0.8rem`, fontSize: `0.8rem`,
width: 20, width: 20,
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
@ -111,11 +111,12 @@ function initChart() {
{ {
type: "text", type: "text",
z: 100, z: 100,
name:props.dataMap.weight,
left: "center", left: "center",
top: "85%", top: "85%",
style: { style: {
fill: "rgba(255, 206, 84, 1)", fill: "rgba(255, 206, 84, 1)",
text: `${props.dataMap.weight ? props.dataMap.weight : ""}`, text: `${props.dataMap.weight.length>16 ? props.dataMap.weight.slice(0,16) + '...' : props.dataMap.weight}`,
fontSize: `1.1rem`, fontSize: `1.1rem`,
}, },
}, },
@ -168,7 +169,7 @@ function initChart() {
polar: [ polar: [
{ {
center: ["50%", "35%"], // center: ["50%", "35%"], //
radius: ["74%", "67%"], // radius: props.type?["54%", "50%"]:["50%", "46%"], //
}, },
], ],
@ -176,7 +177,7 @@ function initChart() {
{ {
type: "pie", type: "pie",
name: "内层细圆环", name: "内层细圆环",
radius: ["95%", "85%"], radius: props.type?["67%", "60%"]:["67%", "60%"],
center: ["50%", "35%"], center: ["50%", "35%"],
startAngle: 90, startAngle: 90,
hoverAnimation: false, hoverAnimation: false,
@ -219,7 +220,7 @@ function initChart() {
{ {
type: "pie", type: "pie",
name: "内层细圆环", name: "内层细圆环",
radius: ["72%", "67%"], radius: props.type?["54%", "50%"]:["50%", "46%"],
center: ["50%", "35%"], center: ["50%", "35%"],
startAngle: 90, startAngle: 90,
hoverAnimation: false, hoverAnimation: false,

View File

@ -7,7 +7,7 @@
{{ props.title === "维修统计" ? "维修统计" : props.title }} {{ props.title === "维修统计" ? "维修统计" : props.title }}
</div> </div>
<div class="el-select2"> <div class="el-select2" v-if="!props.hideSelect">
<el-select <el-select
v-model="params.facName" v-model="params.facName"
placeholder="请选择" placeholder="请选择"
@ -84,7 +84,7 @@
</el-table> </el-table>
</div> </div>
<!-- 故障分析 --> <!-- 故障分析 -->
<div class="box-content-table" v-else-if="props.title === '故障分析'"> <div class="box-content-table" v-else-if="props.title === '故障分析'||props.title === '维修统计'">
<el-table :data="tableList" style="width: 100%"> <el-table :data="tableList" style="width: 100%">
<el-table-column prop="errorDateTime" label="报错时间" align="center" /> <el-table-column prop="errorDateTime" label="报错时间" align="center" />
<el-table-column prop="facCode" label="设备编码" align="center" /> <el-table-column prop="facCode" label="设备编码" align="center" />
@ -96,7 +96,7 @@
</el-table> </el-table>
</div> </div>
<!-- 维修统计 --> <!-- 维修统计 -->
<div class="box-content-table" v-else-if="props.title === '维修统计'"> <!-- <div class="box-content-table" v-else-if="props.title === '维修统计'">
<el-table :data="tableList" style="width: 100%"> <el-table :data="tableList" style="width: 100%">
<el-table-column prop="errorDateTime" label="故障时间" align="center" /> <el-table-column prop="errorDateTime" label="故障时间" align="center" />
<el-table-column prop="facCode" label="设备编码" align="center" /> <el-table-column prop="facCode" label="设备编码" align="center" />
@ -111,7 +111,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div> -->
<div style="float: right"> <div style="float: right">
<el-pagination <el-pagination
@ -144,6 +144,7 @@ import {
const emit = defineEmits(["close"]); const emit = defineEmits(["close"]);
const props = defineProps({ const props = defineProps({
title: String, title: String,
hideSelect:Boolean
}); });
const tableList = ref([ const tableList = ref([

View File

@ -61,7 +61,9 @@
<div class="box-content-box4"> <div class="box-content-box4">
<div class="title"> <div class="title">
<span>维修统计</span> <span>维修统计</span>
<!-- <span class="more" @click="openDialog"></span> --> <span class="more" @click="openDialog"></span>
<!-- <span class="more" @click="openDialog($event, 1)"></span> -->
</div> </div>
<div class="maintenance"> <div class="maintenance">
<div class="maintenance-left"> <div class="maintenance-left">
@ -97,6 +99,7 @@
@close="receiveMsg" @close="receiveMsg"
v-if="maintenanceDialogShow" v-if="maintenanceDialogShow"
:title="dialogTitle" :title="dialogTitle"
:hideSelect="hideSelect"
/> />
</template> </template>
<script setup> <script setup>
@ -115,6 +118,8 @@ function close() {
emit("closeHealth", -1); emit("closeHealth", -1);
} }
const maintenanceDialogShow = ref(false); const maintenanceDialogShow = ref(false);
//
const hideSelect = ref(false)
const dialogTitle = ref(""); const dialogTitle = ref("");
// //
function receiveMsg(val) { function receiveMsg(val) {
@ -128,16 +133,27 @@ function openDialog(event, val) {
} else { } else {
dialogTitle.value = event.target.previousElementSibling.innerText; dialogTitle.value = event.target.previousElementSibling.innerText;
maintenanceDialogShow.value = true; maintenanceDialogShow.value = true;
hideSelect.value = true
} }
// console.log(event.target.previousElementSibling.innerText); // console.log(event.target.previousElementSibling.innerText);
} }
// ecahrts // ecahrts
function drawHealthIndex(list) { function drawHealthIndex(list) {
const color = [ // const color = [
"rgba(25, 174, 250, 0.7)", // "rgba(25, 174, 250, 0.7)",
"rgba(28, 238, 251, 0.7)", // "rgba(28, 238, 251, 0.7)",
"rgba(255, 206, 84, 0.7)", // "rgba(255, 206, 84, 0.7)",
"rgba(174, 211, 255, 0.7)", // "rgba(174, 211, 255, 0.7)",
// ];
var color = [
"rgba(23, 151, 217, 1)",
// "rgba(28, 238, 251, 1)",
"rgba(255, 215, 0,1)",
// "rgba(0, 245, 194, 1)",
"rgba(255, 255, 224,1)",
// "rgba(0, 245, 194, 1)",
"rgba(28, 238, 251, 1)",
"rgba(255, 192, 203,1)",
]; ];
let result = [] let result = []
let total = list.totalCount; let total = list.totalCount;
@ -287,28 +303,35 @@ function drawHealthIndex(list) {
itemStyle: dataStyle, itemStyle: dataStyle,
hoverAnimation: false, hoverAnimation: false,
startAngle: 90, startAngle: 90,
data:result.map((el) => { data:result.map((el,index) => {
if (el.name === "往复式提升机") { return {
return { value:el.value,
value: el.value, name:el.name,
name: el.name, itemStyle:{
itemStyle: { color:color[index]
normal: { }
color: "rgba(28, 238, 251, 0.62)",
},
},
};
} else {
return {
value: el.value,
name:el.name,
itemStyle: {
normal: {
color: "rgba(4, 132, 189, 0.62)",
},
},
};
} }
// if (el.name === "") {
// return {
// value: el.value,
// name: el.name,
// itemStyle: {
// normal: {
// color: "rgba(28, 238, 251, 0.62)",
// },
// },
// };
// } else {
// return {
// value: el.value,
// name:el.name,
// itemStyle: {
// normal: {
// color: "rgba(4, 132, 189, 0.62)",
// },
// },
// };
// }
}), }),
}, },
], ],
@ -320,11 +343,12 @@ function drawHealthIndex(list) {
} }
// echarts // echarts
function drawSpareParts(list) { function drawSpareParts(list) {
const color = [ var color = [
"rgba(25, 174, 250, 0.7)", "rgba(255, 192, 203,1)",
"rgba(28, 238, 251, 0.7)", "rgba(28, 238, 251, 1)",
"rgba(255, 206, 84, 0.7)", "rgba(255, 255, 224,1)",
"rgba(174, 211, 255, 0.7)", "rgba(255, 215, 0,1)",
"rgba(23, 151, 217, 1)",
]; ];
let result = [] let result = []
let total = list.totalCount; let total = list.totalCount;

View File

@ -128,11 +128,21 @@ const tableList = ref([
]); ]);
// //
function drawLeftChart(list) { function drawLeftChart(list) {
const color = [ // const color = [
"rgba(25, 174, 250, 0.7)", // "rgba(25, 174, 250, 0.7)",
"rgba(28, 238, 251, 0.7)", // "rgba(28, 238, 251, 0.7)",
"rgba(255, 206, 84, 0.7)", // "rgba(255, 206, 84, 0.7)",
"rgba(174, 211, 255, 0.7)", // "rgba(174, 211, 255, 0.7)",
// ];
var color = [
"rgba(23, 151, 217, 1)",
// "rgba(28, 238, 251, 1)",
"rgba(255, 215, 0,1)",
// "rgba(0, 245, 194, 1)",
"rgba(255, 255, 224,1)",
// "rgba(0, 245, 194, 1)",
"rgba(28, 238, 251, 1)",
"rgba(255, 192, 203,1)",
]; ];
let result = []; let result = [];
let total = list.totalCount; let total = list.totalCount;
@ -298,11 +308,18 @@ function drawLeftChart(list) {
} }
// //
function drawRightChart(list) { function drawRightChart(list) {
const color = [ // const color = [
"rgba(25, 174, 250, 0.7)", // "rgba(25, 174, 250, 0.7)",
"rgba(28, 238, 251, 0.7)", // "rgba(28, 238, 251, 0.7)",
"rgba(255, 206, 84, 0.7)", // "rgba(255, 206, 84, 0.7)",
"rgba(174, 211, 255, 0.7)", // "rgba(174, 211, 255, 0.7)",
// ];
var color = [
"rgba(255, 192, 203,1)",
"rgba(28, 238, 251, 1)",
"rgba(255, 255, 224,1)",
"rgba(255, 215, 0,1)",
"rgba(23, 151, 217, 1)",
]; ];
let result = []; let result = [];
let total = list.totalCount; let total = list.totalCount;

View File

@ -10,7 +10,6 @@
<div class="box-content-left-title"> <div class="box-content-left-title">
<span>文件列表</span> <span>文件列表</span>
<!-- 选择框 --> <!-- 选择框 -->
<el-select <el-select
@clear="clearHandle" @clear="clearHandle"
@change="GetPageGuideDocsData(params1.code)" @change="GetPageGuideDocsData(params1.code)"
@ -93,7 +92,13 @@ const params1 = {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
}; };
function addPdf(fileName){
if (fileName.endsWith('.pdf')) {
return fileName
}else{
return fileName + '.pdf'
}
}
// //
async function download(item) { async function download(item) {
const response = await downloadPdf( const response = await downloadPdf(
@ -102,7 +107,7 @@ async function download(item) {
const url = window.URL.createObjectURL(new Blob([response])); const url = window.URL.createObjectURL(new Blob([response]));
const link = document.createElement("a"); const link = document.createElement("a");
link.href = url; link.href = url;
link.setAttribute("download", item.fileName); link.setAttribute("download", addPdf(item.fileName));
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
} }

View File

@ -11,7 +11,7 @@
<div class="swiper"> <div class="swiper">
<transition <transition
:name="btnName" :name="btnName"
v-for="(item, index) in Math.ceil(chartList.length / 8)" v-for="(item, index) in Math.ceil(chartList.length / 6)"
:key="item.id" :key="item.id"
> >
<div <div
@ -20,11 +20,11 @@
> >
<div <div
class="box-content-chart-item" class="box-content-chart-item"
v-for="item in chartList.slice(index * 8, 8 * (index + 1))" v-for="item in chartList.slice(index * 6, 6 * (index + 1))"
:key="item.id" :key="item.id"
> >
<div class="chart"> <div class="chart">
<pieChart :dataMap="item" /> <pieChart :dataMap="item" type="2" />
</div> </div>
<div class="line"></div> <div class="line"></div>
</div> </div>
@ -36,12 +36,15 @@
</div> </div>
<div class="box-content-inBound"> <div class="box-content-inBound">
<div class="box-content-inBound-title"> <div class="box-content-inBound-title">
<span> {{props.title==='入库信息'?'入库信息统计':'出库信息统计'}} </span> <span>
{{ props.title === "入库信息" ? "入库信息统计" : "出库信息统计" }}
</span>
<div> <div>
<ul v-if="storeList"> <ul v-if="storeList">
<li><span>单位</span><span>公斤</span></li> <li><span>单位</span><span>公斤</span></li>
<li> <li>
<span>总量</span><span>{{ formatNumber(storeList.totalWeight) }}</span> <span>总量</span
><span>{{ formatNumber(storeList.totalWeight) }}</span>
</li> </li>
<li> <li>
<span>品牌总量</span><span>{{ storeList.brandNum }}</span> <span>品牌总量</span><span>{{ storeList.brandNum }}</span>
@ -223,7 +226,7 @@ function getChartList() {
kg: ele.number + "箱", kg: ele.number + "箱",
name: ele.name, name: ele.name,
value: (ele.percentage * 100).toFixed(2), value: (ele.percentage * 100).toFixed(2),
weight: ele.weight + '公斤', weight: ele.weight + "公斤",
msg: true, msg: true,
}; };
}); });
@ -236,7 +239,8 @@ function getChartList() {
kg: ele.number + "箱", kg: ele.number + "箱",
name: ele.name, name: ele.name,
value: (ele.percentage * 100).toFixed(2), value: (ele.percentage * 100).toFixed(2),
weight: ele.weight + '公斤', // weight: ele.weight +'0000000000' + '',
weight: ele.weight + "公斤",
msg: true, msg: true,
}; };
}); });
@ -278,14 +282,14 @@ function getAllBrandName(boolean) {
params.brandName = brandList.value[0]; params.brandName = brandList.value[0];
getBrandChart(); getBrandChart();
// //
getChartList() getChartList();
}); });
} else { } else {
getOutBrandNames(params).then((res) => { getOutBrandNames(params).then((res) => {
brandList.value = res.result; brandList.value = res.result;
params.brandName = brandList.value[0]; params.brandName = brandList.value[0];
getBrandChart(); getBrandChart();
getChartList() getChartList();
}); });
} }
} }
@ -307,22 +311,22 @@ function getBrandChart(boolean) {
if (props.title === "入库信息") { if (props.title === "入库信息") {
getBrandTimeCount(params).then((res) => { getBrandTimeCount(params).then((res) => {
drawBarChart(res.result); drawBarChart(res.result);
getChartList() getChartList();
getStoreDetail() getStoreDetail();
getBrandNames(params).then((res) => { getBrandNames(params).then((res) => {
brandList.value = res.result; brandList.value = res.result;
params.brandName = brandList.value[0]; params.brandName = brandList.value[0];
}); });
}); });
} else { } else {
getOutBrandTimeCount(params).then((res) => { getOutBrandTimeCount(params).then((res) => {
drawBarChart(res.result); drawBarChart(res.result);
getChartList() getChartList();
getStoreDetail() getStoreDetail();
getOutBrandNames(params).then((res) => { getOutBrandNames(params).then((res) => {
brandList.value = res.result; brandList.value = res.result;
params.brandName = brandList.value[0]; params.brandName = brandList.value[0];
}); });
}); });
} }
} }
@ -376,11 +380,27 @@ function drawBarChart(res) {
show: true, show: true,
formatter: function (data) { formatter: function (data) {
// 1000 // 1000
console.log(data,'xxxxxxxxxx'); console.log(data, "xxxxxxxxxx");
if(params.month){ if (params.month) {
return params.year +'-'+ params.month +'-'+ data.name+ ' : ' + `<span style='color:rgba(28, 238, 251, 1)'>${data.value}</span>` + '公斤' return (
}else{ params.year +
return params.year +'-'+ data.name+ ' : ' + `<span style='color:rgba(28, 238, 251, 1)'>${data.value}</span>` + '公斤' "-" +
params.month +
"-" +
data.name +
" : " +
`<span style='color:rgba(28, 238, 251, 1)'>${data.value}</span>` +
"公斤"
);
} else {
return (
params.year +
"-" +
data.name +
" : " +
`<span style='color:rgba(28, 238, 251, 1)'>${data.value}</span>` +
"公斤"
);
} }
}, },
}, },
@ -580,11 +600,12 @@ onMounted(() => {
// margin-left: vw(35); // margin-left: vw(35);
// } // }
&-item { &-item {
margin-right: vw(40); // width: 16.5%;
// margin-right: vw(40);
// width: vw(100); // width: vw(100);
// height: vh(170); // height: vh(170);
.chart { .chart {
width: vw(110); width: vw(192);
height: vh(190); height: vh(190);
} }
} }

View File

@ -3,7 +3,7 @@ import axios from 'axios';
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_API, // api的base_url baseURL: import.meta.env.VITE_APP_BASE_API, // api的base_url
timeout: 5000 // 请求超时时间 timeout: 60000 // 请求超时时间
}); });
// 请求拦截器 // 请求拦截器
service.interceptors.request.use( service.interceptors.request.use(

View File

@ -21,7 +21,10 @@
<div v-if="listIndex == index" style="display: flex; width: 100%"> <div v-if="listIndex == index" style="display: flex; width: 100%">
<div <div
class="box-content-chart-item" class="box-content-chart-item"
v-for="(item, index) in list.slice(index * 5, 5 * (index + 1))" v-for="(item, index) in list.slice(
index * 5,
5 * (index + 1)
)"
:key="item.id" :key="item.id"
> >
<div class="chart"> <div class="chart">
@ -36,13 +39,27 @@
</div> </div>
<div class="box-content-search"> <div class="box-content-search">
<div> <div>
<el-input <!-- <el-input
v-model="tableParams.name" v-model="tableParams.name"
@change="getTableList" @change="getTableList"
class="w-50 m-2" class="w-50 m-2"
placeholder="请输入搜索内容" placeholder="请输入搜索内容"
:prefix-icon="Search" :prefix-icon="Search"
/> /> -->
<el-select
@clear="clearHandle"
@change="tableParams.index=1;getTableList()"
clearable
v-model="tableParams.name"
placeholder="请选择品牌名"
>
<el-option
v-for="item in list"
:key="item.name"
:label="item.name"
:value="item.name"
/>
</el-select>
<!-- <el-select <!-- <el-select
style="margin-left:1rem" style="margin-left:1rem"
v-model="tableParams.orderByLoc" v-model="tableParams.orderByLoc"
@ -81,21 +98,39 @@
</div> </div>
</div> </div>
<div class="box-content-table"> <div class="box-content-table">
<el-table :data="tableList" @sort-change="sortHandle" style="width: 100%"> <el-table
<el-table-column type="index" label="序号" :index="indexMethod" width="80" /> :data="tableList"
<el-table-column prop="palletNum" label="托盘号" /> @sort-change="sortHandle"
<el-table-column prop="storeLoc" sortable="custom" label="当前存放位置" /> style="width: 100%"
>
<el-table-column
type="index"
label="序号"
:index="indexMethod"
width="80"
/>
<el-table-column prop="palletNum" label="托盘号" width="100"/>
<el-table-column
prop="storeLoc"
sortable="custom"
label="当前存放位置"
/>
<el-table-column <el-table-column
prop="itemDesc" prop="itemDesc"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
label="物料描述" label="物料描述"
width="160"
/> />
<el-table-column prop="batchNum" :show-overflow-tooltip="true" label="批次" /> <el-table-column
<el-table-column prop="status" label="状态" /> prop="batchNum"
:show-overflow-tooltip="true"
label="批次"
/>
<el-table-column prop="status" label="状态" width="100" />
<el-table-column prop="inputTime" label="入库时间" /> <el-table-column prop="inputTime" label="入库时间" />
<!-- <el-table-column prop="number" label="编号" /> --> <!-- <el-table-column prop="number" label="编号" /> -->
<el-table-column prop="upWeight" label="上箱重量" /> <el-table-column prop="upWeight" label="上箱重量" width="100" />
<el-table-column prop="downWeight" label="下箱重量" /> <el-table-column prop="downWeight" label="下箱重量" width="100"/>
</el-table> </el-table>
<div style="float: right"> <div style="float: right">
<el-pagination <el-pagination
@ -245,7 +280,6 @@ const tableParams = reactive({
function getTableList() { function getTableList() {
getBrandTable(tableParams).then((res) => { getBrandTable(tableParams).then((res) => {
tableList.value = res.result.data; tableList.value = res.result.data;
tableTotal.value = res.result.totalNum; tableTotal.value = res.result.totalNum;
}); });
} }
@ -267,13 +301,12 @@ function getChartData() {
list.value = res.result.map((el, index) => { list.value = res.result.map((el, index) => {
return { return {
name: el.name, name: el.name,
kg: el.stockNum + '箱', kg: el.stockNum + "箱",
value: el.weightPercent, value: el.weightPercent,
id: index, id: index,
weight: el.weight + '公斤', weight: el.weight + "公斤",
}; };
}); });
console.log(list.value, "数据"); console.log(list.value, "数据");
}); });
} }
@ -283,7 +316,7 @@ onMounted(() => {
// //
getBrandBox().then((res) => { getBrandBox().then((res) => {
for (let key in res.result) { for (let key in res.result) {
console.log(res.result, key,'huowei'); console.log(res.result, key, "huowei");
if (key === "inventoryNum") { if (key === "inventoryNum") {
areaNum.storeNum = res.result[key]; areaNum.storeNum = res.result[key];
} else if (key === "fullBoxNum") { } else if (key === "fullBoxNum") {
@ -377,23 +410,23 @@ function sortHandle(event) {
position: relative; position: relative;
height: vh(190); height: vh(190);
&-item:nth-child(1) { &-item:nth-child(1) {
margin-left: vw(25); // margin-left: vw(25);
} }
&-item { &-item {
// width: vw(120); // width: vw(120);
display: flex; display: flex;
height: vh(190); height: vh(190);
.chart { .chart {
width: vw(110); width: vw(180);
height: vh(190); height: vh(190);
position: relative; position: relative;
} }
.line { .line {
width: vw(89); width: vw(70);
height: vh(12); height: vh(12);
margin: 0 vw(28); // margin: 0 vw(28);
position: relative; position: relative;
top: 40%; top: 35%;
background-image: url("@/assets/images/dialog/line.png"); background-image: url("@/assets/images/dialog/line.png");
background-size: 100% 100%; background-size: 100% 100%;
} }

View File

@ -227,9 +227,9 @@ onMounted(() => {
// //
// console.log(props); // console.log(props);
list1.value = props.mqttData list1.value = props.mqttData
// getCarErrorIn12().then(res=>{ getCarErrorIn12().then(res=>{
// list1.value = res.result list1.value = res.result
// }) })
// window.PubScribe(null, realInfo); // window.PubScribe(null, realInfo);
// //
getOverTransmission().then((res) => { getOverTransmission().then((res) => {

View File

@ -85,12 +85,15 @@
<el-input <el-input
v-model="searchData" v-model="searchData"
class="w-50 m-2" class="w-50 m-2"
placeholder="请输入搜索内容" placeholder="请输入箱号"
:suffix-icon="Search" :suffix-icon="Search"
@change="searchCar" @change="searchCar"
/> />
</div> </div>
<div class="home-btn-reset" @click="resetUnity">刷新</div> <div class="home-reset">
<div class="home-reset-data" @click="resetData">刷新数据</div>
<div class="home-reset-model" @click="resetModel">刷新场景</div>
</div>
</div> </div>
<div class="home-right"> <div class="home-right">
<!-- 失活二层箱子激活一层箱子 重新加载三维场景 --> <!-- 失活二层箱子激活一层箱子 重新加载三维场景 -->
@ -102,10 +105,11 @@
> >
{{ unityBtn }} {{ unityBtn }}
</div> </div>
<!-- <div class="home-btn-unity" @click="hideenBox">隐藏箱子</div> -->
</div> </div>
<!-- 库存消息 --> <!-- 库存消息 -->
<div class="home-title"> <div class="home-title">
<span class="home-title-font"> 库存</span> <span class="home-title-font"> 库存</span>
<span class="home-title-more" @click="openInventoryNews"> </span> <span class="home-title-more" @click="openInventoryNews"> </span>
</div> </div>
<div class="home-right-inventoryNews" id="inventoryNews"></div> <div class="home-right-inventoryNews" id="inventoryNews"></div>
@ -250,21 +254,34 @@ import {
getLocInfo, getLocInfo,
} from "@/api/home"; } from "@/api/home";
import { fontSize } from "@/utils/common"; import { fontSize } from "@/utils/common";
const unityBoxShow = ref(false); const unityBoxShow = ref(true);
// //
function resetUnity() { function resetModel() {
unityBoxShow.value = false;
document.querySelector("#iframeRef").src = "model/index.html"; document.querySelector("#iframeRef").src = "model/index.html";
} }
function resetData() {
unityBoxShow.value = false;
getDeviceStatus(); //
getBrandData(); //
getInventory(); //
getOutboundWorkOrder(); //
getInboundWorkOrder(); //
getMessageReminder();
}
function hideenBox() {
document.querySelector("#iframeRef").contentWindow.hideBox();
}
const unityBtn = ref("隐藏二层箱子"); const unityBtn = ref("隐藏二层箱子");
const unityNum = ref(0); const unityNum = ref(0);
const isStoreClick = ref(false);
// //
function unityBoxHandle(val) { function unityBoxHandle(val) {
if (val) { if (val) {
inventoryNewsShow.value = false; inventoryNewsShow.value = false;
unityBoxShow.value = true;
unityNum.value = 0; unityNum.value = 0;
unityBtn.value = "隐藏二层箱子"; unityBtn.value = "隐藏二层箱子";
isStoreClick.value = true;
document.querySelector("#iframeRef").contentWindow.unityBoxHandle(val);
} else { } else {
unityNum.value++; unityNum.value++;
if (unityNum.value % 2 != 0) { if (unityNum.value % 2 != 0) {
@ -272,10 +289,12 @@ function unityBoxHandle(val) {
} else { } else {
unityBtn.value = "隐藏二层箱子"; unityBtn.value = "隐藏二层箱子";
} }
if (isStoreClick.value) {
document.querySelector("#iframeRef").contentWindow.unityBoxHandle();
}else{
document.querySelector("#iframeRef").contentWindow.hideBox(val);
}
} }
document
.querySelector("#iframeRef")
.contentWindow.unityBoxHandle(val);
} }
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
// //
@ -874,8 +893,12 @@ function getDeviceStatus() {
}); });
} }
const brandList = ref([]); const brandList = ref([]);
const brandTimer = ref(null);
// //
function getBrandData() { function getBrandData() {
if (brandTimer.value) {
clearTimeout(brandTimer.value);
}
getInventoryInfo().then((res) => { getInventoryInfo().then((res) => {
// darwBrandChart(res.result); // darwBrandChart(res.result);
// for (let key in res.result[1]) { // for (let key in res.result[1]) {
@ -885,18 +908,21 @@ function getBrandData() {
// }); // });
// } // }
brandList.value = res.result; brandList.value = res.result;
brandTimer.value = setTimeout(() => {
getBrandData();
}, 30000);
}); });
} }
// //
async function getMessageReminder() { async function getMessageReminder() {
// await getCarErrorIn12().then((res) => { await getCarErrorIn12().then((res) => {
// res.result.slice(0, 1).forEach((el) => { res.result.slice(0, 1).forEach((el) => {
// el.msg = ""; el.msg = "维修提醒";
// el.reminderMsg = el.facName + el.facCode + " "; el.reminderMsg = el.facName + el.facCode + " 需要维修";
// el.date = el.errorDateTime; el.date = el.errorDateTime;
// messageReminder.value.push(el); messageReminder.value.push(el);
// }); });
// }); });
await getOverTransmission().then((res) => { await getOverTransmission().then((res) => {
res.result.forEach((el) => { res.result.forEach((el) => {
el.msg = "超时提醒"; el.msg = "超时提醒";
@ -906,23 +932,42 @@ async function getMessageReminder() {
}); });
}); });
} }
const inventoryTimer = ref(null);
// //
function getInventory() { function getInventory() {
if (inventoryTimer.value) {
clearTimeout(inventoryTimer.value);
}
getLocInfo().then((res) => { getLocInfo().then((res) => {
drawInventoryNewsEcahrt(res.result); drawInventoryNewsEcahrt(res.result);
inventoryTimer.value = setTimeout(() => {
getInventory;
}, 30000);
}); });
} }
// //
const outTimer = ref(null);
function getOutboundWorkOrder() { function getOutboundWorkOrder() {
if (outTimer.value) {
clearTimeout(outTimer.value);
}
getOutOrder().then((res) => { getOutOrder().then((res) => {
outboundWorkOrder.value = res.result; outboundWorkOrder.value = res.result;
outboundWorkOrder.value.forEach((el) => { outboundWorkOrder.value.forEach((el) => {
el.pic = getPath.outDevice; el.pic = getPath.outDevice;
}); });
outTimer.value = setTimeout(() => {
getOutboundWorkOrder();
}, 30000);
}); });
} }
// //
const inTimer = ref(null);
function getInboundWorkOrder() { function getInboundWorkOrder() {
if (inTimer.value) {
clearTimeout(inTimer.value);
}
getInOrder().then((res) => { getInOrder().then((res) => {
inboundWorkOrder.value = res.result; inboundWorkOrder.value = res.result;
inboundWorkOrder.value.forEach((el) => { inboundWorkOrder.value.forEach((el) => {
@ -930,6 +975,9 @@ function getInboundWorkOrder() {
el.inWeight = formatNumber(el.inWeight); el.inWeight = formatNumber(el.inWeight);
el.planWeight = formatNumber(el.planWeight); el.planWeight = formatNumber(el.planWeight);
}); });
inTimer.value = setTimeout(() => {
getInboundWorkOrder();
}, 30000);
}); });
} }
function formatNumber(num) { function formatNumber(num) {
@ -963,25 +1011,35 @@ function realInfo(topic, message) {
}); });
messageReminder.value = list; messageReminder.value = list;
mqttList.value = msg; mqttList.value = msg;
getMessageReminder(); // // getMessageReminder(); //
} }
} }
onMounted(() => { onMounted(() => {
getDeviceStatus(); // getDeviceStatus(); //
getBrandData(); // getBrandData(); //
getInventory(); // getInventory(); //
getOutboundWorkOrder(); // getOutboundWorkOrder(); //
getInboundWorkOrder(); // getInboundWorkOrder(); //
window.PubScribe(null, realInfo); getMessageReminder();
// window.PubScribe(null, realInfo);
// window.getMqttData = getMqtt; // window.getMqttData = getMqtt;
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
//
.home-reset {
display: flex;
margin-top: vh(20);
div {
background-image: url("@/assets/images/home/unityBtn-D.png");
background-size: 100% 100%;
padding: vw(5) vh(8);
cursor: pointer;
}
div:nth-child(2) {
margin-left: vw(20);
}
}
.kg { .kg {
font-size: 0.875rem; font-size: 0.875rem;
margin-left: 0.2rem; margin-left: 0.2rem;
@ -996,32 +1054,37 @@ onMounted(() => {
} }
} }
.home-btn { .home-btn {
position: absolute; position: fixed;
left: -38%; right: vw(20);
top: 26%; top: vh(10);
&-unity{
width: 6rem; display: flex;
&-unity {
// width: 6rem;
padding: vw(2) vw(8);
line-height: vh(32);
font-size: 1rem; font-size: 1rem;
padding: 0.5rem;
background-image: url("@/assets/images/home/unityBtn-D.png"); background-image: url("@/assets/images/home/unityBtn-D.png");
background-size: 100% 100%; background-size: 100% 100%;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
} }
> div:nth-child(2) { > div:nth-child(2) {
margin-top: 1.5rem; margin-left: vw(20);
} }
} }
.home-btn-reset { .home-btn-reset {
width: 6rem; width: 3rem;
font-size: 1rem; height: 3rem;
padding: 0.5rem; font-size: 1rem;
margin-top: 1rem; background-image: url("@/assets/images/home/refresh.png");
background-image: url("@/assets/images/home/unityBtn-D.png"); background-size: 100% 100%;
background-size: 100% 100%; text-align: center;
text-align: center; cursor: pointer;
cursor: pointer; position: absolute;
} left: 105%;
bottom: 8.5%;
}
.home { .home {
width: 100%; width: 100%;
height: 100%; height: 100%;

View File

@ -23,17 +23,17 @@ export default defineConfig({
proxy: { proxy: {
// https://cn.vitejs.dev/config/#server-proxy // https://cn.vitejs.dev/config/#server-proxy
'/dev-api': { '/dev-api': {
target: 'http://172.16.1.106:5005/', target: 'http://172.16.1.117:5005/',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '') rewrite: (p) => p.replace(/^\/dev-api/, '')
}, },
'/api': { '/api': {
target: 'http://172.16.1.106:5005/api', target: 'http://172.16.1.117:5005/api',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, '') rewrite: (p) => p.replace(/^\/api/, '')
}, },
'/preview': { '/preview': {
target: 'http://172.16.1.106:5005/', target: 'http://172.16.1.117:5005/',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/preview/, '') rewrite: (p) => p.replace(/^\/preview/, '')
} }