sync update from LAN repo (source dhk-1 @ 3e87be55)
This commit is contained in:
1 parent
ab6068a7c1
commit
42f2a26fa8
1482 files changed
+227759
-9584
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import GeoMap from "@/components/GeoMap";
|
||||
import type { GeoMapProps } from "@/components/GeoMap";
|
||||
|
||||
/**
|
||||
* 地图页示例:GeoJSON 数据放 public/ 目录(构建时原样拷贝到 dist/),
|
||||
* 页面里用 fetch("./<文件名>") 相对路径加载。
|
||||
* 地图默认无底图(离线可用);在 site.json 的 map 段配置 tilesUrl / pmtiles 可加底图。
|
||||
*/
|
||||
export default function MapPage() {
|
||||
const [data, setData] = useState<GeoMapProps["data"] | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
fetch("./data.geojson")
|
||||
.then((res) => {
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
return res.json() as Promise<GeoMapProps["data"]>;
|
||||
})
|
||||
.then((json) => {
|
||||
if (!cancelled) setData(json);
|
||||
})
|
||||
.catch((err) => {
|
||||
if (!cancelled) setError(err instanceof Error ? err.message : String(err));
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
<header className="page-header">
|
||||
<h1 className="page-title">地图</h1>
|
||||
<p className="page-subtitle">空间分布可视化(点 / 线 / 面)。</p>
|
||||
</header>
|
||||
|
||||
<section className="card">
|
||||
{error ? (
|
||||
<p className="card-body">数据加载失败:{error}</p>
|
||||
) : data ? (
|
||||
<GeoMap data={data} height={520} />
|
||||
) : (
|
||||
<p className="card-body">地图数据加载中…</p>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import ChartPanel from "@/components/ChartPanel";
|
||||
|
||||
/**
|
||||
* 总览页示例:统计卡片 + 图表 + 页面入口。
|
||||
* 新增页面:在 src/pages/ 下新建 .tsx 文件,并在 site.json 的 nav 里加一项即可。
|
||||
*/
|
||||
export default function OverviewPage() {
|
||||
const stats = [
|
||||
{ label: "覆盖区域", value: "12", unit: "个" },
|
||||
{ label: "重点项目", value: "36", unit: "个" },
|
||||
{ label: "数据总量", value: "1,204", unit: "条" },
|
||||
{ label: "本月新增", value: "+86", unit: "条", trend: "up" as const },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
<header className="page-header">
|
||||
<h1 className="page-title">总览</h1>
|
||||
<p className="page-subtitle">站点数据概览与快速入口。</p>
|
||||
</header>
|
||||
|
||||
<section className="grid grid-4" style={{ marginBottom: 20 }}>
|
||||
{stats.map((s) => (
|
||||
<div className="stat" key={s.label}>
|
||||
<div
|
||||
className={
|
||||
"stat-value " + (s.trend === "up" ? "stat-up" : s.trend === "down" ? "stat-down" : "")
|
||||
}
|
||||
>
|
||||
{s.value}
|
||||
<span className="stat-label" style={{ display: "inline" }}> {s.unit}</span>
|
||||
</div>
|
||||
<div className="stat-label">{s.label}</div>
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
|
||||
<section className="grid grid-2" style={{ marginBottom: 20 }}>
|
||||
<div className="card">
|
||||
<h2 className="card-title">月度趋势</h2>
|
||||
<ChartPanel
|
||||
option={{
|
||||
tooltip: { trigger: "axis" },
|
||||
grid: { left: 40, right: 16, top: 24, bottom: 28 },
|
||||
xAxis: { type: "category", data: ["1月", "2月", "3月", "4月", "5月", "6月"] },
|
||||
yAxis: { type: "value" },
|
||||
series: [
|
||||
{
|
||||
type: "line",
|
||||
smooth: true,
|
||||
data: [120, 182, 161, 204, 232, 287],
|
||||
areaStyle: { opacity: 0.12 },
|
||||
itemStyle: { color: "#2f5cff" },
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="card">
|
||||
<h2 className="card-title">类别占比</h2>
|
||||
<ChartPanel
|
||||
option={{
|
||||
tooltip: { trigger: "item" },
|
||||
legend: { bottom: 0 },
|
||||
series: [
|
||||
{
|
||||
type: "pie",
|
||||
radius: ["42%", "68%"],
|
||||
center: ["50%", "46%"],
|
||||
data: [
|
||||
{ value: 42, name: "类别 A" },
|
||||
{ value: 28, name: "类别 B" },
|
||||
{ value: 20, name: "类别 C" },
|
||||
{ value: 10, name: "其他" },
|
||||
],
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="card">
|
||||
<h2 className="card-title">快速入口</h2>
|
||||
<div className="grid grid-2">
|
||||
<div>
|
||||
<p className="card-body">
|
||||
查看业务流程?前往 <Link to="/process">流程图页</Link>。
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="card-body">
|
||||
查看空间分布?前往 <Link to="/map">地图页</Link>。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import FlowCanvas from "@/components/FlowCanvas";
|
||||
import type { FlowData } from "@/components/FlowCanvas";
|
||||
import MermaidBlock from "@/components/MermaidBlock";
|
||||
|
||||
/**
|
||||
* 流程图页示例:FlowCanvas(可拖拽/缩放的交互流程图)+ MermaidBlock(静态图)。
|
||||
*/
|
||||
const flowData: FlowData = {
|
||||
direction: "TB",
|
||||
nodes: [
|
||||
{ id: "n1", label: "开始", type: "start" },
|
||||
{ id: "n2", label: "数据收集", type: "stage" },
|
||||
{ id: "n3", label: "清洗与校验", type: "process" },
|
||||
{ id: "n4", label: "质量达标?", type: "decision" },
|
||||
{ id: "n5", label: "分析建模", type: "stage" },
|
||||
{ id: "n6", label: "报告产出", type: "deliverable" },
|
||||
{ id: "n7", label: "异常处理", type: "risk" },
|
||||
{ id: "n8", label: "结束", type: "end" },
|
||||
],
|
||||
edges: [
|
||||
{ source: "n1", target: "n2" },
|
||||
{ source: "n2", target: "n3" },
|
||||
{ source: "n3", target: "n4" },
|
||||
{ source: "n4", target: "n5", label: "是" },
|
||||
{ source: "n4", target: "n7", label: "否" },
|
||||
{ source: "n7", target: "n3", label: "重新处理" },
|
||||
{ source: "n5", target: "n6" },
|
||||
{ source: "n6", target: "n8" },
|
||||
],
|
||||
};
|
||||
|
||||
export default function ProcessPage() {
|
||||
return (
|
||||
<div className="page">
|
||||
<header className="page-header">
|
||||
<h1 className="page-title">流程图</h1>
|
||||
<p className="page-subtitle">交互式流程图(可拖拽节点、缩放画布)与静态示意图。</p>
|
||||
</header>
|
||||
|
||||
<section className="card" style={{ marginBottom: 20 }}>
|
||||
<h2 className="card-title">业务主流程</h2>
|
||||
<FlowCanvas data={flowData} height={480} />
|
||||
</section>
|
||||
|
||||
<section className="card">
|
||||
<h2 className="card-title">静态示意图(Mermaid)</h2>
|
||||
<MermaidBlock source={"flowchart LR\n A[需求输入] --> B{评审}\n B -->|通过| C[排期开发]\n B -->|驳回| A"} />
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user