From 8479d557a2a2539b9fd80119c95f82766fd4ce41 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 24 Jun 2025 21:21:42 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90IoT=20=E7=89=A9=E8=81=94?= =?UTF-8?q?=E7=BD=91=E3=80=91=E5=88=9D=E6=AD=A5=E5=AE=9E=E7=8E=B0=E2=80=9C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=B5=81=E8=BD=AC=E2=80=9D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/rule/data/rule/index.ts | 39 ++++ .../rule/{databridge => data/sink}/index.ts | 54 +++-- src/api/iot/rule/scene/scene.types.ts | 2 +- src/utils/dict.ts | 3 +- src/views/iot/rule/data/index.vue | 20 ++ src/views/iot/rule/data/rule/DataRuleForm.vue | 124 +++++++++++ src/views/iot/rule/data/rule/index.vue | 194 ++++++++++++++++++ .../sink/DataSinkForm.vue} | 88 +++----- .../sink}/config/HttpConfigForm.vue | 4 +- .../sink}/config/KafkaMQConfigForm.vue | 4 +- .../sink}/config/MqttConfigForm.vue | 4 +- .../sink}/config/RabbitMQConfigForm.vue | 4 +- .../sink}/config/RedisStreamConfigForm.vue | 4 +- .../sink}/config/RocketMQConfigForm.vue | 4 +- .../config/components/KeyValueEditor.vue | 0 .../{databridge => data/sink}/config/index.ts | 0 .../rule/{databridge => data/sink}/index.vue | 70 +++---- .../components/action/ActionExecutor.vue | 4 +- .../components/action/DataBridgeAction.vue | 14 +- 19 files changed, 482 insertions(+), 154 deletions(-) create mode 100644 src/api/iot/rule/data/rule/index.ts rename src/api/iot/rule/{databridge => data/sink}/index.ts (57%) create mode 100644 src/views/iot/rule/data/index.vue create mode 100644 src/views/iot/rule/data/rule/DataRuleForm.vue create mode 100644 src/views/iot/rule/data/rule/index.vue rename src/views/iot/rule/{databridge/IoTDataBridgeForm.vue => data/sink/DataSinkForm.vue} (69%) rename src/views/iot/rule/{databridge => data/sink}/config/HttpConfigForm.vue (93%) rename src/views/iot/rule/{databridge => data/sink}/config/KafkaMQConfigForm.vue (88%) rename src/views/iot/rule/{databridge => data/sink}/config/MqttConfigForm.vue (89%) rename src/views/iot/rule/{databridge => data/sink}/config/RabbitMQConfigForm.vue (91%) rename src/views/iot/rule/{databridge => data/sink}/config/RedisStreamConfigForm.vue (89%) rename src/views/iot/rule/{databridge => data/sink}/config/RocketMQConfigForm.vue (90%) rename src/views/iot/rule/{databridge => data/sink}/config/components/KeyValueEditor.vue (100%) rename src/views/iot/rule/{databridge => data/sink}/config/index.ts (100%) rename src/views/iot/rule/{databridge => data/sink}/index.vue (69%) diff --git a/src/api/iot/rule/data/rule/index.ts b/src/api/iot/rule/data/rule/index.ts new file mode 100644 index 000000000..ebd050132 --- /dev/null +++ b/src/api/iot/rule/data/rule/index.ts @@ -0,0 +1,39 @@ +import request from '@/config/axios' + +/** IoT 数据流转规则信息 */ +export interface DataRule { + id: number // 场景编号 + name?: string // 场景名称 + description: string // 场景描述 + status?: number // 场景状态 + sourceConfigs?: string // 数据源配置数组 + sinkIds?: string // 数据目的编号数组 +} + +// IoT 数据流转规则 API +export const DataRuleApi = { + // 查询数据流转规则分页 + getDataRulePage: async (params: any) => { + return await request.get({ url: `/iot/data-rule/page`, params }) + }, + + // 查询数据流转规则详情 + getDataRule: async (id: number) => { + return await request.get({ url: `/iot/data-rule/get?id=` + id }) + }, + + // 新增数据流转规则 + createDataRule: async (data: DataRule) => { + return await request.post({ url: `/iot/data-rule/create`, data }) + }, + + // 修改数据流转规则 + updateDataRule: async (data: DataRule) => { + return await request.put({ url: `/iot/data-rule/update`, data }) + }, + + // 删除数据流转规则 + deleteDataRule: async (id: number) => { + return await request.delete({ url: `/iot/data-rule/delete?id=` + id }) + } +} diff --git a/src/api/iot/rule/databridge/index.ts b/src/api/iot/rule/data/sink/index.ts similarity index 57% rename from src/api/iot/rule/databridge/index.ts rename to src/api/iot/rule/data/sink/index.ts index 7c3808947..3e2755e0d 100644 --- a/src/api/iot/rule/databridge/index.ts +++ b/src/api/iot/rule/data/sink/index.ts @@ -1,7 +1,7 @@ import request from '@/config/axios' -// IoT 数据桥梁 VO -export interface DataBridgeVO { +// IoT 数据流转目的 VO +export interface DataSinkVO { id?: number // 桥梁编号 name?: string // 桥梁名称 description?: string // 桥梁描述 @@ -79,8 +79,8 @@ export interface RedisStreamMQConfig extends Config { topic: string } -/** 数据桥梁类型 */ -export const IoTDataBridgeConfigType = { +/** 数据流转目的类型 */ +export const IotDataSinkTypeEnum = { HTTP: 1, TCP: 2, WEBSOCKET: 3, @@ -92,41 +92,35 @@ export const IoTDataBridgeConfigType = { KAFKA: 32 } as const -export const IotDataBridgeDirectionEnum = { - INPUT: 1, // 输入 - OUTPUT: 2 // 输出 -} as const - -// 数据桥梁 API -export const DataBridgeApi = { - // 查询数据桥梁分页 - getDataBridgePage: async (params: any) => { - return await request.get({ url: `/iot/data-bridge/page`, params }) +// 数据流转目的 API +export const DataSinkApi = { + // 查询数据流转目的分页 + getDataSinkPage: async (params: any) => { + return await request.get({ url: `/iot/data-sink/page`, params }) }, - // 查询数据桥梁详情 - getDataBridge: async (id: number) => { - return await request.get({ url: `/iot/data-bridge/get?id=` + id }) + // 查询数据流转目的详情 + getDataSink: async (id: number) => { + return await request.get({ url: `/iot/data-sink/get?id=` + id }) }, - // 新增数据桥梁 - createDataBridge: async (data: DataBridgeVO) => { - return await request.post({ url: `/iot/data-bridge/create`, data }) + // 新增数据流转目的 + createDataSink: async (data: DataSinkVO) => { + return await request.post({ url: `/iot/data-sink/create`, data }) }, - // 修改数据桥梁 - updateDataBridge: async (data: DataBridgeVO) => { - return await request.put({ url: `/iot/data-bridge/update`, data }) + // 修改数据流转目的 + updateDataSink: async (data: DataSinkVO) => { + return await request.put({ url: `/iot/data-sink/update`, data }) }, - // 删除数据桥梁 - deleteDataBridge: async (id: number) => { - return await request.delete({ url: `/iot/data-bridge/delete?id=` + id }) + // 删除数据流转目的 + deleteDataSink: async (id: number) => { + return await request.delete({ url: `/iot/data-sink/delete?id=` + id }) }, - // 查询数据桥梁(精简)列表 - // TODO @puhui999:getDataBridgeSimpleList 哈。项目的风格统一~ 之前有几个,我写错了。。。 - getSimpleDataBridgeList() { - return request.get({ url: '/iot/data-bridge/simple-list' }) + // 查询数据流转目的(精简)列表 + getDataSinkSimpleList() { + return request.get({ url: '/iot/data-sink/simple-list' }) } } diff --git a/src/api/iot/rule/scene/scene.types.ts b/src/api/iot/rule/scene/scene.types.ts index 29cac328f..c8f4a05da 100644 --- a/src/api/iot/rule/scene/scene.types.ts +++ b/src/api/iot/rule/scene/scene.types.ts @@ -104,7 +104,7 @@ interface ActionConfig { type: number // 执行类型 deviceControl?: ActionDeviceControl // 设备控制 alert?: ActionAlert // 告警执行 - dataBridgeId?: number // 数据桥接编号 + dataBridgeId?: number // 数据流转目的编号 } // 主接口 diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 4c1d793e6..a5f8de1b3 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -237,8 +237,7 @@ export enum DICT_TYPE { IOT_THING_MODEL_TYPE = 'iot_thing_model_type', // IOT 产品功能类型 IOT_THING_MODEL_UNIT = 'iot_thing_model_unit', // IOT 物模型单位 IOT_RW_TYPE = 'iot_rw_type', // IOT 读写类型 - IOT_DATA_BRIDGE_DIRECTION_ENUM = 'iot_data_bridge_direction_enum', // 桥梁方向 - IOT_DATA_BRIDGE_TYPE_ENUM = 'iot_data_bridge_type_enum', // 桥梁类型 + IOT_DATA_SINK_TYPE_ENUM = 'iot_data_sink_type_enum', // IoT 数据流转目的类型 IOT_RULE_SCENE_TRIGGER_TYPE_ENUM = 'iot_rule_scene_trigger_type_enum', // IoT 场景流转的触发类型枚举 IOT_RULE_SCENE_ACTION_TYPE_ENUM = 'iot_rule_scene_action_type_enum' // IoT 规则场景的触发类型枚举 } diff --git a/src/views/iot/rule/data/index.vue b/src/views/iot/rule/data/index.vue new file mode 100644 index 000000000..123397eee --- /dev/null +++ b/src/views/iot/rule/data/index.vue @@ -0,0 +1,20 @@ + + + diff --git a/src/views/iot/rule/data/rule/DataRuleForm.vue b/src/views/iot/rule/data/rule/DataRuleForm.vue new file mode 100644 index 000000000..3ebb7aec8 --- /dev/null +++ b/src/views/iot/rule/data/rule/DataRuleForm.vue @@ -0,0 +1,124 @@ + + diff --git a/src/views/iot/rule/data/rule/index.vue b/src/views/iot/rule/data/rule/index.vue new file mode 100644 index 000000000..b8121fc09 --- /dev/null +++ b/src/views/iot/rule/data/rule/index.vue @@ -0,0 +1,194 @@ + + + diff --git a/src/views/iot/rule/databridge/IoTDataBridgeForm.vue b/src/views/iot/rule/data/sink/DataSinkForm.vue similarity index 69% rename from src/views/iot/rule/databridge/IoTDataBridgeForm.vue rename to src/views/iot/rule/data/sink/DataSinkForm.vue index ccf5d5a9c..ff87aab7b 100644 --- a/src/views/iot/rule/databridge/IoTDataBridgeForm.vue +++ b/src/views/iot/rule/data/sink/DataSinkForm.vue @@ -7,50 +7,38 @@ :rules="formRules" label-width="120px" > - - + + - - - - {{ dict.label }} - - + + + + - - - - {{ dict.label }} - - - - - + + - + - + @@ -74,12 +62,7 @@