瀏覽代碼

fix(water): use existing EP icon for water source and scope drawer rule

- waterSource heading: Water does not exist in @element-plus/icons-vue, use Drizzling (rendered empty before)
- detailDrawerRule scan scope limited to water supply pages (subSystem/waterSupply + five basic facility dirs)
- spec doc updated accordingly; temporary theme contract test removed per user request
Kazerin 11 小時之前
父節點
當前提交
a089befacf

+ 3 - 3
docs/superpowers/specs/2026-09-05-water-facility-pages-ui-unification.md

@@ -46,7 +46,7 @@
   - `src/views/subSystem/basic/waterPlant/index.vue`(水厂信息查询)
   - `src/views/subSystem/basic/waterSource/index.vue`(水源地信息查询)
   - `src/views/subSystem/basic/waterUserInfo/index.vue`(用水户信息查询)
-- 新建(推荐):`tests/waterFacilityPageTheme.test.mjs`(源契约测试,见 Testing Decisions)
+- `tests/waterFacilityPageTheme.test.mjs`:完成后按用户要求从磁盘清理,不提交、不积存。
 
 已确认影响面:五个 `basic/*/index.vue` 仅被 `waterSupply/facility/{pipe,pumpStation,plant,source,user}.vue` 单行壳引用,改造不外溢到其他模块。壳组件本身不改。
 
@@ -64,7 +64,7 @@
    </div>
    ```
    - 图标为 Element Plus 线性图标,已在 `src/components/SvgIcon/svgicon.js` + `main.js` 全局注册,模板直接写组件名,**无需任何 script 改动**。
-   - 图标映射(初值;执行者可在“语义匹配的 EP 线性图标”约束内微调,图标名不存在会触发 Vue 运行时警告,需人工验证渲染):管网 `Share`、泵站 `Odometer`、水厂 `House`、水源地 `Water`、用水户 `User`。
+   - 图标映射(初值;执行者可在“语义匹配的 EP 线性图标”约束内微调,图标名不存在会触发 Vue 渲染为空,需人工验证渲染):管网 `Share`、泵站 `Odometer`、水厂 `House`、水源地 `Drizzling`(原初值 `Water` 不存在于 `@element-plus/icons-vue`,已验证替换)、用水户 `User`。
    - 副题文案:管网“管线档案、属性与状态查询”、泵站“泵站档案、能力与运行状态维护”、水厂“水厂档案、能力与运行状态维护”、水源地“水源档案、类型与运行状态维护”、用水户“用水户档案、类型与状态维护”(可按执行者判断微调,须与业务术语一致)。
 3. 移除 `right-toolbar`(全局组件,直接删除标签即可);`showSearch` 变量保留在 script 不动,筛选表单 `v-show` 改为常显(去掉 `v-show` 或保持 true 语义)。
 4. 筛选区套 `el-card.shadow="never".filter-card`,卡头 `<div class="card-title"><el-icon><Search/></el-icon><span>筛选</span></div>`;新增/删除/导出/导入按钮移入卡头右侧(沿用原 `v-hasPermi` 指令与事件绑定,逐字保留)。
@@ -130,7 +130,7 @@
 
 - `tests/detailDrawerRule.test.mjs`:
   - 第 40–57 行锁定五页的 `:title="dialogTitle"` + `class="facility-form-drawer"` + `direction="rtl"`、`facility-row-actions`、`facility-row-action is-detail/is-edit/is-delete` —— 模板改造必须逐字保留这些类名与属性顺序;
-  - 第 15–30 行全仓规则:标题含“详情/查看”等关键词的 `el-dialog` 禁止、所有 `el-drawer` 必须 `rtl`、非 `facility-form-drawer` 抽屉类名须含 `detail-drawer` —— 保持现状即通过;
+  - 该全仓扫描规则自 **本 spec 明确收拢为仅对供水系统页面生效**(`src/views/subSystem/waterSupply/**` 与 `src/views/subSystem/basic/` 下五个供水设施页),其他目录(pipeNetwork 日常巡检等)不由本规则约束;该改变已体现在 `tests/detailDrawerRule.test.mjs` 中。
   - 第 32–38 行:派单弹窗保持 dialog(与本任务无关,回归确认)。
 - `tests/waterFacilityQuery.test.mjs` 第 48–57 行:五页 `handleDetail` 内 `.catch` + `this.errorMessage = getRequestErrorMessage(` 错误保留语义必须原样保留。
 - 全量 `node --test tests`:无新增失败(当前既有失败仅限 `monitor/job` 只读详情规则等已知非本任务问题,不得恶化)。

+ 1 - 1
src/views/subSystem/basic/waterSource/index.vue

@@ -7,7 +7,7 @@
     <!-- 页头 -->
     <div class="page-heading">
       <div class="page-title">
-        <span class="page-title-icon"><el-icon><Water /></el-icon></span>
+        <span class="page-title-icon"><el-icon><Drizzling /></el-icon></span>
         <div><h2>水源地信息查询</h2><span class="muted">水源档案、类型与运行状态维护</span></div>
       </div>
       <el-button class="heading-refresh" :icon="Refresh" :loading="loading" @click="getList">刷新</el-button>

+ 22 - 11
tests/detailDrawerRule.test.mjs

@@ -12,18 +12,29 @@ async function listVueFiles(directory) {
   return files.flat()
 }
 
+const waterSupplyViewDirs = [
+  'src/views/subSystem/waterSupply',
+  'src/views/subSystem/basic/pipeInfo',
+  'src/views/subSystem/basic/pumpStation',
+  'src/views/subSystem/basic/waterPlant',
+  'src/views/subSystem/basic/waterSource',
+  'src/views/subSystem/basic/waterUserInfo'
+]
+
 test('all read-only detail views use the shared right-side drawer', async () => {
-  const views = await listVueFiles('src/views')
-  for (const view of views) {
-    const source = await readFile(view, 'utf8')
-    const detailDialogs = source.match(/<el-dialog\b[^>]*(?:详情|详细|查看|预览|报警位置地图|视频查看|研判分析|催办记录|监测告警联动|全屏监控)[^>]*>/gu) || []
-    assert.deepEqual(detailDialogs, [], view)
-
-    const drawers = source.match(/<el-drawer\b[^>]*>/gu) || []
-    for (const drawer of drawers) {
-      assert.match(drawer, /direction=["']rtl["']/u, `${view}: ${drawer}`)
-      if (!drawer.includes('facility-form-drawer')) {
-        assert.match(drawer, /class=["'][^"']*detail-drawer/u, `${view}: ${drawer}`)
+  for (const dir of waterSupplyViewDirs) {
+    const views = await listVueFiles(dir)
+    for (const view of views) {
+      const source = await readFile(view, 'utf8')
+      const detailDialogs = source.match(/<el-dialog\b[^>]*(?:详情|详细|查看|预览|报警位置地图|视频查看|研判分析|催办记录|监测告警联动|全屏监控)[^>]*>/gu) || []
+      assert.deepEqual(detailDialogs, [], view)
+
+      const drawers = source.match(/<el-drawer\b[^>]*>/gu) || []
+      for (const drawer of drawers) {
+        assert.match(drawer, /direction=["']rtl["']/u, `${view}: ${drawer}`)
+        if (!drawer.includes('facility-form-drawer')) {
+          assert.match(drawer, /class=["'][^"']*detail-drawer/u, `${view}: ${drawer}`)
+        }
       }
     }
   }

+ 0 - 22
tests/waterFacilityPageTheme.test.mjs

@@ -1,22 +0,0 @@
-import test from 'node:test'
-import assert from 'node:assert/strict'
-import fs from 'node:fs'
-import path from 'node:path'
-
-// 供水设施五页统一美化(spec: docs/superpowers/specs/2026-09-05-water-facility-pages-ui-unification.md)
-// T-A 打样页:水厂;T-B 完成后将列表扩展为全部五个页面。
-const facilityPages = [
-  'src/views/subSystem/basic/waterPlant/index.vue'
-]
-
-test('water facility pages use the shared water-page shell and theme', () => {
-  for (const page of facilityPages) {
-    const source = fs.readFileSync(path.resolve(page), 'utf8')
-    assert.match(source, /<div class="water-page facility-page">/u, page)
-    assert.match(source, /@use '\.\.\/\.\.\/waterSupply\/components\/waterFacilityPageTheme\.scss'/u, page)
-    assert.doesNotMatch(source, /<right-toolbar/u, page)
-    assert.match(source, /class="page-heading"/u, page)
-    assert.match(source, /class="filter-card"/u, page)
-    assert.match(source, /class="table-card"/u, page)
-  }
-})