diff --git a/src/api/iot/thingmodel/index.ts b/src/api/iot/thingmodel/index.ts index 3b93c38c1..63b17a605 100644 --- a/src/api/iot/thingmodel/index.ts +++ b/src/api/iot/thingmodel/index.ts @@ -213,7 +213,13 @@ export const ThingModelApi = { }, // 计算 Modbus 命令(用于前端自动生成) - calculateModbusCommand: async (data: { productId: number; registerAddress: number; functionCode?: number }) => { + calculateModbusCommand: async (data: { + productId: number; + registerAddress: number; + functionCode?: number; + registerCount?: number; + byteOrder?: number; + }) => { return await request.post({ url: `/iot/thing-model/calculate-modbus-command`, data }) } } diff --git a/src/views/iot/thingmodel/ThingModelProperty.vue b/src/views/iot/thingmodel/ThingModelProperty.vue index 1a33262a4..6fd9b5156 100644 --- a/src/views/iot/thingmodel/ThingModelProperty.vue +++ b/src/views/iot/thingmodel/ThingModelProperty.vue @@ -317,7 +317,9 @@ const handleRegisterAddressChange = async (registerAddress: number | undefined) const { data } = await ThingModelApi.calculateModbusCommand({ productId: product.value.id, registerAddress: registerAddress, - functionCode: property.value.modbusConfig?.functionCode || 3 + functionCode: property.value.modbusConfig?.functionCode || 3, + registerCount: property.value.modbusConfig?.registerCount || 1, + byteOrder: property.value.modbusConfig?.byteOrder || 2 // 默认小端模式 }) // 更新表单数据