Commit 337e695815ddc510da81844ec2eb2345f17f7fbc
1 parent
e2460747
fix: fix bind data source can not select slave device
Showing
1 changed file
with
26 additions
and
6 deletions
@@ -5666,7 +5666,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -5666,7 +5666,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
5666 | [enumDataSourceConst.ORG_ID]: field[enumDataSourceConst.ORG_ID], | 5666 | [enumDataSourceConst.ORG_ID]: field[enumDataSourceConst.ORG_ID], |
5667 | [enumDataSourceConst.DEVICE_ID]: field[enumDataSourceConst.DEVICE_ID], | 5667 | [enumDataSourceConst.DEVICE_ID]: field[enumDataSourceConst.DEVICE_ID], |
5668 | // ...(field[enumDataSourceConst.SLAVE_DEVICE_ID] && { [enumDataSourceConst.SLAVE_DEVICE_ID]: field[enumDataSourceConst.SLAVE_DEVICE_ID] }), | 5668 | // ...(field[enumDataSourceConst.SLAVE_DEVICE_ID] && { [enumDataSourceConst.SLAVE_DEVICE_ID]: field[enumDataSourceConst.SLAVE_DEVICE_ID] }), |
5669 | - [enumDataSourceConst.SLAVE_DEVICE_ID]: field[enumDataSourceConst.SLAVE_DEVICE_ID] ? [enumDataSourceConst.SLAVE_DEVICE_ID] : '', | 5669 | + [enumDataSourceConst.SLAVE_DEVICE_ID]: field[enumDataSourceConst.SLAVE_DEVICE_ID] ? field[enumDataSourceConst.SLAVE_DEVICE_ID] : '', |
5670 | [enumDataSourceConst.ATTR]: field[enumDataSourceConst.ATTR], | 5670 | [enumDataSourceConst.ATTR]: field[enumDataSourceConst.ATTR], |
5671 | [enumDataSourceConst.ADDITIONAL]: field[additionalKey.DATA_TYPE] ? { | 5671 | [enumDataSourceConst.ADDITIONAL]: field[additionalKey.DATA_TYPE] ? { |
5672 | [additionalKey.AGG]: field[additionalKey.AGG], | 5672 | [additionalKey.AGG]: field[additionalKey.AGG], |
@@ -6343,7 +6343,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6343,7 +6343,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6343 | /** | 6343 | /** |
6344 | * @description 下拉选项挂载 | 6344 | * @description 下拉选项挂载 |
6345 | */ | 6345 | */ |
6346 | - function createSelectOptionMountEvent(params) { | 6346 | + function createSelectOptionMountEvent() { |
6347 | $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).on('click', '.layui-form-select', event => { | 6347 | $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).on('click', '.layui-form-select', event => { |
6348 | const width = event.currentTarget.offsetWidth || 200 | 6348 | const width = event.currentTarget.offsetWidth || 200 |
6349 | const height = event.currentTarget.offsetHeight || 38 | 6349 | const height = event.currentTarget.offsetHeight || 38 |
@@ -6383,7 +6383,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6383,7 +6383,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6383 | function echoOrgTree(id) { | 6383 | function echoOrgTree(id) { |
6384 | orgId = id | 6384 | orgId = id |
6385 | const node = UseLayUi.findTreeObjectByField(treeList, id) | 6385 | const node = UseLayUi.findTreeObjectByField(treeList, id) |
6386 | - | ||
6387 | UseLayUi.nextTick(() => $(`#${enumActionEl.ORG_EL} input[name="${enumConst.ORG_ID}"]`).val(orgId).parent().find('span').html(node?.name)) | 6386 | UseLayUi.nextTick(() => $(`#${enumActionEl.ORG_EL} input[name="${enumConst.ORG_ID}"]`).val(orgId).parent().find('span').html(node?.name)) |
6388 | } | 6387 | } |
6389 | 6388 | ||
@@ -6527,8 +6526,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6527,8 +6526,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6527 | }) | 6526 | }) |
6528 | createOrgTreeSelect() | 6527 | createOrgTreeSelect() |
6529 | const info = getLayerBindInfo('event', type) | 6528 | const info = getLayerBindInfo('event', type) |
6530 | - const { content: { data = [] } = {}, orgId } = info | ||
6531 | - echoOrgTree(orgId) | 6529 | + const { content: { data = [] } = {}, orgId: recordOrgId } = info |
6530 | + orgId = recordOrgId | ||
6532 | await getAllGatewayDeviceAndConnectionDevice() | 6531 | await getAllGatewayDeviceAndConnectionDevice() |
6533 | if (!info || !data.length) { | 6532 | if (!info || !data.length) { |
6534 | addRecord() | 6533 | addRecord() |
@@ -6537,7 +6536,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6537,7 +6536,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6537 | } | 6536 | } |
6538 | generatorEventListen() | 6537 | generatorEventListen() |
6539 | form.render() | 6538 | form.render() |
6540 | - echoOrgTree(orgId) | 6539 | + echoOrgTree(recordOrgId) |
6541 | }, | 6540 | }, |
6542 | }) | 6541 | }) |
6543 | } | 6542 | } |
@@ -6886,6 +6885,24 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6886,6 +6885,24 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6886 | }) | 6885 | }) |
6887 | } | 6886 | } |
6888 | 6887 | ||
6888 | + | ||
6889 | + /** | ||
6890 | + * @description 下拉选项挂载 | ||
6891 | + */ | ||
6892 | + function createSelectOptionMountEvent() { | ||
6893 | + $(`#${enumActionEl.TABLE_BODY_EL}`).on('click', '.layui-form-select', event => { | ||
6894 | + const width = event.currentTarget.offsetWidth || 200 | ||
6895 | + const height = event.currentTarget.offsetHeight || 38 | ||
6896 | + const offset = $(event.currentTarget).offset() | ||
6897 | + $(event.currentTarget).find('dl').css({ | ||
6898 | + position: 'fixed', | ||
6899 | + 'min-width': width + 'px', | ||
6900 | + top: offset.top + height + 'px', | ||
6901 | + left: offset.left + 'px' | ||
6902 | + }) | ||
6903 | + }) | ||
6904 | + } | ||
6905 | + | ||
6889 | /** | 6906 | /** |
6890 | * @description 创建事件监听 | 6907 | * @description 创建事件监听 |
6891 | */ | 6908 | */ |
@@ -6893,6 +6910,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -6893,6 +6910,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
6893 | createInputListener() | 6910 | createInputListener() |
6894 | createAddRowListenEvent() | 6911 | createAddRowListenEvent() |
6895 | createDeleteRowListenEvent() | 6912 | createDeleteRowListenEvent() |
6913 | + createSelectOptionMountEvent() | ||
6896 | } | 6914 | } |
6897 | 6915 | ||
6898 | /** | 6916 | /** |
@@ -7136,6 +7154,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7136,6 +7154,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7136 | data: treeList, | 7154 | data: treeList, |
7137 | onlyIconControl: true, | 7155 | onlyIconControl: true, |
7138 | click(node) { | 7156 | click(node) { |
7157 | + currentCheckedOrgNode = node.data.id | ||
7139 | form.val(componentFilter, { | 7158 | form.val(componentFilter, { |
7140 | [enumDataSourceConst.DEVICE_ID]: null, | 7159 | [enumDataSourceConst.DEVICE_ID]: null, |
7141 | [enumDataSourceConst.SLAVE_DEVICE_ID]: null, | 7160 | [enumDataSourceConst.SLAVE_DEVICE_ID]: null, |
@@ -7248,6 +7267,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7248,6 +7267,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7248 | } | 7267 | } |
7249 | 7268 | ||
7250 | function getValue() { | 7269 | function getValue() { |
7270 | + console.log(form.val(componentFilter)) | ||
7251 | return form.val(componentFilter) | 7271 | return form.val(componentFilter) |
7252 | } | 7272 | } |
7253 | 7273 |