Parcourir la source

feat(cockpit): 九类设施点全量上图,水源地接入详情与坐标

票 02(设施全量上图)。运行信息是设施点图层唯一的实体来源,水源地此前
detailCategory 为空、也不在详情类别白名单,因此永远拿不到坐标、点不开详情。

- WATER_SOURCE 进入详情类别白名单并拥有自己的 detailCategory,与其余类型同链。
- 实体详情补水源地类别:中文类别名、摘要(水源/保护/水质等级)与 water_source_info
  专属字段,避免点开显示「未知」且无业务字段。
- 契约样例补齐九类设施实体行 + 一条无坐标(用水户)+ 档案有而实体不下发的类型,
  让「可上图 / 无地图位置 / 后端未下发」三态在 mock 下都可演示。
- 新增回归 t135:九类进标记计划、水源地上图与详情、无坐标进清单、未下发图例如实说明、
  档案数与上图口径不变。
ChenJZ il y a 4 heures
Parent
commit
9f11de9a0c

+ 19 - 0
src/modules/cockpit/domain/entityDetail.js

@@ -171,6 +171,7 @@ const COMMON_UNITS = {
 const UNIT_BY_CATEGORY = {
     PIPE_NETWORK: {},
     WATER_PLANT: {},
+    WATER_SOURCE: {},
     PUMP_STATION: { designFlow: 'm³/h' },
     ENGINEERING_FACILITY: { designFlow: 'm³/s' },
     DRAINAGE_GATE: { designFlow: 'm³/s' },
@@ -226,6 +227,9 @@ const SUMMARY_LABELS = {
     annualWaterConsumption: '年用水量',
     hydrantType: '消火栓类型',
     inletPipeDiameter: '进水主管管径',
+    waterType: '水源类型',
+    protectionLevel: '保护等级',
+    waterQualityLevel: '水质等级',
 }
 /** 同类字段在不同设施里的业务名不同(隐患等级 vs 设施等级),差异只在这里登记。 */
 const SUMMARY_LABELS_BY_CATEGORY = {
@@ -241,6 +245,7 @@ function assetSummary(category, a, status, location) {
     // 摘要只挑"一眼要看的读数",键与明细同源;单位统一由 METRIC_UNITS 提供。
     const byCategory = {
         WATER_PLANT: ['currentCapacity', 'designCapacity', 'treatmentProcess'],
+        WATER_SOURCE: ['waterType', 'protectionLevel', 'waterQualityLevel'],
         ENGINEERING_FACILITY: ['facilityLevel', 'designFlow', 'storageCapacity'],
         DRAINAGE_GATE: ['facilityLevel', 'designFlow', 'storageCapacity'],
         DRAINAGE_STORAGE: ['facilityLevel', 'designFlow', 'storageCapacity'],
@@ -302,6 +307,7 @@ const FACILITY_CATEGORY_TEXT = {
     PIPE_NETWORK: '管网',
     WATER_PLANT: '水厂',
     PUMP_STATION: '泵站',
+    WATER_SOURCE: '水源地',
     ENGINEERING_FACILITY: '排水工程设施',
     DRAINAGE_GATE: '闸门',
     DRAINAGE_STORAGE: '调蓄设施',
@@ -400,6 +406,19 @@ const ASSET_FIELD_ROWS = {
         { label: '权属单位', key: 'ownershipUnit' },
         { label: '备注', key: 'remark', wide: true },
     ],
+    // 票 02:水源地字段按后端 water_source_info 实体登记(详情接口已返回这些属性),
+    // 与「水源类型」区分:waterSourceType 是水厂的取水水源类型,waterType 是水源地自身的水源类型。
+    WATER_SOURCE: [
+        { label: '水源类型', key: 'waterType' },
+        { label: '保护等级', key: 'protectionLevel' },
+        { label: '水质等级', key: 'waterQualityLevel' },
+        { label: '水源地类型', key: 'sourceType' },
+        { label: '所属单位', key: 'unit' },
+        { label: '详细地址', key: 'address', wide: true },
+        { label: '保护范围', key: 'protectionScope', wide: true },
+        { label: '上报时间', key: 'reportTime' },
+        { label: '备注', key: 'remark', wide: true },
+    ],
     WATER_PLANT: [
         { label: '水源类型', key: 'waterSourceType' },
         { label: '设计能力', key: 'designCapacity' },

+ 4 - 3
src/modules/cockpit/domain/facilityPoints.js

@@ -15,7 +15,7 @@
  *   · `WATER_PLANT`(水厂)—— `facilityTypeDistribution` / 实体类别同名;
  *   · `PUMP_STATION`(泵站)—— 后端两类 `WATER_PUMP_STATION` / `DRAINAGE_PUMP_STATION`
  *     在图例上并为一类,实体类别统一为 `PUMP_STATION`;
- *   · `WATER_SOURCE`(水源地)—— 档案有计数,但 cockpit 未下发实体/坐标(契约缺口);
+ *   · `WATER_SOURCE`(水源地)—— 后方票 01 已补实体行与详情类别,与其余类型同链(票 02);
  *   · `WATER_USER`(用水户)—— 票 05 起前端已按目标契约接入详情;旧载荷若未下发则如实留空。
  */
 
@@ -24,7 +24,7 @@ import { facilityStatusTone } from './entityDetail.js'
 import { districtQuery, industryQuery } from './filterOptions.js'
 // MANHOLE(维护者 2026-11-16):后端 CockpitEntityCategory 与详情服务已支持窨井,
 // 本白名单同步放行 —— 否则后端能回详情、界面却仍提示「设施类别未发布」。
-export const FACILITY_DETAIL_CATEGORIES = Object.freeze(['WATER_PLANT', 'PUMP_STATION', 'PIPE_NETWORK', 'DRAINAGE_GATE', 'DRAINAGE_STORAGE', 'WATER_USER', 'WATER_FIRE_HYDRANT', 'MANHOLE'])
+export const FACILITY_DETAIL_CATEGORIES = Object.freeze(['WATER_PLANT', 'PUMP_STATION', 'WATER_SOURCE', 'PIPE_NETWORK', 'DRAINAGE_GATE', 'DRAINAGE_STORAGE', 'WATER_USER', 'WATER_FIRE_HYDRANT', 'MANHOLE'])
 
 /** 设施点类型的稳定键(进 filterStore、data-* 断言面与测试,不用中文)。 */
 export const FACILITY_POINT_TYPE = Object.freeze({
@@ -100,7 +100,8 @@ export const FACILITY_POINT_TYPES = Object.freeze([
         unit: '处',
         symbol: 'facilitySource',
         archiveCodes: ['WATER_SOURCE'],
-        detailCategory: '',
+        // 票 02:后端已提供 WATER_SOURCE 详情类别并返回经纬度,水源地不再是有图例没点的类型。
+        detailCategory: 'WATER_SOURCE',
     },
     {
         key: FACILITY_POINT_TYPE.WATER_USER,

+ 92 - 0
src/modules/cockpit/mocks/contractMocks.js

@@ -1825,6 +1825,12 @@ function baseArchivesPayload(scenario, query = {}) {
         { district: 0, industry: 'GAS', type: 'GAS_PIPE', name: '燃气管线', age: '10_TO_20_YEARS', length: 4.2, commissioned: true },
         { district: 1, industry: 'WATER_SUPPLY', type: 'WATER_PIPE', name: '供水管线', age: '20_YEARS_OR_OVER', length: 5.6, commissioned: false },
         { district: null, industry: 'DRAINAGE', type: 'DRAINAGE_PIPE', name: '排水管线', age: '20_YEARS_OR_OVER', length: 2.6, commissioned: false },
+        // 票 02:档案里有、但后端不下发实体行的类型 —— 「后端尚未下发可上图的实体」这一态
+        // 必须在 mock 下演示得出来(否则图例的 NO_ENTITY 分支永远走不到)。
+        // 消火栓刻意只出现在档案、不出现在运行信息样例里。
+        { district: 1, industry: 'WATER_SUPPLY', type: 'WATER_FIRE_HYDRANT', name: '消火栓', age: 'UNDER_5_YEARS', length: 0, commissioned: true },
+        { district: 0, industry: 'WATER_SUPPLY', type: 'WATER_SOURCE', name: '水源地', age: 'UNDER_5_YEARS', length: 0, commissioned: true },
+        { district: 2, industry: 'MANHOLE', type: 'MANHOLE', name: '窨井', age: 'UNDER_5_YEARS', length: 0, commissioned: true },
     ]
     const selected = status === 'EMPTY' ? [] : facts.filter((row) =>
         (!query.industry || row.industry === query.industry) &&
@@ -1909,6 +1915,17 @@ function operatingInformationPayload(scenario, query = {}) {
                       metric('water_supply_flow', '供水流量', 'SUPPLY', 'm3/h', '0', '4000', '0.0000', 'NORMAL', ['TCGC202609020001'], {
                           facilityId: '1', facilityKind: 'WATER_PLANT', facilityStatus: '0',
                       }),
+                      // 票 02:补齐九类设施实体行,让「全量上图」在 mock 下也可演示。
+                      // 水源地带坐标;用水户故意不带坐标(无地图位置链路);消火栓带坐标。
+                      metric('water_source_point_count', '洮水水源地', 'CAPACITY', '处', '1', null, null, 'UNKNOWN', ['WS001'], {
+                          facilityId: '3', facilityKind: 'WATER_SOURCE', facilityStatus: '0',
+                      }),
+                      metric('water_user_point_count', '自来水公司用水户', 'CAPACITY', '户', '1', null, null, 'UNKNOWN', ['U001'], {
+                          facilityId: '4', facilityKind: 'WATER_USER', facilityStatus: '0',
+                      }),
+                      metric('water_fire_hydrant_point_count', '中山路消火栓', 'CAPACITY', '座', '1', null, null, 'UNKNOWN', ['FH001'], {
+                          facilityId: '5', facilityKind: 'WATER_FIRE_HYDRANT', facilityStatus: '0',
+                      }),
                       metric('water_supply_load', '供水负荷', 'CAPACITY', 'm3/h', '5000', '4000', '1.2500', 'OVERLOAD', ['CNGC202609020001']),
                       // 边界:能力基准缺失 → 负荷率也算不出来(界面显示占位符,不显示 0)。
                       metric('water_pressure', '供水压力', 'PRESSURE', 'MPa', '0.45', null, null, 'UNKNOWN', ['TCGC202609020002']),
@@ -1925,6 +1942,25 @@ function operatingInformationPayload(scenario, query = {}) {
                       metric('rainwater_flow', '雨水流量', 'FLOW', 'm3/h', '880', '1000', '0.8800', 'WATCH', ['TCYS202609020001'], {
                           facilityId: '2', facilityKind: 'PUMP_STATION', facilityStatus: '2',
                       }),
+                      // 票 02:闸门 / 调蓄设施实体行(排水行业)。
+                      metric('drainage_gate_point_count', '东堤闸门', 'CAPACITY', '个', '1', null, null, 'UNKNOWN', ['G001'], {
+                          facilityId: '6', facilityKind: 'DRAINAGE_GATE', facilityStatus: '0',
+                      }),
+                      metric('drainage_storage_point_count', '一号调蓄池', 'CAPACITY', '个', '1', null, null, 'UNKNOWN', ['S001'], {
+                          facilityId: '7', facilityKind: 'DRAINAGE_STORAGE', facilityStatus: '0',
+                      }),
+                  ],
+              },
+              // 票 02:窨井是第四个正式行业,运行信息也要有它的实体行,否则 fig 例上的窨井永远「未下发」。
+              {
+                  industry: { code: 'MANHOLE', key: 'manhole', label: '窨井' },
+                  state: 'READY',
+                  stateReason: 'READY',
+                  abnormalMetricCount: 0,
+                  metrics: [
+                      metric('manhole_point_count', '沅陵县窨井001', 'CAPACITY', '座', '1', null, null, 'UNKNOWN', ['YL-YJ-001'], {
+                          facilityId: '8', facilityKind: 'MANHOLE', facilityStatus: '0',
+                      }),
                   ],
               },
           ]
@@ -1966,6 +2002,62 @@ function operatingInformationPayload(scenario, query = {}) {
  * 两条样例与运行信息 mock 里带 `facilityId/facilityKind` 的指标行一一对应。
  */
 const FACILITY_ENTITY_FIXTURES = {
+    // 票 02:九类设施各一条样例。
+    // 用药用户(用户 4)故意不给坐标 —— 「有实体、无坐标」这一态在 mock 下必须可演示。
+    'WATER_SOURCE|3': {
+        category: 'WATER_SOURCE',
+        id: '3',
+        code: 'WS001',
+        name: '洮水水源地',
+        status: '0',
+        location: '洮水镇河边',
+        coordinates: { longitude: 110.401, latitude: 28.441, endLongitude: null, endLatitude: null },
+    },
+    'WATER_USER|4': {
+        category: 'WATER_USER',
+        id: '4',
+        code: 'U001',
+        name: '自来水公司用水户',
+        status: '0',
+        location: '沅陵县人民路',
+        coordinates: { longitude: null, latitude: null, endLongitude: null, endLatitude: null },
+    },
+    'WATER_FIRE_HYDRANT|5': {
+        category: 'WATER_FIRE_HYDRANT',
+        id: '5',
+        code: 'FH001',
+        name: '中山路消火栓',
+        status: '0',
+        location: '中山路',
+        coordinates: { longitude: 110.396, latitude: 28.432, endLongitude: null, endLatitude: null },
+    },
+    'DRAINAGE_GATE|6': {
+        category: 'DRAINAGE_GATE',
+        id: '6',
+        code: 'G001',
+        name: '东堤闸门',
+        status: '0',
+        location: '东堤',
+        coordinates: { longitude: 110.388, latitude: 28.428, endLongitude: null, endLatitude: null },
+    },
+    'DRAINAGE_STORAGE|7': {
+        category: 'DRAINAGE_STORAGE',
+        id: '7',
+        code: 'S001',
+        name: '一号调蓄池',
+        status: '0',
+        location: '城北',
+        coordinates: { longitude: 110.381, latitude: 28.445, endLongitude: null, endLatitude: null },
+    },
+    'MANHOLE|8': {
+        category: 'MANHOLE',
+        id: '8',
+        code: 'YL-YJ-001',
+        name: '沅陵县窨井001',
+        status: '0',
+        location: '龙兴路',
+        coordinates: { longitude: 110.394, latitude: 28.436, endLongitude: null, endLatitude: null },
+    },
     'WATER_PLANT|1': {
         category: 'WATER_PLANT',
         id: '1',