Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
79507aef
authored
Mar 16, 2025
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【代码评审】IoT:数据桥梁的接入
parent
9ca5ffbf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
17 deletions
+23
-17
src/api/iot/rule/databridge/index.ts
+2
-1
src/views/iot/rule/databridge/IoTDataBridgeForm.vue
+9
-7
src/views/iot/rule/databridge/config/KafkaMQConfigForm.vue
+1
-1
src/views/iot/rule/databridge/config/RocketMQConfigForm.vue
+9
-6
src/views/iot/rule/databridge/config/components/KeyValueEditor.vue
+2
-2
No files found.
src/api/iot/rule/databridge/index.ts
View file @
79507aef
import
request
from
'@/config/axios'
//数据桥梁 VO
//
IoT
数据桥梁 VO
export
interface
DataBridgeVO
{
id
?:
number
// 桥梁编号
name
?:
string
// 桥梁名称
...
...
@@ -80,6 +80,7 @@ export interface RedisStreamMQConfig extends Config {
}
/** 数据桥梁类型 */
// TODO @puhui999:枚举用 number 可以么?
export
const
IoTDataBridgeConfigType
=
{
HTTP
:
'1'
,
TCP
:
'2'
,
...
...
src/views/iot/rule/databridge/IoTDataBridgeForm.vue
View file @
79507aef
...
...
@@ -100,28 +100,28 @@ const formData = ref<DataBridgeVO>({
config
:
{}
as
any
})
const
formRules
=
reactive
({
/
** 通用字段 */
/
/ 通用字段
name
:
[{
required
:
true
,
message
:
'桥梁名称不能为空'
,
trigger
:
'blur'
}],
status
:
[{
required
:
true
,
message
:
'桥梁状态不能为空'
,
trigger
:
'blur'
}],
direction
:
[{
required
:
true
,
message
:
'桥梁方向不能为空'
,
trigger
:
'blur'
}],
type
:
[{
required
:
true
,
message
:
'桥梁类型不能为空'
,
trigger
:
'change'
}],
/
** HTTP 配置 */
/
/ HTTP 配置
'config.url'
:
[{
required
:
true
,
message
:
'请求地址不能为空'
,
trigger
:
'blur'
}],
'config.method'
:
[{
required
:
true
,
message
:
'请求方法不能为空'
,
trigger
:
'blur'
}],
/
** MQTT 配置 */
/
/ MQTT 配置
'config.username'
:
[{
required
:
true
,
message
:
'用户名不能为空'
,
trigger
:
'blur'
}],
'config.password'
:
[{
required
:
true
,
message
:
'密码不能为空'
,
trigger
:
'blur'
}],
'config.clientId'
:
[{
required
:
true
,
message
:
'客户端ID不能为空'
,
trigger
:
'blur'
}],
'config.topic'
:
[{
required
:
true
,
message
:
'主题不能为空'
,
trigger
:
'blur'
}],
/
** RocketMQ 配置 */
/
/ RocketMQ 配置
'config.nameServer'
:
[{
required
:
true
,
message
:
'NameServer 地址不能为空'
,
trigger
:
'blur'
}],
'config.accessKey'
:
[{
required
:
true
,
message
:
'AccessKey 不能为空'
,
trigger
:
'blur'
}],
'config.secretKey'
:
[{
required
:
true
,
message
:
'SecretKey 不能为空'
,
trigger
:
'blur'
}],
'config.group'
:
[{
required
:
true
,
message
:
'消费组不能为空'
,
trigger
:
'blur'
}],
/
** Kafka 配置 */
/
/ Kafka 配置
'config.bootstrapServers'
:
[{
required
:
true
,
message
:
'服务地址不能为空'
,
trigger
:
'blur'
}],
'config.ssl'
:
[{
required
:
true
,
message
:
'SSL 配置不能为空'
,
trigger
:
'change'
}],
/
** RabbitMQ 配置 */
/
/ RabbitMQ 配置
'config.host'
:
[{
required
:
true
,
message
:
'主机地址不能为空'
,
trigger
:
'blur'
}],
'config.port'
:
[
{
required
:
true
,
message
:
'端口不能为空'
,
trigger
:
'blur'
},
...
...
@@ -131,7 +131,7 @@ const formRules = reactive({
'config.exchange'
:
[{
required
:
true
,
message
:
'交换机不能为空'
,
trigger
:
'blur'
}],
'config.routingKey'
:
[{
required
:
true
,
message
:
'路由键不能为空'
,
trigger
:
'blur'
}],
'config.queue'
:
[{
required
:
true
,
message
:
'队列不能为空'
,
trigger
:
'blur'
}],
/
** Redis Stream 配置 */
/
/ Redis Stream 配置
'config.database'
:
[
{
required
:
true
,
message
:
'数据库索引不能为空'
,
trigger
:
'blur'
},
{
type
:
'number'
,
min
:
0
,
message
:
'数据库索引必须是非负整数'
,
trigger
:
'blur'
}
...
...
@@ -143,6 +143,7 @@ const showConfig = computed(() => (val: string) => {
const
dict
=
getDictObj
(
DICT_TYPE
.
IOT_DATA_BRIDGE_TYPE_ENUM
,
formData
.
value
.
type
)
return
dict
&&
dict
.
value
+
''
===
val
})
// 显示对应的 Config 配置项
/** 打开弹窗 */
const
open
=
async
(
type
:
string
,
id
?:
number
)
=>
{
dialogVisible
.
value
=
true
...
...
@@ -195,6 +196,7 @@ const handleTypeChange = (val: number) => {
/** 重置表单 */
const
resetForm
=
()
=>
{
formData
.
value
=
{
// TODO @puhui999:换成枚举值哈
status
:
0
,
direction
:
1
,
type
:
1
,
...
...
src/views/iot/rule/databridge/config/KafkaMQConfigForm.vue
View file @
79507aef
...
...
@@ -8,7 +8,7 @@
<el-form-item
label=
"密码"
prop=
"config.password"
>
<el-input
v-model=
"config.password"
placeholder=
"请输入密码"
show-password
type=
"password"
/>
</el-form-item>
<el-form-item
label=
"启用SSL"
prop=
"config.ssl"
>
<el-form-item
label=
"启用
SSL"
prop=
"config.ssl"
>
<el-switch
v-model=
"config.ssl"
/>
</el-form-item>
<el-form-item
label=
"主题"
prop=
"config.topic"
>
...
...
src/views/iot/rule/databridge/config/RocketMQConfigForm.vue
View file @
79507aef
<
template
>
<el-form-item
label=
"名称服务地址"
prop=
"config.nameServer"
>
<el-input
v-model=
"config.nameServer"
placeholder=
"请输入命名服务地址,如:127.0.0.1:9876"
/>
<el-form-item
label=
"NameServer"
prop=
"config.nameServer"
>
<el-input
v-model=
"config.nameServer"
placeholder=
"请输入 NameServer 地址,如:127.0.0.1:9876"
/>
</el-form-item>
<el-form-item
label=
"Access
Key"
prop=
"config.accessKey"
>
<el-input
v-model=
"config.accessKey"
placeholder=
"请输入
Access
Key"
/>
<el-form-item
label=
"AccessKey"
prop=
"config.accessKey"
>
<el-input
v-model=
"config.accessKey"
placeholder=
"请输入
Access
Key"
/>
</el-form-item>
<el-form-item
label=
"Secret
Key"
prop=
"config.secretKey"
>
<el-form-item
label=
"SecretKey"
prop=
"config.secretKey"
>
<el-input
v-model=
"config.secretKey"
placeholder=
"请输入
Secret
Key"
placeholder=
"请输入
Secret
Key"
show-password
type=
"password"
/>
...
...
src/views/iot/rule/databridge/config/components/KeyValueEditor.vue
View file @
79507aef
...
...
@@ -33,8 +33,7 @@ const props = defineProps<{
addButtonText
:
string
}
>
()
const
emit
=
defineEmits
([
'update:modelValue'
])
/** 内部 key-value 项列表 */
const
items
=
ref
<
KeyValueItem
[]
>
([])
const
items
=
ref
<
KeyValueItem
[]
>
([])
// 内部 key-value 项列表
/** 添加项目 */
const
addItem
=
()
=>
{
...
...
@@ -59,6 +58,7 @@ const updateModelValue = () => {
emit
(
'update:modelValue'
,
result
)
}
// TODO @puhui999:有告警的地方,尽量用 cursor 处理下
/** 监听项目变化 */
watch
(
items
,
updateModelValue
,
{
deep
:
true
})
watch
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment