init:一期二期代码合并

This commit is contained in:
zhangzq
2025-05-22 14:13:19 +08:00
parent 2dfe5f22de
commit ad7bfbfc7f
10 changed files with 215 additions and 19 deletions

View File

@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>智能仓储监控看板</title>
<style>
body {
background-color: #0a192f;
color: #fff;
font-family: 'Arial', sans-serif;
margin: 0;
padding: 20px;
overflow-x: hidden;
}
.dashboard-title {
text-align: center;
font-size: 2.5em;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 3px;
text-shadow: 0 0 10px rgba(66, 153, 225, 0.5);
}
.grid-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 15px;
padding: 20px;
max-width: 1600px;
margin: 0 auto;
}
.point-card {
background: linear-gradient(145deg, #1a365f, #12243f);
border-radius: 8px;
padding: 15px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
transition: transform 0.3s ease;
border: 1px solid rgba(66, 153, 225, 0.2);
position: relative;
overflow: hidden;
}
.point-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 15px rgba(0, 0, 0, 0.5);
}
.point-card::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(66, 153, 225, 0.2),
transparent
);
transition: 0.5s;
}
.point-card:hover::before {
left: 100%;
}
.status-default { background-color: #105fe7; }
.status-2 { background-color: #d69e2e; }
.status-3 { background-color: #38a169; }
.point-code {
font-size: 1.2em;
font-weight: bold;
margin-bottom: 8px;
}
.container-code {
font-size: 0.9em;
opacity: 0.8;
word-break: break-all;
}
.status-indicator {
width: 30px;
height: 30px;
border-radius: 50%;
position: absolute;
top: 10px;
right: 10px;
box-shadow: 0 0 8px currentColor;
}
@media (max-width: 768px) {
.grid-container {
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
}
</style>
</head>
<body>
<h1 class="dashboard-title">装箱区点位监控系统</h1>
<div class="grid-container" id="gridContainer"></div>
<script>
// 状态颜色映射
const statusColors = {
1: 'status-default',
2: 'status-2',
3: 'status-3'
};
// 获取数据并更新看板
async function updateDashboard() {
try {
const response = await fetch('http://10.1.3.91:8013/api/bstIvtPackageInfoIvt?page=0&packageinfo_area=3&size=100&sort=ivt_id%2Cdesc&is_used=1');
const data = await response.json();
renderPoints(data.content);
} catch (error) {
console.error('数据获取失败:', error);
}
}
// 渲染点位卡片
function renderPoints(points) {
const container = document.getElementById('gridContainer');
container.innerHTML = '';
points.forEach(point => {
const card = document.createElement('div');
// 检查更新时间
let time = point.update_time
if (time==null ||time ==undefined){
time = new Date()
}
const updateTime = new Date(time);
const currentTime = new Date();
const timeDiff = (currentTime - updateTime) / (1000 * 60 * 60); // 转换为小时
// 如果时间差超过2小时使用红色背景
if (point.container_name!=null&& point.container_name!=undefined) {
card.className = 'point-card';
if (timeDiff > 2 ){
card.style.background = 'linear-gradient(145deg, #9db9e7, #186bf2)'; // 红色渐变背景
}else {
card.className = 'point-card';
card.style.background = 'linear-gradient(145deg, #dc2626, #991b1b)'; // 红色渐变背景
}
} else {
card.className = `point-card ${statusColors[point.ivt_status] || 'status-default'}`;
}
let colorPoint = {}
if (point.container_name!=null&& point.container_name!=undefined){
if (point.ivt_status == 3){
colorPoint = '#0bef0f'
}else if (point.ivt_status == 3){
colorPoint = '#5d0402'
} else{
colorPoint = '#ecd74b'
}
}
card.innerHTML = `
<div class="status-indicator" style="background-color: ${colorPoint}"></div>
<div class="point-code">${point.point_code}</div>
<div class="container-code">${point.container_name || '-- 无子卷信息 --'}</div>
`;
container.appendChild(card);
});
}
// 初始加载
updateDashboard();
// 每30秒自动更新
setInterval(updateDashboard, 3000);
</script>
</body>
</html>