|
@@ -5063,7 +5063,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -5063,7 +5063,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5063
|
GATEWAY: 'GATEWAY',
|
5063
|
GATEWAY: 'GATEWAY',
|
5064
|
ADDITIONAL: 'additional',
|
5064
|
ADDITIONAL: 'additional',
|
5065
|
DEVICE_PROFILE_ID: 'deviceProfileId',
|
5065
|
DEVICE_PROFILE_ID: 'deviceProfileId',
|
5066
|
- DEVICE_TYPE: 'deviceType'
|
5066
|
+ DEVICE_TYPE: 'deviceType',
|
|
|
5067
|
+ SOURCE_OPTION: 'sourceOption'
|
5067
|
}
|
5068
|
}
|
5068
|
|
5069
|
|
5069
|
/**
|
5070
|
/**
|
|
@@ -5509,7 +5510,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -5509,7 +5510,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5509
|
}
|
5510
|
}
|
5510
|
|
5511
|
|
5511
|
const enumFields = {
|
5512
|
const enumFields = {
|
5512
|
- DEVICE_IDS: 'deviceIdS',
|
5513
|
+ DEVICE_INFO: 'devicesInfo',
|
5513
|
AUTO_PLAY: 'autoPlay',
|
5514
|
AUTO_PLAY: 'autoPlay',
|
5514
|
INTERVAL: 'interval',
|
5515
|
INTERVAL: 'interval',
|
5515
|
START_TIME: 'startTime',
|
5516
|
START_TIME: 'startTime',
|
|
@@ -5523,12 +5524,12 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -5523,12 +5524,12 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5523
|
|
5524
|
|
5524
|
const deviceGroupPanel = createPanel()
|
5525
|
const deviceGroupPanel = createPanel()
|
5525
|
$(deviceGroupPanel).addClass('override__panel--default')
|
5526
|
$(deviceGroupPanel).addClass('override__panel--default')
|
5526
|
- $(deviceGroupPanel).append(`<div style="display: flex; justify-content: space-between;"><input style="display: none;" id="${enumActionEl.DEVICES_INPUT}" name="${enumFields.DEVICE_IDS}" /><div>设备绑定</div><i id="${enumActionEl.BIND_DEVICE_ICON}" class="layui-icon-edit layui-icon" style="cursor: pointer;"><i/></div>`)
|
5527
|
+ $(deviceGroupPanel).append(`<div style="display: flex; justify-content: space-between;"><input style="display: none;" id="${enumActionEl.DEVICES_INPUT}" name="${enumFields.DEVICE_INFO}" /><div>设备绑定</div><i id="${enumActionEl.BIND_DEVICE_ICON}" class="layui-icon-edit layui-icon" style="cursor: pointer;"><i/></div>`)
|
5527
|
|
5528
|
|
5528
|
const queryTimeRangePanel = createPanel()
|
5529
|
const queryTimeRangePanel = createPanel()
|
5529
|
$(queryTimeRangePanel).addClass('override__panel--default')
|
5530
|
$(queryTimeRangePanel).addClass('override__panel--default')
|
5530
|
$(queryTimeRangePanel).append(`<input style="display: none;" type="number" id="${enumActionEl.START_TIME}" name="${enumFields.START_TIME}"><input style="display: none;" type="number" id="${enumActionEl.END_TIME}" name="${enumFields.END_TIME}">`)
|
5531
|
$(queryTimeRangePanel).append(`<input style="display: none;" type="number" id="${enumActionEl.START_TIME}" name="${enumFields.START_TIME}"><input style="display: none;" type="number" id="${enumActionEl.END_TIME}" name="${enumFields.END_TIME}">`)
|
5531
|
- $(queryTimeRangePanel).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 style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap;" class="layui-input" id="${enumActionEl.DATE_RANGE}" placeholder="请选择查询日期"></div></div>`)
|
5532
|
+ $(queryTimeRangePanel).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 style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap;" class="layui-input" id="${enumActionEl.DATE_RANGE}" autocomplete="off" placeholder="请选择查询日期"></div></div>`)
|
5532
|
|
5533
|
|
5533
|
const autoPlayPanel = createPanel()
|
5534
|
const autoPlayPanel = createPanel()
|
5534
|
$(autoPlayPanel).addClass('override__panel--default')
|
5535
|
$(autoPlayPanel).addClass('override__panel--default')
|
|
@@ -5572,7 +5573,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -5572,7 +5573,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5572
|
return `${enumLayFilter.ROW_FILTER_NAME}-${rowCount}`
|
5573
|
return `${enumLayFilter.ROW_FILTER_NAME}-${rowCount}`
|
5573
|
}
|
5574
|
}
|
5574
|
|
5575
|
|
5575
|
- async function getOrganization() {
|
5576
|
+ async function getOrganization(organizationId, rowFilter) {
|
5576
|
if (!organizationList.length) {
|
5577
|
if (!organizationList.length) {
|
5577
|
const [err, res] = await to(ConfigurationNodeApi.getOrgTree())
|
5578
|
const [err, res] = await to(ConfigurationNodeApi.getOrgTree())
|
5578
|
if (!err) organizationList = res
|
5579
|
if (!err) organizationList = res
|
|
@@ -5604,9 +5605,16 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -5604,9 +5605,16 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5604
|
})
|
5605
|
})
|
5605
|
|
5606
|
|
5606
|
form.render()
|
5607
|
form.render()
|
|
|
5608
|
+
|
|
|
5609
|
+ if (organizationId) {
|
|
|
5610
|
+ UseLayUi.nextTick(() => {
|
|
|
5611
|
+ const node = UseLayUi.findTreeObjectByField(organizationList, organizationId)
|
|
|
5612
|
+ $(`#${enumTableActionEl.TABLE_ID} tr[lay-filter="${rowFilter}"] input[name="${enumDeviceKeys.ORGANIZATION_ID}"]`).val(organizationId).parent().find('span').html(node?.name)
|
|
|
5613
|
+ })
|
|
|
5614
|
+ }
|
5607
|
}
|
5615
|
}
|
5608
|
|
5616
|
|
5609
|
- async function getDeviceType() {
|
5617
|
+ async function getDeviceType(value, rowFilter) {
|
5610
|
if (!deviceType.length) {
|
5618
|
if (!deviceType.length) {
|
5611
|
const [err, res] = await to(ConfigurationNodeApi.getDictionaryValue('device_type'))
|
5619
|
const [err, res] = await to(ConfigurationNodeApi.getDictionaryValue('device_type'))
|
5612
|
if (!err) deviceType = res
|
5620
|
if (!err) deviceType = res
|
|
@@ -5619,26 +5627,65 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -5619,26 +5627,65 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5619
|
$(target).html(template)
|
5627
|
$(target).html(template)
|
5620
|
})
|
5628
|
})
|
5621
|
form.render()
|
5629
|
form.render()
|
|
|
5630
|
+
|
|
|
5631
|
+ if (value) {
|
|
|
5632
|
+ UseLayUi.nextTick(() => {
|
|
|
5633
|
+ form.val(rowFilter, { [enumDeviceKeys.DEVICE_TYPE]: value })
|
|
|
5634
|
+ })
|
|
|
5635
|
+ }
|
5622
|
}
|
5636
|
}
|
5623
|
|
5637
|
|
5624
|
- async function getDeviceProfile(currentRowFilter) {
|
|
|
5625
|
- const { deviceType } = form.val(currentRowFilter) || {}
|
5638
|
+ async function getDeviceProfile(currentRowFilter, record, value) {
|
|
|
5639
|
+ const { deviceType } = record || form.val(currentRowFilter) || {}
|
5626
|
if (!deviceType) return
|
5640
|
if (!deviceType) return
|
5627
|
const [err, res] = await to(ConfigurationNodeApi.getProduct(deviceType))
|
5641
|
const [err, res] = await to(ConfigurationNodeApi.getProduct(deviceType))
|
5628
|
const deviceProfile = res
|
5642
|
const deviceProfile = res
|
5629
|
const template = UseLayUi.generateOptionTemplate({ dataSource: deviceProfile, labelField: 'name', valueField: 'id' })
|
5643
|
const template = UseLayUi.generateOptionTemplate({ dataSource: deviceProfile, labelField: 'name', valueField: 'id' })
|
5630
|
$(`#${enumTableActionEl.TABLE_ID}`).find(`tr[lay-filter="${currentRowFilter}"] select[name="${enumDeviceKeys.DEVICE_PROFILE_ID}"]`).html(template)
|
5644
|
$(`#${enumTableActionEl.TABLE_ID}`).find(`tr[lay-filter="${currentRowFilter}"] select[name="${enumDeviceKeys.DEVICE_PROFILE_ID}"]`).html(template)
|
5631
|
form.render()
|
5645
|
form.render()
|
|
|
5646
|
+
|
|
|
5647
|
+ if (value) {
|
|
|
5648
|
+ UseLayUi.nextTick(() => {
|
|
|
5649
|
+ form.val(currentRowFilter, { [enumDeviceKeys.DEVICE_PROFILE_ID]: value })
|
|
|
5650
|
+ })
|
|
|
5651
|
+ }
|
5632
|
}
|
5652
|
}
|
5633
|
|
5653
|
|
5634
|
- async function getDevice(currentRowFilter) {
|
|
|
5635
|
- const { deviceProfileId, organizationId, deviceType } = form.val(currentRowFilter) || {}
|
5654
|
+ async function getDevice(currentRowFilter, record, value) {
|
|
|
5655
|
+ const { deviceProfileId, organizationId, deviceType } = record || form.val(currentRowFilter) || {}
|
5636
|
if (![deviceProfileId, organizationId, deviceType].every(Boolean)) return
|
5656
|
if (![deviceProfileId, organizationId, deviceType].every(Boolean)) return
|
5637
|
const [err, res] = await to(ConfigurationNodeApi.getMeetConditionsDevice({ deviceProfileId, deviceType, organizationId }))
|
5657
|
const [err, res] = await to(ConfigurationNodeApi.getMeetConditionsDevice({ deviceProfileId, deviceType, organizationId }))
|
5638
|
if (err) return
|
5658
|
if (err) return
|
5639
|
const template = UseLayUi.generateOptionTemplate({ dataSource: res, labelField: 'name', valueField: 'id', alias: 'alias' })
|
5659
|
const template = UseLayUi.generateOptionTemplate({ dataSource: res, labelField: 'name', valueField: 'id', alias: 'alias' })
|
5640
|
$(`#${enumTableActionEl.TABLE_ID}`).find(`tr[lay-filter="${currentRowFilter}"] select[name="${enumDeviceKeys.DEVICE_ID}"]`).html(template)
|
5660
|
$(`#${enumTableActionEl.TABLE_ID}`).find(`tr[lay-filter="${currentRowFilter}"] select[name="${enumDeviceKeys.DEVICE_ID}"]`).html(template)
|
5641
|
form.render()
|
5661
|
form.render()
|
|
|
5662
|
+ if (value) {
|
|
|
5663
|
+ UseLayUi.nextTick(() => {
|
|
|
5664
|
+ form.val(currentRowFilter, { [enumDeviceKeys.DEVICE_ID]: value })
|
|
|
5665
|
+ })
|
|
|
5666
|
+ }
|
|
|
5667
|
+ }
|
|
|
5668
|
+
|
|
|
5669
|
+ function echoDeviceBindInfo() {
|
|
|
5670
|
+ const dataSource = currentNodeData?.dataSources?.find(item => item.nodeId === nodeInfo.id)
|
|
|
5671
|
+ if (!dataSource) return
|
|
|
5672
|
+ const record = dataSource.sourceOption
|
|
|
5673
|
+ const devicesInfo = record.devicesInfo
|
|
|
5674
|
+ const value = UseLayUi.parseStringToJSON(devicesInfo, [])
|
|
|
5675
|
+ if (value.length) {
|
|
|
5676
|
+ $(`#${enumTableActionEl.TABLE_ID}`).find('tbody').empty()
|
|
|
5677
|
+ }
|
|
|
5678
|
+ value.forEach((item) => {
|
|
|
5679
|
+ const template = createRow()
|
|
|
5680
|
+ const rowFilter = `${enumLayFilter.ROW_FILTER_NAME}-${rowCount}`
|
|
|
5681
|
+ $(`#${enumTableActionEl.TABLE_ID}`).find('tbody').append(template)
|
|
|
5682
|
+
|
|
|
5683
|
+ // form.render(null, rowFilter)
|
|
|
5684
|
+ getDeviceType(item[enumDeviceKeys.DEVICE_TYPE], rowFilter)
|
|
|
5685
|
+ getOrganization(item[enumDeviceKeys.ORGANIZATION_ID], rowFilter)
|
|
|
5686
|
+ getDeviceProfile(rowFilter, item, item[enumDeviceKeys.DEVICE_PROFILE_ID])
|
|
|
5687
|
+ getDevice(rowFilter, item, item[enumDeviceKeys.DEVICE_ID])
|
|
|
5688
|
+ })
|
5642
|
}
|
5689
|
}
|
5643
|
|
5690
|
|
5644
|
function createEventListener(index) {
|
5691
|
function createEventListener(index) {
|
|
@@ -5768,12 +5815,13 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -5768,12 +5815,13 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5768
|
</div>
|
5815
|
</div>
|
5769
|
</div>
|
5816
|
</div>
|
5770
|
`,
|
5817
|
`,
|
5771
|
- success(el, index) {
|
5818
|
+ async success(el, index) {
|
5772
|
form.render()
|
5819
|
form.render()
|
5773
|
- getDeviceType()
|
|
|
5774
|
- getOrganization()
|
5820
|
+ await getDeviceType()
|
|
|
5821
|
+ await getOrganization()
|
5775
|
createEventListener(index)
|
5822
|
createEventListener(index)
|
5776
|
$(el).addClass('layui-form').find('.layui-layer-btn0').attr('lay-submit', true).attr('lay-filter', enumTableActionEl.SUBMIT_BUTTON)
|
5823
|
$(el).addClass('layui-form').find('.layui-layer-btn0').attr('lay-submit', true).attr('lay-filter', enumTableActionEl.SUBMIT_BUTTON)
|
|
|
5824
|
+ echoDeviceBindInfo()
|
5777
|
},
|
5825
|
},
|
5778
|
yes() {
|
5826
|
yes() {
|
5779
|
return false
|
5827
|
return false
|
|
@@ -5781,10 +5829,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -5781,10 +5829,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5781
|
})
|
5829
|
})
|
5782
|
}
|
5830
|
}
|
5783
|
|
5831
|
|
5784
|
- function init() {
|
|
|
5785
|
- $(`#${enumActionEl.BIND_DEVICE_ICON}`).on('click', openBindDeviceLayer)
|
|
|
5786
|
- form.render()
|
|
|
5787
|
-
|
5832
|
+ function createDateRange() {
|
5788
|
laydate.render({
|
5833
|
laydate.render({
|
5789
|
elem: `#${enumActionEl.DATE_RANGE}`,
|
5834
|
elem: `#${enumActionEl.DATE_RANGE}`,
|
5790
|
type: 'datetime',
|
5835
|
type: 'datetime',
|
|
@@ -5878,6 +5923,46 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -5878,6 +5923,46 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5878
|
$(`#${enumActionEl.END_TIME}`).val(endTs)
|
5923
|
$(`#${enumActionEl.END_TIME}`).val(endTs)
|
5879
|
}
|
5924
|
}
|
5880
|
})
|
5925
|
})
|
|
|
5926
|
+ }
|
|
|
5927
|
+
|
|
|
5928
|
+ function formatTimespanToDateString(timespan) {
|
|
|
5929
|
+ if (isNaN(timespan)) return
|
|
|
5930
|
+ const date = new Date(Number(timespan))
|
|
|
5931
|
+ const year = date.getFullYear()
|
|
|
5932
|
+ const month = (date.getMonth() + 1).toString().padStart(2, 0)
|
|
|
5933
|
+ const day = date.getDate().toString().padStart(2, 0)
|
|
|
5934
|
+ const hour = date.getHours().toString().padStart(2, 0)
|
|
|
5935
|
+ const minute = date.getMinutes().toString().padStart(2, 0)
|
|
|
5936
|
+ const second = date.getSeconds().toString().padStart(2, 0)
|
|
|
5937
|
+
|
|
|
5938
|
+ return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
|
|
5939
|
+ }
|
|
|
5940
|
+
|
|
|
5941
|
+ async function echoData() {
|
|
|
5942
|
+ const getBindValue = currentNodeData?.dataSources?.find(item => item.nodeId === nodeInfo.id)
|
|
|
5943
|
+ if (!getBindValue) return
|
|
|
5944
|
+ const record = getBindValue.sourceOption
|
|
|
5945
|
+ form.val(CONTAINER_FILTER, record)
|
|
|
5946
|
+
|
|
|
5947
|
+ const startTime = formatTimespanToDateString(record.startTime)
|
|
|
5948
|
+ const endTime = formatTimespanToDateString(record.endTime)
|
|
|
5949
|
+ laydate.render({
|
|
|
5950
|
+ elem: `#${enumActionEl.DATE_RANGE}`,
|
|
|
5951
|
+ value: `${startTime} - ${endTime}`
|
|
|
5952
|
+ })
|
|
|
5953
|
+ }
|
|
|
5954
|
+
|
|
|
5955
|
+ function init() {
|
|
|
5956
|
+ $(`#${enumActionEl.BIND_DEVICE_ICON}`).on('click', openBindDeviceLayer)
|
|
|
5957
|
+ form.render()
|
|
|
5958
|
+
|
|
|
5959
|
+ createDateRange()
|
|
|
5960
|
+
|
|
|
5961
|
+ const refreshFN = echoRefreshFn
|
|
|
5962
|
+ echoRefreshFn = async function () {
|
|
|
5963
|
+ refreshFN.apply(this, arguments)
|
|
|
5964
|
+ await echoData()
|
|
|
5965
|
+ }
|
5881
|
|
5966
|
|
5882
|
}
|
5967
|
}
|
5883
|
|
5968
|
|
|
@@ -6533,18 +6618,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -6533,18 +6618,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6533
|
|
6618
|
|
6534
|
function getFlowmeterSubmitValue(field = {}) {
|
6619
|
function getFlowmeterSubmitValue(field = {}) {
|
6535
|
const additionalKey = HandleDataSource.enumConst
|
6620
|
const additionalKey = HandleDataSource.enumConst
|
6536
|
- // const minValue = field[additionalKey.MIN_VALUE]
|
|
|
6537
|
- // const maxValue = field[additionalKey.MAX_VALUE]
|
|
|
6538
|
-
|
|
|
6539
|
- // if ([minValue, maxValue].some(item => isNaN(item))) {
|
|
|
6540
|
- // UseLayUi.topErrorMsg('最大值或最小值不是一个数字!')
|
|
|
6541
|
- // return false
|
|
|
6542
|
- // }
|
|
|
6543
|
-
|
|
|
6544
|
- // if (Number(minValue) > Number(maxValue)) {
|
|
|
6545
|
- // UseLayUi.topErrorMsg('最小值大于最大值!')
|
|
|
6546
|
- // return false
|
|
|
6547
|
- // }
|
|
|
6548
|
|
6621
|
|
6549
|
const value = {
|
6622
|
const value = {
|
6550
|
configurationId,
|
6623
|
configurationId,
|
|
@@ -6571,9 +6644,22 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
|
@@ -6571,9 +6644,22 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
6571
|
}
|
6644
|
}
|
6572
|
return value
|
6645
|
return value
|
6573
|
}
|
6646
|
}
|
6574
|
- c
|
6647
|
+
|
6575
|
function getAlarmListSubmitValue(filed = {}) {
|
6648
|
function getAlarmListSubmitValue(filed = {}) {
|
6576
|
- console.log(field)
|
6649
|
+
|
|
|
6650
|
+ const value = {
|
|
|
6651
|
+ configurationId,
|
|
|
6652
|
+ contentId: currentPageId.id,
|
|
|
6653
|
+ nodeId: graphId,
|
|
|
6654
|
+ [enumCategory.ACT]: [],
|
|
|
6655
|
+ [enumCategory.EVENT]: [],
|
|
|
6656
|
+ [enumCategory.DATA_SOURCE]: {
|
|
|
6657
|
+ [enumDataSourceConst.ADDITIONAL]: { componentType: 'alarmList' },
|
|
|
6658
|
+ [enumDataSourceConst.SOURCE_OPTION]: field
|
|
|
6659
|
+ }
|
|
|
6660
|
+ }
|
|
|
6661
|
+
|
|
|
6662
|
+ return value
|
6577
|
}
|
6663
|
}
|
6578
|
}
|
6664
|
}
|
6579
|
|
6665
|
|
|
@@ -13053,6 +13139,18 @@ class UseLayUi { |
|
@@ -13053,6 +13139,18 @@ class UseLayUi { |
13053
|
`
|
13139
|
`
|
13054
|
}
|
13140
|
}
|
13055
|
|
13141
|
|
|
|
13142
|
+ static parseStringToJSON(string, defaultValue = {}) {
|
|
|
13143
|
+ try {
|
|
|
13144
|
+ if (typeof string === 'string') {
|
|
|
13145
|
+ const value = JSON.parse(string)
|
|
|
13146
|
+ if (typeof value === 'object') return value
|
|
|
13147
|
+ }
|
|
|
13148
|
+ return defaultValue
|
|
|
13149
|
+ } catch (error) {
|
|
|
13150
|
+ return defaultValue
|
|
|
13151
|
+ }
|
|
|
13152
|
+ }
|
|
|
13153
|
+
|
13056
|
/**
|
13154
|
/**
|
13057
|
* @description 生成输入框控件
|
13155
|
* @description 生成输入框控件
|
13058
|
* @param {{label: string, value: string, labelWidth: number, numberInput: boolean}} params
|
13156
|
* @param {{label: string, value: string, labelWidth: number, numberInput: boolean}} params
|
|
@@ -14246,6 +14344,11 @@ class DispatchCenter { |
|
@@ -14246,6 +14344,11 @@ class DispatchCenter { |
14246
|
}
|
14344
|
}
|
14247
|
|
14345
|
|
14248
|
afterGetContentDataNode() {
|
14346
|
afterGetContentDataNode() {
|
|
|
14347
|
+ this.handleFlowmeterComponent()
|
|
|
14348
|
+ this.handleAlarmList()
|
|
|
14349
|
+ }
|
|
|
14350
|
+
|
|
|
14351
|
+ handleFlowmeterComponent() {
|
14249
|
setTimeout(() => {
|
14352
|
setTimeout(() => {
|
14250
|
const componentType = Sidebar.prototype.enumComponentType
|
14353
|
const componentType = Sidebar.prototype.enumComponentType
|
14251
|
if (!this.contentData?.dataSources) return
|
14354
|
if (!this.contentData?.dataSources) return
|
|
@@ -14279,6 +14382,50 @@ class DispatchCenter { |
|
@@ -14279,6 +14382,50 @@ class DispatchCenter { |
14279
|
}, 10);
|
14382
|
}, 10);
|
14280
|
}
|
14383
|
}
|
14281
|
|
14384
|
|
|
|
14385
|
+
|
|
|
14386
|
+ // 处理告警列表
|
|
|
14387
|
+ async handleAlarmList() {
|
|
|
14388
|
+ const componentType = Sidebar.prototype.enumComponentType
|
|
|
14389
|
+ if (!this.contentData?.dataSources) return
|
|
|
14390
|
+ const alarmList = this.contentData?.dataSources?.filter(item => item.additional && (item.additional || {}).componentType === componentType.ALARM_LIST)
|
|
|
14391
|
+ const allCell = Object.entries(this.graph?.getModel()?.cells || {}).map(([_, item]) => item) || []
|
|
|
14392
|
+ const { UUID } = AlarmListComponent.getAttributeKeys()
|
|
|
14393
|
+ const { jquery: $ } = layui
|
|
|
14394
|
+ for (const item of alarmList || []) {
|
|
|
14395
|
+ const { nodeId, sourceOption } = item || {}
|
|
|
14396
|
+ const { devicesInfo, autoPlay, interval, startTime, endTime } = sourceOption || {}
|
|
|
14397
|
+ const node = allCell.find(item => item.id === nodeId)
|
|
|
14398
|
+ const deviceIds = UseLayUi.parseStringToJSON(devicesInfo, []).map(item => item.deviceId)
|
|
|
14399
|
+ const id = node.getAttribute(UUID)
|
|
|
14400
|
+ const element = document.getElementById(id)
|
|
|
14401
|
+ if (element) {
|
|
|
14402
|
+ const [err, data] = await to(ConfigurationNodeApi.getAlarmList({ page: 1, pageSize: 30, startTime: Number(startTime), endTime: Number(endTime), deviceIds }))
|
|
|
14403
|
+ if (err) return
|
|
|
14404
|
+ if (data?.items && data?.items?.length) {
|
|
|
14405
|
+ const template = AlarmListComponent.createAlarmItem(data.items)
|
|
|
14406
|
+ $(`#${id}`).find('.list-wrapper').html(template)
|
|
|
14407
|
+ }
|
|
|
14408
|
+ if (autoPlay) {
|
|
|
14409
|
+ const wrapperHeight = $(`#${id}`).height()
|
|
|
14410
|
+ const listWrapper = $(`#${id}`).find('.list-wrapper')
|
|
|
14411
|
+ const allHeight = listWrapper.height()
|
|
|
14412
|
+ const itemHeight = allHeight / listWrapper.children().length
|
|
|
14413
|
+ let scrollDistance = 0
|
|
|
14414
|
+ const cancel = RAFSetInterval(() => {
|
|
|
14415
|
+ try {
|
|
|
14416
|
+ scrollDistance = itemHeight + scrollDistance
|
|
|
14417
|
+ if (scrollDistance + wrapperHeight > allHeight) scrollDistance = 0
|
|
|
14418
|
+ document.getElementById(id).scrollTo({ top: scrollDistance, behavior: 'smooth' })
|
|
|
14419
|
+ } catch (error) {
|
|
|
14420
|
+ cancel?.()
|
|
|
14421
|
+ }
|
|
|
14422
|
+
|
|
|
14423
|
+ }, Number(interval) * 1000)
|
|
|
14424
|
+ }
|
|
|
14425
|
+ }
|
|
|
14426
|
+ }
|
|
|
14427
|
+ }
|
|
|
14428
|
+
|
14282
|
sendSubscribeMessage() {
|
14429
|
sendSubscribeMessage() {
|
14283
|
const message = this.generateSubscribeMessage()
|
14430
|
const message = this.generateSubscribeMessage()
|
14284
|
this.socket.send(JSON.stringify(message))
|
14431
|
this.socket.send(JSON.stringify(message))
|