infra-dashboard.tsx 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. "use client"
  2. import Section from "@/components/shared/section"
  3. import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card"
  4. import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "@/components/ui/table"
  5. import {ChartContainer, ChartTooltip, ChartTooltipContent,} from "@/components/ui/chart"
  6. import {
  7. Area,
  8. AreaChart,
  9. CartesianGrid,
  10. PolarAngleAxis,
  11. PolarGrid,
  12. PolarRadiusAxis,
  13. Radar,
  14. RadarChart,
  15. ResponsiveContainer,
  16. XAxis,
  17. YAxis,
  18. } from "recharts"
  19. const baseArchive = [
  20. { industry: "燃气", 规模: 1240, 平均年限: 9.4, 类型数: 12, 覆盖区县: 12 },
  21. { industry: "供水", 规模: 980, 平均年限: 8.1, 类型数: 9, 覆盖区县: 12 },
  22. { industry: "排水", 规模: 760, 平均年限: 10.2, 类型数: 7, 覆盖区县: 12 },
  23. ]
  24. export default function InfraDashboard() {
  25. return (
  26. <div className="space-y-8">
  27. <Section
  28. title="基础档案"
  29. description="构建设施基础档案,数字化呈现规模、年限、类型与分布。"
  30. >
  31. <Card>
  32. <CardContent className="pt-4 overflow-x-auto">
  33. <Table>
  34. <TableHeader>
  35. <TableRow>
  36. <TableHead>行业</TableHead>
  37. <TableHead>规模(处)</TableHead>
  38. <TableHead>平均年限(年)</TableHead>
  39. <TableHead>类型数</TableHead>
  40. <TableHead>覆盖区县</TableHead>
  41. </TableRow>
  42. </TableHeader>
  43. <TableBody>
  44. {baseArchive.map((row) => (
  45. <TableRow key={row.industry}>
  46. <TableCell className="font-medium">{row.industry}</TableCell>
  47. <TableCell>{row.规模}</TableCell>
  48. <TableCell>{row.平均年限}</TableCell>
  49. <TableCell>{row.类型数}</TableCell>
  50. <TableCell>{row.覆盖区县}</TableCell>
  51. </TableRow>
  52. ))}
  53. </TableBody>
  54. </Table>
  55. </CardContent>
  56. </Card>
  57. </Section>
  58. <Section
  59. title="运行信息"
  60. description="展示日常供应能力与承载能力,辅助掌握运行能力、指导设施建设。"
  61. >
  62. <div className="grid gap-4 md:grid-cols-2">
  63. <Card>
  64. <CardHeader>
  65. <CardTitle className="text-sm">供水能力(万m³/日)</CardTitle>
  66. </CardHeader>
  67. <CardContent>
  68. <ChartContainer
  69. config={{ supply: { label: "供水", color: "hsl(var(--chart-2))" } }}
  70. className="h-[220px]"
  71. >
  72. <ResponsiveContainer width="100%" height="100%">
  73. <AreaChart
  74. data={Array.from({ length: 12 }).map((_, i) => ({
  75. m: `${i + 1}月`,
  76. supply: Math.round(290 + 5 * i + 10 * Math.sin(i / 2)),
  77. }))}
  78. >
  79. <defs>
  80. <linearGradient id="supplyFill" x1="0" y1="0" x2="0" y2="1">
  81. <stop offset="5%" stopColor="var(--color-supply)" stopOpacity={0.35} />
  82. <stop offset="95%" stopColor="var(--color-supply)" stopOpacity={0.05} />
  83. </linearGradient>
  84. </defs>
  85. <CartesianGrid strokeDasharray="3 3" vertical={false} />
  86. <XAxis dataKey="m" tickLine={false} axisLine={false} />
  87. <YAxis tickLine={false} axisLine={false} />
  88. <ChartTooltip content={<ChartTooltipContent />} />
  89. <Area type="monotone" dataKey="supply" stroke="var(--color-supply)" fill="url(#supplyFill)" />
  90. </AreaChart>
  91. </ResponsiveContainer>
  92. </ChartContainer>
  93. </CardContent>
  94. </Card>
  95. <Card>
  96. <CardHeader>
  97. <CardTitle className="text-sm">承载能力雷达图(样例)</CardTitle>
  98. </CardHeader>
  99. <CardContent>
  100. <ChartContainer
  101. config={{
  102. score: { label: "能力分", color: "hsl(var(--chart-3))" },
  103. }}
  104. className="h-[220px]"
  105. >
  106. <ResponsiveContainer width="100%" height="100%">
  107. <RadarChart
  108. data={[
  109. { name: "管网", score: 76 },
  110. { name: "水厂", score: 84 },
  111. { name: "泵站", score: 72 },
  112. { name: "阀门", score: 68 },
  113. { name: "智能化", score: 80 },
  114. ]}
  115. >
  116. <PolarGrid />
  117. <PolarAngleAxis dataKey="name" />
  118. <PolarRadiusAxis angle={30} domain={[0, 100]} />
  119. <Radar
  120. name="能力"
  121. dataKey="score"
  122. stroke="var(--color-score)"
  123. fill="var(--color-score)"
  124. fillOpacity={0.2}
  125. />
  126. </RadarChart>
  127. </ResponsiveContainer>
  128. </ChartContainer>
  129. </CardContent>
  130. </Card>
  131. </div>
  132. </Section>
  133. <Section title="管理信息" description="分类展示管理单位信息,辅助了解权属分布。">
  134. <Card>
  135. <CardContent className="pt-4">
  136. <div className="grid gap-4 md:grid-cols-3">
  137. <UnitCard name="市燃气集团" owners={5} regions={8} />
  138. <UnitCard name="市自来水公司" owners={4} regions={10} />
  139. <UnitCard name="市排水管理中心" owners={3} regions={12} />
  140. </div>
  141. </CardContent>
  142. </Card>
  143. </Section>
  144. <Section title="应急保障" description="展示危险源、防护目标及应急资源配置情况。">
  145. <div className="grid gap-4 md:grid-cols-3">
  146. <Card>
  147. <CardHeader>
  148. <CardTitle className="text-sm">危险源</CardTitle>
  149. </CardHeader>
  150. <CardContent>
  151. <ul className="text-sm list-disc pl-4 space-y-1">
  152. <li>高压燃气管线(重点段) 26 处</li>
  153. <li>大型储气罐区 8 处</li>
  154. <li>易涝点 14 处</li>
  155. </ul>
  156. </CardContent>
  157. </Card>
  158. <Card>
  159. <CardHeader>
  160. <CardTitle className="text-sm">防护目标</CardTitle>
  161. </CardHeader>
  162. <CardContent>
  163. <ul className="text-sm list-disc pl-4 space-y-1">
  164. <li>学校、医院等重点单位 120 所</li>
  165. <li>大型商圈 12 个</li>
  166. <li>交通枢纽 6 处</li>
  167. </ul>
  168. </CardContent>
  169. </Card>
  170. <Card>
  171. <CardHeader>
  172. <CardTitle className="text-sm">应急资源</CardTitle>
  173. </CardHeader>
  174. <CardContent>
  175. <ul className="text-sm list-disc pl-4 space-y-1">
  176. <li>应急队伍 18 支</li>
  177. <li>应急车辆 64 台</li>
  178. <li>物资库 9 处(发电机、沙袋、移动泵等)</li>
  179. </ul>
  180. </CardContent>
  181. </Card>
  182. </div>
  183. </Section>
  184. </div>
  185. )
  186. }
  187. function UnitCard({ name, owners, regions }: { name: string; owners: number; regions: number }) {
  188. return (
  189. <div className="rounded-lg border p-4">
  190. <h3 className="font-medium">{name}</h3>
  191. <p className="text-sm text-muted-foreground mt-1">权属单位:{owners} 个</p>
  192. <p className="text-sm text-muted-foreground">覆盖区县:{regions} 个</p>
  193. </div>
  194. )
  195. }