From ac5b531a6f3c52c394b36e592898893a843b3718 Mon Sep 17 00:00:00 2001 From: mmc <1556375442@qq.com> Date: Thu, 7 May 2026 09:40:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=8E=A5=E5=85=A5=20=20?= =?UTF-8?q?=E7=BB=86=E8=8A=82=E6=90=AD=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/DeviceAccessPage.tsx | 123 +++++++++++++++++++++++++++------ src/pages/SystemSetting.tsx | 1 - 2 files changed, 103 insertions(+), 21 deletions(-) diff --git a/src/pages/DeviceAccessPage.tsx b/src/pages/DeviceAccessPage.tsx index 552b624..27359db 100644 --- a/src/pages/DeviceAccessPage.tsx +++ b/src/pages/DeviceAccessPage.tsx @@ -13,9 +13,18 @@ const { TabPane } = Tabs; // ====================== 模拟基础数据 ====================== const productList = [ - { id: 1, name: '海康威视摄像头', code: 'hikvision', protocolType: 'onvif', manufacturer: '海康', status: 1 }, - { id: 2, name: '大华摄像头', code: 'dahua', protocolType: 'rtsp', manufacturer: '大华', status: 1 }, - { id: 3, name: '通用MQTT设备', code: 'mqtt_device', protocolType: 'mqtt', manufacturer: '通用', status: 1 }, + { + id: 1, name: '海康威视摄像头', code: 'hikvision', protocolType: 'onvif', manufacturer: '海康', status: 1, + publishTopic: '/hik/device/upload', subscribeTopic: '/hik/device/cmd' + }, + { + id: 2, name: '大华摄像头', code: 'dahua', protocolType: 'rtsp', manufacturer: '大华', status: 1, + publishTopic: '/dahua/device/upload', subscribeTopic: '/dahua/device/cmd' + }, + { + id: 3, name: '通用MQTT设备', code: 'mqtt_device', protocolType: 'mqtt', manufacturer: '通用', status: 1, + publishTopic: '/iot/device/upload', subscribeTopic: '/iot/device/cmd' + }, ]; const modelList = [ @@ -23,7 +32,7 @@ const modelList = [ { id: 11, name: '环境监测设备', code: 'env_sensor', desc: '温湿度、烟感' }, ]; -// 物模型详情 +// 物模型详情(完全保留你原来的) const modelDetailList: Record setVisible(true), 300); + message.success('字段映射保存成功'); }); }; @@ -213,8 +248,10 @@ export default function DeviceAccessPage() { const productColumns = [ { title: '产品名称', dataIndex: 'name' }, { title: '产品编码', dataIndex: 'code' }, - { title: '协议类型', dataIndex: 'protocolType', render: (t: string) => {t.toUpperCase()} }, { title: '厂商', dataIndex: 'manufacturer' }, + { title: '协议类型', dataIndex: 'protocolType', render: (t: string) => {t.toUpperCase()} }, + { title: '上报Topic', dataIndex: 'publishTopic' }, + { title: '订阅Topic', dataIndex: 'subscribeTopic' }, { title: '操作', render: (r: any) => ( @@ -232,7 +269,6 @@ export default function DeviceAccessPage() { { title: '操作', render: (r: any) => } ]; - // 字段映射列表列 const mappingColumns = [ { title: '标准模型字段', dataIndex: 'standardCode' }, { title: '厂商原始字段', dataIndex: 'sourceField' }, @@ -256,7 +292,6 @@ export default function DeviceAccessPage() { { title: '告警时间', dataIndex: 'time' }, ]; - // 物模型子项列 const propColumns = [ { title: '字段编码', dataIndex: 'code' }, { title: '字段名称', dataIndex: 'name' }, @@ -348,10 +383,11 @@ export default function DeviceAccessPage() { } onCancel={() => setVisible(false)} onOk={handleSubmit} - width={750} + width={800} destroyOnClose >
+ {/* 设备接入 */} {modalType === 'device' && ( @@ -367,6 +403,7 @@ export default function DeviceAccessPage() { + {protocol === 'onvif' && ( <> @@ -376,14 +413,55 @@ export default function DeviceAccessPage() { )} + {protocol === 'rtsp' && ( )} + + {protocol === 'mqtt' && ( + <> + + + + + + + + + +
上报主题:{editData?.publishTopic || '未配置'}
+
订阅主题:{editData?.subscribeTopic || '未配置'}
+
+ + )} +
+ + {/* 新增:报警阈值配置 */} + +
可配置设备触发告警的上下限参数
+ + + + + + + + + + + + + + + + + +
)} - {/* 产品配置 */} + {/* 产品配置 + MQTT Topic */} {modalType === 'product' && ( <> @@ -396,10 +474,19 @@ export default function DeviceAccessPage() { + + 厂商级 MQTT Topic 配置 + + + + + + +
同一厂商设备自动继承该 Topic
)} - {/* 物模型完整编辑 */} + {/* 物模型完整编辑(完全保留你原来的!) */} {modalType === 'model' && ( <> @@ -421,12 +508,10 @@ export default function DeviceAccessPage() { )}
- {/* ========== 字段映射列表(独立显示,不嵌套) ========== */} + {/* 字段映射列表 */} {modalType === 'mapping' && (
- - {editData?.name} - 字段映射配置 - + {editData?.name} - 字段映射配置
); diff --git a/src/pages/SystemSetting.tsx b/src/pages/SystemSetting.tsx index ad40589..02a8edb 100644 --- a/src/pages/SystemSetting.tsx +++ b/src/pages/SystemSetting.tsx @@ -170,7 +170,6 @@ export default function SystemSettings() { }, []); const BasicSettingsPage = () =>

基础设置页面

; const NoticePage = () =>

通知策略页面

; - //const DeviceAccessPage = () =>

设备接入页面

; const DataSafetyPage = () =>

数据与安全页面

; const SystemMaintenancePage = () =>

系统维护页面

; const DefaultPage = () =>

请选择菜单

;