...
|
...
|
@@ -4952,12 +4952,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
4952
|
4952
|
let treeList = []
|
4953
|
4953
|
|
4954
|
4954
|
/**
|
4955
|
|
- * @description 当前选中的组织树节点
|
4956
|
|
- * @type {null | string}
|
4957
|
|
- */
|
4958
|
|
- let currentCheckedOrgNode = null
|
4959
|
|
-
|
4960
|
|
- /**
|
4961
|
4955
|
* @description 当前节点绑定数据
|
4962
|
4956
|
* @type {null | {act: [], event: [], dataSources: []}}
|
4963
|
4957
|
*/
|
...
|
...
|
@@ -5067,7 +5061,9 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5067
|
5061
|
SLAVE_DEVICE_ID: 'slaveDeviceId',
|
5068
|
5062
|
ATTR: 'attr',
|
5069
|
5063
|
GATEWAY: 'GATEWAY',
|
5070
|
|
- ADDITIONAL: 'additional'
|
|
5064
|
+ ADDITIONAL: 'additional',
|
|
5065
|
+ DEVICE_PROFILE_ID: 'deviceProfileId',
|
|
5066
|
+ DEVICE_TYPE: 'deviceType'
|
5071
|
5067
|
}
|
5072
|
5068
|
|
5073
|
5069
|
/**
|
...
|
...
|
@@ -5078,7 +5074,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5078
|
5074
|
|
5079
|
5075
|
/**
|
5080
|
5076
|
* @description 用于在其他位置获取数据源绑定的数据,在生成数据源面板中进行了改写
|
5081
|
|
- * @return {{orgId: string, attr: string, deviceId: string, slaveDeviceId: string}}
|
|
5077
|
+ * @return {{orgId: string, attr: string, deviceId: string, deviceType: string, deviceProfileId: string}}
|
5082
|
5078
|
*/
|
5083
|
5079
|
function getDataSourceBindValue() {
|
5084
|
5080
|
|
...
|
...
|
@@ -5236,7 +5232,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5236
|
5232
|
|
5237
|
5233
|
|
5238
|
5234
|
async function mount() {
|
5239
|
|
- const { component, echoDataSource, getValue } = generateDataSourceComponent({ validate: false })
|
|
5235
|
+ const { component, echoDataSource, getValue } = generateDataSourceComponent({ validate: true })
|
5240
|
5236
|
$(fragment).append(title).append(component)
|
5241
|
5237
|
$(container).append(fragment)
|
5242
|
5238
|
|
...
|
...
|
@@ -5938,7 +5934,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5938
|
5934
|
const type = graph.getAttributeForCell(cell, basicAttr.COMPONENT_TYPE)
|
5939
|
5935
|
return renderMapping[type]?.(field) || {}
|
5940
|
5936
|
|
5941
|
|
- function getSubmitValue(field) {
|
|
5937
|
+ function getSubmitValue(field) {
|
5942
|
5938
|
const ENABLED_FLAG = 'on'
|
5943
|
5939
|
const additionalKey = HandleDataSource.enumConst
|
5944
|
5940
|
const value = {
|
...
|
...
|
@@ -5950,7 +5946,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5950
|
5946
|
[enumCategory.DATA_SOURCE]: {
|
5951
|
5947
|
[enumDataSourceConst.ORG_ID]: field[enumDataSourceConst.ORG_ID],
|
5952
|
5948
|
[enumDataSourceConst.DEVICE_ID]: field[enumDataSourceConst.DEVICE_ID],
|
5953
|
|
- [enumDataSourceConst.SLAVE_DEVICE_ID]: field[enumDataSourceConst.SLAVE_DEVICE_ID] ? field[enumDataSourceConst.SLAVE_DEVICE_ID] : '',
|
|
5949
|
+ [enumDataSourceConst.DEVICE_TYPE]: field[enumDataSourceConst.DEVICE_TYPE],
|
|
5950
|
+ [enumDataSourceConst.DEVICE_PROFILE_ID]: field[enumDataSourceConst.DEVICE_PROFILE_ID],
|
5954
|
5951
|
[enumDataSourceConst.ATTR]: field[enumDataSourceConst.ATTR],
|
5955
|
5952
|
[enumDataSourceConst.ADDITIONAL]: field[additionalKey.DATA_TYPE] ? {
|
5956
|
5953
|
[additionalKey.AGG]: field[additionalKey.AGG],
|
...
|
...
|
@@ -5994,7 +5991,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
5994
|
5991
|
[enumCategory.DATA_SOURCE]: {
|
5995
|
5992
|
[enumDataSourceConst.ORG_ID]: field[enumDataSourceConst.ORG_ID],
|
5996
|
5993
|
[enumDataSourceConst.DEVICE_ID]: field[enumDataSourceConst.DEVICE_ID],
|
5997
|
|
- [enumDataSourceConst.SLAVE_DEVICE_ID]: field[enumDataSourceConst.SLAVE_DEVICE_ID] ? field[enumDataSourceConst.SLAVE_DEVICE_ID] : '',
|
|
5994
|
+ [enumDataSourceConst.DEVICE_TYPE]: field[enumDataSourceConst.DEVICE_TYPE],
|
|
5995
|
+ [enumDataSourceConst.DEVICE_PROFILE_ID]: field[enumDataSourceConst.DEVICE_PROFILE_ID],
|
5998
|
5996
|
[enumDataSourceConst.ATTR]: field[enumDataSourceConst.ATTR],
|
5999
|
5997
|
[enumDataSourceConst.ADDITIONAL]: {
|
6000
|
5998
|
[additionalKey.ORG_NAME]: field[additionalKey.ORG_NAME],
|
...
|
...
|
@@ -7765,27 +7763,27 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
7765
|
7763
|
|
7766
|
7764
|
const enumDataSourceConst = {
|
7767
|
7765
|
ORG_ID: 'orgId',
|
|
7766
|
+ DEVICE_TYPE: 'deviceType',
|
|
7767
|
+ DEVICE_PROFILE_ID: 'deviceProfileId',
|
7768
|
7768
|
DEVICE_ID: 'deviceId',
|
7769
|
|
- SLAVE_DEVICE_ID: 'slaveDeviceId',
|
7770
|
7769
|
ATTR: 'attr',
|
7771
|
7770
|
GATEWAY: 'GATEWAY',
|
7772
|
7771
|
ORG_NAME: 'orgName',
|
7773
|
7772
|
DEVICE_NAME: 'deviceName',
|
7774
|
|
- SLAVE_DEVICE_NAME: 'slaveDeviceName',
|
7775
|
7773
|
ATTR_NAME: 'attrName'
|
7776
|
7774
|
}
|
7777
|
7775
|
|
7778
|
7776
|
/**
|
7779
|
7777
|
* @description
|
7780
|
|
- * @type {{id: string, deviceType: string, name: string}[]}
|
|
7778
|
+ * @type {{id: string, deviceType: string, name: string, deviceProfileId: string}[]}
|
7781
|
7779
|
*/
|
7782
|
7780
|
let deviceList = []
|
7783
|
7781
|
|
7784
|
7782
|
/**
|
7785
|
|
- * @description
|
7786
|
|
- * @type {{id: string, deviceType: string, name: string}[]}
|
7787
|
|
- */
|
7788
|
|
- let slaveDeviceList = []
|
|
7783
|
+ * @descrition
|
|
7784
|
+ * @type {{deviceProfileId: string, id: string, organizationId: string, deviceType: string}}
|
|
7785
|
+ */
|
|
7786
|
+ let currentDataSource = {}
|
7789
|
7787
|
|
7790
|
7788
|
const component = document.createElement('div')
|
7791
|
7789
|
|
...
|
...
|
@@ -7799,13 +7797,66 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
7799
|
7797
|
init()
|
7800
|
7798
|
|
7801
|
7799
|
function init() {
|
7802
|
|
- generatorOrgTres()
|
|
7800
|
+ generateDeviceTypeSelect()
|
|
7801
|
+ generateProductSelect()
|
|
7802
|
+ generatorOrgTrees()
|
7803
|
7803
|
generatorDeviceSelect()
|
7804
|
|
- generatorSlaveDevice()
|
7805
|
7804
|
generatorAttrSelect()
|
7806
|
7805
|
generateDeviceNameInput()
|
7807
|
7806
|
}
|
7808
|
7807
|
|
|
7808
|
+ function generateDeviceTypeSelect() {
|
|
7809
|
+ getDeviceType()
|
|
7810
|
+
|
|
7811
|
+ const deviceType = UseLayUi.createSelect({
|
|
7812
|
+ label: '设备类型',
|
|
7813
|
+ bindValueFiled: enumDataSourceConst.DEVICE_TYPE,
|
|
7814
|
+ layFilter: `${componentFilter}--${enumDataSourceConst.DEVICE_TYPE}`,
|
|
7815
|
+ className: 'data-source__component-select',
|
|
7816
|
+ ...validateRule,
|
|
7817
|
+ onClick(data) {
|
|
7818
|
+ const { value } = data
|
|
7819
|
+ form.val(componentFilter, {
|
|
7820
|
+ [enumDataSourceConst.DEVICE_PROFILE_ID]: null,
|
|
7821
|
+ [enumDataSourceConst.DEVICE_ID]: null,
|
|
7822
|
+ [enumDataSourceConst.DEVICE_NAME]: null,
|
|
7823
|
+ [enumDataSourceConst.DEVICE_ID]: null,
|
|
7824
|
+ [enumDataSourceConst.ATTR]: null,
|
|
7825
|
+ [enumDataSourceConst.ATTR_NAME]: null,
|
|
7826
|
+ [enumDataSourceConst.ORG_ID]: null
|
|
7827
|
+ })
|
|
7828
|
+
|
|
7829
|
+ currentDataSource[enumDataSourceConst.DEVICE_TYPE] = value
|
|
7830
|
+ getMeetConditionsDevice(currentDataSource)
|
|
7831
|
+ getProduct(value)
|
|
7832
|
+ },
|
|
7833
|
+ })
|
|
7834
|
+ $(component).append(deviceType)
|
|
7835
|
+ }
|
|
7836
|
+
|
|
7837
|
+ function generateProductSelect() {
|
|
7838
|
+ const productSelect = UseLayUi.createSelect({
|
|
7839
|
+ label: '产品',
|
|
7840
|
+ bindValueFiled: enumDataSourceConst.DEVICE_PROFILE_ID,
|
|
7841
|
+ layFilter: `${componentFilter}--${enumDataSourceConst.DEVICE_PROFILE_ID}`,
|
|
7842
|
+ className: 'data-source__component-select',
|
|
7843
|
+ ...validateRule,
|
|
7844
|
+ onClick(data) {
|
|
7845
|
+ const { value } = data
|
|
7846
|
+ form.val(componentFilter, {
|
|
7847
|
+ [enumDataSourceConst.DEVICE_NAME]: null,
|
|
7848
|
+ [enumDataSourceConst.DEVICE_ID]: null,
|
|
7849
|
+ [enumDataSourceConst.ATTR]: null,
|
|
7850
|
+ [enumDataSourceConst.ATTR_NAME]: null,
|
|
7851
|
+ })
|
|
7852
|
+ currentDataSource[enumDataSourceConst.DEVICE_PROFILE_ID] = value
|
|
7853
|
+ getMeetConditionsDevice(currentDataSource)
|
|
7854
|
+ getAttrByDeviceId(value)
|
|
7855
|
+ },
|
|
7856
|
+ })
|
|
7857
|
+ $(component).append(productSelect)
|
|
7858
|
+ }
|
|
7859
|
+
|
7809
|
7860
|
async function generateDeviceNameInput() {
|
7810
|
7861
|
const template = `
|
7811
|
7862
|
<div class="layui-form-item" style="margin-bottom: 0">
|
...
|
...
|
@@ -7815,45 +7866,42 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
7815
|
7866
|
<input style="display: none" type="text" name="${enumDataSourceConst.DEVICE_NAME}" class="layui-input">
|
7816
|
7867
|
</div>
|
7817
|
7868
|
<div class="layui-form-item" style="margin-bottom: 0">
|
7818
|
|
- <input style="display: none" type="text" name="${enumDataSourceConst.SLAVE_DEVICE_NAME}" class="layui-input">
|
7819
|
|
- </div>
|
7820
|
|
- <div class="layui-form-item" style="margin-bottom: 0">
|
7821
|
7869
|
<input style="display: none" type="text" name="${enumDataSourceConst.ATTR_NAME}" class="layui-input">
|
7822
|
7870
|
</div>
|
7823
|
7871
|
`
|
7824
|
7872
|
$(component).append(template)
|
7825
|
7873
|
}
|
7826
|
7874
|
|
|
7875
|
+ async function getDeviceType() {
|
|
7876
|
+ const items = await ConfigurationNodeApi.getDictionaryValue('device_type')
|
|
7877
|
+ $(`#${componentId} `).find(`select[name="${enumDataSourceConst.DEVICE_TYPE}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: items, labelField: 'itemText', valueField: 'itemValue' }))
|
|
7878
|
+ form.render('select', componentFilter)
|
|
7879
|
+ }
|
7827
|
7880
|
|
7828
|
|
- /**
|
7829
|
|
- * @description 根据组织ID获取设备
|
7830
|
|
- */
|
7831
|
|
- async function getDevicesByOrgId(organizationId) {
|
7832
|
|
- if (organizationId) {
|
7833
|
|
- const items = deviceList = await ConfigurationNodeApi.getMasterDevice(organizationId);
|
7834
|
|
- $(`#${componentId} `).find(`select[name="${enumDataSourceConst.DEVICE_ID}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: items }))
|
7835
|
|
- form.render('select', componentFilter)
|
7836
|
|
- }
|
|
7881
|
+ async function getProduct(deviceType) {
|
|
7882
|
+ const items = productList = await ConfigurationNodeApi.getProduct(deviceType)
|
|
7883
|
+ $(`#${componentId} `).find(`select[name="${enumDataSourceConst.DEVICE_PROFILE_ID}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: items, labelField: 'name', valueField: 'id', alias: 'alias' }))
|
|
7884
|
+ form.render('select', componentFilter)
|
7837
|
7885
|
}
|
7838
|
7886
|
|
7839
|
7887
|
/**
|
7840
|
|
- * @description 通过主设备ID获取从设备
|
|
7888
|
+ * @description 根据组织ID获取设备
|
7841
|
7889
|
*/
|
7842
|
|
- async function getSlaveDeviceByMasterDeviceId(orgId, deviceId) {
|
7843
|
|
- if (deviceId && currentCheckedOrgNode) {
|
7844
|
|
- const items = slaveDeviceList = await ConfigurationNodeApi.getSlaveDevice(orgId, deviceId);
|
7845
|
|
- $(`#${componentId} `).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: items }))
|
7846
|
|
- form.render('select', componentFilter)
|
7847
|
|
- }
|
|
7890
|
+ async function getMeetConditionsDevice(params) {
|
|
7891
|
+ if (!params.organizationId) return
|
|
7892
|
+ const items = await ConfigurationNodeApi.getMeetConditionsDevice(params);
|
|
7893
|
+ $(`#${componentId} `).find(`select[name="${enumDataSourceConst.DEVICE_ID}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: items, valueField: 'tbDeviceId', labelField: 'name', alias: 'alias' }))
|
|
7894
|
+ form.render('select', componentFilter)
|
7848
|
7895
|
}
|
7849
|
7896
|
|
|
7897
|
+
|
7850
|
7898
|
/**
|
7851
|
7899
|
* @description 根据设备ID获取属性
|
7852
|
7900
|
*/
|
7853
|
|
- async function getAttrByDeviceId(tbDeviceId) {
|
7854
|
|
- if (tbDeviceId) {
|
7855
|
|
- const [err, res] = await to(ConfigurationNodeApi.getDeviceAttr(tbDeviceId))
|
7856
|
|
- $(`#${componentId} `).find(`select[name="${enumDataSourceConst.ATTR}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: res }))
|
|
7901
|
+ async function getAttrByDeviceId(deviceProfileId) {
|
|
7902
|
+ if (deviceProfileId) {
|
|
7903
|
+ const [err, res] = await to(ConfigurationNodeApi.getDeviceAttribute(deviceProfileId))
|
|
7904
|
+ $(`#${componentId} `).find(`select[name="${enumDataSourceConst.ATTR}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: Array.isArray(res) ? res : [], labelField: 'name', valueField: 'identifier' }))
|
7857
|
7905
|
form.render('select', componentFilter)
|
7858
|
7906
|
}
|
7859
|
7907
|
}
|
...
|
...
|
@@ -7862,7 +7910,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
7862
|
7910
|
/**
|
7863
|
7911
|
* @description 生成组织选择
|
7864
|
7912
|
*/
|
7865
|
|
- async function generatorOrgTres() {
|
|
7913
|
+ async function generatorOrgTrees() {
|
7866
|
7914
|
const orgContainerId = `data-source__component--org-${Date.now()}`
|
7867
|
7915
|
const orgContainer = `<div id="${orgContainerId}"></div>`
|
7868
|
7916
|
$(component).append(orgContainer)
|
...
|
...
|
@@ -7881,18 +7929,15 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
7881
|
7929
|
treeProps: {
|
7882
|
7930
|
data: treeList,
|
7883
|
7931
|
onlyIconControl: true,
|
7884
|
|
- click(node) {
|
7885
|
|
- currentCheckedOrgNode = node.data.id
|
|
7932
|
+
|
|
7933
|
+ click(node) {
|
7886
|
7934
|
form.val(componentFilter, {
|
7887
|
|
- [enumDataSourceConst.ORG_NAME]: node.data.title,
|
|
7935
|
+ [enumDataSourceConst.ORG_NAME]: node?.data?.title,
|
7888
|
7936
|
[enumDataSourceConst.DEVICE_ID]: null,
|
7889
|
|
- [enumDataSourceConst.SLAVE_DEVICE_ID]: null,
|
7890
|
|
- [enumDataSourceConst.ATTR]: null,
|
7891
|
7937
|
[enumDataSourceConst.DEVICE_NAME]: null,
|
7892
|
|
- [enumDataSourceConst.SLAVE_DEVICE_NAME]: null,
|
7893
|
|
- [enumDataSourceConst.ATTR_NAME]: null,
|
7894
|
7938
|
})
|
7895
|
|
- getDevicesByOrgId(node.data.id)
|
|
7939
|
+ currentDataSource.organizationId = node?.data?.id
|
|
7940
|
+ getMeetConditionsDevice(currentDataSource)
|
7896
|
7941
|
},
|
7897
|
7942
|
},
|
7898
|
7943
|
})
|
...
|
...
|
@@ -7911,52 +7956,18 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
7911
|
7956
|
onClick(data) {
|
7912
|
7957
|
const { value } = data
|
7913
|
7958
|
const selected = deviceList.find(item => item.id === value)
|
|
7959
|
+ if (!selected) return
|
7914
|
7960
|
form.val(componentFilter, {
|
7915
|
|
- [enumDataSourceConst.DEVICE_NAME]: selected.name,
|
7916
|
|
- [enumDataSourceConst.SLAVE_DEVICE_ID]: null,
|
|
7961
|
+ [enumDataSourceConst.DEVICE_NAME]: selected?.name,
|
7917
|
7962
|
[enumDataSourceConst.ATTR]: null,
|
7918
|
|
- [enumDataSourceConst.SLAVE_DEVICE_NAME]: null,
|
7919
|
7963
|
[enumDataSourceConst.ATTR_NAME]: null,
|
7920
|
7964
|
})
|
7921
|
|
- if (!selected) return
|
7922
|
|
- if (selected.deviceType === enumDataSourceConst.GATEWAY) {
|
7923
|
|
- $(`#${componentId}`).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`)
|
7924
|
|
- .attr('lay-verify', 'required').attr('lay-verType', 'tips')
|
7925
|
|
- .parentsUntil(`#${componentId}`).show()
|
7926
|
|
- getSlaveDeviceByMasterDeviceId(currentCheckedOrgNode, selected.id)
|
7927
|
|
- } else {
|
7928
|
|
- $(`#${componentId}`).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`)
|
7929
|
|
- .attr('lay-verify', '').attr('lay-verType', 'tips')
|
7930
|
|
- .parentsUntil(`#${componentId}`).hide()
|
7931
|
|
- getAttrByDeviceId(selected.id)
|
7932
|
|
- }
|
7933
|
7965
|
},
|
7934
|
7966
|
})
|
7935
|
7967
|
$(component).append(deviceSelect)
|
7936
|
7968
|
}
|
7937
|
7969
|
|
7938
|
|
- /**
|
7939
|
|
- * @description 生成从设备选择器
|
7940
|
|
- */
|
7941
|
|
- function generatorSlaveDevice() {
|
7942
|
|
- const slaveDeviceSelect = UseLayUi.createSelect({
|
7943
|
|
- label: '子设备',
|
7944
|
|
- bindValueFiled: enumDataSourceConst.SLAVE_DEVICE_ID,
|
7945
|
|
- layFilter: `${componentFilter}--${enumDataSourceConst.SLAVE_DEVICE_ID}`,
|
7946
|
|
- className: 'data-source__component-select',
|
7947
|
|
- onClick(data) {
|
7948
|
|
- const { value } = data
|
7949
|
|
- const selected = slaveDeviceList.find(item => item.id === value)
|
7950
|
|
- form.val(componentFilter, {
|
7951
|
|
- [enumDataSourceConst.SLAVE_DEVICE_NAME]: selected.name,
|
7952
|
|
- [enumDataSourceConst.ATTR]: null,
|
7953
|
|
- [enumDataSourceConst.ATTR_NAME]: null,
|
7954
|
|
- })
|
7955
|
|
- getAttrByDeviceId(value)
|
7956
|
|
- },
|
7957
|
|
- })
|
7958
|
|
- $(component).append(slaveDeviceSelect)
|
7959
|
|
- }
|
|
7970
|
+
|
7960
|
7971
|
|
7961
|
7972
|
/**
|
7962
|
7973
|
* @description 生成属性选择器
|
...
|
...
|
@@ -7983,36 +7994,32 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
7983
|
7994
|
* @param {{orgId: string, deviceId: string, slaveDeviceId?: string, attr: string}} dataSource
|
7984
|
7995
|
*/
|
7985
|
7996
|
function echoDataSource(dataSource = {}) {
|
7986
|
|
- const { orgId, deviceId, slaveDeviceId, attr } = dataSource
|
|
7997
|
+ const { orgId, deviceId, deviceProfileId, deviceType, attr } = dataSource
|
7987
|
7998
|
const queue = []
|
7988
|
|
- if (orgId) {
|
7989
|
|
- currentCheckedOrgNode = orgId
|
7990
|
|
- queue.push(getDevicesByOrgId(orgId))
|
7991
|
|
- }
|
7992
|
|
- if (slaveDeviceId) {
|
7993
|
|
- queue.push(getSlaveDeviceByMasterDeviceId(orgId, deviceId))
|
7994
|
|
- $(`#${componentId}`).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`).parentsUntil(`#${componentId}`).show()
|
7995
|
|
- queue.push(getAttrByDeviceId(slaveDeviceId))
|
7996
|
|
- } else {
|
7997
|
|
- $(`#${componentId}`).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`).parentsUntil(`#${componentId}`).hide()
|
7998
|
|
- queue.push(getAttrByDeviceId(deviceId))
|
7999
|
|
- }
|
|
7999
|
+ currentDataSource = { organizationId: orgId, deviceProfileId, deviceType }
|
|
8000
|
+ queue.push(getProduct(deviceType))
|
|
8001
|
+ queue.push(getMeetConditionsDevice({ organizationId: orgId, deviceProfileId, deviceType }))
|
|
8002
|
+ queue.push(getAttrByDeviceId(deviceProfileId))
|
8000
|
8003
|
Promise.all(queue)
|
8001
|
8004
|
.finally(() => {
|
8002
|
|
- const orgNode = UseLayUi.findTreeObjectByField(treeList, currentCheckedOrgNode)
|
8003
|
|
- $(`#${componentId} input[name="${enumDataSourceConst.ORG_ID}"]`).parent().find('span').html(orgNode?.name)
|
|
8005
|
+ const orgNode = UseLayUi.findTreeObjectByField(treeList, orgId)
|
|
8006
|
+
|
|
8007
|
+ $(`#${componentId} input[name="${enumDataSourceConst.ORG_ID}"]`).val(orgNode?.id).parent().find('span').html(orgNode?.name)
|
|
8008
|
+
|
8004
|
8009
|
form.val(componentFilter, {
|
8005
|
8010
|
orgId,
|
8006
|
8011
|
deviceId,
|
8007
|
|
- slaveDeviceId,
|
|
8012
|
+ deviceProfileId,
|
|
8013
|
+ deviceType,
|
8008
|
8014
|
attr,
|
8009
|
8015
|
})
|
|
8016
|
+
|
8010
|
8017
|
})
|
8011
|
8018
|
}
|
8012
|
8019
|
|
8013
|
8020
|
/**
|
8014
|
8021
|
*
|
8015
|
|
- * @returns {{orgId: string, attr: string, deviceId: string, slaveDeviceId: string}}
|
|
8022
|
+ * @returns {{orgId: string, attr: string, deviceId: string, devi}}
|
8016
|
8023
|
*/
|
8017
|
8024
|
function getValue() {
|
8018
|
8025
|
return form.val(componentFilter)
|
...
|
...
|
@@ -8444,13 +8451,14 @@ DataFormatPanel.prototype.addDataFont = function (container) { |
8444
|
8451
|
function proxyFn(fn) {
|
8445
|
8452
|
return (...args) => {
|
8446
|
8453
|
const currentDataSource = getDataSourceBindValue() || {}
|
8447
|
|
-
|
8448
|
|
- to(ConfigurationNodeApi.updateNodeInfo({
|
8449
|
|
- configurationId,
|
8450
|
|
- contentId: currentPageId.id,
|
8451
|
|
- nodeId: graphId,
|
8452
|
|
- [enumCategory.DATA_SOURCE]: currentDataSource
|
8453
|
|
- }))
|
|
8454
|
+ if (currentDataSource.deviceProfileId && currentDataSource.deviceType && currentDataSource.orgId) {
|
|
8455
|
+ to(ConfigurationNodeApi.updateNodeInfo({
|
|
8456
|
+ configurationId,
|
|
8457
|
+ contentId: currentPageId.id,
|
|
8458
|
+ nodeId: graphId,
|
|
8459
|
+ [enumCategory.DATA_SOURCE]: currentDataSource
|
|
8460
|
+ }))
|
|
8461
|
+ }
|
8454
|
8462
|
fn.apply(null, args)
|
8455
|
8463
|
}
|
8456
|
8464
|
}
|
...
|
...
|
@@ -12302,14 +12310,15 @@ class UseLayUi { |
12302
|
12310
|
* @param {boolean} [addPlaceholderOption = true] options.addPlaceholderOption
|
12303
|
12311
|
* @param {string} [labelField = 'name'] options.labelField
|
12304
|
12312
|
* @param {string} [valueField = 'name'] options.valueField
|
|
12313
|
+ * @param {string} [alias] options.alias
|
12305
|
12314
|
* @returns {*}
|
12306
|
12315
|
*/
|
12307
|
12316
|
static generateOptionTemplate(options) {
|
12308
|
|
- const { dataSource = [], addPlaceholderOption = true, labelField = 'name', valueField = 'id' } = options
|
|
12317
|
+ const { dataSource = [], addPlaceholderOption = true, labelField = 'name', valueField = 'id', alias } = options
|
12309
|
12318
|
let { renderFn } = options
|
12310
|
12319
|
renderFn = renderFn || ((record) => {
|
12311
|
12320
|
if (typeof record === 'object') {
|
12312
|
|
- return `<option value="${record[valueField]}" ${record.disabled ? 'disabled=""' : ''}>${record[labelField]}</option>`
|
|
12321
|
+ return `<option value="${record[valueField]}" ${record.disabled ? 'disabled=""' : ''}>${alias && record[alias] ? record[alias] : record[labelField]}</option>`
|
12313
|
12322
|
} else {
|
12314
|
12323
|
return `<option value="${record}">${record}</option>`
|
12315
|
12324
|
}
|
...
|
...
|
@@ -12455,6 +12464,7 @@ class UseLayUi { |
12455
|
12464
|
* @param {boolean} [options.autoFormatDataSource = true] options.autoFormatDataSource
|
12456
|
12465
|
* @param {string} [options.layVerify] options.layVerify
|
12457
|
12466
|
* @param {string} [options.layVerType] options.layVerType
|
|
12467
|
+ * @param {boolean} [options.addPlaceholderOption] options.addPlaceholderOption
|
12458
|
12468
|
* @param {Function} [options.treeProps.onReady] options.treeProps.onReady
|
12459
|
12469
|
*/
|
12460
|
12470
|
static createTreeSelect(options) {
|
...
|
...
|
@@ -12476,6 +12486,7 @@ class UseLayUi { |
12476
|
12486
|
childrenField = 'children',
|
12477
|
12487
|
layVerify,
|
12478
|
12488
|
layVerType,
|
|
12489
|
+ addPlaceholderOption
|
12479
|
12490
|
} = options
|
12480
|
12491
|
|
12481
|
12492
|
let { data = [], click, onReady } = treeProps
|
...
|
...
|
@@ -12517,12 +12528,12 @@ class UseLayUi { |
12517
|
12528
|
function mount() {
|
12518
|
12529
|
// mount select container
|
12519
|
12530
|
$(elem).html(template)
|
12520
|
|
-
|
12521
|
|
- // mount tree
|
12522
|
|
- // UseLayUi.nextTick(() => {
|
|
12531
|
+ const treeData = UseLayUi.formatTreeDataSource(data, customSetTree, valueField, labelField, childrenField)
|
|
12532
|
+ if (addPlaceholderOption) treeData.unshift({ title: '请选择', id: undefined })
|
|
12533
|
+ // mount tree
|
12523
|
12534
|
tree.render({
|
12524
|
12535
|
...treeProps,
|
12525
|
|
- ...(autoFormatDataSource ? { data: UseLayUi.formatTreeDataSource(data, customSetTree, valueField, labelField, childrenField) } : {}),
|
|
12536
|
+ ...(autoFormatDataSource ? { data: treeData } : {}),
|
12526
|
12537
|
elem: $(elem).find('.tree-select__tree-mount'),
|
12527
|
12538
|
click(node) {
|
12528
|
12539
|
setValue(node.data)
|
...
|
...
|
@@ -12544,22 +12555,10 @@ class UseLayUi { |
12544
|
12555
|
layui.stope(e);
|
12545
|
12556
|
})
|
12546
|
12557
|
|
12547
|
|
- // blur
|
12548
|
|
- // $(document)
|
12549
|
|
- // .on("click", function (e) {
|
12550
|
|
- // const target = e.target
|
12551
|
|
- // const parentNode = $(`.${CLASS_NAME} .tree-select__tree-mount`)
|
12552
|
|
- // if (!parentNode) return
|
12553
|
|
- // console.log($.contains(parentNode, target))
|
12554
|
|
- // // const showClose = UseLayUi.isInNode(parentNode, target, true)
|
12555
|
|
- // // if (showClose) return
|
12556
|
|
- // // $(`.${ SELECT_CLS }`).removeClass("layui-form-selected")
|
12557
|
|
- // });
|
12558
|
|
-
|
12559
|
12558
|
if (UseLayUi.isFunction(onReady)) {
|
12560
|
12559
|
onReady(setValue)
|
12561
|
12560
|
}
|
12562
|
|
- // })
|
|
12561
|
+
|
12563
|
12562
|
form.render()
|
12564
|
12563
|
}
|
12565
|
12564
|
|
...
|
...
|
@@ -13033,18 +13032,56 @@ function previewAction(editorUi, currentPage) { |
13033
|
13032
|
class DispatchCenter {
|
13034
|
13033
|
|
13035
|
13034
|
/**
|
13036
|
|
- * @description 节点映射
|
13037
|
|
- * @type {Map<string, Map<string, object>>}
|
13038
|
|
- */
|
13039
|
|
- nodeMapping
|
13040
|
|
-
|
13041
|
|
- /**
|
13042
|
13035
|
* @description cmd ID 与 node 映射关系
|
13043
|
13036
|
* @type {Map<number, string>}
|
13044
|
13037
|
*/
|
13045
|
13038
|
cmdIdMapping = new Map()
|
13046
|
13039
|
|
13047
|
13040
|
/**
|
|
13041
|
+ * @type { Map<string, {
|
|
13042
|
+ * deviceId: string,
|
|
13043
|
+ * dataOrigin: 'dataSources' | 'act',
|
|
13044
|
+ * slaveDeviceId: string,
|
|
13045
|
+ * nodeId: string,
|
|
13046
|
+ * attr: string
|
|
13047
|
+ * condition?: { max?: number, min?: number },
|
|
13048
|
+ * additional?: {
|
|
13049
|
+ * agg?: string,
|
|
13050
|
+ * attrName?: string,
|
|
13051
|
+ * dataType?: 'tsSubCmds' | 'historyCmds',
|
|
13052
|
+ * deviceName?: string,
|
|
13053
|
+ * effectScope?: string,
|
|
13054
|
+ * interval?: string,
|
|
13055
|
+ * orgName?: string,
|
|
13056
|
+ * slaveDeviceName?: string
|
|
13057
|
+ * }
|
|
13058
|
+ * }[]>}
|
|
13059
|
+ */
|
|
13060
|
+ deviceIdMapping = new Map()
|
|
13061
|
+
|
|
13062
|
+ /**
|
|
13063
|
+ * @type {Map<number, {
|
|
13064
|
+ * deviceId: string,
|
|
13065
|
+ * slaveDeviceId: string,
|
|
13066
|
+ * nodeId: string,
|
|
13067
|
+ * attr: string
|
|
13068
|
+ * dataOrigin: 'dataSources' | 'act',
|
|
13069
|
+ * condition?: { max?: number, min?: number },
|
|
13070
|
+ * additional?: {
|
|
13071
|
+ * agg?: string,
|
|
13072
|
+ * attrName?: string,
|
|
13073
|
+ * dataType?: 'tsSubCmds' | 'historyCmds',
|
|
13074
|
+ * deviceName?: string,
|
|
13075
|
+ * effectScope?: string,
|
|
13076
|
+ * interval?: string,
|
|
13077
|
+ * orgName?: string,
|
|
13078
|
+ * slaveDeviceName?: string
|
|
13079
|
+ * }
|
|
13080
|
+ * }[]>}
|
|
13081
|
+ */
|
|
13082
|
+ subscribeIdMapping = new Map()
|
|
13083
|
+
|
|
13084
|
+ /**
|
13048
|
13085
|
* @description
|
13049
|
13086
|
*/
|
13050
|
13087
|
editorUi
|
...
|
...
|
@@ -13150,7 +13187,6 @@ class DispatchCenter { |
13150
|
13187
|
|
13151
|
13188
|
|
13152
|
13189
|
constructor(editorUi, currentPage) {
|
13153
|
|
- this.nodeMapping = new Map()
|
13154
|
13190
|
this.editorUi = editorUi
|
13155
|
13191
|
this.init(editorUi, currentPage)
|
13156
|
13192
|
}
|
...
|
...
|
@@ -13169,6 +13205,7 @@ class DispatchCenter { |
13169
|
13205
|
this.dataInteractionInstance = new HandleDataInteraction(this)
|
13170
|
13206
|
this.dynamicEffectInstance = new HandleDynamicEffect(this)
|
13171
|
13207
|
this.updateQueueInstance = new UpdateQueue(this)
|
|
13208
|
+ this.sendSubscribeMessage()
|
13172
|
13209
|
}
|
13173
|
13210
|
|
13174
|
13211
|
/**
|
...
|
...
|
@@ -13176,7 +13213,7 @@ class DispatchCenter { |
13176
|
13213
|
*/
|
13177
|
13214
|
connectSocket() {
|
13178
|
13215
|
Ws.instance?.destroy?.()
|
13179
|
|
- this.socket = Ws.getInstance({ url: GLOBAL_WS_URL(), onmessageCallback: this.socketOnmessage })
|
|
13216
|
+ this.socket = Ws.getInstance({ url: GLOBAL_WS_URL(), onmessageCallback: this.socketOnMessage.bind(this) })
|
13180
|
13217
|
}
|
13181
|
13218
|
|
13182
|
13219
|
/**
|
...
|
...
|
@@ -13185,9 +13222,35 @@ class DispatchCenter { |
13185
|
13222
|
* @param event
|
13186
|
13223
|
* @param ws
|
13187
|
13224
|
*/
|
13188
|
|
- socketOnmessage(message, event, ws) {
|
13189
|
|
- const { subscriptionId, data } = message
|
13190
|
|
- DispatchCenter.instance.publishEvent(subscriptionId, data, message, event, ws)
|
|
13225
|
+ socketOnMessage(message, event, ws) {
|
|
13226
|
+ const { subscriptionId, errorMsg } = message
|
|
13227
|
+ if (errorMsg) return
|
|
13228
|
+ const subList = this.subscribeIdMapping.get(subscriptionId)
|
|
13229
|
+ subList.forEach(item => {
|
|
13230
|
+ const { dataOrigin, additional } = item
|
|
13231
|
+ if (dataOrigin === 'dataSources') {
|
|
13232
|
+ if (additional) {
|
|
13233
|
+ const { dataType } = additional || {}
|
|
13234
|
+ if (dataType === HandleDataSource.enumDataBindType.REAL) {
|
|
13235
|
+ this.dataSourceHandlerInstance.updateRealTimeDataSource(message, item)
|
|
13236
|
+ } else if (dataType === HandleDataSource.enumDataBindType.HISTORY) {
|
|
13237
|
+ this.dataSourceHandlerInstance.updateHistoryDataSource(message, item)
|
|
13238
|
+ }
|
|
13239
|
+ }
|
|
13240
|
+ else
|
|
13241
|
+ this.dataSourceHandlerInstance.updateCommonDataSource(message, item)
|
|
13242
|
+ }
|
|
13243
|
+ if (dataOrigin === 'act') {
|
|
13244
|
+ const { type } = item
|
|
13245
|
+ // this.dynamicEffectInstance.videoPlay()
|
|
13246
|
+ const handleFunction = this.dynamicEffectInstance.dispatch.call(this.dynamicEffectInstance, type)
|
|
13247
|
+ handleFunction(message, item)
|
|
13248
|
+ }
|
|
13249
|
+ })
|
|
13250
|
+ // this.subscribeEvent(cmdId, this.updateCommonDataSource.bind(this))
|
|
13251
|
+ return
|
|
13252
|
+ // const { subscriptionId, data } = message
|
|
13253
|
+ // DispatchCenter.instance.publishEvent(subscriptionId, data, message, event, ws)
|
13191
|
13254
|
}
|
13192
|
13255
|
|
13193
|
13256
|
/**
|
...
|
...
|
@@ -13220,6 +13283,177 @@ class DispatchCenter { |
13220
|
13283
|
this.contentData = res
|
13221
|
13284
|
}
|
13222
|
13285
|
|
|
13286
|
+ sendSubscribeMessage() {
|
|
13287
|
+ const message = this.generateSubscribeMessage()
|
|
13288
|
+ this.socket.send(JSON.stringify(message))
|
|
13289
|
+ }
|
|
13290
|
+
|
|
13291
|
+ /**
|
|
13292
|
+ * @description 创建订阅消息
|
|
13293
|
+ */
|
|
13294
|
+ generateSubscribeMessage() {
|
|
13295
|
+
|
|
13296
|
+ /**
|
|
13297
|
+ * @type {{dataSources: [], act: [], event: [], enabled: boolean}}
|
|
13298
|
+ */
|
|
13299
|
+ const data = JSON.parse(JSON.stringify(this.contentData))
|
|
13300
|
+ delete data.enabled
|
|
13301
|
+
|
|
13302
|
+ /**
|
|
13303
|
+ *
|
|
13304
|
+ * @param {'dataSources' | 'act'} key
|
|
13305
|
+ * @param {{
|
|
13306
|
+ * id: string,
|
|
13307
|
+ * enabled: boolean,
|
|
13308
|
+ * deviceId: string,
|
|
13309
|
+ * slaveDeviceId: string,
|
|
13310
|
+ * nodeId: string,
|
|
13311
|
+ * attr: string
|
|
13312
|
+ * condition?: { max?: number, min?: number },
|
|
13313
|
+ * additional?: {
|
|
13314
|
+ * agg?: string,
|
|
13315
|
+ * attrName?: string,
|
|
13316
|
+ * dataType?: 'tsSubCmds' | 'historyCmds',
|
|
13317
|
+ * deviceName?: string,
|
|
13318
|
+ * effectScope?: string,
|
|
13319
|
+ * interval?: string,
|
|
13320
|
+ * orgName?: string,
|
|
13321
|
+ * slaveDeviceName?: string
|
|
13322
|
+ * }
|
|
13323
|
+ * }} record
|
|
13324
|
+ */
|
|
13325
|
+ const setDeviceMapping = (record) => {
|
|
13326
|
+ const { deviceId, slaveDeviceId } = record
|
|
13327
|
+ if (this.deviceIdMapping.has(slaveDeviceId || deviceId)) {
|
|
13328
|
+ const group = this.deviceIdMapping.get(slaveDeviceId || deviceId)
|
|
13329
|
+ group.push(record)
|
|
13330
|
+ } else {
|
|
13331
|
+ this.deviceIdMapping.set(slaveDeviceId || deviceId, [record])
|
|
13332
|
+ }
|
|
13333
|
+ }
|
|
13334
|
+
|
|
13335
|
+ Object.keys(data).forEach(key => {
|
|
13336
|
+ /**
|
|
13337
|
+ * @type {{
|
|
13338
|
+ * id: string,
|
|
13339
|
+ * nodeId: string,
|
|
13340
|
+ * deviceId: string,
|
|
13341
|
+ * slaveDeviceId: string,
|
|
13342
|
+ * attr: string,
|
|
13343
|
+ * enabled: boolean,
|
|
13344
|
+ * additional: object,
|
|
13345
|
+ * condition: object
|
|
13346
|
+ * }[]}
|
|
13347
|
+ */
|
|
13348
|
+ const list = data[key]
|
|
13349
|
+ if (key === 'dataSources') {
|
|
13350
|
+ for (const item of list) {
|
|
13351
|
+ setDeviceMapping({ dataOrigin: key, ...item })
|
|
13352
|
+ }
|
|
13353
|
+ }
|
|
13354
|
+ if (key === 'act') {
|
|
13355
|
+ for (const item of list) {
|
|
13356
|
+ const { enabled } = item
|
|
13357
|
+ if (!enabled) continue
|
|
13358
|
+ setDeviceMapping({ dataOrigin: key, ...item })
|
|
13359
|
+ }
|
|
13360
|
+ }
|
|
13361
|
+ })
|
|
13362
|
+
|
|
13363
|
+ /**
|
|
13364
|
+ * @param {{
|
|
13365
|
+ * entityId: string,
|
|
13366
|
+ * cmdId: number,
|
|
13367
|
+ * keys: string,
|
|
13368
|
+ * agg?: string,
|
|
13369
|
+ * interval?: number,
|
|
13370
|
+ * startTs?: number,
|
|
13371
|
+ * endTs?: number
|
|
13372
|
+ * }} params
|
|
13373
|
+ * @returns {{ entityType: string, entityId: string, scope: string, cmdId: number, keys: string }}
|
|
13374
|
+ */
|
|
13375
|
+ const generateMessage = (params) => {
|
|
13376
|
+ const getDynamicAttr = (attr) => params[attr] ? { [attr]: params[attr] } : {}
|
|
13377
|
+ return {
|
|
13378
|
+ entityType: 'DEVICE',
|
|
13379
|
+ entityId: params.entityId,
|
|
13380
|
+ cmdId: params.cmdId,
|
|
13381
|
+ keys: params.keys,
|
|
13382
|
+
|
|
13383
|
+ ... (params.interval ? {} : { scope: 'LATEST_TELEMETRY' }),
|
|
13384
|
+ ...getDynamicAttr('agg'),
|
|
13385
|
+ ...getDynamicAttr('interval'),
|
|
13386
|
+ ...getDynamicAttr('startTs'),
|
|
13387
|
+ ...getDynamicAttr('endTs'),
|
|
13388
|
+ }
|
|
13389
|
+ }
|
|
13390
|
+
|
|
13391
|
+ const generateGroupMessage = () => {
|
|
13392
|
+ /**
|
|
13393
|
+ * @type {{
|
|
13394
|
+ * historyCmds: {
|
|
13395
|
+ * entityType: 'DEVICE',
|
|
13396
|
+ * entityId: string,
|
|
13397
|
+ * scope?: 'LATEST_TELEMETRY',
|
|
13398
|
+ * cmdId: number,
|
|
13399
|
+ * keys: string,
|
|
13400
|
+ * startTs?: number
|
|
13401
|
+ * endTs?: number
|
|
13402
|
+ * }[],
|
|
13403
|
+ * tsSubCmds: {
|
|
13404
|
+ * entityType: 'DEVICE',
|
|
13405
|
+ * entityId: string,
|
|
13406
|
+ * scope?: 'LATEST_TELEMETRY',
|
|
13407
|
+ * cmdId: number,
|
|
13408
|
+ * keys: string,
|
|
13409
|
+ * startTs?: number
|
|
13410
|
+ * endTs?: number
|
|
13411
|
+ * }[]}}
|
|
13412
|
+ */
|
|
13413
|
+ const messageList = { tsSubCmds: [], historyCmds: [] }
|
|
13414
|
+ let cmdId = 0
|
|
13415
|
+
|
|
13416
|
+ const getKeys = (list) => Array.from(new Set(list)).join(',')
|
|
13417
|
+
|
|
13418
|
+ const toNumber = (string, defaultValue = 0) => isNaN(string) ? defaultValue : Number(string)
|
|
13419
|
+
|
|
13420
|
+ const setSubscribeMapping = (cmdId, record) => this.subscribeIdMapping.set(cmdId, record)
|
|
13421
|
+
|
|
13422
|
+ this.deviceIdMapping.forEach((value, key) => {
|
|
13423
|
+ const basicRecord = value.filter(item => !item.additional)
|
|
13424
|
+ const moreFilterRecord = value.filter(item => item.additional)
|
|
13425
|
+
|
|
13426
|
+ const message = basicRecord.length ? generateMessage({ entityId: key, cmdId, keys: getKeys(basicRecord.map(item => item.attr)) }) : null
|
|
13427
|
+ basicRecord.length && setSubscribeMapping(cmdId, basicRecord)
|
|
13428
|
+ cmdId++
|
|
13429
|
+
|
|
13430
|
+ // 图表控件订阅
|
|
13431
|
+ moreFilterRecord.forEach(item => {
|
|
13432
|
+ const { additional = {} } = item
|
|
13433
|
+ const { dataType = 'tsSubCmds', interval, effectScope, agg } = additional
|
|
13434
|
+ const message = generateMessage({
|
|
13435
|
+ entityId: key,
|
|
13436
|
+ cmdId,
|
|
13437
|
+ agg,
|
|
13438
|
+ keys: getKeys(moreFilterRecord.map(item => item.attr)),
|
|
13439
|
+ interval: toNumber(interval, 1000),
|
|
13440
|
+ startTs: Date.now() - toNumber(effectScope),
|
|
13441
|
+ ...(dataType === HandleDataSource.enumDataBindType.REAL ? {} : { endTs: Date.now() })
|
|
13442
|
+ })
|
|
13443
|
+ setSubscribeMapping(cmdId, [item])
|
|
13444
|
+ messageList[dataType].push(message)
|
|
13445
|
+ cmdId++
|
|
13446
|
+ })
|
|
13447
|
+
|
|
13448
|
+ message && messageList.tsSubCmds.push(message)
|
|
13449
|
+ })
|
|
13450
|
+
|
|
13451
|
+ return messageList
|
|
13452
|
+ }
|
|
13453
|
+
|
|
13454
|
+ return generateGroupMessage()
|
|
13455
|
+ }
|
|
13456
|
+
|
13223
|
13457
|
/**
|
13224
|
13458
|
* @description 发送消息去获取实时数据
|
13225
|
13459
|
*/
|
...
|
...
|
@@ -13242,7 +13476,7 @@ class DispatchCenter { |
13242
|
13476
|
/**
|
13243
|
13477
|
* @description 生成节点映射表
|
13244
|
13478
|
* @param dataSources
|
13245
|
|
- * @return {{cmdId: number, entityType: string, keys: *, scope: string, entityId: *}[]}
|
|
13479
|
+ * @return {{cmdId: number, entityType: string, keys: string, scope: string, entityId: string}[]}
|
13246
|
13480
|
*/
|
13247
|
13481
|
generatorDataSourceMapping(dataSources = []) {
|
13248
|
13482
|
return dataSources.map((datum) => {
|
...
|
...
|
@@ -13264,12 +13498,7 @@ class DispatchCenter { |
13264
|
13498
|
* @description 分发事件
|
13265
|
13499
|
*/
|
13266
|
13500
|
publishEvent(eventName, data, message, event, ws) {
|
13267
|
|
- // data = data ? data : {}
|
13268
|
13501
|
this.eventBus.emit(eventName, message, event, ws)
|
13269
|
|
- // console.log(arguments)
|
13270
|
|
- // Object.keys(data).forEach(() => {
|
13271
|
|
- // this.eventBus.emit(eventName, message, event, ws)
|
13272
|
|
- // })
|
13273
|
13502
|
}
|
13274
|
13503
|
|
13275
|
13504
|
/**
|
...
|
...
|
@@ -13414,8 +13643,8 @@ class HandleDataSource { |
13414
|
13643
|
|
13415
|
13644
|
constructor(DispatchInstance) {
|
13416
|
13645
|
this.DispatchInstance = DispatchInstance
|
13417
|
|
- this.generatorCommonDataSourceMapping()
|
13418
|
|
- this.generatorChartDataSourceMapping()
|
|
13646
|
+ // this.generatorCommonDataSourceMapping()
|
|
13647
|
+ // this.generatorChartDataSourceMapping()
|
13419
|
13648
|
}
|
13420
|
13649
|
|
13421
|
13650
|
get graph() {
|
...
|
...
|
@@ -13536,29 +13765,30 @@ class HandleDataSource { |
13536
|
13765
|
* @description 更新变量值
|
13537
|
13766
|
* @param {} message
|
13538
|
13767
|
*/
|
13539
|
|
- updateCommonDataSource(message) {
|
13540
|
|
- const { subscriptionId } = message
|
13541
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
13542
|
|
- const { attr } = this.getBindData(subscriptionId)
|
|
13768
|
+ updateCommonDataSource(message, record) {
|
|
13769
|
+ const { nodeId, attr } = record
|
|
13770
|
+ const node = this.getNodeByCmdId(nodeId)
|
|
13771
|
+
|
13543
|
13772
|
node && this.updatePage(() => {
|
13544
|
13773
|
const { data } = message
|
13545
|
13774
|
const type = this.getComponentType(node)
|
13546
|
13775
|
if (type === this.componentType.SWITCH) {
|
13547
|
|
- this.handleSwitchComponent(message)
|
|
13776
|
+ this.handleSwitchComponent(message, record)
|
13548
|
13777
|
return
|
13549
|
13778
|
}
|
13550
|
13779
|
|
13551
|
13780
|
if (type === this.componentType.PARAMS_SETTING_BUTTON) {
|
13552
|
|
- this.handleParamSettingButton(message)
|
|
13781
|
+ this.handleParamSettingButton(message, record)
|
13553
|
13782
|
return
|
13554
|
13783
|
}
|
13555
|
13784
|
|
13556
|
13785
|
if (type === this.componentType.IMAGE) {
|
13557
|
|
- this.handleImageComponent(message)
|
|
13786
|
+ this.handleImageComponent(message, record)
|
13558
|
13787
|
return
|
13559
|
13788
|
}
|
13560
|
13789
|
|
13561
|
|
- if (!data) return
|
|
13790
|
+ if (!data || !data[attr]) return
|
|
13791
|
+
|
13562
|
13792
|
const [[timespan, value]] = data[attr]
|
13563
|
13793
|
node.setValue(value)
|
13564
|
13794
|
}, node)
|
...
|
...
|
@@ -13568,11 +13798,11 @@ class HandleDataSource { |
13568
|
13798
|
* @description 处理switch 组件
|
13569
|
13799
|
* @param {} message
|
13570
|
13800
|
*/
|
13571
|
|
- handleSwitchComponent(message) {
|
13572
|
|
- const { subscriptionId, data = {} } = message
|
13573
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
13574
|
|
- const { nodeId, attr } = this.getBindData(subscriptionId)
|
13575
|
|
- const [[timespan, receiveValue] = []] = data[attr] || []
|
|
13801
|
+ handleSwitchComponent(message, record) {
|
|
13802
|
+ const { data = {} } = message
|
|
13803
|
+ const { nodeId, attr } = record
|
|
13804
|
+ const node = this.getNodeByCmdId(nodeId)
|
|
13805
|
+ const [[_timespan, receiveValue] = []] = data[attr] || []
|
13576
|
13806
|
const switchConfig = this.DispatchInstance.contentData.act.find(item => item.id === nodeId && item.type === 'SWITCH')
|
13577
|
13807
|
const { condition = [] } = switchConfig || {}
|
13578
|
13808
|
let reg = /image=[^;]+/g
|
...
|
...
|
@@ -13589,6 +13819,7 @@ class HandleDataSource { |
13589
|
13819
|
flag = true
|
13590
|
13820
|
this.updatePage(() => {
|
13591
|
13821
|
const style = node.getStyle()
|
|
13822
|
+ if ((style || '').includes(imagePath)) return
|
13592
|
13823
|
const sendValue = getSendValue(type)
|
13593
|
13824
|
node.setStyle(style.replace(reg, `image=${imagePath}`))
|
13594
|
13825
|
node.setAttribute('label', '')
|
...
|
...
|
@@ -13611,22 +13842,22 @@ class HandleDataSource { |
13611
|
13842
|
|
13612
|
13843
|
}
|
13613
|
13844
|
|
13614
|
|
- handleParamSettingButton(message) {
|
13615
|
|
- const { subscriptionId, data = {} } = message
|
|
13845
|
+ handleParamSettingButton(message, record) {
|
|
13846
|
+ const { data = {} } = message
|
13616
|
13847
|
if (!data) return
|
13617
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
13618
|
|
- const { attr } = this.getBindData(subscriptionId)
|
13619
|
|
- const [[timespan, receiveValue] = []] = data[attr] || []
|
|
13848
|
+ const { nodeId, attr } = record
|
|
13849
|
+ const node = this.getNodeByCmdId(nodeId)
|
|
13850
|
+ const [[_timespan, receiveValue] = []] = data[attr] || []
|
13620
|
13851
|
this.updatePage(() => {
|
13621
|
13852
|
node.setAttribute('label', `<button class="param-setting-button">${receiveValue}</button>`)
|
13622
|
13853
|
}, node)
|
13623
|
13854
|
}
|
13624
|
13855
|
|
13625
|
|
- handleImageComponent(message) {
|
13626
|
|
- const { subscriptionId, data = {} } = message
|
13627
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
13628
|
|
- const { attr } = this.getBindData(subscriptionId)
|
13629
|
|
- const [[timespan, receiveValue] = []] = data[attr] || []
|
|
13856
|
+ handleImageComponent(message, record) {
|
|
13857
|
+ const { data = {} } = message
|
|
13858
|
+ const { nodeId, attr } = record
|
|
13859
|
+ const node = this.getNodeByCmdId(nodeId)
|
|
13860
|
+ const [[_timespan, receiveValue] = []] = data[attr] || []
|
13630
|
13861
|
this.updatePage(() => {
|
13631
|
13862
|
node.setAttribute('label', `<img class="basic-component__image" alt="图片" src="${receiveValue}" />`)
|
13632
|
13863
|
}, node)
|
...
|
...
|
@@ -13635,18 +13866,19 @@ class HandleDataSource { |
13635
|
13866
|
/**
|
13636
|
13867
|
* @description 更新实时数据
|
13637
|
13868
|
* @param {} message
|
13638
|
|
- * @param {} agg 聚合方式
|
|
13869
|
+ * @param {} record 聚合方式
|
13639
|
13870
|
*/
|
13640
|
|
- updateRealTimeDataSource(message, agg) {
|
13641
|
|
- const { data = {}, subscriptionId } = message
|
13642
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
|
13871
|
+ updateRealTimeDataSource(message, record) {
|
|
13872
|
+ const { data = {} } = message
|
|
13873
|
+ const { nodeId, attr, additional = {} } = record
|
|
13874
|
+ const { agg } = additional
|
|
13875
|
+ const node = this.getNodeByCmdId(nodeId)
|
13643
|
13876
|
if (!node) return
|
13644
|
13877
|
const enumConst = Sidebar.prototype.enumCellBasicAttribute
|
13645
|
13878
|
const chartInstanceMap = Sidebar.prototype.chartsInstanceMapping
|
13646
|
13879
|
const chartInstanceId = node.getAttribute(enumConst.CHART_INSTANCE_ID)
|
13647
|
13880
|
const chartInstanceType = node.getAttribute(enumConst.COMPONENT_TYPE)
|
13648
|
13881
|
const instance = chartInstanceMap.get(chartInstanceId)
|
13649
|
|
- const { attr = [[]], additional } = this.getBindData(subscriptionId)
|
13650
|
13882
|
const realDataList = data[attr] || []
|
13651
|
13883
|
|
13652
|
13884
|
const action = agg === 'NONE' ? 'unshift' : 'push'
|
...
|
...
|
@@ -13655,12 +13887,12 @@ class HandleDataSource { |
13655
|
13887
|
const isActive = instance.isActive
|
13656
|
13888
|
if (!isActive) {
|
13657
|
13889
|
instance.isActive = true
|
13658
|
|
- const chartOption = this.getChartComponentOption(chartInstanceType, { chartType: chartInstanceType, attr, dataList: realDataList, action, nodeId: node.id , additional})
|
|
13890
|
+ const chartOption = this.getChartComponentOption(chartInstanceType, { chartType: chartInstanceType, attr, dataList: realDataList, action, nodeId: node.id, additional })
|
13659
|
13891
|
instance.setOption(chartOption)
|
13660
|
13892
|
|
13661
|
13893
|
} else {
|
13662
|
13894
|
const oldOptions = instance.getOption()
|
13663
|
|
- const options = this.getRealTimeUpdateChartOption(chartInstanceType, { oldOptions, dataList: realDataList , additional})
|
|
13895
|
+ const options = this.getRealTimeUpdateChartOption(chartInstanceType, { oldOptions, dataList: realDataList, additional })
|
13664
|
13896
|
if (!instance) clearInterval(interval)
|
13665
|
13897
|
instance && instance.setOption(options)
|
13666
|
13898
|
}
|
...
|
...
|
@@ -13669,16 +13901,17 @@ class HandleDataSource { |
13669
|
13901
|
/**
|
13670
|
13902
|
* @description 更新历史数据
|
13671
|
13903
|
*/
|
13672
|
|
- updateHistoryDataSource(message, agg) {
|
13673
|
|
- const { data = {}, subscriptionId } = message
|
13674
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
|
13904
|
+ updateHistoryDataSource(message, record) {
|
|
13905
|
+ const { data = {} } = message
|
|
13906
|
+ const { nodeId, attr, additional = {} } = record
|
|
13907
|
+ const { agg } = additional
|
|
13908
|
+ const node = this.getNodeByCmdId(nodeId)
|
13675
|
13909
|
if (!node) return
|
13676
|
13910
|
const enumConst = Sidebar.prototype.enumCellBasicAttribute
|
13677
|
13911
|
const chartInstanceMap = Sidebar.prototype.chartsInstanceMapping
|
13678
|
13912
|
const chartInstanceId = node.getAttribute(enumConst.CHART_INSTANCE_ID)
|
13679
|
13913
|
const chartInstanceType = node.getAttribute(enumConst.COMPONENT_TYPE)
|
13680
|
13914
|
const instance = chartInstanceMap.get(chartInstanceId)
|
13681
|
|
- const { attr = [[]], additional } = this.getBindData(subscriptionId)
|
13682
|
13915
|
const historyDataList = data[attr] || []
|
13683
|
13916
|
const showNumberOf = 4
|
13684
|
13917
|
const action = agg === 'NONE' ? 'unshift' : 'push'
|
...
|
...
|
@@ -13965,11 +14198,10 @@ class HandleDataSource { |
13965
|
14198
|
/**
|
13966
|
14199
|
* @description 获取仪表盘配置
|
13967
|
14200
|
*/
|
13968
|
|
- getRealTimeUpdateDashboardChartOption(params = { dataList: [] , additional: {}}) {
|
|
14201
|
+ getRealTimeUpdateDashboardChartOption(params = { dataList: [], additional: {} }) {
|
13969
|
14202
|
const { dataList = [], oldOptions, additional } = params
|
13970
|
14203
|
const { attrName } = additional
|
13971
|
14204
|
const [timespan, value] = dataList[0] || []
|
13972
|
|
- console.log(value)
|
13973
|
14205
|
return {
|
13974
|
14206
|
series: [
|
13975
|
14207
|
{
|
...
|
...
|
@@ -13990,8 +14222,7 @@ class HandleDataSource { |
13990
|
14222
|
* @param actionType
|
13991
|
14223
|
* @return {{attr: string, additional: { agg: string, dataType: string, effectScope: string, interval: string, unit: string, orgName: string, deviceName: string, slaveDeviceName: string, attrName: string }}}
|
13992
|
14224
|
*/
|
13993
|
|
- getBindData(subscriptionId) {
|
13994
|
|
- const nodeId = this.getNodeIdByCmdId(subscriptionId)
|
|
14225
|
+ getBindData(nodeId) {
|
13995
|
14226
|
const temp = this.dataSourceNodeMapping.get(nodeId) || {}
|
13996
|
14227
|
return temp
|
13997
|
14228
|
}
|
...
|
...
|
@@ -14011,7 +14242,8 @@ class HandleDataSource { |
14011
|
14242
|
* @return {string}
|
14012
|
14243
|
*/
|
14013
|
14244
|
getNodeIdByCmdId(subscriptionId) {
|
14014
|
|
- return this.DispatchInstance.cmdIdMapping.get(subscriptionId)
|
|
14245
|
+ // return this.DispatchInstance.cmdIdMapping.get(subscriptionId)
|
|
14246
|
+ return this.DispatchInstance.subscribeIdMapping.get(subscriptionId)
|
14015
|
14247
|
}
|
14016
|
14248
|
|
14017
|
14249
|
/**
|
...
|
...
|
@@ -14019,8 +14251,8 @@ class HandleDataSource { |
14019
|
14251
|
* @param subscriptionId
|
14020
|
14252
|
* @return {*}
|
14021
|
14253
|
*/
|
14022
|
|
- getNodeByCmdId(subscriptionId) {
|
14023
|
|
- const nodeId = this.getNodeIdByCmdId(subscriptionId)
|
|
14254
|
+ getNodeByCmdId(nodeId) {
|
|
14255
|
+ // const nodeId = this.getNodeIdByCmdId(subscriptionId)
|
14024
|
14256
|
return this.contentAllCell.find(item => item.id === nodeId)
|
14025
|
14257
|
}
|
14026
|
14258
|
|
...
|
...
|
@@ -14634,7 +14866,7 @@ class HandleDynamicEffect { |
14634
|
14866
|
*/
|
14635
|
14867
|
generatorMappingRelation() {
|
14636
|
14868
|
this.videoPlay()
|
14637
|
|
- const tsSubCmds = []
|
|
14869
|
+ // const tsSubCmds = []
|
14638
|
14870
|
this.enableActList.forEach(each => {
|
14639
|
14871
|
const { id, type, attr, deviceId, slaveDeviceId } = each
|
14640
|
14872
|
|
...
|
...
|
@@ -14642,13 +14874,13 @@ class HandleDynamicEffect { |
14642
|
14874
|
const temp = this.actNodeMapping.get(id)
|
14643
|
14875
|
temp.value.set(type, each)
|
14644
|
14876
|
|
14645
|
|
- const cmdId = this.DispatchInstance.getCmdId(id)
|
|
14877
|
+ // const cmdId = this.DispatchInstance.getCmdId(id)
|
14646
|
14878
|
|
14647
|
|
- tsSubCmds.push(this.generatorMessage(slaveDeviceId ? slaveDeviceId : deviceId, cmdId, attr))
|
|
14879
|
+ // tsSubCmds.push(this.generatorMessage(slaveDeviceId ? slaveDeviceId : deviceId, cmdId, attr))
|
14648
|
14880
|
|
14649
|
|
- this.subscribeEvent(cmdId, this.dispatch(type))
|
|
14881
|
+ // this.subscribeEvent(cmdId, this.dispatch(type))
|
14650
|
14882
|
})
|
14651
|
|
- if (tsSubCmds.length) this.sendMsg({ tsSubCmds })
|
|
14883
|
+ // if (tsSubCmds.length) this.sendMsg({ tsSubCmds })
|
14652
|
14884
|
}
|
14653
|
14885
|
|
14654
|
14886
|
/**
|
...
|
...
|
@@ -14718,15 +14950,16 @@ class HandleDynamicEffect { |
14718
|
14950
|
* @param message
|
14719
|
14951
|
* @param attr
|
14720
|
14952
|
*/
|
14721
|
|
- rotate(message) {
|
14722
|
|
- const { subscriptionId, data } = message
|
14723
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
|
14953
|
+ rotate(message, record) {
|
|
14954
|
+ const { data } = message
|
|
14955
|
+ const { id } = record
|
|
14956
|
+ const node = this.getNodeByCmdId(id)
|
14724
|
14957
|
const key = node.id + DispatchCenter.enumDynamicEffectType.ROTATE
|
14725
|
14958
|
if (!this.validatePriority(node.id)) {
|
14726
|
14959
|
this.delUpdateFn(key)
|
14727
|
14960
|
return
|
14728
|
14961
|
}
|
14729
|
|
- const { flag } = this.validate(subscriptionId, DispatchCenter.enumDynamicEffectType.ROTATE, data)
|
|
14962
|
+ const { flag } = this.validate(record, DispatchCenter.enumDynamicEffectType.ROTATE, data)
|
14730
|
14963
|
let deg = 0
|
14731
|
14964
|
const updateFn = () => {
|
14732
|
14965
|
if (deg === 360) deg = 0
|
...
|
...
|
@@ -14750,11 +14983,12 @@ class HandleDynamicEffect { |
14750
|
14983
|
* @param message
|
14751
|
14984
|
* @param attr
|
14752
|
14985
|
*/
|
14753
|
|
- display(message) {
|
14754
|
|
- const { subscriptionId, data = {} } = message
|
14755
|
|
- const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.DISPLAY, data)
|
|
14986
|
+ display(message, record) {
|
|
14987
|
+ const { data = {} } = message
|
|
14988
|
+ const { id } = record
|
|
14989
|
+ const { flag, condition } = this.validate(record, HandleDynamicEffect.enumActType.DISPLAY, data)
|
14756
|
14990
|
if (!flag) return
|
14757
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
|
14991
|
+ const node = this.getNodeByCmdId(id)
|
14758
|
14992
|
let isShow = false
|
14759
|
14993
|
if (condition.type === HandleDynamicEffect.enumDisplayType.SHOW) {
|
14760
|
14994
|
isShow = true
|
...
|
...
|
@@ -14784,15 +15018,16 @@ class HandleDynamicEffect { |
14784
|
15018
|
* @param message
|
14785
|
15019
|
* @param attr
|
14786
|
15020
|
*/
|
14787
|
|
- flash(message) {
|
14788
|
|
- const { subscriptionId, data } = message
|
14789
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
|
15021
|
+ flash(message, record) {
|
|
15022
|
+ const { data } = message
|
|
15023
|
+ const { id } = record
|
|
15024
|
+ const node = this.getNodeByCmdId(id)
|
14790
|
15025
|
const key = node.id + DispatchCenter.enumDynamicEffectType.FLASH
|
14791
|
|
- if (!this.validatePriority(node.id)) {
|
|
15026
|
+ if (!this.validatePriority(id)) {
|
14792
|
15027
|
this.delUpdateFn(key)
|
14793
|
15028
|
return
|
14794
|
15029
|
}
|
14795
|
|
- const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.FLASH, data)
|
|
15030
|
+ const { flag } = this.validate(record, HandleDynamicEffect.enumActType.FLASH, data)
|
14796
|
15031
|
let flashFlag = false
|
14797
|
15032
|
const updateFn = () => {
|
14798
|
15033
|
node.setVisible(flashFlag)
|
...
|
...
|
@@ -14810,10 +15045,11 @@ class HandleDynamicEffect { |
14810
|
15045
|
/**
|
14811
|
15046
|
* @description 处理变量图片
|
14812
|
15047
|
*/
|
14813
|
|
- varImage(message) {
|
14814
|
|
- const { subscriptionId, data } = message
|
14815
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
14816
|
|
- const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.IMAGE, data)
|
|
15048
|
+ varImage(message, record) {
|
|
15049
|
+ const { data } = message
|
|
15050
|
+ const { id } = record
|
|
15051
|
+ const node = this.getNodeByCmdId(id)
|
|
15052
|
+ const { flag, condition } = this.validate(record, HandleDynamicEffect.enumActType.IMAGE, data)
|
14817
|
15053
|
if (flag && node) {
|
14818
|
15054
|
const { imagePath } = condition
|
14819
|
15055
|
this.insertOnceUpdateFn(
|
...
|
...
|
@@ -14822,7 +15058,7 @@ class HandleDynamicEffect { |
14822
|
15058
|
node.setStyle(`image;image=${imagePath};imageAspect=0;`)
|
14823
|
15059
|
})
|
14824
|
15060
|
} else if (!flag && node) {
|
14825
|
|
- const { condition = [], attr } = this.getBindData(subscriptionId, HandleDynamicEffect.enumActType.IMAGE)
|
|
15061
|
+ const { condition = [], attr } = record
|
14826
|
15062
|
const flag = HandleDynamicEffect.enumVarImageConst.DEFAULT_IMAGE_FLAG
|
14827
|
15063
|
const defaultBindData = condition.find(item => item[flag])
|
14828
|
15064
|
if (defaultBindData) {
|
...
|
...
|
@@ -14837,11 +15073,12 @@ class HandleDynamicEffect { |
14837
|
15073
|
}
|
14838
|
15074
|
}
|
14839
|
15075
|
|
14840
|
|
- running(message) {
|
14841
|
|
- const { subscriptionId, data = {} } = message
|
14842
|
|
- const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.RUNNING, data)
|
|
15076
|
+ running(message, record) {
|
|
15077
|
+ const { id } = record
|
|
15078
|
+ const { data = {} } = message
|
|
15079
|
+ const { flag, condition } = this.validate(record, HandleDynamicEffect.enumActType.RUNNING, data)
|
14843
|
15080
|
if (!flag) return
|
14844
|
|
- const node = this.getNodeByCmdId(subscriptionId)
|
|
15081
|
+ const node = this.getNodeByCmdId(id)
|
14845
|
15082
|
let isRun = false
|
14846
|
15083
|
if (condition.type === HandleDynamicEffect.enumRunningType.RUN) {
|
14847
|
15084
|
isRun = true
|
...
|
...
|
@@ -14897,7 +15134,7 @@ class HandleDynamicEffect { |
14897
|
15134
|
const { geometry = {} } = cell
|
14898
|
15135
|
const { width, height } = geometry
|
14899
|
15136
|
const idEl = getIdEl()
|
14900
|
|
- graph.getModel().beginUpdate()
|
|
15137
|
+ graph.getModel().beginUpdate()
|
14901
|
15138
|
try {
|
14902
|
15139
|
let type
|
14903
|
15140
|
if (videoUrl.replace(reg, '') === 'm3u8') type = 'application/x-mpegURL'
|
...
|
...
|
@@ -14939,14 +15176,15 @@ class HandleDynamicEffect { |
14939
|
15176
|
|
14940
|
15177
|
/**
|
14941
|
15178
|
* @description 验证是否满足条件列表中的任意一条
|
14942
|
|
- * @param subscriptionId
|
|
15179
|
+ * @param record
|
14943
|
15180
|
* @param type
|
14944
|
15181
|
* @param value
|
14945
|
15182
|
* @return {{flag: boolean, condition: {}}}
|
14946
|
15183
|
*/
|
14947
|
|
- validate(subscriptionId, type, value) {
|
14948
|
|
- const { condition = [], attr } = this.getBindData(subscriptionId, type)
|
|
15184
|
+ validate(record, type, value) {
|
|
15185
|
+ const { condition = [], attr } = record
|
14949
|
15186
|
const result = { condition: {}, flag: false }
|
|
15187
|
+ if (!value[attr]) return result
|
14950
|
15188
|
for (let i = 0; i < condition.length; i++) {
|
14951
|
15189
|
const { min, max } = condition[i]
|
14952
|
15190
|
const [timespan, realValue] = value[attr][0]
|
...
|
...
|
@@ -14996,8 +15234,7 @@ class HandleDynamicEffect { |
14996
|
15234
|
* @param subscriptionId
|
14997
|
15235
|
* @return {*}
|
14998
|
15236
|
*/
|
14999
|
|
- getNodeByCmdId(subscriptionId) {
|
15000
|
|
- const nodeId = this.getNodeIdByCmdId(subscriptionId)
|
|
15237
|
+ getNodeByCmdId(nodeId) {
|
15001
|
15238
|
return this.contentAllCell.find(item => item.id === nodeId)
|
15002
|
15239
|
}
|
15003
|
15240
|
|
...
|
...
|
|