This commit is contained in:
oneao committed 2026-03-25 21:27:48 +08:00
1 parent a4e59dd5d1
commit c7240ea7c9
16 files changed
+598 -476

No files matched your search

+96 -173
View File
@@ -1,187 +1,110 @@
<!DOCTYPE html>
<html lang="zh">
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>数据看板</title>
<!-- Tailwind -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>集装箱录入</title>
<script src="https://cdn.tailwindcss.com"></script>
<!-- ECharts -->
<script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
</head>
<body class="bg-gray-100">
<div class="p-4">
<!-- 顶部 -->
<div class="flex justify-between items-center mb-4">
<h1 class="text-xl font-bold">数据看板</h1>
<button id="refreshBtn"
class="bg-blue-500 text-white px-3 py-1 rounded"
onclick="refreshData()">
🔄 刷新
<div class="bg-white shadow-sm px-4 py-3 text-lg font-semibold">
集装箱录入
</div>
<div class="p-4 space-y-4">
<!-- Step 1 -->
<div class="bg-white rounded-2xl shadow p-4 space-y-4">
<!-- 标题 -->
<div class="flex items-center gap-2">
<div class="w-6 h-6 rounded-full bg-blue-500 text-white text-sm flex items-center justify-center">
1
</div>
<div class="font-medium text-gray-800">
集装箱识别
</div>
</div>
<!-- 输入框 -->
<div>
<label class="text-sm text-gray-500">集装箱号</label>
<input
type="text"
placeholder="请输入或识别集装箱号"
class="w-full mt-1 border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400"
/>
</div>
<!-- 拍照 -->
<div class="flex gap-3">
<div class="flex-1 border-2 border-dashed rounded-xl h-28 flex flex-col items-center justify-center text-gray-400">
📷
<div class="text-xs mt-1">拍照识别</div>
</div>
<div class="flex-1 border-2 border-dashed rounded-xl h-28 flex flex-col items-center justify-center text-gray-400">
🖼
<div class="text-xs mt-1">相册上传</div>
</div>
</div>
<!-- OCR结果 -->
<div class="bg-gray-50 rounded-lg p-3 text-sm text-gray-600">
OCR识别结果:<span class="text-gray-400">暂无</span>
</div>
</div>
<!-- Step 2 -->
<div class="bg-white rounded-2xl shadow p-4 space-y-4">
<div class="flex items-center gap-2">
<div class="w-6 h-6 rounded-full bg-green-500 text-white text-sm flex items-center justify-center">
2
</div>
<div class="font-medium text-gray-800">
其他照片录入
</div>
</div>
<!-- 图片列表 -->
<div class="grid grid-cols-3 gap-3">
<!-- 已上传 -->
<div class="relative">
<div class="h-24 bg-gray-200 rounded-lg"></div>
<div class="absolute top-1 right-1 bg-black/50 text-white text-xs px-1 rounded">
✓
</div>
</div>
<!-- 上传按钮 -->
<div class="h-24 border-2 border-dashed rounded-lg flex flex-col items-center justify-center text-gray-400">
➕
<div class="text-xs mt-1">添加</div>
</div>
</div>
<!-- 说明 -->
<div class="text-xs text-gray-400">
可上传箱体、封条、货物等相关照片
</div>
</div>
</div>
<!-- 底部按钮 -->
<div class="fixed bottom-0 left-0 right-0 bg-white border-t p-3">
<button class="w-full bg-blue-500 text-white py-3 rounded-xl text-lg">
提交
</button>
</div>
<!-- KPI -->
<div id="kpi" class="grid grid-cols-6 gap-3 mb-4"></div>
<!-- 趋势 -->
<div class="bg-white p-4 rounded shadow mb-4">
<div class="mb-2 font-semibold">近7天上传趋势</div>
<div id="trend" style="height:260px;"></div>
</div>
<!-- 中间区域 -->
<div class="grid grid-cols-3 gap-4 mb-4">
<!-- 排行 -->
<div class="bg-white p-4 rounded shadow col-span-2">
<div class="mb-2 font-semibold">操作员上传排行</div>
<div id="rank" style="height:260px;"></div>
</div>
<!-- 右侧 -->
<div class="flex flex-col gap-4">
<!-- 最新上传 -->
<div class="bg-white p-4 rounded shadow">
<div class="mb-2 font-semibold">最新上传</div>
<table class="w-full text-sm">
<thead>
<tr class="text-gray-500">
<th>箱号</th><th>操作员</th><th>时间</th><th>数量</th>
</tr>
</thead>
<tbody id="table"></tbody>
</table>
</div>
<!-- 企业公告 -->
<div class="bg-white p-4 rounded shadow">
<div class="mb-2 font-semibold">📢 企业公告</div>
<div id="notice" class="text-sm space-y-2 max-h-[120px] overflow-auto"></div>
</div>
</div>
</div>
<!-- 异常 -->
<div class="bg-white p-4 rounded shadow">
<div class="mb-2 font-semibold text-red-500">⚠️ 数据异常</div>
<div id="warn" class="text-sm text-red-500 space-y-1"></div>
</div>
</div>
<script>
// ===== 模拟数据 =====
function getData() {
return {
kpi: [
["今日箱数", rand(80,150)],
["照片总数", rand(300,800)],
["活跃操作员", rand(5,20)],
["最近上传", "10:" + rand(10,59)],
["异常箱数", rand(0,10)],
["待处理", rand(0,5)],
],
trend: Array.from({length:7},()=>rand(50,150)),
rank: Array.from({length:5},()=>rand(40,120)),
users: ["张三","李四","王五","赵六","钱七"],
list: [
["MSCU1234567","张三","10:30",5],
["TEMU7654321","李四","10:20",4],
["CMAU9988776","王五","10:10",6],
],
notice: [
"📌 今日起必须上传封条照片",
"📌 晚班请补录遗漏数据",
"📌 周五晚系统维护"
],
warn: [
"图片少于3张:" + rand(0,5),
"箱号为空:" + rand(0,3),
"OCR失败:" + rand(0,3)
]
}
}
function rand(min,max){return Math.floor(Math.random()*(max-min)+min)}
// ===== 渲染 =====
let trendChart = echarts.init(document.getElementById('trend'));
let rankChart = echarts.init(document.getElementById('rank'));
function render() {
const data = getData();
// KPI
document.getElementById("kpi").innerHTML = data.kpi.map(i=>`
<div class="bg-white p-3 rounded shadow">
<div class="text-gray-400 text-xs">${i[0]}</div>
<div class="text-xl font-bold mt-1">${i[1]}</div>
</div>
`).join("");
// 表格
document.getElementById("table").innerHTML = data.list.map(i=>`
<tr class="border-t">
<td>${i[0]}</td>
<td>${i[1]}</td>
<td>${i[2]}</td>
<td>${i[3]}</td>
</tr>
`).join("");
// 公告
document.getElementById("notice").innerHTML =
data.notice.map(i=>`<div>${i}</div>`).join("");
// 异常
document.getElementById("warn").innerHTML =
data.warn.map(i=>`<div>${i}</div>`).join("");
// 趋势图
trendChart.setOption({
xAxis: { type: 'category', data: ['一','二','三','四','五','六','日'] },
yAxis: { type: 'value' },
series: [{
data: data.trend,
type: 'line',
smooth: true
}]
});
// 排行
rankChart.setOption({
xAxis: { type: 'category', data: data.users },
yAxis: { type: 'value' },
series: [{
data: data.rank,
type: 'bar'
}]
});
}
// ===== 刷新 =====
function refreshData() {
const btn = document.getElementById("refreshBtn");
btn.innerText = "刷新中...";
btn.disabled = true;
setTimeout(()=>{
render();
btn.innerText = "🔄 刷新";
btn.disabled = false;
}, 800);
}
render();
</script>
</body>
</html>