mirror of
https://github.com/xiaozhou233/RiverWaterQualityMonitoring.git
synced 2026-12-05 13:05:53 +08:00
添加水质数据生成器和前端仪表板,支持 pH、TDS 和浊度的实时监测与可视化
This commit is contained in:
1 parent
1059400b7e
commit
d05ceaf046
4 files changed
+1023
No files matched your search
@@ -0,0 +1,106 @@
|
|||||||
|
import random
|
||||||
|
import time
|
||||||
|
import requests
|
||||||
|
|
||||||
|
# API
|
||||||
|
URL = "http://127.0.0.1:8000/data/upload"
|
||||||
|
TOKEN = "mE7yG0kI"
|
||||||
|
|
||||||
|
INTERVAL = 0.05
|
||||||
|
|
||||||
|
|
||||||
|
def generate_ph():
|
||||||
|
"""Generate pH"""
|
||||||
|
r = random.random()
|
||||||
|
|
||||||
|
# 80% 正常
|
||||||
|
if r < 0.80:
|
||||||
|
return round(random.uniform(6.5, 8.5), 2)
|
||||||
|
|
||||||
|
# 15% 一般
|
||||||
|
elif r < 0.95:
|
||||||
|
if random.random() < 0.5:
|
||||||
|
return round(random.uniform(6.0, 6.5), 2)
|
||||||
|
else:
|
||||||
|
return round(random.uniform(8.5, 9.0), 2)
|
||||||
|
|
||||||
|
# 5% 异常
|
||||||
|
else:
|
||||||
|
if random.random() < 0.5:
|
||||||
|
return round(random.uniform(3.0, 6.0), 2)
|
||||||
|
else:
|
||||||
|
return round(random.uniform(9.0, 12.0), 2)
|
||||||
|
|
||||||
|
|
||||||
|
def generate_tds():
|
||||||
|
"""Generate TDS"""
|
||||||
|
r = random.random()
|
||||||
|
|
||||||
|
if r < 0.60:
|
||||||
|
return round(random.uniform(50, 300), 1)
|
||||||
|
|
||||||
|
elif r < 0.80:
|
||||||
|
return round(random.uniform(300, 500), 1)
|
||||||
|
|
||||||
|
elif r < 0.95:
|
||||||
|
return round(random.uniform(500, 1000), 1)
|
||||||
|
|
||||||
|
else:
|
||||||
|
return round(random.uniform(1000, 2000), 1)
|
||||||
|
|
||||||
|
|
||||||
|
def generate_turbidity():
|
||||||
|
"""Generate Turbidity"""
|
||||||
|
r = random.random()
|
||||||
|
|
||||||
|
if r < 0.70:
|
||||||
|
return round(random.uniform(0.1, 5), 2)
|
||||||
|
|
||||||
|
elif r < 0.90:
|
||||||
|
return round(random.uniform(5, 25), 2)
|
||||||
|
|
||||||
|
elif r < 0.98:
|
||||||
|
return round(random.uniform(25, 100), 2)
|
||||||
|
|
||||||
|
else:
|
||||||
|
return round(random.uniform(100, 300), 2)
|
||||||
|
|
||||||
|
|
||||||
|
def upload():
|
||||||
|
ph = generate_ph()
|
||||||
|
tds = generate_tds()
|
||||||
|
turbidity = generate_turbidity()
|
||||||
|
|
||||||
|
params = {
|
||||||
|
"token": TOKEN,
|
||||||
|
"ph": ph,
|
||||||
|
"tds": tds,
|
||||||
|
"turbidity": turbidity
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = requests.get(URL, params=params, timeout=5)
|
||||||
|
|
||||||
|
print(
|
||||||
|
f"[{response.status_code}] "
|
||||||
|
f"pH={ph:5} "
|
||||||
|
f"TDS={tds:6} "
|
||||||
|
f"Turbidity={turbidity:6} "
|
||||||
|
f"=> {response.text}"
|
||||||
|
)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print("Upload failed:", e)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print("Water Quality Data Generator Started")
|
||||||
|
print("Press Ctrl+C to stop.\n")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
upload()
|
||||||
|
time.sleep(INTERVAL)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,278 @@
|
|||||||
|
const SCORE_API = "http://127.0.0.1:8000/data/score?token=mE7yG0kI";
|
||||||
|
const HISTORY_API = "http://127.0.0.1:8000/data/all?token=mE7yG0kI";
|
||||||
|
|
||||||
|
let phChart = null;
|
||||||
|
let tdsChart = null;
|
||||||
|
let turbidityChart = null;
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Create Chart
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
function createChart(chart, title, color) {
|
||||||
|
|
||||||
|
chart.setOption({
|
||||||
|
|
||||||
|
animation: true,
|
||||||
|
|
||||||
|
tooltip: {
|
||||||
|
trigger: "axis"
|
||||||
|
},
|
||||||
|
|
||||||
|
grid: {
|
||||||
|
left: 55,
|
||||||
|
right: 25,
|
||||||
|
top: 30,
|
||||||
|
bottom: 40
|
||||||
|
},
|
||||||
|
|
||||||
|
xAxis: {
|
||||||
|
type: "category",
|
||||||
|
boundaryGap: false,
|
||||||
|
data: [],
|
||||||
|
axisLabel: {
|
||||||
|
color: "#666"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
yAxis: {
|
||||||
|
type: "value",
|
||||||
|
scale: true,
|
||||||
|
axisLabel: {
|
||||||
|
color: "#666"
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
lineStyle: {
|
||||||
|
color: "#e6e6e6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
series: [{
|
||||||
|
name: title,
|
||||||
|
type: "line",
|
||||||
|
smooth: true,
|
||||||
|
symbol: "none",
|
||||||
|
lineStyle: {
|
||||||
|
width: 3,
|
||||||
|
color: color
|
||||||
|
},
|
||||||
|
areaStyle: {
|
||||||
|
opacity: 0.15,
|
||||||
|
color: color
|
||||||
|
},
|
||||||
|
data: []
|
||||||
|
}]
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Init Charts
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
function initCharts() {
|
||||||
|
|
||||||
|
phChart = echarts.init(document.getElementById("phChart"));
|
||||||
|
tdsChart = echarts.init(document.getElementById("tdsChart"));
|
||||||
|
turbidityChart = echarts.init(document.getElementById("turbidityChart"));
|
||||||
|
|
||||||
|
createChart(phChart, "pH", "#2196f3");
|
||||||
|
createChart(tdsChart, "TDS", "#4caf50");
|
||||||
|
createChart(turbidityChart, "浊度", "#ff9800");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Update Item
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
function setItem(name, data) {
|
||||||
|
|
||||||
|
document.getElementById(name + "-value").innerHTML =
|
||||||
|
Number(data.value).toFixed(2);
|
||||||
|
|
||||||
|
document.getElementById(name + "-level").innerHTML =
|
||||||
|
"等级:" + data.level;
|
||||||
|
|
||||||
|
document.getElementById(name + "-score").innerHTML =
|
||||||
|
"评分:" + data.score;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Load Score
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
async function loadData() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
const res = await fetch(SCORE_API);
|
||||||
|
|
||||||
|
const data = await res.json();
|
||||||
|
|
||||||
|
document.getElementById("score").innerHTML = data.score;
|
||||||
|
|
||||||
|
document.getElementById("level").innerHTML = data.level;
|
||||||
|
|
||||||
|
document.getElementById("time").innerHTML =
|
||||||
|
data.time.substring(11, 19);
|
||||||
|
|
||||||
|
const abnormal =
|
||||||
|
document.getElementById("abnormal");
|
||||||
|
|
||||||
|
abnormal.innerHTML =
|
||||||
|
data.abnormal ? "异常" : "正常";
|
||||||
|
|
||||||
|
abnormal.className =
|
||||||
|
"card-value " +
|
||||||
|
(data.abnormal ? "abnormal" : "normal");
|
||||||
|
|
||||||
|
setItem("ph", data.ph);
|
||||||
|
setItem("tds", data.tds);
|
||||||
|
setItem("turbidity", data.turbidity);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
|
||||||
|
console.error("Load Score Error:", e);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Load History
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
async function loadHistory() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
const res = await fetch(HISTORY_API);
|
||||||
|
|
||||||
|
const all = await res.json();
|
||||||
|
|
||||||
|
if (!Array.isArray(all) || all.length === 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const history = all.slice(-100);
|
||||||
|
|
||||||
|
const time = history.map(item =>
|
||||||
|
item.time.substring(11, 19));
|
||||||
|
|
||||||
|
phChart.setOption({
|
||||||
|
|
||||||
|
xAxis: {
|
||||||
|
data: time
|
||||||
|
},
|
||||||
|
|
||||||
|
series: [{
|
||||||
|
|
||||||
|
data: history.map(item => item.ph)
|
||||||
|
|
||||||
|
}]
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
tdsChart.setOption({
|
||||||
|
|
||||||
|
xAxis: {
|
||||||
|
data: time
|
||||||
|
},
|
||||||
|
|
||||||
|
series: [{
|
||||||
|
|
||||||
|
data: history.map(item => item.tds)
|
||||||
|
|
||||||
|
}]
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
turbidityChart.setOption({
|
||||||
|
|
||||||
|
xAxis: {
|
||||||
|
data: time
|
||||||
|
},
|
||||||
|
|
||||||
|
series: [{
|
||||||
|
|
||||||
|
data: history.map(item => item.turbidity)
|
||||||
|
|
||||||
|
}]
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
|
||||||
|
console.error("Load History Error:", e);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Clock
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
function updateClock() {
|
||||||
|
|
||||||
|
document.getElementById("clock").innerHTML =
|
||||||
|
new Date().toLocaleString("zh-CN");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Resize
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
window.addEventListener("resize", () => {
|
||||||
|
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
|
||||||
|
if (phChart) phChart.resize();
|
||||||
|
|
||||||
|
if (tdsChart) tdsChart.resize();
|
||||||
|
|
||||||
|
if (turbidityChart) turbidityChart.resize();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Start
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
window.addEventListener("load", async () => {
|
||||||
|
|
||||||
|
initCharts();
|
||||||
|
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
|
||||||
|
phChart.resize();
|
||||||
|
tdsChart.resize();
|
||||||
|
turbidityChart.resize();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
updateClock();
|
||||||
|
|
||||||
|
await loadData();
|
||||||
|
|
||||||
|
await loadHistory();
|
||||||
|
|
||||||
|
setInterval(updateClock, 1000);
|
||||||
|
|
||||||
|
setInterval(async () => {
|
||||||
|
|
||||||
|
await loadData();
|
||||||
|
|
||||||
|
await loadHistory();
|
||||||
|
|
||||||
|
}, 3000);
|
||||||
|
|
||||||
|
});
|
||||||
@@ -0,0 +1,236 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>智慧河流水质监测系统</title>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- ================= Banner ================= -->
|
||||||
|
|
||||||
|
<header class="banner">
|
||||||
|
|
||||||
|
<div class="banner-left">
|
||||||
|
<div class="banner-title">
|
||||||
|
智慧河流水质监测系统
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="banner-subtitle">
|
||||||
|
Smart River Water Quality Monitoring System
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="banner-right">
|
||||||
|
|
||||||
|
<div class="clock-title">
|
||||||
|
当前时间
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="clock" class="clock">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- ================= Main ================= -->
|
||||||
|
|
||||||
|
<main class="container">
|
||||||
|
|
||||||
|
<!-- ================= Summary ================= -->
|
||||||
|
|
||||||
|
<section class="cards">
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
|
||||||
|
<div class="card-title">
|
||||||
|
综合评分
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="score" class="card-value black">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
|
||||||
|
<div class="card-title">
|
||||||
|
综合等级
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="level" class="card-value black">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
|
||||||
|
<div class="card-title">
|
||||||
|
系统状态
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="abnormal" class="card-value">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
|
||||||
|
<div class="card-title">
|
||||||
|
数据更新时间
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="time" class="update-time">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ================= Items ================= -->
|
||||||
|
|
||||||
|
<section class="items">
|
||||||
|
|
||||||
|
<div class="item">
|
||||||
|
|
||||||
|
<div class="item-header">
|
||||||
|
|
||||||
|
<div class="item-name">
|
||||||
|
pH
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="ph-value" class="value">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="ph-level" class="level">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="ph-score" class="score">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="item">
|
||||||
|
|
||||||
|
<div class="item-header">
|
||||||
|
|
||||||
|
<div class="item-name">
|
||||||
|
TDS(溶解性总固体)
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="tds-value" class="value">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="tds-level" class="level">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="tds-score" class="score">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="item">
|
||||||
|
|
||||||
|
<div class="item-header">
|
||||||
|
|
||||||
|
<div class="item-name">
|
||||||
|
浊度
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="turbidity-value" class="value">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="turbidity-level" class="level">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="turbidity-score" class="score">
|
||||||
|
--
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ================= Charts ================= -->
|
||||||
|
|
||||||
|
<section class="chart-grid">
|
||||||
|
|
||||||
|
<div class="chart">
|
||||||
|
|
||||||
|
<div class="chart-title">
|
||||||
|
pH 变化趋势
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chart-body">
|
||||||
|
<div id="phChart"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chart">
|
||||||
|
|
||||||
|
<div class="chart-title">
|
||||||
|
TDS(溶解性总固体)变化趋势
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chart-body">
|
||||||
|
<div id="tdsChart"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chart">
|
||||||
|
|
||||||
|
<div class="chart-title">
|
||||||
|
浊度变化趋势
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chart-body">
|
||||||
|
<div id="turbidityChart"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- ================= Footer ================= -->
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
智慧河流水质监测平台 © 2026
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="dashboard.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,403 @@
|
|||||||
|
/* ===========================
|
||||||
|
Global
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: "Microsoft YaHei", Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #eef3f8;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Banner
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
.banner {
|
||||||
|
|
||||||
|
height: 11vh;
|
||||||
|
|
||||||
|
min-height: 90px;
|
||||||
|
|
||||||
|
background: linear-gradient(90deg, #1565c0, #2196f3);
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
padding: 0 2vw;
|
||||||
|
|
||||||
|
box-shadow: 0 3px 12px rgba(0, 0, 0, .18);
|
||||||
|
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner-title {
|
||||||
|
|
||||||
|
font-size: clamp(30px, 2vw, 52px);
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
letter-spacing: 2px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner-subtitle {
|
||||||
|
|
||||||
|
margin-top: .5vh;
|
||||||
|
|
||||||
|
opacity: .9;
|
||||||
|
|
||||||
|
font-size: clamp(14px, .9vw, 22px);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner-right {
|
||||||
|
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.clock-title {
|
||||||
|
|
||||||
|
font-size: clamp(16px, 1vw, 24px);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.clock {
|
||||||
|
|
||||||
|
margin-top: .6vh;
|
||||||
|
|
||||||
|
font-size: clamp(28px, 2vw, 46px);
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Main
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
.container {
|
||||||
|
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
gap: 1.2vh;
|
||||||
|
|
||||||
|
padding: 1.2vh 1.2vw;
|
||||||
|
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Summary Cards
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
.cards {
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
|
||||||
|
gap: 1vw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
border-radius: 16px;
|
||||||
|
|
||||||
|
padding: 1.2vw;
|
||||||
|
|
||||||
|
box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
font-size: clamp(18px, 1vw, 28px);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-value {
|
||||||
|
|
||||||
|
margin-top: 1vh;
|
||||||
|
|
||||||
|
font-size: clamp(36px, 2.3vw, 64px);
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.black {
|
||||||
|
|
||||||
|
color: #111;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.normal {
|
||||||
|
|
||||||
|
color: #2ecc71;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.abnormal {
|
||||||
|
|
||||||
|
color: #e74c3c;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-time {
|
||||||
|
|
||||||
|
margin-top: 1vh;
|
||||||
|
|
||||||
|
font-size: clamp(18px, 1.1vw, 30px);
|
||||||
|
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Items
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
.items {
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
|
||||||
|
gap: 1vw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
border-radius: 16px;
|
||||||
|
|
||||||
|
padding: 1.2vw;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-name {
|
||||||
|
|
||||||
|
font-size: clamp(22px, 1.3vw, 36px);
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
|
||||||
|
margin-top: 1vh;
|
||||||
|
|
||||||
|
color: #1976d2;
|
||||||
|
|
||||||
|
font-size: clamp(48px, 3vw, 84px);
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.level {
|
||||||
|
|
||||||
|
margin-top: 1vh;
|
||||||
|
|
||||||
|
font-size: clamp(22px, 1.2vw, 30px);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.score {
|
||||||
|
|
||||||
|
margin-top: .5vh;
|
||||||
|
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
font-size: clamp(18px, 1vw, 26px);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Charts
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
.chart-grid {
|
||||||
|
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
|
||||||
|
gap: 1vw;
|
||||||
|
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart {
|
||||||
|
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
border-radius: 16px;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
|
||||||
|
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-title {
|
||||||
|
|
||||||
|
padding: 16px 20px;
|
||||||
|
|
||||||
|
border-bottom: 1px solid #e6e6e6;
|
||||||
|
|
||||||
|
font-size: clamp(22px, 1.3vw, 34px);
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-body {
|
||||||
|
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
padding: 12px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#phChart,
|
||||||
|
#tdsChart,
|
||||||
|
#turbidityChart {
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Footer
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
|
||||||
|
height: 3.5vh;
|
||||||
|
|
||||||
|
min-height: 28px;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
font-size: clamp(12px, .8vw, 18px);
|
||||||
|
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===========================
|
||||||
|
Responsive
|
||||||
|
=========================== */
|
||||||
|
|
||||||
|
@media (max-width: 1400px) {
|
||||||
|
|
||||||
|
.cards {
|
||||||
|
|
||||||
|
gap: .8vw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.items {
|
||||||
|
|
||||||
|
gap: .8vw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-grid {
|
||||||
|
|
||||||
|
gap: .8vw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1100px) {
|
||||||
|
|
||||||
|
.cards {
|
||||||
|
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.items {
|
||||||
|
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-grid {
|
||||||
|
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in new issue
Block a user