Commit aa46654d07c5f7048b964a4b6a5282900ed7cf07
Merge branch 'perf/preview-mode-params-setting' into 'main_dev'
fix: 修复开关组件无法下发modbus指令 See merge request yunteng/thingskit-scada!107
Showing
1 changed file
with
12 additions
and
2 deletions
@@ -16193,9 +16193,15 @@ class HandleDataInteraction { | @@ -16193,9 +16193,15 @@ class HandleDataInteraction { | ||
16193 | } | 16193 | } |
16194 | } else { | 16194 | } else { |
16195 | const { additional = {} } = dataSource | 16195 | const { additional = {} } = dataSource |
16196 | - const { deviceCode, registerAddress } = additional || {} | 16196 | + const { deviceCode, registerAddress, method } = additional || {} |
16197 | if (!deviceCode) UseLayUi.topErrorMsg('未找到设备地址码') | 16197 | if (!deviceCode) UseLayUi.topErrorMsg('未找到设备地址码') |
16198 | if (!registerAddress) UseLayUi.topErrorMsg('未找到寄存器地址') | 16198 | if (!registerAddress) UseLayUi.topErrorMsg('未找到寄存器地址') |
16199 | + flag = true | ||
16200 | + value = currentNode.getAttribute(SWITCH_SEND_VALUE) | ||
16201 | + if (method == '16') { | ||
16202 | + const hexValue = UseLayUi.numberToHex(value).split(' ').join('') | ||
16203 | + value = [parseInt(hexValue.slice(0, 4), 16), parseInt(hexValue.slice(4, 8), 16)] | ||
16204 | + } | ||
16199 | } | 16205 | } |
16200 | 16206 | ||
16201 | return { flag, value } | 16207 | return { flag, value } |
@@ -16203,11 +16209,15 @@ class HandleDataInteraction { | @@ -16203,11 +16209,15 @@ class HandleDataInteraction { | ||
16203 | 16209 | ||
16204 | function handleSwitchComponent() { | 16210 | function handleSwitchComponent() { |
16205 | const state = currentNode.getAttribute(SWITCH_STATE) | 16211 | const state = currentNode.getAttribute(SWITCH_STATE) |
16212 | + | ||
16206 | if (state === SWITCH_STATE_NONE) { | 16213 | if (state === SWITCH_STATE_NONE) { |
16214 | + UseLayUi.topErrorMsg('暂无数据上报,无法下发指令') | ||
16207 | return | 16215 | return |
16208 | } | 16216 | } |
16209 | - const { flag, value } = validateSwitchCommand() | ||
16210 | 16217 | ||
16218 | + | ||
16219 | + const { flag, value } = validateSwitchCommand() | ||
16220 | + console.log({ flag, value }) | ||
16211 | if (!flag) return | 16221 | if (!flag) return |
16212 | 16222 | ||
16213 | layer.confirm('是否确认下发命令?', async function (index) { | 16223 | layer.confirm('是否确认下发命令?', async function (index) { |