lHome.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. <template>
  2. <div class="lifeline-home" v-loading="loading">
  3. <header class="home-header">
  4. <div class="header-copy">
  5. <span class="header-kicker">城市生命线运行态势</span>
  6. <h1>预警联动管理首页</h1>
  7. <p>汇集供水、排水、燃气与窨井预警,集中掌握风险和处置进度。</p>
  8. </div>
  9. <div class="header-tools">
  10. <div class="date-block">
  11. <strong>{{ currentDateLabel }}</strong>
  12. <span>{{ currentTimeLabel }} · 数据更新 {{ lastUpdated || '未更新' }}</span>
  13. </div>
  14. <el-tooltip content="刷新首页数据" placement="bottom">
  15. <el-button circle type="primary" :loading="loading" aria-label="刷新首页数据" @click="loadData">
  16. <el-icon v-if="!loading"><Refresh /></el-icon>
  17. </el-button>
  18. </el-tooltip>
  19. </div>
  20. </header>
  21. <el-alert
  22. v-if="errorMessage"
  23. :title="errorMessage"
  24. :type="allRequestsFailed ? 'error' : 'warning'"
  25. show-icon
  26. closable
  27. class="data-alert"
  28. @close="errorMessage = ''"
  29. >
  30. <template #default>
  31. <el-button link type="primary" @click="loadData">重新加载</el-button>
  32. </template>
  33. </el-alert>
  34. <section class="metric-grid" aria-label="今日预警核心指标">
  35. <button
  36. v-for="metric in metricCards"
  37. :key="metric.key"
  38. type="button"
  39. class="metric-card"
  40. :style="{ '--tone': metric.color, '--tone-soft': metric.softColor }"
  41. @click="navigate(metric.routeName)"
  42. >
  43. <span class="metric-icon"><el-icon><component :is="metric.icon" /></el-icon></span>
  44. <span class="metric-content">
  45. <span class="metric-label">{{ metric.label }}</span>
  46. <strong>{{ formatCount(metric.value) }}</strong>
  47. <small>{{ metric.note }}</small>
  48. </span>
  49. <el-icon class="metric-arrow"><ArrowRight /></el-icon>
  50. </button>
  51. </section>
  52. <div class="analysis-grid">
  53. <section class="panel trend-panel">
  54. <div class="panel-header">
  55. <div>
  56. <h2>近 7 日预警趋势</h2>
  57. <p>四类设施非草稿预警的每日变化</p>
  58. </div>
  59. <el-button link type="primary" @click="navigate('WarningTrend')">
  60. 趋势分析<el-icon><ArrowRight /></el-icon>
  61. </el-button>
  62. </div>
  63. <div ref="trendChartRef" class="chart-box" />
  64. <el-empty v-if="!trendRows.length && !loading" description="近 7 日暂无预警数据" :image-size="74" />
  65. </section>
  66. <section class="panel status-panel">
  67. <div class="panel-header">
  68. <div>
  69. <h2>近 30 日处置状态</h2>
  70. <p>各处置阶段预警数量分布</p>
  71. </div>
  72. <el-button link type="primary" @click="navigate('WarningDisposeStatus')">
  73. 查看分析<el-icon><ArrowRight /></el-icon>
  74. </el-button>
  75. </div>
  76. <div ref="statusChartRef" class="chart-box" />
  77. <el-empty v-if="!statusRows.length && !loading" description="当前周期暂无状态数据" :image-size="74" />
  78. </section>
  79. </div>
  80. <section class="panel facility-panel">
  81. <div class="panel-header">
  82. <div>
  83. <h2>设施预警分布</h2>
  84. <p>历史非草稿预警累计 {{ formatCount(facilityTotal) }} 条</p>
  85. </div>
  86. <el-button link type="primary" @click="navigate('WarningHistoryOverview')">
  87. 历史预警概况<el-icon><ArrowRight /></el-icon>
  88. </el-button>
  89. </div>
  90. <div class="facility-grid">
  91. <article
  92. v-for="facility in facilityStats"
  93. :key="facility.value"
  94. class="facility-card"
  95. :style="{ '--facility-color': facility.color, '--facility-soft': facility.softColor }"
  96. >
  97. <div class="facility-title">
  98. <span class="facility-mark">{{ facility.shortLabel }}</span>
  99. <div><strong>{{ facility.label }}</strong><small>历史预警</small></div>
  100. </div>
  101. <div class="facility-value">
  102. <strong>{{ formatCount(facility.count) }}</strong>
  103. <span>{{ formatPercent(facility.percentage) }}</span>
  104. </div>
  105. <div class="facility-progress"><i :style="{ width: `${facility.percentage}%` }" /></div>
  106. </article>
  107. </div>
  108. </section>
  109. <div class="operations-grid">
  110. <section class="panel warning-panel">
  111. <div class="panel-header">
  112. <div>
  113. <h2>重点未处置预警</h2>
  114. <p>按预警级别和等待时长优先展示,共 {{ formatCount(unprocessedTotal) }} 条</p>
  115. </div>
  116. <el-button link type="primary" @click="navigate('WarningTodayUnprocessed')">
  117. 查看全部<el-icon><ArrowRight /></el-icon>
  118. </el-button>
  119. </div>
  120. <el-table
  121. :data="unprocessedRows"
  122. row-key="warningId"
  123. class="warning-table"
  124. empty-text="当前暂无未处置预警"
  125. @row-click="openDetail"
  126. >
  127. <el-table-column label="级别" width="122">
  128. <template #default="{ row }">
  129. <el-tag :type="warningLevelTag(row)" effect="light" size="small">
  130. {{ warningLevelText(row) }}
  131. </el-tag>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="预警事项" min-width="190" show-overflow-tooltip>
  135. <template #default="{ row }">
  136. <div class="warning-name">
  137. <i :class="`level-${warningLevelCode(row)}`" />
  138. <span>{{ listValue(row, 'warningName', 'warning_name') || '未命名预警' }}</span>
  139. </div>
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="设施类型" width="110">
  143. <template #default="{ row }">{{ warningTypeText(row) }}</template>
  144. </el-table-column>
  145. <el-table-column label="权属单位" min-width="150" show-overflow-tooltip>
  146. <template #default="{ row }">{{ listValue(row, 'ownershipUnit', 'ownership_unit') || '未设置' }}</template>
  147. </el-table-column>
  148. <el-table-column label="等待时长" width="105">
  149. <template #default="{ row }"><span class="waiting-time">{{ waitingText(row) }}</span></template>
  150. </el-table-column>
  151. <el-table-column label="状态" width="94" align="center">
  152. <template #default="{ row }">
  153. <el-tag :type="warningStatusTag(row)" effect="plain" size="small">
  154. {{ warningStatusText(row) }}
  155. </el-tag>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="操作" width="84" fixed="right" align="center">
  159. <template #default="{ row }">
  160. <el-button link type="primary" @click.stop="openDetail(row)">详情</el-button>
  161. </template>
  162. </el-table-column>
  163. </el-table>
  164. </section>
  165. <aside class="panel quick-panel">
  166. <div class="panel-header">
  167. <div>
  168. <h2>常用功能</h2>
  169. <p>快速进入预警查询与处置工作</p>
  170. </div>
  171. </div>
  172. <div class="quick-list">
  173. <button
  174. v-for="action in quickActions"
  175. :key="action.routeName"
  176. type="button"
  177. class="quick-action"
  178. @click="navigate(action.routeName)"
  179. >
  180. <span class="quick-icon" :style="{ color: action.color, background: action.softColor }">
  181. <el-icon><component :is="action.icon" /></el-icon>
  182. </span>
  183. <span><strong>{{ action.label }}</strong><small>{{ action.note }}</small></span>
  184. <el-icon class="quick-arrow"><ArrowRight /></el-icon>
  185. </button>
  186. </div>
  187. </aside>
  188. </div>
  189. <WarningDetailDrawer v-model="detailVisible" :row="selectedRow" />
  190. </div>
  191. </template>
  192. <script setup>
  193. import { computed, nextTick, onMounted, onUnmounted, ref } from 'vue'
  194. import { useRouter } from 'vue-router'
  195. import { ElMessage } from 'element-plus'
  196. import {
  197. ArrowRight,
  198. Bell,
  199. CircleCheck,
  200. Clock,
  201. DataAnalysis,
  202. Refresh,
  203. Setting,
  204. TrendCharts,
  205. Warning
  206. } from '@element-plus/icons-vue'
  207. import * as echarts from 'echarts'
  208. import {
  209. getWarningTodayOverview,
  210. pageWarningHistory,
  211. pageWarningTodayUnprocessed
  212. } from '@/api/warning/dashboard'
  213. import { getDisposeStatusStat, getWarningTrendByDay } from '@/api/warning/statistics'
  214. import WarningDetailDrawer from '../lOverviewWarning/WarningDetailDrawer.vue'
  215. import {
  216. dashboardData,
  217. listValue,
  218. pageRecords,
  219. pageTotal,
  220. warningLevelCode,
  221. warningLevelTag,
  222. warningLevelText,
  223. warningStatusTag,
  224. warningStatusText,
  225. warningTypeText
  226. } from '../lOverviewWarning/dashboardShared'
  227. import { labelOf, responseData, statusLabels } from '../lstatistics/statisticsShared'
  228. const router = useRouter()
  229. const loading = ref(false)
  230. const errorMessage = ref('')
  231. const allRequestsFailed = ref(false)
  232. const lastUpdated = ref('')
  233. const now = ref(new Date())
  234. const todayOverview = ref({})
  235. const unprocessedRows = ref([])
  236. const unprocessedTotal = ref(null)
  237. const trendRows = ref([])
  238. const statusRows = ref([])
  239. const detailVisible = ref(false)
  240. const selectedRow = ref(null)
  241. const trendChartRef = ref()
  242. const statusChartRef = ref()
  243. let trendChart
  244. let statusChart
  245. let clockTimer
  246. let resizeObserver
  247. const facilityDefinitions = [
  248. { value: 'WATER_PIPE', label: '供水管网', shortLabel: '供', color: '#2563eb', softColor: '#eff6ff' },
  249. { value: 'SEWER_PIPE', label: '排水管网', shortLabel: '排', color: '#0f766e', softColor: '#ecfdf5' },
  250. { value: 'GAS_PIPE', label: '燃气管网', shortLabel: '燃', color: '#d97706', softColor: '#fffbeb' },
  251. { value: 'MANHOLE', label: '窨井', shortLabel: '井', color: '#64748b', softColor: '#f1f5f9' }
  252. ]
  253. const facilityCounts = ref(Object.fromEntries(facilityDefinitions.map(item => [item.value, null])))
  254. const facilityTotal = computed(() => {
  255. const values = Object.values(facilityCounts.value).filter(value => Number.isFinite(value))
  256. return values.length ? values.reduce((total, value) => total + value, 0) : null
  257. })
  258. const facilityStats = computed(() => facilityDefinitions.map(item => {
  259. const count = facilityCounts.value[item.value]
  260. const percentage = Number.isFinite(count) && facilityTotal.value > 0
  261. ? Number(((count / facilityTotal.value) * 100).toFixed(1))
  262. : 0
  263. return { ...item, count, percentage }
  264. }))
  265. const metricCards = computed(() => [
  266. {
  267. key: 'today', label: '今日预警', value: numericValue(todayOverview.value.todayTotal),
  268. note: '今日非草稿预警', routeName: 'WarningTodayOverview', icon: Bell,
  269. color: '#2563eb', softColor: '#eff6ff'
  270. },
  271. {
  272. key: 'unresolved', label: '当前未解除', value: numericValue(todayOverview.value.unresolvedCount),
  273. note: '截至当前仍在跟进', routeName: 'WarningTodayOverview', icon: Warning,
  274. color: '#dc2626', softColor: '#fef2f2'
  275. },
  276. {
  277. key: 'resolved', label: '今日已解除', value: numericValue(todayOverview.value.resolvedCount),
  278. note: '今日完成风险解除', routeName: 'WarningTodayOverview', icon: CircleCheck,
  279. color: '#059669', softColor: '#ecfdf5'
  280. },
  281. {
  282. key: 'unprocessed', label: '未处置预警', value: unprocessedTotal.value,
  283. note: '需要重点督办', routeName: 'WarningTodayUnprocessed', icon: Clock,
  284. color: '#d97706', softColor: '#fffbeb'
  285. }
  286. ])
  287. const quickActions = [
  288. { label: '今日预警概况', note: '查看今日警情明细', routeName: 'WarningTodayOverview', icon: Bell, color: '#2563eb', softColor: '#eff6ff' },
  289. { label: '今日未处置预警', note: '跟进待处理警情', routeName: 'WarningTodayUnprocessed', icon: Warning, color: '#dc2626', softColor: '#fef2f2' },
  290. { label: '历史预警概况', note: '查看设施预警分布', routeName: 'WarningHistoryOverview', icon: DataAnalysis, color: '#0f766e', softColor: '#ecfdf5' },
  291. { label: '处置状态分析', note: '分析处置进度', routeName: 'WarningDisposeStatus', icon: TrendCharts, color: '#7c3aed', softColor: '#f5f3ff' },
  292. { label: '预警事项管理', note: '维护预警清单配置', routeName: 'WarningItemManage', icon: Setting, color: '#475569', softColor: '#f1f5f9' }
  293. ]
  294. const currentDateLabel = computed(() => new Intl.DateTimeFormat('zh-CN', {
  295. year: 'numeric', month: 'long', day: 'numeric', weekday: 'long'
  296. }).format(now.value))
  297. const currentTimeLabel = computed(() => new Intl.DateTimeFormat('zh-CN', {
  298. hour: '2-digit', minute: '2-digit', hour12: false
  299. }).format(now.value))
  300. function numericValue(value) {
  301. if (value === null || value === undefined || value === '') return null
  302. const number = Number(value)
  303. return Number.isFinite(number) ? number : null
  304. }
  305. function formatCount(value) {
  306. return Number.isFinite(value) ? new Intl.NumberFormat('zh-CN').format(value) : '-'
  307. }
  308. function formatPercent(value) {
  309. return facilityTotal.value > 0 ? `${Number(value || 0).toFixed(1)}%` : '-'
  310. }
  311. function pad(value) {
  312. return String(value).padStart(2, '0')
  313. }
  314. function formatApiDate(date) {
  315. return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
  316. }
  317. function rangeForDays(days) {
  318. const end = new Date()
  319. const start = new Date(end)
  320. start.setHours(0, 0, 0, 0)
  321. start.setDate(start.getDate() - days + 1)
  322. return { startTime: formatApiDate(start), endTime: formatApiDate(end) }
  323. }
  324. function recentDateKeys(days = 7) {
  325. const result = []
  326. const cursor = new Date()
  327. cursor.setHours(0, 0, 0, 0)
  328. cursor.setDate(cursor.getDate() - days + 1)
  329. for (let index = 0; index < days; index += 1) {
  330. result.push(`${cursor.getFullYear()}-${pad(cursor.getMonth() + 1)}-${pad(cursor.getDate())}`)
  331. cursor.setDate(cursor.getDate() + 1)
  332. }
  333. return result
  334. }
  335. function warningCount(row) {
  336. return Number(row.warning_count ?? row.warningCount ?? row.status_count ?? row.statusCount ?? 0)
  337. }
  338. function renderTrendChart() {
  339. if (!trendChartRef.value) return
  340. trendChart ||= echarts.init(trendChartRef.value)
  341. if (!trendRows.value.length) {
  342. trendChart.clear()
  343. return
  344. }
  345. const dates = recentDateKeys()
  346. const totals = Object.fromEntries(dates.map(date => [date, 0]))
  347. trendRows.value.forEach(row => {
  348. const date = String(row.stat_date ?? row.statDate ?? '').slice(0, 10)
  349. if (date in totals) totals[date] += warningCount(row)
  350. })
  351. trendChart.setOption({
  352. animationDuration: 450,
  353. color: ['#2563eb'],
  354. tooltip: { trigger: 'axis', valueFormatter: value => `${value} 条` },
  355. grid: { left: 48, right: 22, top: 24, bottom: 38 },
  356. xAxis: {
  357. type: 'category', boundaryGap: false, data: dates.map(date => date.slice(5)),
  358. axisLine: { lineStyle: { color: '#d9e1ea' } }, axisLabel: { color: '#64748b' }
  359. },
  360. yAxis: {
  361. type: 'value', minInterval: 1, axisLabel: { color: '#64748b' },
  362. splitLine: { lineStyle: { color: '#edf1f5' } }
  363. },
  364. series: [{
  365. name: '预警数量', type: 'line', smooth: true, symbol: 'circle', symbolSize: 7,
  366. lineStyle: { width: 3 }, itemStyle: { borderColor: '#ffffff', borderWidth: 2 },
  367. areaStyle: { color: 'rgba(37, 99, 235, 0.10)' }, data: dates.map(date => totals[date])
  368. }]
  369. }, true)
  370. }
  371. function renderStatusChart() {
  372. if (!statusChartRef.value) return
  373. statusChart ||= echarts.init(statusChartRef.value)
  374. const data = statusRows.value.map(row => ({
  375. name: labelOf(statusLabels, row.status), value: warningCount(row), status: String(row.status || '').toUpperCase()
  376. })).filter(item => item.value > 0)
  377. if (!data.length) {
  378. statusChart.clear()
  379. return
  380. }
  381. const colorByStatus = {
  382. PENDING: '#dc2626', PROCESSING: '#d97706', RELEASED: '#2563eb',
  383. HANDLED: '#0f766e', CLOSED: '#059669', RESOLVED: '#059669'
  384. }
  385. statusChart.setOption({
  386. tooltip: { trigger: 'item', formatter: '{b}<br/>{c} 条({d}%)' },
  387. legend: { type: 'scroll', bottom: 0, left: 'center', textStyle: { color: '#64748b' } },
  388. series: [{
  389. type: 'pie', radius: ['46%', '68%'], center: ['50%', '43%'], avoidLabelOverlap: true,
  390. itemStyle: { borderColor: '#ffffff', borderWidth: 3 }, label: { show: false },
  391. emphasis: { label: { show: true, fontSize: 14, fontWeight: 600 } },
  392. data: data.map(item => ({
  393. name: item.name, value: item.value,
  394. itemStyle: { color: colorByStatus[item.status] || '#64748b' }
  395. }))
  396. }]
  397. }, true)
  398. }
  399. function waitingText(row) {
  400. const hours = numericValue(listValue(row, 'waitingHours', 'waiting_hours'))
  401. if (hours === null) return '-'
  402. if (hours < 1) return '< 1 小时'
  403. if (hours < 24) return `${hours.toFixed(hours >= 10 ? 0 : 1)} 小时`
  404. return `${Math.floor(hours / 24)} 天 ${Math.round(hours % 24)} 小时`
  405. }
  406. function openDetail(row) {
  407. selectedRow.value = row
  408. detailVisible.value = true
  409. }
  410. function navigate(routeName) {
  411. const routeCandidates = router.getRoutes().filter(route => route.name === routeName)
  412. if (!routeCandidates.length) {
  413. ElMessage.warning('当前账号暂无该功能菜单权限')
  414. return
  415. }
  416. // Legacy databases can temporarily expose the same route name at root level
  417. // and under the subsystem. Prefer the scoped route when both are available.
  418. const preferredRoute = routeCandidates.sort((left, right) => {
  419. const leftScoped = left.path.startsWith('/subSystem/') ? 1 : 0
  420. const rightScoped = right.path.startsWith('/subSystem/') ? 1 : 0
  421. return rightScoped - leftScoped || right.path.length - left.path.length
  422. })[0]
  423. router.push(preferredRoute.path).catch(() => {})
  424. }
  425. async function loadData() {
  426. if (loading.value) return
  427. loading.value = true
  428. errorMessage.value = ''
  429. const requests = [
  430. { key: 'today', label: '今日概况', promise: getWarningTodayOverview() },
  431. { key: 'unprocessed', label: '未处置清单', promise: pageWarningTodayUnprocessed({ pageNum: 1, pageSize: 6 }) },
  432. { key: 'trend', label: '预警趋势', promise: getWarningTrendByDay(rangeForDays(7)) },
  433. { key: 'status', label: '处置状态', promise: getDisposeStatusStat(rangeForDays(30)) },
  434. ...facilityDefinitions.map(item => ({
  435. key: item.value, label: item.label,
  436. promise: pageWarningHistory({ pageNum: 1, pageSize: 1, warningType: item.value })
  437. }))
  438. ]
  439. try {
  440. const results = await Promise.allSettled(requests.map(item => item.promise))
  441. const failedLabels = []
  442. let successCount = 0
  443. let generatedAt = ''
  444. results.forEach((result, index) => {
  445. const request = requests[index]
  446. if (result.status === 'rejected') {
  447. failedLabels.push(request.label)
  448. return
  449. }
  450. successCount += 1
  451. if (request.key === 'today') {
  452. todayOverview.value = dashboardData(result.value, {})
  453. generatedAt = todayOverview.value.generatedAt || generatedAt
  454. } else if (request.key === 'unprocessed') {
  455. const data = dashboardData(result.value, {})
  456. unprocessedRows.value = pageRecords(result.value)
  457. unprocessedTotal.value = pageTotal(result.value)
  458. generatedAt = data.generatedAt || generatedAt
  459. } else if (request.key === 'trend') {
  460. trendRows.value = responseData(result.value, [])
  461. } else if (request.key === 'status') {
  462. statusRows.value = responseData(result.value, [])
  463. } else {
  464. facilityCounts.value = { ...facilityCounts.value, [request.key]: pageTotal(result.value) }
  465. }
  466. })
  467. allRequestsFailed.value = successCount === 0
  468. if (successCount > 0) lastUpdated.value = generatedAt || formatApiDate(new Date())
  469. if (failedLabels.length) errorMessage.value = `${failedLabels.join('、')}加载失败,其他可用数据已正常展示。`
  470. await nextTick()
  471. renderTrendChart()
  472. renderStatusChart()
  473. } finally {
  474. loading.value = false
  475. }
  476. }
  477. function resizeCharts() {
  478. trendChart?.resize()
  479. statusChart?.resize()
  480. }
  481. onMounted(() => {
  482. clockTimer = window.setInterval(() => { now.value = new Date() }, 30000)
  483. resizeObserver = new ResizeObserver(resizeCharts)
  484. if (trendChartRef.value) resizeObserver.observe(trendChartRef.value)
  485. if (statusChartRef.value) resizeObserver.observe(statusChartRef.value)
  486. loadData()
  487. })
  488. onUnmounted(() => {
  489. window.clearInterval(clockTimer)
  490. resizeObserver?.disconnect()
  491. trendChart?.dispose()
  492. statusChart?.dispose()
  493. })
  494. </script>
  495. <style scoped lang="scss">
  496. .lifeline-home {
  497. min-height: calc(100vh - 84px);
  498. padding: 20px 22px 28px;
  499. background: #f3f6fa;
  500. color: #1f2937;
  501. }
  502. .home-header {
  503. display: flex;
  504. align-items: flex-end;
  505. justify-content: space-between;
  506. gap: 24px;
  507. padding: 2px 2px 18px;
  508. border-bottom: 1px solid #dfe6ee;
  509. }
  510. .header-kicker { color: #2563eb; font-size: 12px; font-weight: 700; }
  511. .header-copy h1 { margin: 6px 0 5px; font-size: 26px; line-height: 1.25; }
  512. .header-copy p, .panel-header p { margin: 0; color: #718096; }
  513. .header-tools { display: flex; align-items: center; gap: 14px; }
  514. .date-block {
  515. display: flex;
  516. min-width: 245px;
  517. flex-direction: column;
  518. align-items: flex-end;
  519. gap: 5px;
  520. }
  521. .date-block strong { font-size: 14px; }
  522. .date-block span { color: #8492a6; font-size: 12px; }
  523. .data-alert { margin-top: 16px; }
  524. .metric-grid {
  525. display: grid;
  526. grid-template-columns: repeat(4, minmax(0, 1fr));
  527. gap: 14px;
  528. margin: 18px 0 16px;
  529. }
  530. .metric-card {
  531. position: relative;
  532. display: flex;
  533. min-width: 0;
  534. min-height: 122px;
  535. align-items: center;
  536. gap: 15px;
  537. padding: 20px;
  538. border: 1px solid #e1e7ef;
  539. border-top: 3px solid var(--tone);
  540. border-radius: 8px;
  541. background: #ffffff;
  542. color: inherit;
  543. text-align: left;
  544. cursor: pointer;
  545. transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  546. }
  547. .metric-card:hover {
  548. border-color: var(--tone);
  549. box-shadow: 0 8px 20px rgba(31, 41, 55, 0.08);
  550. transform: translateY(-1px);
  551. }
  552. .metric-icon, .quick-icon {
  553. display: inline-flex;
  554. width: 42px;
  555. height: 42px;
  556. flex: 0 0 42px;
  557. align-items: center;
  558. justify-content: center;
  559. border-radius: 7px;
  560. }
  561. .metric-icon { background: var(--tone-soft); color: var(--tone); font-size: 21px; }
  562. .metric-content { display: flex; min-width: 0; flex: 1; flex-direction: column; }
  563. .metric-label { color: #64748b; font-size: 13px; }
  564. .metric-content strong { margin: 4px 0 2px; color: #172033; font-size: 34px; line-height: 1.05; }
  565. .metric-content small {
  566. overflow: hidden;
  567. color: #94a3b8;
  568. font-size: 12px;
  569. text-overflow: ellipsis;
  570. white-space: nowrap;
  571. }
  572. .metric-arrow { color: #b6c0cd; }
  573. .analysis-grid, .operations-grid {
  574. display: grid;
  575. grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
  576. gap: 16px;
  577. margin-bottom: 16px;
  578. }
  579. .panel {
  580. min-width: 0;
  581. border: 1px solid #e1e7ef;
  582. border-radius: 8px;
  583. background: #ffffff;
  584. box-shadow: 0 2px 8px rgba(31, 41, 55, 0.035);
  585. }
  586. .panel-header {
  587. display: flex;
  588. min-height: 72px;
  589. align-items: center;
  590. justify-content: space-between;
  591. gap: 16px;
  592. padding: 17px 20px 14px;
  593. border-bottom: 1px solid #edf1f5;
  594. }
  595. .panel-header h2 { margin: 0 0 5px; font-size: 17px; line-height: 1.25; }
  596. .panel-header p { font-size: 12px; }
  597. .panel-header .el-button { flex: 0 0 auto; }
  598. .chart-box { width: 100%; height: 292px; }
  599. .trend-panel, .status-panel { position: relative; min-height: 365px; }
  600. .trend-panel .el-empty, .status-panel .el-empty { position: absolute; inset: 84px 0 8px; }
  601. .facility-panel { margin-bottom: 16px; }
  602. .facility-grid {
  603. display: grid;
  604. grid-template-columns: repeat(4, minmax(0, 1fr));
  605. gap: 14px;
  606. padding: 16px 20px 20px;
  607. }
  608. .facility-card {
  609. min-width: 0;
  610. padding: 16px;
  611. border: 1px solid #e7ebf1;
  612. border-radius: 7px;
  613. background: #ffffff;
  614. }
  615. .facility-title, .facility-value {
  616. display: flex;
  617. align-items: center;
  618. justify-content: space-between;
  619. gap: 10px;
  620. }
  621. .facility-title { justify-content: flex-start; }
  622. .facility-title > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
  623. .facility-title strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
  624. .facility-title small, .facility-value span { color: #94a3b8; font-size: 12px; }
  625. .facility-mark {
  626. display: inline-flex;
  627. width: 36px;
  628. height: 36px;
  629. flex: 0 0 36px;
  630. align-items: center;
  631. justify-content: center;
  632. border-radius: 7px;
  633. background: var(--facility-soft);
  634. color: var(--facility-color);
  635. font-size: 14px;
  636. font-weight: 700;
  637. }
  638. .facility-value { margin: 14px 0 10px; align-items: flex-end; }
  639. .facility-value strong { font-size: 27px; line-height: 1; }
  640. .facility-progress { height: 5px; overflow: hidden; border-radius: 3px; background: #eef2f6; }
  641. .facility-progress i {
  642. display: block;
  643. height: 100%;
  644. border-radius: inherit;
  645. background: var(--facility-color);
  646. transition: width 0.35s ease;
  647. }
  648. .warning-table { width: calc(100% - 32px); margin: 0 16px 16px; cursor: pointer; }
  649. .warning-name { display: flex; min-width: 0; align-items: center; gap: 8px; }
  650. .warning-name i {
  651. width: 8px;
  652. height: 8px;
  653. flex: 0 0 8px;
  654. border-radius: 50%;
  655. background: #94a3b8;
  656. }
  657. .warning-name i.level-1 { background: #2563eb; }
  658. .warning-name i.level-2 { background: #eab308; }
  659. .warning-name i.level-3 { background: #f97316; }
  660. .warning-name i.level-4 { background: #dc2626; }
  661. .warning-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  662. .waiting-time { color: #b45309; font-weight: 600; }
  663. .quick-panel { align-self: stretch; }
  664. .quick-list { display: flex; flex-direction: column; padding: 8px 14px 14px; }
  665. .quick-action {
  666. display: flex;
  667. width: 100%;
  668. min-height: 64px;
  669. align-items: center;
  670. gap: 12px;
  671. padding: 10px 8px;
  672. border: 0;
  673. border-bottom: 1px solid #edf1f5;
  674. background: transparent;
  675. color: inherit;
  676. text-align: left;
  677. cursor: pointer;
  678. }
  679. .quick-action:last-child { border-bottom: 0; }
  680. .quick-action:hover { background: #f8fafc; }
  681. .quick-action > span:nth-child(2) {
  682. display: flex;
  683. min-width: 0;
  684. flex: 1;
  685. flex-direction: column;
  686. gap: 4px;
  687. }
  688. .quick-action strong, .quick-action small {
  689. overflow: hidden;
  690. text-overflow: ellipsis;
  691. white-space: nowrap;
  692. }
  693. .quick-action strong { font-size: 14px; }
  694. .quick-action small { color: #94a3b8; font-size: 12px; }
  695. .quick-icon { width: 38px; height: 38px; flex-basis: 38px; font-size: 18px; }
  696. .quick-arrow { flex: 0 0 auto; color: #b6c0cd; }
  697. @media (max-width: 1180px) {
  698. .metric-grid, .facility-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  699. .analysis-grid, .operations-grid { grid-template-columns: 1fr; }
  700. .quick-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
  701. }
  702. @media (max-width: 680px) {
  703. .lifeline-home { padding: 14px 12px 22px; }
  704. .home-header { align-items: flex-start; flex-direction: column; }
  705. .header-tools { width: 100%; justify-content: space-between; }
  706. .date-block { min-width: 0; align-items: flex-start; }
  707. .metric-grid, .facility-grid, .quick-list { grid-template-columns: 1fr; }
  708. .metric-card { min-height: 110px; }
  709. .panel-header { align-items: flex-start; }
  710. .chart-box { height: 260px; }
  711. .trend-panel, .status-panel { min-height: 335px; }
  712. .facility-grid { padding: 14px; }
  713. }
  714. </style>