Showing
1 changed file
with
40 additions
and
31 deletions
... | ... | @@ -5540,7 +5540,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5540 | 5540 | |
5541 | 5541 | const playIntervalPanel = createPanel() |
5542 | 5542 | $(playIntervalPanel).addClass('override__panel--default') |
5543 | - $(playIntervalPanel).append(`<div class="layui-form-item" style="margin-bottom: 0;"><label class="layui-form-label" style="width: 80px; padding: 9px 0; text-align: left;">停留时间(秒)</label><div class="layui-input-block" style="margin-left: 80px;"><input class="layui-input" name="${enumFields.INTERVAL}" placeholder="请输入报警停留时间" /></div></div>`) | |
5543 | + $(playIntervalPanel).append(`<div class="layui-form-item" style="margin-bottom: 0;"><label class="layui-form-label" style="width: 80px; padding: 9px 0; text-align: left;">停留时间(秒)</label><div class="layui-input-block" style="margin-left: 80px;"><input class="layui-input" name="${enumFields.INTERVAL}" placeholder="请输入报警停留时间" lay-verify="number" type="number" min="2" /></div></div>`) | |
5544 | 5544 | |
5545 | 5545 | function openBindDeviceLayer() { |
5546 | 5546 | |
... | ... | @@ -6665,7 +6665,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6665 | 6665 | } |
6666 | 6666 | |
6667 | 6667 | function getAlarmListSubmitValue(filed = {}) { |
6668 | - console.log(field?.devicesInfo) | |
6668 | + | |
6669 | 6669 | if (!field?.devicesInfo) { |
6670 | 6670 | UseLayUi.errorMsg('请先进行设备绑定!') |
6671 | 6671 | return |
... | ... | @@ -14780,41 +14780,50 @@ class DispatchCenter { |
14780 | 14780 | const allCell = Object.entries(this.graph?.getModel()?.cells || {}).map(([_, item]) => item) || [] |
14781 | 14781 | const { UUID } = AlarmListComponent.getAttributeKeys() |
14782 | 14782 | const { jquery: $ } = layui |
14783 | + | |
14784 | + const currentScale = this.graph.currentScale | |
14783 | 14785 | for (const item of alarmList || []) { |
14784 | 14786 | const { nodeId, sourceOption } = item || {} |
14785 | - const { devicesInfo, autoPlay, interval, startTime, endTime } = sourceOption || {} | |
14787 | + const { devicesInfo, autoPlay, interval = 2, startTime, endTime } = sourceOption || {} | |
14786 | 14788 | const node = allCell.find(item => item.id === nodeId) |
14787 | 14789 | const deviceIds = UseLayUi.parseStringToJSON(devicesInfo, []).map(item => item.deviceId) |
14788 | 14790 | if (!node) continue |
14789 | - const id = node.getAttribute(UUID) | |
14790 | - const element = document.getElementById(id) | |
14791 | - if (element) { | |
14792 | - const [err, data] = await to(ConfigurationNodeApi.getAlarmList({ page: 1, pageSize: 30, startTime: Number(startTime), endTime: Number(endTime), deviceIds })) | |
14793 | - if (err) return | |
14794 | - if (data?.items && data?.items?.length) { | |
14795 | - const template = AlarmListComponent.createAlarmItem(data.items) | |
14796 | - $(`#${id}`).find('.list-wrapper').html(template) | |
14797 | - } else { | |
14798 | - $(`#${id}`).find('.list-wrapper').html(`<div>暂无数据</div>`) | |
14799 | - } | |
14800 | - if (autoPlay) { | |
14801 | - const wrapperHeight = $(`#${id}`).height() | |
14802 | - const listWrapper = $(`#${id}`).find('.list-wrapper') | |
14803 | - const allHeight = listWrapper.height() | |
14804 | - const itemHeight = allHeight / listWrapper.children().length | |
14805 | - let scrollDistance = 0 | |
14806 | - const cancel = RAFSetInterval(() => { | |
14807 | - try { | |
14808 | - scrollDistance = itemHeight + scrollDistance | |
14809 | - if (scrollDistance + wrapperHeight > allHeight) scrollDistance = 0 | |
14810 | - document.getElementById(id).scrollTo({ top: scrollDistance, behavior: 'smooth' }) | |
14811 | - } catch (error) { | |
14812 | - cancel?.() | |
14813 | - } | |
14791 | + // const id = node.getAttribute(UUID) | |
14792 | + // const element = document.getElementById(id) | |
14793 | + // if (element) { | |
14794 | + const [err, data] = await to(ConfigurationNodeApi.getAlarmList({ page: 1, pageSize: 30, startTime: Number(startTime), endTime: Number(endTime), deviceIds })) | |
14795 | + if (err) return | |
14814 | 14796 | |
14815 | - }, Number(interval) * 1000) | |
14816 | - } | |
14797 | + const [rect, element] = this.graph.getNodesForCells([node]) | |
14798 | + if (data?.items && data?.items?.length) { | |
14799 | + const template = AlarmListComponent.createAlarmItem(data.items) | |
14800 | + $(element).find('.list-wrapper').html(template) | |
14801 | + } else { | |
14802 | + $(element).find('.list-wrapper').html(`<div>暂无数据</div>`) | |
14803 | + } | |
14804 | + if (typeof autoPlay === 'boolean' ? autoPlay : autoPlay == 'on') { | |
14805 | + const wrapperHeight = $(element).find('.alarm-list').height() * currentScale | |
14806 | + const listWrapper = $(element).find('.list-wrapper') | |
14807 | + const allHeight = listWrapper.height() * currentScale | |
14808 | + const itemHeight = allHeight / listWrapper.children().length | |
14809 | + let scrollDistance = 0 | |
14810 | + const id = $(element).find('.alarm-list').attr('id') | |
14811 | + | |
14812 | + let interval = Number(interval) | |
14813 | + interval = isNaN(interval) ? 2 : interval | |
14814 | + | |
14815 | + const cancel = RAFSetInterval(() => { | |
14816 | + try { | |
14817 | + scrollDistance = itemHeight + scrollDistance | |
14818 | + if (scrollDistance + wrapperHeight > allHeight) scrollDistance = 0 | |
14819 | + document.getElementById(id).scrollTo({ top: scrollDistance, behavior: 'smooth' }) | |
14820 | + } catch (error) { | |
14821 | + cancel?.() | |
14822 | + } | |
14823 | + | |
14824 | + }, (interval <= 2 ? 2 : interval) * 1000) | |
14817 | 14825 | } |
14826 | + // } | |
14818 | 14827 | } |
14819 | 14828 | } |
14820 | 14829 | |
... | ... | @@ -16292,7 +16301,7 @@ class HandleDataInteraction { |
16292 | 16301 | |
16293 | 16302 | |
16294 | 16303 | const { flag, value } = validateSwitchCommand() |
16295 | - console.log({ flag, value }) | |
16304 | + | |
16296 | 16305 | if (!flag) return |
16297 | 16306 | |
16298 | 16307 | layer.confirm('是否确认下发命令?', async function (index) { | ... | ... |