Showing
1 changed file
with
33 additions
and
15 deletions
| ... | ... | @@ -6588,7 +6588,24 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
| 6588 | 6588 | function getSwitchSubmitValue(field) { |
| 6589 | 6589 | const dataSources = getDataSourceBindValue() |
| 6590 | 6590 | const enableStatus = getEnableStatus(field) |
| 6591 | - return { configurationId, contentId: currentPageId.id, nodeId: graphId, dataSources: { ...dataSources, additional: { deviceCode: dataSources?.deviceCode, method: dataSources?.method, registerAddress: dataSources?.registerAddress, thingsModelDataType: dataSources?.thingsModelDataType, deviceName: dataSources?.deviceName, attrName: dataSources?.attrName } }, ...enableStatus } | |
| 6591 | + return { | |
| 6592 | + configurationId, | |
| 6593 | + contentId: currentPageId.id, | |
| 6594 | + nodeId: graphId, | |
| 6595 | + dataSources: { | |
| 6596 | + ...dataSources, | |
| 6597 | + additional: { | |
| 6598 | + deviceCode: dataSources?.deviceCode, | |
| 6599 | + method: dataSources?.method, | |
| 6600 | + registerAddress: dataSources?.registerAddress, | |
| 6601 | + thingsModelDataType: dataSources?.thingsModelDataType, | |
| 6602 | + deviceName: dataSources?.deviceName, | |
| 6603 | + attrName: dataSources?.attrName, | |
| 6604 | + zoomFactor: dataSources?.zoomFactor | |
| 6605 | + } | |
| 6606 | + }, | |
| 6607 | + ...enableStatus | |
| 6608 | + } | |
| 6592 | 6609 | } |
| 6593 | 6610 | |
| 6594 | 6611 | |
| ... | ... | @@ -8728,7 +8745,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
| 8728 | 8745 | DEVICE_COED: 'deviceCode', |
| 8729 | 8746 | REGISTER_ADDRESS: 'registerAddress', |
| 8730 | 8747 | DATA_TYPE: 'thingsModelDataType', |
| 8731 | - ACTION_TYPE: 'actionType' | |
| 8748 | + ACTION_TYPE: 'actionType', | |
| 8749 | + ZOOM_FACTOR: 'zoomFactor' | |
| 8732 | 8750 | } |
| 8733 | 8751 | |
| 8734 | 8752 | /** |
| ... | ... | @@ -8788,6 +8806,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
| 8788 | 8806 | [enumDataSourceConst.REGISTER_ADDRESS]: null, |
| 8789 | 8807 | [enumDataSourceConst.DATA_TYPE]: null, |
| 8790 | 8808 | [enumDataSourceConst.ACTION_TYPE]: null, |
| 8809 | + [enumDataSourceConst.ZOOM_FACTOR]: null, | |
| 8791 | 8810 | }) |
| 8792 | 8811 | |
| 8793 | 8812 | currentDataSource[enumDataSourceConst.DEVICE_TYPE] = value |
| ... | ... | @@ -8817,6 +8836,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
| 8817 | 8836 | [enumDataSourceConst.REGISTER_ADDRESS]: null, |
| 8818 | 8837 | [enumDataSourceConst.DATA_TYPE]: null, |
| 8819 | 8838 | [enumDataSourceConst.ACTION_TYPE]: null, |
| 8839 | + [enumDataSourceConst.ZOOM_FACTOR]: null, | |
| 8820 | 8840 | |
| 8821 | 8841 | }) |
| 8822 | 8842 | currentDataSource[enumDataSourceConst.DEVICE_PROFILE_ID] = value |
| ... | ... | @@ -8853,6 +8873,9 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
| 8853 | 8873 | <div class="layui-form-item" style="margin-bottom: 0; display: none;"> |
| 8854 | 8874 | <input style="display: none" type="text" name="${enumDataSourceConst.ACTION_TYPE}" class="layui-input"> |
| 8855 | 8875 | </div> |
| 8876 | + <div class="layui-form-item" style="margin-bottom: 0; display: none;"> | |
| 8877 | + <input style="display: none" type="text" name="${enumDataSourceConst.ZOOM_FACTOR}" class="layui-input"> | |
| 8878 | + </div> | |
| 8856 | 8879 | ` |
| 8857 | 8880 | $(component).append(template) |
| 8858 | 8881 | } |
| ... | ... | @@ -8982,23 +9005,13 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
| 8982 | 9005 | const selected = thingsModel?.find(item => item.identifier === value) |
| 8983 | 9006 | |
| 8984 | 9007 | if (!selected) return |
| 8985 | - // const type = selected?.extensionDesc?.dataType | |
| 8986 | - | |
| 8987 | - // let method | |
| 8988 | - | |
| 8989 | - // if (type === 'short' || type === 'unshort') { | |
| 8990 | - // method = '06' | |
| 8991 | - // } else if (type === 'bit') { | |
| 8992 | - // method = '05' | |
| 8993 | - // } else { | |
| 8994 | - // method = '10' | |
| 8995 | - // } | |
| 8996 | 9008 | |
| 8997 | 9009 | form.val(componentFilter, { |
| 8998 | 9010 | [enumDataSourceConst.METHOD]: selected?.extensionDesc?.actionType, |
| 8999 | 9011 | [enumDataSourceConst.REGISTER_ADDRESS]: selected?.extensionDesc?.registerAddress, |
| 9000 | 9012 | [enumDataSourceConst.DATA_TYPE]: selected?.extensionDesc?.dataType, |
| 9001 | 9013 | [enumDataSourceConst.ACTION_TYPE]: selected?.extensionDesc?.actionType, |
| 9014 | + [enumDataSourceConst.ZOOM_FACTOR]: selected?.extensionDesc?.zoomFactor, | |
| 9002 | 9015 | }) |
| 9003 | 9016 | } |
| 9004 | 9017 | }) |
| ... | ... | @@ -9010,7 +9023,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
| 9010 | 9023 | * @param {{orgId: string, deviceId: string, slaveDeviceId?: string, attr: string}} dataSource |
| 9011 | 9024 | */ |
| 9012 | 9025 | function echoDataSource(dataSource = {}) { |
| 9013 | - const { orgId, deviceId, deviceProfileId, deviceType, attr, method, deviceCode, registerAddress, thingsModelDataType, actionType } = dataSource | |
| 9026 | + const { orgId, deviceId, deviceProfileId, deviceType, attr, method, deviceCode, registerAddress, thingsModelDataType, actionType, zoomFacor } = dataSource | |
| 9014 | 9027 | const queue = [] |
| 9015 | 9028 | currentDataSource = { organizationId: orgId, deviceProfileId, deviceType } |
| 9016 | 9029 | queue.push(getProduct(deviceType)) |
| ... | ... | @@ -9041,6 +9054,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
| 9041 | 9054 | actionType, |
| 9042 | 9055 | deviceName, |
| 9043 | 9056 | attrName, |
| 9057 | + zoomFacor | |
| 9044 | 9058 | }) |
| 9045 | 9059 | |
| 9046 | 9060 | }) |
| ... | ... | @@ -16261,7 +16275,7 @@ class HandleDataInteraction { |
| 16261 | 16275 | |
| 16262 | 16276 | if (commandType == enumCommandType.MODBUS) { |
| 16263 | 16277 | value = data[enumActionEl.CUSTOM_TCP_COMMAND] |
| 16264 | - const { method, deviceCode } = additional || {} | |
| 16278 | + const { method, deviceCode, zoomFactor = 1 } = additional || {} | |
| 16265 | 16279 | const validate = new Validate([ |
| 16266 | 16280 | { value: deviceCode, required: true, message: '未找到设备地址码' }, |
| 16267 | 16281 | { value: method, required: true, message: '未找到Modbus命令操作类型' }, |
| ... | ... | @@ -16270,6 +16284,10 @@ class HandleDataInteraction { |
| 16270 | 16284 | ...(method == '06' ? [{ value, message: '下发类型必须为整型', validator(value) { return !isNaN(value) && Number(value) % 1 === 0 } }, { value, message: '最大值不能超过65535', validator(value) { return Number(value) <= parseInt('ffff', 16) } }] : []), |
| 16271 | 16285 | ...(method == '16' ? [{ value, message: '下发类型精确到两位小数', validator(value) { return /^-?\d+(\.\d{0,2})?$/.test(value) } }] : []) |
| 16272 | 16286 | ]) |
| 16287 | + | |
| 16288 | + if (method == '06' || method == '16') { | |
| 16289 | + value = value * zoomFactor | |
| 16290 | + } | |
| 16273 | 16291 | |
| 16274 | 16292 | if (method == '16') { |
| 16275 | 16293 | const hexValue = UseLayUi.numberToHex(value).split(' ').join('') | ... | ... |