取设备模板协议配置表单
本地
本地
GET
http://127.0.0.1:9999/api/v1/protocol_plugin/config_form
没有data表示没有表单
请求参数
Query 参数
device_type
string
必需
示例值:
2
protocol_type
string
必需
示例值:
MQTT
Header 参数
x-token
string
可选
默认值:
{{x-token}}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request GET 'http://127.0.0.1:9999/api/v1/protocol_plugin/config_form?device_type=2&protocol_type=MQTT' \
--header 'x-token: {{x-token}}'
返回响应
🟢200成功
application/json
Body
code
integer
必需
message
string
必需
data
array [object {6}]
必需
dataKey
string
必需
label
string
必需
placeholder
string
可选
type
string
必需
validate
object
可选
array
array [object {7}]
可选
示例
{
"code": 200,
"message": "success",
"data": [
{
"dataKey": "SlaveID",
"label": "从机地址",
"placeholder": "请输入设备地址",
"type": "input",
"validate": {
"message": "设备地址不能为空",
"required": true,
"rules": "/^\\d{1,}$/",
"type": "number"
}
},
{
"array": [
{
"dataKey": "FunctionCode",
"label": "功能码",
"options": [
{
"label": "01读线圈状态/05强制单个线圈",
"value": 1
},
{
"label": "02读输入位状态",
"value": 2
},
{
"label": "03读保持寄存器/06预置单个寄存器",
"value": 3
},
{
"label": "04读输入寄存器",
"value": 4
}
],
"placeholder": "请选择功能码",
"type": "select",
"validate": {
"message": "功能码不能为空",
"required": true,
"type": "number"
}
},
{
"dataKey": "Interval",
"label": "读取策略(秒)",
"placeholder": "请输入时间间隔,单位s",
"type": "input",
"validate": {
"message": "读取策略不能为空",
"required": true,
"rules": "/^\\d{1,}$/",
"type": "number"
}
},
{
"dataKey": "StartingAddress",
"label": "起始地址",
"placeholder": "请输入起始地址(十进制)",
"type": "input",
"validate": {
"message": "起始地址不能为空",
"required": true,
"rules": "/^\\d{1,}$/",
"type": "number"
}
},
{
"dataKey": "Quantity",
"label": "地址数量/线圈数量",
"placeholder": "03功能码输入地址数量/01功能码输入线圈数量",
"type": "input",
"validate": {
"message": "地址数量不能为空",
"required": true,
"rules": "/^\\d{1,}$/",
"type": "number"
}
},
{
"dataKey": "DataType",
"label": "数据类型",
"options": [
{
"label": "线圈-1线圈数量",
"value": "coil"
},
{
"label": "int16-1地址数量",
"value": "int16"
},
{
"label": "uint16-1地址数量",
"value": "uint16"
},
{
"label": "int32-2地址数量",
"value": "int32"
},
{
"label": "uint32-2地址数量",
"value": "uint32"
},
{
"label": "int64-4地址数量",
"value": "int64"
},
{
"label": "float32-2地址数量",
"value": "float32"
},
{
"label": "float64-4地址数量",
"value": "float64"
}
],
"placeholder": "请选择数据类型(读写线圈选“线圈”)",
"type": "select",
"validate": {
"message": "数据类型不能为空",
"required": true,
"type": "string"
}
},
{
"dataKey": "DataIdentifierListStr",
"label": "设备字段(多字段用英文,隔开)",
"placeholder": "请输入设备字段(字段数量=地址/数据类型的地址或线圈数量)",
"type": "input",
"validate": {
"message": "设备字段不能为空",
"required": true,
"type": "string"
}
},
{
"dataKey": "EquationListStr",
"label": "公式处理",
"placeholder": "例如设备字段是temp:temp*0.01;多个字段(公式可跨字段)的处理公式用英文,隔开",
"type": "input",
"validate": {
"required": false,
"type": "string"
}
},
{
"dataKey": "DecimalPlacesListStr",
"label": "精度处理",
"placeholder": "例:2;小数点后位数只填一个代表通用,否则用英文,隔开",
"type": "input",
"validate": {
"required": false,
"type": "string"
}
},
{
"dataKey": "Endianess",
"label": "字节序",
"options": [
{
"label": "大端",
"value": "BIG"
},
{
"label": "小端",
"value": "LITTLE"
}
],
"placeholder": "请选择传输字节序",
"required": true,
"type": "select",
"validate": {
"message": "字节序不能为空",
"required": true,
"type": "string"
}
}
],
"dataKey": "CommandRawList",
"label": "配置列表",
"type": "table"
}
]
}
修改于 2025-03-24 08:06:42