Browse Source

Merge remote-tracking branch 'origin/master'

zengy 3 weeks ago
parent
commit
aec29a393d

+ 24 - 0
memory/sessions/2026-09-28.md

@@ -25,3 +25,27 @@
 - 当前筛选导出逐页查询统一接口(每页最多 100),不只导出屏幕上当前页。列表与态势独立失败反馈、保留已有数据,并用请求代次防止旧响应覆盖新查询;图表有局部加载,详情抽屉适配窄屏。
 - 代码审查 Standards 初报 4 项,纠正 3 项硬性问题,剩余 SQL 与 Java 同步状态优先级的重复规则为分页筛选所需的启发式风险,测试锁定两边口径;Spec 初报的工单跳转及状态口径偏差均已修正并复核撤回。
 - 前端全量 Node 177 项:174 通过、3 个旧设备台账/责任人测试既存失败;生产构建通过。后端 zksy-system 全量 190 项:189 通过、1 个 cockpit 旧 pipe_length 检查失败(其他任务代码);报警 service 与 mapper 定向测试通过。未进行真实登录与 Kingbase 联调,前后端需同步部署。
+
+## 供水报警管理页面视觉回归
+
+- 用户反馈从报警管理切到首页再返回时,顶部两张统计卡图标与文字重叠;筛选标题的图标与文字被分到两端,并要求视觉语言对齐「供水设施管理-管网数据统计分析」。
+- 独立的样式反馈测试先复现:共享 `waterSupplyPageTheme.scss` 把 `.metric-icon` 绝对定位,而本页没有将其复位;本页 `.card-title` 的 `justify-content: space-between` 将筛选标题推向右侧。两个断言先红后绿。
+- 仅调整 `WaterAlarmPage.vue` 的 scoped 布局与图表标题:图标回到弹性布局,筛选标题左侧并排,页头/卡片/图表区沿用统计分析页的蓝白色值与间距;四级报警业务配色不变。新增 `tests/waterAlarmLayout.test.mjs` 作为回归测试。
+- 本地前端服务可访问,但当前应用内会话停在登录页,Chrome 扩展连接不可用,因此真实「首页→报警管理」路线仍需人工视觉复核;未提交登录信息或修改用户会话。
+- 单文件布局与业务测试 11 项通过,生产构建通过;全量 179 项中 176 项通过,余下 3 项为此前已知的旧设备台账/责任人测试失败,无新增失败。
+
+## Gogs #67 / T03 运行监测三页设备类型口径
+
+- 在既有监测 REST 接口与页面 seam 上按设备类型树 `equipment_type.id` 区分三页:流量 11、压力 12/14、漏失 13;不新增测试数据或表结构,保留原页面视觉和 API 形状。
+- 后端默认查询在无采样时仍返回供水设备基础档案,监测值与时间保持空值;有采集时间或数值筛选时仍只保留匹配采样的设备。前端将无监测值显示为“暂无数据”,不计入异常点位统计。
+- 定向测试先红后绿:`MonitoringServiceImplTest` 模拟四台已约定供水设备及排水设备,核对三页归属、无采样空值与筛选行为;`waterSupplyMonitoring.test.mjs` 锁定无数据的前端状态。
+- 后端 `zksy-system` 及依赖全量测试通过;整仓 Maven 在并行新增的 cockpit 测试编译中失败(`CockpitMonitoringPointDetailSnapshotContractTest` 调用旧 `load` 形参),未触碰该文件。前端构建通过,Node 全量 179 项中 176 通过、3 项为既有旧设备页测试失败。真实 KingbaseES 与浏览器登录态验收仍由项目侧复核。
+
+## Gogs #68 / T04 首页入口路由跳转修复
+
+- 公共 seam 为首页语义入口解析到当前用户动态菜单路由;未修改数据库菜单或权限配置。
+- 新增 `src/router/waterHomeRouteResolver.js`,支持供水专属监测报警路径和已部署的共享报警菜单路径,排除其他子系统/未知入口;首页统一通过解析器跳转。
+- 修复审核快捷入口及实时报警回落审核时丢失 `rootTypeId=1` 的问题,确保共享审核页仍按供水范围加载;保留 alarmId/deviceCode 深链参数。
+- 新增路由解析器测试,扩展 `npm test` 项目入口;Home 模型测试覆盖审核入口供水范围。
+- `npm test` 6/6 通过;首页/模型及路由目标回归 25 项通过;生产构建通过;`git diff --check` 通过。全量 183 项中 180 项通过,3 项仍是旧设备台账/责任人测试引用已删除 `WaterDevicePage.vue` 的既有失败。
+- Code Review:Standards 无硬违规,Spec 复核无阻断;将路由评分数字收敛为具名常量。保留已有 `.gitignore` 用户修改,不纳入本票。

+ 1 - 0
package.json

@@ -7,6 +7,7 @@
   "type": "module",
   "scripts": {
     "dev": "vite",
+    "test": "node --test tests/waterHomeRouteResolver.test.mjs tests/waterSupplyMonitoring.test.mjs tests/waterSupplyModel.test.mjs",
     "build:prod": "vite build",
     "build:stage": "vite build --mode staging",
     "preview": "vite preview"

+ 79 - 0
src/router/waterHomeRouteResolver.js

@@ -0,0 +1,79 @@
+const SCORE = {
+  SUFFIX_BASE: 1000,
+  WATER_PATH: 500,
+  ROOT_TYPE: 400,
+  SHARED_ALARM_PATH: 200,
+  TITLE: 100
+}
+
+const WATER_ALARM_ENTRY_ALIASES = {
+  '/monitorAlarm/index': {
+    title: '报警管理',
+    suffixes: ['/monitorAlarm/index', '/alarm/common/list', '/alarm/list', '/alarm/alarmList', '/alarm/index']
+  },
+  '/monitorAlarm/audit': {
+    title: '报警审核',
+    suffixes: ['/monitorAlarm/audit', '/alarm/common/audit', '/alarm/audit', '/alarm/alarmAudit']
+  }
+}
+
+function normalizePath(value) {
+  const path = String(value || '').trim()
+  if (!path) return ''
+  const normalized = path.startsWith('/') ? path : `/${path}`
+  return normalized.replace(/\/+/gu, '/').replace(/\/$/u, '') || '/'
+}
+
+function parseQuery(value) {
+  if (!value) return {}
+  if (typeof value === 'object') return value
+  try { return JSON.parse(value) || {} } catch { return {} }
+}
+
+function routeRootTypeId(route) {
+  const query = parseQuery(route?.query || route?.meta?.query)
+  return query.rootTypeId == null ? null : Number(query.rootTypeId)
+}
+
+function routeScore(route, candidates, title) {
+  const path = normalizePath(route?.path)
+  if (!path) return Number.NEGATIVE_INFINITY
+  const rootTypeId = routeRootTypeId(route)
+  if (rootTypeId != null && rootTypeId !== 1) return Number.NEGATIVE_INFINITY
+  if (title && !path.includes('/subSystem/waterSupply/') && !path.startsWith('/subSystem/alarm/')) {
+    return Number.NEGATIVE_INFINITY
+  }
+
+  const suffixIndex = candidates.findIndex(candidate => path.endsWith(normalizePath(candidate)))
+  const titleMatch = route?.meta?.title === title
+  if (suffixIndex < 0 && !titleMatch) return Number.NEGATIVE_INFINITY
+  let score = suffixIndex < 0 ? 0 : SCORE.SUFFIX_BASE - suffixIndex
+  if (titleMatch) score += SCORE.TITLE
+  if (path.includes('/subSystem/waterSupply/')) score += SCORE.WATER_PATH
+  if (rootTypeId === 1) score += SCORE.ROOT_TYPE
+  if (path.startsWith('/subSystem/alarm/')) score += SCORE.SHARED_ALARM_PATH
+  return score
+}
+
+/**
+ * Resolve a semantic water-home entry against the routes currently registered by
+ * the permission store. Shared alarm menus and dedicated water menus both occur
+ * in deployed environments, so this boundary must not assume a database path.
+ */
+export function resolveWaterHomeRoute(routes, target) {
+  const list = Array.isArray(routes) ? routes : []
+  const canonicalPath = typeof target === 'string' ? target : target?.path
+  const definition = WATER_ALARM_ENTRY_ALIASES[canonicalPath]
+  const candidates = definition?.suffixes || [canonicalPath]
+  const title = definition?.title
+  let best = null
+  let bestScore = Number.NEGATIVE_INFINITY
+  for (const route of list) {
+    const score = routeScore(route, candidates, title)
+    if (score > bestScore) {
+      best = route
+      bestScore = score
+    }
+  }
+  return bestScore === Number.NEGATIVE_INFINITY ? null : best
+}

+ 2 - 1
src/utils/waterHomeModel.js

@@ -42,7 +42,7 @@ export const WATER_DEVICE_ROOT_TYPE_ID = 1
 export const HOME_QUICK_ENTRIES = [
   { key: 'abnormal', label: '设备异常管理', suffix: '/device/abnormal', icon: 'WarningFilled' },
   { key: 'alarm', label: '报警管理', suffix: '/monitorAlarm/index', icon: 'BellFilled' },
-  { key: 'audit', label: '报警审核', suffix: '/monitorAlarm/audit', icon: 'Finished' },
+  { key: 'audit', label: '报警审核', suffix: '/monitorAlarm/audit', query: { rootTypeId: WATER_DEVICE_ROOT_TYPE_ID }, icon: 'Finished' },
   { key: 'map', label: '监测报警一张图', suffix: '/waterSupplyAlarmGIS', query: { rootTypeId: WATER_DEVICE_ROOT_TYPE_ID }, icon: 'MapLocation' }
 ]
 
@@ -244,6 +244,7 @@ export function realtimeAlarmJumpTarget(row = {}) {
   return {
     path: '/monitorAlarm/audit',
     query: {
+      rootTypeId: WATER_DEVICE_ROOT_TYPE_ID,
       alarmId: row?.id ?? row?.alarmId ?? undefined,
       deviceCode: row?.deviceCode || undefined
     }

+ 1 - 1
src/utils/waterSupplyModel.js

@@ -34,7 +34,7 @@ export function normalizeMonitoringRecord(record = {}, metric = 'value', monitor
     location: record.equipmentLocation ?? record.location ?? record.address ?? '-',
     value: value == null || value === '' ? null : Number(value),
     unit: record.unit ?? (metric === 'pressure' ? 'MPa' : metric === 'power' ? 'kW' : 'm³/h'),
-    status: record.status ?? record.onlineStatus ?? record.alarmStatus ?? 0,
+    status: value == null || value === '' ? 'no-data' : record.status ?? record.onlineStatus ?? record.alarmStatus ?? 0,
     updateTime: record.updateTime ?? record.monitorTime ?? record.createTime ?? record.time ?? '-'
   }
 }

+ 70 - 20
src/views/subSystem/waterSupply/components/WaterAlarmPage.vue

@@ -20,9 +20,9 @@
 
     <el-alert v-if="dashboardError" class="dashboard-error" :title="dashboardError" type="error" show-icon :closable="false"><el-button link type="primary" @click="load">重新加载</el-button></el-alert>
     <div v-loading="dashboardLoading" class="chart-grid">
-      <el-card shadow="never" class="water-panel trend-card"><template #header><div class="card-title"><span>报警趋势</span><span class="muted">近 {{ trendDays }} 天 · 四级报警</span></div></template><div ref="trendRef" class="chart" /></el-card>
-      <el-card shadow="never" class="water-panel"><template #header><div class="card-title">报警分类占比</div></template><div ref="warningRef" class="chart chart--small" /></el-card>
-      <el-card shadow="never" class="water-panel"><template #header><div class="card-title">设备分类占比</div></template><div ref="deviceRef" class="chart chart--small" /></el-card>
+      <el-card shadow="never" class="water-panel chart-card trend-card"><template #header><div class="card-title"><el-icon><TrendCharts /></el-icon><span>报警趋势</span><span class="muted chart-caption">近 {{ trendDays }} 天 · 四级报警</span></div></template><div ref="trendRef" class="chart" /></el-card>
+      <el-card shadow="never" class="water-panel chart-card"><template #header><div class="card-title"><el-icon><PieChart /></el-icon><span>报警分类占比</span></div></template><div ref="warningRef" class="chart chart--small" /></el-card>
+      <el-card shadow="never" class="water-panel chart-card"><template #header><div class="card-title"><el-icon><DataAnalysis /></el-icon><span>设备分类占比</span></div></template><div ref="deviceRef" class="chart chart--small" /></el-card>
     </div>
 
     <el-card shadow="never" class="filter-card water-panel"><template #header><div class="card-title"><el-icon><Search /></el-icon><span>报警台账筛选</span></div></template>
@@ -61,7 +61,7 @@
 
 <script setup>
 import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
-import { BellFilled, Download, List, Monitor, Refresh, RefreshLeft, Search, View } from '@element-plus/icons-vue'
+import { BellFilled, DataAnalysis, Download, List, Monitor, PieChart, Refresh, RefreshLeft, Search, TrendCharts, View } from '@element-plus/icons-vue'
 import { ElMessage } from 'element-plus'
 import { saveAs } from 'file-saver'
 import * as echarts from 'echarts'
@@ -168,20 +168,70 @@ onBeforeUnmount(() => { ++loadGeneration; window.removeEventListener('resize', r
 </script>
 
 <style scoped>
-.water-page { min-height: calc(100vh - 84px); padding: 20px; color: #1e293b; background: #f3f7fb; }
-.page-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:16px; }
-.page-title { display:flex; align-items:center; gap:12px; }
-.page-title-icon { display:grid; place-items:center; width:42px; height:42px; border-radius:8px; color:#fff; background:#2563eb; }
-.page-heading h2 { margin:0 0 4px; color:#172b4d; font-size:20px; }
-.heading-actions { display:flex; gap:8px; }
-.muted { color:#718096; font-size:13px; }
-.metric-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
-.metric { display:flex; align-items:center; gap:12px; min-height:74px; padding:14px 16px; background:#fff; border:1px solid #e1ebf3; border-radius:8px; box-shadow:0 5px 16px rgba(28,75,110,.05); }
-.metric-icon { display:grid; place-items:center; flex:0 0 40px; width:40px; height:40px; border-radius:8px; font-size:20px; }
-.tone-blue { color:#2563eb; background:#e6f4ff; }.tone-orange { color:#d97706; background:#fff7ed; }.tone-cyan { color:#0891b2; background:#ecfeff; }.tone-green { color:#16a34a; background:#f0fdf4; }.tone-red { color:#dc2626; background:#fff1f2; }
-.metric-body { min-width:0; }.metric-body span { display:block; color:#718096; font-size:13px; }.metric-value { display:flex; align-items:baseline; gap:5px; }.metric-value strong { color:#17324d; font-size:24px; }.metric-value small { color:#94a3b8; }
-.chart-grid { display:grid; grid-template-columns:minmax(0,2fr) minmax(260px,1fr) minmax(260px,1fr); gap:12px; margin-bottom:16px; }.water-panel { overflow:hidden; border:1px solid #e1ebf3; border-radius:8px; box-shadow:0 5px 16px rgba(28,75,110,.05); }.chart { height:300px; }.chart--small { height:300px; }.trend-card :deep(.el-card__header), .water-panel :deep(.el-card__header) { padding:14px 16px; }.card-title { display:flex; align-items:center; justify-content:space-between; gap:8px; color:#17324d; font-weight:600; }
-.dashboard-error { margin-bottom:16px; }.filter-card { margin-bottom:16px; }.filter-card :deep(.el-form-item) { margin-top:8px; margin-bottom:8px; }.table-card :deep(.el-table) { --el-table-header-bg-color:#f8fafc; --el-table-row-hover-bg-color:#eff6ff; }.table-card :deep(.el-pagination) { justify-content:flex-end; margin-top:16px; }.table-toolbar { display:flex; justify-content:space-between; align-items:center; }
-@media (max-width:1000px) { .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }.chart-grid { grid-template-columns:1fr; } }
-@media (max-width:650px) { .page-heading { align-items:flex-start; flex-direction:column; }.metric-grid { grid-template-columns:1fr; }.heading-actions { width:100%; }.heading-actions .el-button { flex:1; } }
+/* 仅在报警页作用域内复用管网数据统计分析的蓝白卡片语言,避免影响其他供水页面。 */
+.water-page {
+  min-height: calc(100vh - 84px);
+  padding: 20px;
+  color: #1e293b;
+  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 45%, #eef2f7 100%);
+}
+.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
+.page-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
+.page-title-icon {
+  display: grid; place-items: center; flex: 0 0 42px;
+  width: 42px; height: 42px; border-radius: 8px; color: #fff;
+  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
+  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
+}
+.page-heading h2 { margin: 0 0 4px; font-size: 20px; color: #1e293b; }
+.heading-actions { display: flex; align-items: center; gap: 12px; }
+.muted { color: #64748b; font-size: 13px; }
+
+.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
+.metric {
+  position: static; display: flex; align-items: center; gap: 14px;
+  min-width: 0; padding: 16px 18px; background: #fff;
+  border: 1px solid #e2e8f0; border-radius: 8px;
+  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
+}
+.metric-icon {
+  position: static; top: auto; left: auto; flex: 0 0 42px;
+  display: grid; place-items: center; width: 42px; height: 42px;
+  border-radius: 8px; font-size: 22px;
+}
+.tone-blue { color: #2563eb; background: linear-gradient(135deg, #dbeafe, #eff6ff); }
+.tone-red { color: #dc2626; background: linear-gradient(135deg, #fee2e2, #fff1f2); }
+.metric-body { min-width: 0; }
+.metric-body span { display: block; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748b; font-size: 13px; }
+.metric-value { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
+.metric-value strong { color: #1e293b; font-size: 24px; line-height: 1.2; }
+.metric-value small { margin-left: 0; color: #94a3b8; }
+
+.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
+.trend-card { grid-column: 1 / -1; }
+.water-panel { overflow: hidden; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04); }
+.chart { height: 320px; }
+.card-title { display: flex; align-items: center; justify-content: flex-start; gap: 8px; color: #1e293b; font-weight: 600; }
+.card-title .el-icon { color: #2563eb; font-size: 18px; }
+.chart-caption { margin-left: auto; font-weight: 400; }
+.chart-card :deep(.el-card__header), .filter-card :deep(.el-card__header), .table-card :deep(.el-card__header) {
+  padding: 14px 18px; border-bottom: 1px solid #e2e8f0;
+}
+.filter-card :deep(.el-card__header) { background: #fbfdff; }
+.dashboard-error, .filter-card { margin-bottom: 16px; }
+.filter-card :deep(.el-form-item) { margin: 8px 16px 8px 0; }
+.filter-card :deep(.el-form-item__label) { color: #475569; }
+.table-card :deep(.el-card__body) { padding-top: 0; }
+.table-card :deep(.el-table) { --el-table-border-color: #e2e8f0; --el-table-header-bg-color: #f8fafc; --el-table-header-text-color: #475569; --el-table-row-hover-bg-color: #eff6ff; }
+.table-card :deep(.el-pagination) { justify-content: flex-end; margin-top: 16px; }
+.table-toolbar { display: flex; align-items: center; gap: 10px; }
+@media (max-width: 1000px) { .chart-grid { grid-template-columns: 1fr; } }
+@media (max-width: 650px) {
+  .water-page { padding: 12px; }
+  .page-heading { align-items: flex-start; flex-direction: column; }
+  .metric-grid { grid-template-columns: 1fr; }
+  .heading-actions { width: 100%; }
+  .heading-actions .el-button { flex: 1; }
+  .chart-caption { margin-left: 0; }
+}
 </style>

+ 3 - 2
src/views/subSystem/waterSupply/components/WaterMonitoringPage.vue

@@ -123,7 +123,7 @@
                 <el-table-column prop="location" label="安装位置" min-width="180" show-overflow-tooltip/>
                 <el-table-column :label="`${metricLabel}(${unit})`" min-width="130">
                     <template #default="{ row }">
-            <span :class="{ danger: row.value == null || row.status === 1 || row.status === '1' }">
+            <span :class="{ danger: row.status === 1 || row.status === '1' }">
               {{ row.value ?? '-' }}
             </span>
                     </template>
@@ -273,13 +273,14 @@
         return values.length ? (values.reduce((a, b) => a + b, 0) / values.length).toFixed(2) : '-'
     })
     const abnormalCount = computed(() => page.value.records.filter(item =>
-        item.status === 1 || item.status === '1' || item.value == null
+        item.status === 1 || item.status === '1'
     ).length)
     const latestTime = computed(() =>
         page.value.records.map(item => item.updateTime).filter(Boolean).sort().at(-1) || '-'
     )
 
     function statusText(row) {
+        if (row.status === 'no-data') return '暂无数据'
         if (row.status === 1 || row.status === '1') return '异常'
         if (row.status === 0 || row.status === '0') return '正常'
         return row.status ? '在线' : '未知'

+ 2 - 1
src/views/subSystem/waterSupply/components/WaterSupplyHome.vue

@@ -293,6 +293,7 @@ import { normalizeGeoJson, normalizePage, unwrapResponse } from '@/utils/waterSu
 import { normalizeDeviceGisPoints } from '@/utils/waterSupplyUiModel'
 import { gisPointStatusColors, gisPointStatusLabels, gisPointStatusTagTypes } from '@/utils/gisMapColors'
 import { buildFacilityMapModel } from '@/utils/waterFacilityGisModel'
+import { resolveWaterHomeRoute } from '@/router/waterHomeRouteResolver'
 import GisMapCanvas from '@/components/GisMapCanvas.vue'
 import {
   HOME_QUICK_ENTRIES, WATER_DEVICE_ROOT_TYPE_ID, buildHomeGisOverview, buildHomeWorkOrderQuery,
@@ -494,7 +495,7 @@ function openRealtimeAlarm(item) {
 }
 
 function resolveRoutePath(suffix) {
-  const matched = router.getRoutes().find(item => item.path.endsWith(suffix))
+  const matched = resolveWaterHomeRoute(router.getRoutes(), suffix)
   return matched ? matched.path : ''
 }
 

+ 34 - 0
tests/waterAlarmLayout.test.mjs

@@ -0,0 +1,34 @@
+import assert from 'node:assert/strict'
+import { readFile } from 'node:fs/promises'
+import test from 'node:test'
+import postcss from 'postcss'
+import { parse } from '@vue/compiler-sfc'
+
+const pagePath = new URL('../src/views/subSystem/waterSupply/components/WaterAlarmPage.vue', import.meta.url)
+const themePath = new URL('../src/views/subSystem/waterSupply/components/waterSupplyPageTheme.scss', import.meta.url)
+
+async function effectiveDeclarations(selector) {
+  const { descriptor } = parse(await readFile(pagePath, 'utf8'))
+  const sharedTheme = await readFile(themePath, 'utf8')
+  const scopedStyle = descriptor.styles.find(style => style.scoped)?.content || ''
+  const declarations = {}
+  // 实际页面在全局共享主题之后加载 scoped 页面样式;同名选择器按顺序覆盖。
+  postcss.parse(`${sharedTheme}\n${scopedStyle}`).walkRules(rule => {
+    if (!rule.selectors.some(item => item.trim() === selector)) return
+    rule.walkDecls(decl => { declarations[decl.prop] = decl.value })
+  })
+  return declarations
+}
+
+test('alarm metric icon remains in flex flow when the shared page theme is loaded', async () => {
+  const icon = await effectiveDeclarations('.metric-icon')
+  const card = await effectiveDeclarations('.metric')
+  assert.equal(icon.position, 'static', '绝对定位会让图标脱离卡片弹性布局,与数字文字重叠')
+  assert.match(card.display || '', /flex/u)
+})
+
+test('alarm filter title keeps its text adjacent to the search icon', async () => {
+  const heading = await effectiveDeclarations('.card-title')
+  assert.equal(heading['justify-content'], 'flex-start', 'space-between 会将标题推到筛选卡片右侧')
+  assert.ok(Number.parseFloat(heading.gap) > 0)
+})

+ 3 - 1
tests/waterHomeModel.test.mjs

@@ -211,7 +211,7 @@ test('realtime alarm jumps split between audit and work order by display status'
     displayStatus: 1
   }), {
     path: '/monitorAlarm/audit',
-    query: { alarmId: 'alarm-1', deviceCode: 'CN-GS-202609020001' }
+    query: { rootTypeId: 1, alarmId: 'alarm-1', deviceCode: 'CN-GS-202609020001' }
   })
   assert.deepEqual(realtimeAlarmJumpTarget({
     id: 'alarm-2',
@@ -225,6 +225,7 @@ test('realtime alarm jumps split between audit and work order by display status'
   // 已转工单但缺少工单号时回落到报警审核,避免无效跳转
   const fallback = realtimeAlarmJumpTarget({ id: 'alarm-3', displayStatus: 2 })
   assert.equal(fallback.path, '/monitorAlarm/audit')
+  assert.equal(fallback.query.rootTypeId, 1)
 })
 
 test('abnormal todo rows reuse the shared device normalization contract', () => {
@@ -354,6 +355,7 @@ test('home GIS facility points share device status color semantics by facility s
 test('home quick entries cover the four workbench jumps', () => {
   assert.deepEqual(HOME_QUICK_ENTRIES.map(item => item.label), ['设备异常管理', '报警管理', '报警审核', '监测报警一张图'])
   assert.ok(HOME_QUICK_ENTRIES.every(item => item.suffix.startsWith('/')))
+  assert.equal(HOME_QUICK_ENTRIES.find(item => item.key === 'audit').query.rootTypeId, 1)
 })
 
 test('home device statistics derive online rate from the unified equipment endpoint', () => {

+ 35 - 0
tests/waterHomeRouteResolver.test.mjs

@@ -0,0 +1,35 @@
+import test from 'node:test'
+import assert from 'node:assert/strict'
+import { resolveWaterHomeRoute } from '../src/router/waterHomeRouteResolver.js'
+
+test('resolves dedicated water routes by canonical suffix', () => {
+  const route = resolveWaterHomeRoute([
+    { path: '/subSystem/waterSupply/monitorAlarm/index', meta: { title: '报警管理' } },
+    { path: '/subSystem/waterSupply/monitorAlarm/audit', meta: { title: '报警审核' } }
+  ], '/monitorAlarm/index')
+
+  assert.equal(route.path, '/subSystem/waterSupply/monitorAlarm/index')
+})
+
+test('resolves legacy shared alarm menus without changing database routes', () => {
+  const routes = [
+    { path: '/subSystem/alarm/alarmList', meta: { title: '报警管理' }, query: { rootTypeId: 1 } },
+    { path: '/subSystem/alarm/alarmAudit', meta: { title: '报警审核' }, query: { rootTypeId: 1 } }
+  ]
+
+  assert.equal(resolveWaterHomeRoute(routes, '/monitorAlarm/index').path, '/subSystem/alarm/alarmList')
+  assert.equal(resolveWaterHomeRoute(routes, '/monitorAlarm/audit').path, '/subSystem/alarm/alarmAudit')
+})
+
+test('does not select an unrelated subsystem route with the same title', () => {
+  const routes = [
+    { path: '/subSystem/drainage/monitorAlarm/index', meta: { title: '报警管理' } },
+    { path: '/subSystem/waterSupply/monitorAlarm/index', meta: { title: '报警管理' }, query: { rootTypeId: 1 } }
+  ]
+
+  assert.equal(resolveWaterHomeRoute(routes, '/monitorAlarm/index').path, '/subSystem/waterSupply/monitorAlarm/index')
+})
+
+test('returns null when the requested entry is not registered', () => {
+  assert.equal(resolveWaterHomeRoute([{ path: '/404', meta: { title: '页面不存在' } }], '/monitorAlarm/index'), null)
+})

+ 16 - 0
tests/waterSupplyMonitoring.test.mjs

@@ -1,4 +1,5 @@
 import assert from 'node:assert/strict'
+import test from 'node:test'
 import {
   buildMonitoringQuery,
   buildTrendQuery,
@@ -56,6 +57,21 @@ const trendPoint = normalizeMonitoringRecord({
 assert.equal(trendPoint.updateTime, '2026-09-01 12:30:00')
 assert.equal(trendPoint.value, 25.5)
 
+test('unmeasured water devices keep their identity and show a neutral monitoring empty state', () => {
+  for (const [metric, sample] of [
+    ['flow', { equipmentId: 'flow-11', equipmentName: '测试流量计', instantFlow: null, monitorTime: null }],
+    ['pressure', { equipmentId: 'pressure-12', equipmentName: '测试压力计', pressureValue: null, monitorTime: null }],
+    ['power', { equipmentId: 'leak-13', equipmentName: '测试漏失监测01', power: null, monitorTime: null }]
+  ]) {
+    const row = normalizeMonitoringRecord(sample, metric)
+    assert.equal(row.id, sample.equipmentId)
+    assert.equal(row.equipmentName, sample.equipmentName)
+    assert.equal(row.value, null)
+    assert.equal(row.status, 'no-data')
+    assert.equal(row.updateTime, '-')
+  }
+})
+
 const exportError = await readMonitoringExportError(
   new Blob(['{"code":500,"msg":"导出数据过多"}'], {type: 'application/json'})
 )