Commit 82c8e16c0efa25e73809505e8f3e0c722b35270a
1 parent
424afb95
fix: 修复下发命令为负数时无法下发及非TCP设备命令下发方式隐藏modbus选项
Showing
1 changed file
with
11 additions
and
5 deletions
@@ -7900,6 +7900,11 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7900,6 +7900,11 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7900 | }) | 7900 | }) |
7901 | const formValue = form.val(enumActionEl.FORM_FILTER) | 7901 | const formValue = form.val(enumActionEl.FORM_FILTER) |
7902 | 7902 | ||
7903 | + if (transportType != 'TCP') { | ||
7904 | + $(`#${enumActionEl.COMMAND_TYPE_EL} dl dd[lay-value="2"]`).remove() | ||
7905 | + $(`#${enumActionEl.COMMAND_TYPE_EL} select option[value="2"]`).remove() | ||
7906 | + } | ||
7907 | + | ||
7903 | controlFormDisplay(value, formValue) | 7908 | controlFormDisplay(value, formValue) |
7904 | }) | 7909 | }) |
7905 | 7910 | ||
@@ -7956,6 +7961,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7956,6 +7961,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7956 | } | 7961 | } |
7957 | 7962 | ||
7958 | form.render('select', enumActionEl.FORM_FILTER) | 7963 | form.render('select', enumActionEl.FORM_FILTER) |
7964 | + | ||
7959 | } catch (error) { | 7965 | } catch (error) { |
7960 | throw error | 7966 | throw error |
7961 | } | 7967 | } |
@@ -9459,7 +9465,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -9459,7 +9465,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
9459 | 9465 | ||
9460 | function proxyFn(fn) { | 9466 | function proxyFn(fn) { |
9461 | return (...args) => { | 9467 | return (...args) => { |
9462 | - const currentDataSource = getDataSourceBindValue() || {} | 9468 | + let currentDataSource = getValueOnSubmit(form.val(CONTAINER_FILTER)) || {} |
9469 | + currentDataSource = currentDataSource.dataSources || {} | ||
9463 | if (currentDataSource.deviceProfileId && currentDataSource.deviceType && currentDataSource.orgId) { | 9470 | if (currentDataSource.deviceProfileId && currentDataSource.deviceType && currentDataSource.orgId) { |
9464 | to(ConfigurationNodeApi.updateNodeInfo({ | 9471 | to(ConfigurationNodeApi.updateNodeInfo({ |
9465 | configurationId, | 9472 | configurationId, |
@@ -16231,19 +16238,18 @@ class HandleDataInteraction { | @@ -16231,19 +16238,18 @@ class HandleDataInteraction { | ||
16231 | if (commandType == enumCommandType.MODBUS) { | 16238 | if (commandType == enumCommandType.MODBUS) { |
16232 | value = data[enumActionEl.CUSTOM_TCP_COMMAND] | 16239 | value = data[enumActionEl.CUSTOM_TCP_COMMAND] |
16233 | const { method, deviceCode } = additional || {} | 16240 | const { method, deviceCode } = additional || {} |
16234 | - | ||
16235 | const validate = new Validate([ | 16241 | const validate = new Validate([ |
16236 | { value: deviceCode, required: true, message: '未找到设备地址码' }, | 16242 | { value: deviceCode, required: true, message: '未找到设备地址码' }, |
16237 | { value: method, required: true, message: '未找到Modbus命令操作类型' }, | 16243 | { value: method, required: true, message: '未找到Modbus命令操作类型' }, |
16238 | { value, required: true, message: '下发值是必填项' }, | 16244 | { value, required: true, message: '下发值是必填项' }, |
16239 | ...(method == '05' ? [{ value, message: '下发类型必须为0或1', validator(value) { return value == 0 || value == 1 } }] : []), | 16245 | ...(method == '05' ? [{ value, message: '下发类型必须为0或1', validator(value) { return value == 0 || value == 1 } }] : []), |
16240 | ...(method == '06' ? [{ value, message: '下发类型必须为整型', validator(value) { return !isNaN(value) && Number(value) % 1 === 0 } }, { value, message: '最大值不能超过65535', validator(value) { return Number(value) <= parseInt('ffff', 16) } }] : []), | 16246 | ...(method == '06' ? [{ value, message: '下发类型必须为整型', validator(value) { return !isNaN(value) && Number(value) % 1 === 0 } }, { value, message: '最大值不能超过65535', validator(value) { return Number(value) <= parseInt('ffff', 16) } }] : []), |
16241 | - ...(method == '16' ? [{ value, message: '下发类型精确到两位小数', validator(value) { return /^\d+(\.\d{0,2})?$/.test(value) } }] : []) | 16247 | + ...(method == '16' ? [{ value, message: '下发类型精确到两位小数', validator(value) { return /^-?\d+(\.\d{0,2})?$/.test(value) } }] : []) |
16242 | ]) | 16248 | ]) |
16243 | 16249 | ||
16244 | if (method == '16') { | 16250 | if (method == '16') { |
16245 | - const hexValue = UseLayUi.numberToHex(value).split(' ').slice(0, 2).join('') | ||
16246 | - value = [parseInt(hexValue, 16), 0] | 16251 | + const hexValue = UseLayUi.numberToHex(value).split(' ') |
16252 | + value = [parseInt(hexValue.slice(0, 2), 16), parseInt(hexValue.slice(2, 4), 16)] | ||
16247 | } | 16253 | } |
16248 | 16254 | ||
16249 | if (validate.begin()) flag = true | 16255 | if (validate.begin()) flag = true |