Commit 5b576b6759a17ffa8d4ad9a96285891162504d20

Authored by xp.Huang
2 parents 83502dce d2915ed7

Merge branch 'ww' into 'main'

fix: fix some problem

See merge request huang/thingskit-drawio!27
@@ -618,10 +618,10 @@ @@ -618,10 +618,10 @@
618 this.setComponentPermission(DEFAULT, [DYNAMIC_EFFECT]) 618 this.setComponentPermission(DEFAULT, [DYNAMIC_EFFECT])
619 this.setComponentPermission(REAL_TIME, [DYNAMIC_EFFECT]) 619 this.setComponentPermission(REAL_TIME, [DYNAMIC_EFFECT])
620 this.setComponentPermission(TITLE, [INTERACTION, DYNAMIC_EFFECT]) 620 this.setComponentPermission(TITLE, [INTERACTION, DYNAMIC_EFFECT])
621 - this.setComponentPermission(VAR_IMAGE, [DATA_SOURCE, INTERACTION, VAR_IMAGE]) 621 + this.setComponentPermission(VAR_IMAGE, [INTERACTION, VAR_IMAGE])
622 this.setComponentPermission(VARIABLE, [DATA_SOURCE, INTERACTION, DYNAMIC_EFFECT]) 622 this.setComponentPermission(VARIABLE, [DATA_SOURCE, INTERACTION, DYNAMIC_EFFECT])
623 - this.setComponentPermission(BAR_CHART, [DATA_SOURCE, BAR_CHART_EXPAND, DYNAMIC_EFFECT])  
624 - this.setComponentPermission(LINE_CHART, [DATA_SOURCE, LINE_CHART_EXPAND, DYNAMIC_EFFECT]) 623 + this.setComponentPermission(BAR_CHART, [DATA_SOURCE, BAR_CHART_EXPAND])
  624 + this.setComponentPermission(LINE_CHART, [DATA_SOURCE, LINE_CHART_EXPAND])
625 625
626 var thingskitEntries = [ 626 var thingskitEntries = [
627 { title: "风机", id: 'fan', image: IMAGE_PATH + '/thingskit/风机.png' }, 627 { title: "风机", id: 'fan', image: IMAGE_PATH + '/thingskit/风机.png' },
@@ -5579,7 +5579,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -5579,7 +5579,6 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5579 const { dataSources = [] } = currentNodeData 5579 const { dataSources = [] } = currentNodeData
5580 const { additional = {} } = dataSources[0] || {} 5580 const { additional = {} } = dataSources[0] || {}
5581 const { [enumBindKey.EFFECT_SCOPE]: effectScope = 1000 } = additional 5581 const { [enumBindKey.EFFECT_SCOPE]: effectScope = 1000 } = additional
5582 - console.log(additional)  
5583 linkageIntervalSelect(effectScope) 5582 linkageIntervalSelect(effectScope)
5584 form.val(CONTAINER_FILTER, additional) 5583 form.val(CONTAINER_FILTER, additional)
5585 } 5584 }
@@ -5666,7 +5665,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -5666,7 +5665,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5666 [enumDataSourceConst.ORG_ID]: field[enumDataSourceConst.ORG_ID], 5665 [enumDataSourceConst.ORG_ID]: field[enumDataSourceConst.ORG_ID],
5667 [enumDataSourceConst.DEVICE_ID]: field[enumDataSourceConst.DEVICE_ID], 5666 [enumDataSourceConst.DEVICE_ID]: field[enumDataSourceConst.DEVICE_ID],
5668 // ...(field[enumDataSourceConst.SLAVE_DEVICE_ID] && { [enumDataSourceConst.SLAVE_DEVICE_ID]: field[enumDataSourceConst.SLAVE_DEVICE_ID] }), 5667 // ...(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] : '', 5668 + [enumDataSourceConst.SLAVE_DEVICE_ID]: field[enumDataSourceConst.SLAVE_DEVICE_ID] ? field[enumDataSourceConst.SLAVE_DEVICE_ID] : '',
5670 [enumDataSourceConst.ATTR]: field[enumDataSourceConst.ATTR], 5669 [enumDataSourceConst.ATTR]: field[enumDataSourceConst.ATTR],
5671 [enumDataSourceConst.ADDITIONAL]: field[additionalKey.DATA_TYPE] ? { 5670 [enumDataSourceConst.ADDITIONAL]: field[additionalKey.DATA_TYPE] ? {
5672 [additionalKey.AGG]: field[additionalKey.AGG], 5671 [additionalKey.AGG]: field[additionalKey.AGG],
@@ -6343,7 +6342,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6343,7 +6342,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6343 /** 6342 /**
6344 * @description 下拉选项挂载 6343 * @description 下拉选项挂载
6345 */ 6344 */
6346 - function createSelectOptionMountEvent(params) { 6345 + function createSelectOptionMountEvent() {
6347 $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).on('click', '.layui-form-select', event => { 6346 $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).on('click', '.layui-form-select', event => {
6348 const width = event.currentTarget.offsetWidth || 200 6347 const width = event.currentTarget.offsetWidth || 200
6349 const height = event.currentTarget.offsetHeight || 38 6348 const height = event.currentTarget.offsetHeight || 38
@@ -6383,7 +6382,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6383,7 +6382,6 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6383 function echoOrgTree(id) { 6382 function echoOrgTree(id) {
6384 orgId = id 6383 orgId = id
6385 const node = UseLayUi.findTreeObjectByField(treeList, id) 6384 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)) 6385 UseLayUi.nextTick(() => $(`#${enumActionEl.ORG_EL} input[name="${enumConst.ORG_ID}"]`).val(orgId).parent().find('span').html(node?.name))
6388 } 6386 }
6389 6387
@@ -6527,8 +6525,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6527,8 +6525,8 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6527 }) 6525 })
6528 createOrgTreeSelect() 6526 createOrgTreeSelect()
6529 const info = getLayerBindInfo('event', type) 6527 const info = getLayerBindInfo('event', type)
6530 - const { content: { data = [] } = {}, orgId } = info  
6531 - echoOrgTree(orgId) 6528 + const { content: { data = [] } = {}, orgId: recordOrgId } = info
  6529 + orgId = recordOrgId
6532 await getAllGatewayDeviceAndConnectionDevice() 6530 await getAllGatewayDeviceAndConnectionDevice()
6533 if (!info || !data.length) { 6531 if (!info || !data.length) {
6534 addRecord() 6532 addRecord()
@@ -6537,7 +6535,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6537,7 +6535,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6537 } 6535 }
6538 generatorEventListen() 6536 generatorEventListen()
6539 form.render() 6537 form.render()
6540 - echoOrgTree(orgId) 6538 + echoOrgTree(recordOrgId)
6541 }, 6539 },
6542 }) 6540 })
6543 } 6541 }
@@ -6634,6 +6632,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6634,6 +6632,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6634 configurationId, 6632 configurationId,
6635 contentId: currentPageId.id, 6633 contentId: currentPageId.id,
6636 id: graphId, 6634 id: graphId,
  6635 + orgId: 'b4dd6e2b-6e0f-413c-bf5a-70133bd571e8',
6637 content: { 6636 content: {
6638 type: formVal[enumConst.ACTION], 6637 type: formVal[enumConst.ACTION],
6639 value: formVal[enumGetValue[formVal[enumConst.ACTION]]], 6638 value: formVal[enumGetValue[formVal[enumConst.ACTION]]],
@@ -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 /**
@@ -6939,7 +6957,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6939,7 +6957,6 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6939 contentId: currentPageId.id, 6957 contentId: currentPageId.id,
6940 ...formVal, 6958 ...formVal,
6941 id: graphId, 6959 id: graphId,
6942 - orgId: 'b4dd6e2b-6e0f-413c-bf5a-70133bd571e8',  
6943 condition: tableData, 6960 condition: tableData,
6944 type: event.data.type, 6961 type: event.data.type,
6945 } 6962 }
@@ -7005,6 +7022,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -7005,6 +7022,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
7005 echoDataSource, 7022 echoDataSource,
7006 } = generatorDataSourceComponent({ overrideClass: 'dynamic-effect__data-source-comp--override' }) 7023 } = generatorDataSourceComponent({ overrideClass: 'dynamic-effect__data-source-comp--override' })
7007 $(`#${enumActionEl.DATA_SOURCE_COMP_EL}`).append(component) 7024 $(`#${enumActionEl.DATA_SOURCE_COMP_EL}`).append(component)
  7025 + form.render()
7008 const info = getLayerBindInfo('act', type) 7026 const info = getLayerBindInfo('act', type)
7009 const { condition = [] } = info 7027 const { condition = [] } = info
7010 if (info && condition.length) { 7028 if (info && condition.length) {
@@ -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,
@@ -11620,6 +11639,7 @@ class UseLayUi { @@ -11620,6 +11639,7 @@ class UseLayUi {
11620 // focus 11639 // focus
11621 $(`.${SELECT_CLS}`).off('click') 11640 $(`.${SELECT_CLS}`).off('click')
11622 .on("click", ".layui-select-title", function (e) { 11641 .on("click", ".layui-select-title", function (e) {
  11642 + $(document).find('.layui-form-select').removeClass('layui-form-selected')
11623 $(this).parents(`.${SELECT_CLS}`).toggleClass("layui-form-selected"); 11643 $(this).parents(`.${SELECT_CLS}`).toggleClass("layui-form-selected");
11624 layui.stope(e); 11644 layui.stope(e);
11625 }) 11645 })
@@ -12467,7 +12487,7 @@ class HandleDataSource { @@ -12467,7 +12487,7 @@ class HandleDataSource {
12467 * @description 普通数据源绑定列表 12487 * @description 普通数据源绑定列表
12468 */ 12488 */
12469 get commonDataSourceBindList() { 12489 get commonDataSourceBindList() {
12470 - return this.DispatchInstance.contentData?.dataSources?.filter(item => !item.additional) || [] 12490 + return this.DispatchInstance.contentData?.dataSources?.filter(item => !item.additional && item.attr) || []
12471 } 12491 }
12472 12492
12473 /** 12493 /**
@@ -12533,13 +12553,17 @@ class HandleDataSource { @@ -12533,13 +12553,17 @@ class HandleDataSource {
12533 template[STARTTs] = Date.now() - scope 12553 template[STARTTs] = Date.now() - scope
12534 template[ENDTs] = Date.now() 12554 template[ENDTs] = Date.now()
12535 historyList.push(template) 12555 historyList.push(template)
12536 - this.subscribeEvent(cmdId, this.updateHistoryDataSource.bind(this)) 12556 + this.subscribeEvent(cmdId, (message) => {
  12557 + this.updateHistoryDataSource(message, agg)
  12558 + })
12537 } 12559 }
12538 else if (dataType === REAL) { 12560 else if (dataType === REAL) {
12539 template[STARTTs] = Date.now() - scope 12561 template[STARTTs] = Date.now() - scope
12540 - template['timeWindow'] = interval 12562 + // template['timeWindow'] = interval
12541 realList.push(template) 12563 realList.push(template)
12542 - this.subscribeEvent(cmdId, this.updateRealTimeDataSource.bind(this)) 12564 + this.subscribeEvent(cmdId, (message) => {
  12565 + this.updateRealTimeDataSource(message, agg)
  12566 + })
12543 } 12567 }
12544 this.dataSourceNodeMapping.set(nodeId, item) 12568 this.dataSourceNodeMapping.set(nodeId, item)
12545 } 12569 }
@@ -12575,9 +12599,9 @@ class HandleDataSource { @@ -12575,9 +12599,9 @@ class HandleDataSource {
12575 /** 12599 /**
12576 * @description 更新实时数据 12600 * @description 更新实时数据
12577 * @param {} message 12601 * @param {} message
  12602 + * @param {} agg 聚合方式
12578 */ 12603 */
12579 - updateRealTimeDataSource(message) {  
12580 - console.log(message) 12604 + updateRealTimeDataSource(message, agg) {
12581 const { data = {}, subscriptionId } = message 12605 const { data = {}, subscriptionId } = message
12582 const node = this.getNodeByCmdId(subscriptionId) 12606 const node = this.getNodeByCmdId(subscriptionId)
12583 if (!node) return 12607 if (!node) return
@@ -12588,11 +12612,12 @@ class HandleDataSource { @@ -12588,11 +12612,12 @@ class HandleDataSource {
12588 const instance = chartInstanceMap.get(chartInstanceId) 12612 const instance = chartInstanceMap.get(chartInstanceId)
12589 const { attr = [[]] } = this.getBindData(subscriptionId) 12613 const { attr = [[]] } = this.getBindData(subscriptionId)
12590 const realDataList = data[attr] || [] 12614 const realDataList = data[attr] || []
  12615 + const showNumberOf = 4
  12616 + const action = agg === 'NONE' ? 'unshift' : 'push'
  12617 +
  12618 + // const chartWidth = node.getAttribute('width')
  12619 + // const chartHeight = node.getAttribute('height')
12591 12620
12592 - const chartWidth = node.getAttribute('width')  
12593 - const chartHeight = node.getAttribute('height')  
12594 - console.log(chartHeight)  
12595 - console.log(chartWidth)  
12596 // chart insstance 是否已经接受过一次消息推送 12621 // chart insstance 是否已经接受过一次消息推送
12597 const isActive = instance.isActive 12622 const isActive = instance.isActive
12598 if (!isActive) { 12623 if (!isActive) {
@@ -12601,24 +12626,10 @@ class HandleDataSource { @@ -12601,24 +12626,10 @@ class HandleDataSource {
12601 const seriesValue = [] 12626 const seriesValue = []
12602 const chartOption = { 12627 const chartOption = {
12603 title: { 12628 title: {
12604 - // text: '{a|}',  
12605 - subtext: '暂无数据', 12629 + subtext: realDataList.length ? '' : '暂无数据',
12606 x: 'center', 12630 x: 'center',
12607 y: 'center', 12631 y: 'center',
12608 itemGap: -20, 12632 itemGap: -20,
12609 - // textStyle: {  
12610 - // rich: {  
12611 - // a: {  
12612 - // color: '#000',  
12613 - // fontSize: '16',  
12614 - // height: 160,  
12615 - // width: 180,  
12616 - // backgroundColor: {  
12617 - // image: '/thingskit-drawio/images/thingskit/empty.svg'  
12618 - // }  
12619 - // }  
12620 - // }  
12621 - // },  
12622 subtextStyle: { 12633 subtextStyle: {
12623 fontSize: 16 12634 fontSize: 16
12624 } 12635 }
@@ -12661,21 +12672,24 @@ class HandleDataSource { @@ -12661,21 +12672,24 @@ class HandleDataSource {
12661 ], 12672 ],
12662 dataZoom: [ 12673 dataZoom: [
12663 { 12674 {
12664 - xAxisIndex: 0,  
12665 - show: realDataList.length ? true : false, 12675 + show: true,
12666 type: 'slider', 12676 type: 'slider',
12667 - startValue: 0,  
12668 - endValue: 4 12677 + // endValue: showNumberOf
12669 } 12678 }
12670 ] 12679 ]
12671 } 12680 }
12672 12681
12673 - for (let i = realDataList.length - 1; i >= 0; i--) {  
12674 - const [timespan, value] = realDataList[i]  
12675 - xAxisData.push(new Date(Number(timespan)).toLocaleTimeString())  
12676 - seriesValue.push(Number(value))  
12677 - }  
12678 - console.log(chartOption) 12682 + // for (let i = realDataList.length - 1; i >= 0; i--) {
  12683 + // const [timespan, value] = realDataList[i]
  12684 + // xAxisData.push(new Date(Number(timespan)).toLocaleTimeString())
  12685 + // seriesValue.push(Number(value))
  12686 + // }
  12687 + realDataList.forEach(item => {
  12688 + const [timespan, value] = item
  12689 + xAxisData[action](new Date(Number(timespan)).toLocaleTimeString())
  12690 + seriesValue[action](Number(value))
  12691 + })
  12692 +
12679 instance.setOption(chartOption) 12693 instance.setOption(chartOption)
12680 12694
12681 } else { 12695 } else {
@@ -12692,7 +12706,7 @@ class HandleDataSource { @@ -12692,7 +12706,7 @@ class HandleDataSource {
12692 } 12706 }
12693 12707
12694 if (Number(oldOptions.dataZoom[0].endValue) === seriesValue.length - 1) { 12708 if (Number(oldOptions.dataZoom[0].endValue) === seriesValue.length - 1) {
12695 - oldOptions.dataZoom[0].endValue = 4 12709 + oldOptions.dataZoom[0].endValue = showNumberOf
12696 oldOptions.dataZoom[0].startValue = 0 12710 oldOptions.dataZoom[0].startValue = 0
12697 } else { 12711 } else {
12698 oldOptions.dataZoom[0].endValue = oldOptions.dataZoom[0].endValue + 1 12712 oldOptions.dataZoom[0].endValue = oldOptions.dataZoom[0].endValue + 1
@@ -12701,6 +12715,9 @@ class HandleDataSource { @@ -12701,6 +12715,9 @@ class HandleDataSource {
12701 12715
12702 if (!instance) clearInterval(interval) 12716 if (!instance) clearInterval(interval)
12703 instance && instance.setOption({ 12717 instance && instance.setOption({
  12718 + title: {
  12719 + subtext: ''
  12720 + },
12704 xAxis: { 12721 xAxis: {
12705 data: xAxisData 12722 data: xAxisData
12706 }, 12723 },
@@ -12711,17 +12728,21 @@ class HandleDataSource { @@ -12711,17 +12728,21 @@ class HandleDataSource {
12711 ], 12728 ],
12712 dataZoom: [ 12729 dataZoom: [
12713 { 12730 {
12714 - startValue: seriesValue.length > 5  
12715 - ? oldStartValue === seriesValue.length - 1  
12716 - ? 0  
12717 - : oldStartValue + 1  
12718 - : 0,  
12719 - endValue: seriesValue.length > 5  
12720 - ? oldEndValue === seriesValue.length - 1  
12721 - ? 4  
12722 - : oldEndValue + 1  
12723 - : 4 12731 + show: true,
  12732 + type: 'slider',
12724 } 12733 }
  12734 + // {
  12735 + // startValue: seriesValue.length - 1 > showNumberOf
  12736 + // ? oldStartValue === seriesValue.length - 1
  12737 + // ? 0
  12738 + // : oldStartValue + 1
  12739 + // : 0,
  12740 + // endValue: seriesValue.length - 1 > showNumberOf
  12741 + // ? oldEndValue === seriesValue.length - 1
  12742 + // ? showNumberOf
  12743 + // : oldEndValue + 1
  12744 + // : showNumberOf
  12745 + // }
12725 ] 12746 ]
12726 }) 12747 })
12727 } 12748 }
@@ -12730,7 +12751,7 @@ class HandleDataSource { @@ -12730,7 +12751,7 @@ class HandleDataSource {
12730 /** 12751 /**
12731 * @description 更新历史数据 12752 * @description 更新历史数据
12732 */ 12753 */
12733 - updateHistoryDataSource(message) { 12754 + updateHistoryDataSource(message, agg) {
12734 const { data = {}, subscriptionId } = message 12755 const { data = {}, subscriptionId } = message
12735 const node = this.getNodeByCmdId(subscriptionId) 12756 const node = this.getNodeByCmdId(subscriptionId)
12736 if (!node) return 12757 if (!node) return
@@ -12741,10 +12762,22 @@ class HandleDataSource { @@ -12741,10 +12762,22 @@ class HandleDataSource {
12741 const instance = chartInstanceMap.get(chartInstanceId) 12762 const instance = chartInstanceMap.get(chartInstanceId)
12742 const { attr = [[]] } = this.getBindData(subscriptionId) 12763 const { attr = [[]] } = this.getBindData(subscriptionId)
12743 const historyDataList = data[attr] || [] 12764 const historyDataList = data[attr] || []
  12765 + const showNumberOf = 4
  12766 + const action = agg === 'NONE' ? 'unshift' : 'push'
  12767 +
12744 12768
12745 const xAxisData = [] 12769 const xAxisData = []
12746 const seriesValue = [] 12770 const seriesValue = []
12747 const chartOption = { 12771 const chartOption = {
  12772 + title: {
  12773 + subtext: historyDataList.length ? '' : '暂无数据',
  12774 + x: 'center',
  12775 + y: 'center',
  12776 + itemGap: -20,
  12777 + subtextStyle: {
  12778 + fontSize: 16
  12779 + }
  12780 + },
12748 tooltip: { 12781 tooltip: {
12749 trigger: 'axis', 12782 trigger: 'axis',
12750 axisPointer: { 12783 axisPointer: {
@@ -12784,20 +12817,20 @@ class HandleDataSource { @@ -12784,20 +12817,20 @@ class HandleDataSource {
12784 ], 12817 ],
12785 dataZoom: [ 12818 dataZoom: [
12786 { 12819 {
12787 - xAxisIndex: 0,  
12788 - show: false, 12820 + // xAxisIndex: 0,
  12821 + show: true,
12789 type: 'slider', 12822 type: 'slider',
12790 - startValue: 0,  
12791 - endValue: 4 12823 + // startValue: 0,
  12824 + // endValue: showNumberOf
12792 } 12825 }
12793 ] 12826 ]
12794 } 12827 }
12795 12828
12796 - for (let i = historyDataList.length - 1; i >= 0; i--) {  
12797 - const [timespan, value] = historyDataList[i]  
12798 - xAxisData.push(new Date(Number(timespan)).toLocaleTimeString())  
12799 - seriesValue.push(Number(value))  
12800 - } 12829 + historyDataList.forEach(item => {
  12830 + const [timespan, value] = item
  12831 + xAxisData[action](new Date(Number(timespan)).toLocaleTimeString())
  12832 + seriesValue[action](Number(value))
  12833 + })
12801 12834
12802 let interval 12835 let interval
12803 // TODO 清除定时器 12836 // TODO 清除定时器
@@ -12805,7 +12838,7 @@ class HandleDataSource { @@ -12805,7 +12838,7 @@ class HandleDataSource {
12805 if (seriesValue.length <= 5) return 12838 if (seriesValue.length <= 5) return
12806 interval = setInterval(() => { 12839 interval = setInterval(() => {
12807 if (Number(chartOption.dataZoom[0].endValue) === seriesValue.length - 1) { 12840 if (Number(chartOption.dataZoom[0].endValue) === seriesValue.length - 1) {
12808 - chartOption.dataZoom[0].endValue = 4 12841 + chartOption.dataZoom[0].endValue = showNumberOf
12809 chartOption.dataZoom[0].startValue = 0 12842 chartOption.dataZoom[0].startValue = 0
12810 } else { 12843 } else {
12811 chartOption.dataZoom[0].endValue = chartOption.dataZoom[0].endValue + 1 12844 chartOption.dataZoom[0].endValue = chartOption.dataZoom[0].endValue + 1
@@ -12829,9 +12862,9 @@ class HandleDataSource { @@ -12829,9 +12862,9 @@ class HandleDataSource {
12829 } 12862 }
12830 12863
12831 instance.setOption(chartOption) 12864 instance.setOption(chartOption)
12832 - instance.on('mouseover', stop)  
12833 - instance.on('mouseout', goMove)  
12834 - autoMove() 12865 + // instance.on('mouseover', stop)
  12866 + // instance.on('mouseout', goMove)
  12867 + // autoMove()
12835 } 12868 }
12836 12869
12837 /** 12870 /**
@@ -13110,7 +13143,7 @@ class HandleDynamicEffect { @@ -13110,7 +13143,7 @@ class HandleDynamicEffect {
13110 13143
13111 /** 13144 /**
13112 * @description 动效节点映射 13145 * @description 动效节点映射
13113 - * @type {Map<string, Map<string, any>>} 13146 + * @type {Map<string, {display: boolean, value: Map<string, any>}>}
13114 */ 13147 */
13115 actNodeMapping = new Map() 13148 actNodeMapping = new Map()
13116 13149
@@ -13192,9 +13225,9 @@ class HandleDynamicEffect { @@ -13192,9 +13225,9 @@ class HandleDynamicEffect {
13192 this.enableActList.forEach(each => { 13225 this.enableActList.forEach(each => {
13193 const { id, type, attr, deviceId, slaveDeviceId } = each 13226 const { id, type, attr, deviceId, slaveDeviceId } = each
13194 13227
13195 - if (!this.actNodeMapping.has(id)) this.actNodeMapping.set(id, new Map()) 13228 + if (!this.actNodeMapping.has(id)) this.actNodeMapping.set(id, { display: true, value: new Map() })
13196 const temp = this.actNodeMapping.get(id) 13229 const temp = this.actNodeMapping.get(id)
13197 - temp.set(type, each) 13230 + temp.value.set(type, each)
13198 13231
13199 const cmdId = this.DispatchInstance.getCmdId(id) 13232 const cmdId = this.DispatchInstance.getCmdId(id)
13200 13233
@@ -13272,6 +13305,11 @@ class HandleDynamicEffect { @@ -13272,6 +13305,11 @@ class HandleDynamicEffect {
13272 rotate(message) { 13305 rotate(message) {
13273 const { subscriptionId, data } = message 13306 const { subscriptionId, data } = message
13274 const node = this.getNodeByCmdId(subscriptionId) 13307 const node = this.getNodeByCmdId(subscriptionId)
  13308 + const key = node.id + DispatchCenter.enumDynamicEffectType.ROTATE
  13309 + if (!this.validatePriority(node.id)) {
  13310 + this.delUpdateFn(key)
  13311 + return
  13312 + }
13275 const { flag } = this.validate(subscriptionId, DispatchCenter.enumDynamicEffectType.ROTATE, data) 13313 const { flag } = this.validate(subscriptionId, DispatchCenter.enumDynamicEffectType.ROTATE, data)
13276 let deg = 0 13314 let deg = 0
13277 const updateFn = () => { 13315 const updateFn = () => {
@@ -13280,11 +13318,10 @@ class HandleDynamicEffect { @@ -13280,11 +13318,10 @@ class HandleDynamicEffect {
13280 let style = node.getStyle() 13318 let style = node.getStyle()
13281 const reg = /rotation=(-?)\w+(;?)/g 13319 const reg = /rotation=(-?)\w+(;?)/g
13282 style = style.replace(reg, '') 13320 style = style.replace(reg, '')
13283 - style += `rotation=${deg}` 13321 + style += `rotation=${deg};`
13284 node.setStyle(style) 13322 node.setStyle(style)
13285 this.graph.updateCellStyles(style, node) 13323 this.graph.updateCellStyles(style, node)
13286 } 13324 }
13287 - const key = node.id + DispatchCenter.enumDynamicEffectType.ROTATE  
13288 if (!flag) { 13325 if (!flag) {
13289 this.delUpdateFn(key) 13326 this.delUpdateFn(key)
13290 return 13327 return
@@ -13303,14 +13340,31 @@ class HandleDynamicEffect { @@ -13303,14 +13340,31 @@ class HandleDynamicEffect {
13303 if (!flag) return 13340 if (!flag) return
13304 const node = this.getNodeByCmdId(subscriptionId) 13341 const node = this.getNodeByCmdId(subscriptionId)
13305 let isShow = false 13342 let isShow = false
13306 - if (node.visible && condition.type === HandleDynamicEffect.enumDisplayType.SHOW) {  
13307 - return  
13308 - } else if (condition.type === HandleDynamicEffect.enumDisplayType.SHOW) { 13343 + if (condition.type === HandleDynamicEffect.enumDisplayType.SHOW) {
13309 isShow = true 13344 isShow = true
13310 } else if (condition.type === HandleDynamicEffect.enumDisplayType.HIDDEN) { 13345 } else if (condition.type === HandleDynamicEffect.enumDisplayType.HIDDEN) {
13311 isShow = false 13346 isShow = false
13312 } 13347 }
13313 const updateFn = () => { 13348 const updateFn = () => {
  13349 + // let style = node.getStyle()
  13350 + // const reg = /opacity=(-?)\w+(;?)/g
  13351 + // style = style.replace(reg, '')
  13352 + // style += `opacity=${isShow ? 100 : 0};`
  13353 + // console.log(style)
  13354 + // node.setStyle(style)
  13355 +
  13356 + if (!isShow) {
  13357 + Object.keys(HandleDynamicEffect.enumActType).forEach(key => {
  13358 + const delKey = node.id + key
  13359 + this.delUpdateFn(delKey)
  13360 + })
  13361 + const temp = this.actNodeMapping.get(node.id)
  13362 + temp.display = false
  13363 + } else {
  13364 + const temp = this.actNodeMapping.get(node.id)
  13365 + temp.display = true
  13366 + }
  13367 +
13314 node.setVisible(isShow) 13368 node.setVisible(isShow)
13315 } 13369 }
13316 this.insertOnceUpdateFn(node, updateFn) 13370 this.insertOnceUpdateFn(node, updateFn)
@@ -13324,13 +13378,17 @@ class HandleDynamicEffect { @@ -13324,13 +13378,17 @@ class HandleDynamicEffect {
13324 flash(message) { 13378 flash(message) {
13325 const { subscriptionId, data } = message 13379 const { subscriptionId, data } = message
13326 const node = this.getNodeByCmdId(subscriptionId) 13380 const node = this.getNodeByCmdId(subscriptionId)
  13381 + const key = node.id + DispatchCenter.enumDynamicEffectType.FLASH
  13382 + if (!this.validatePriority(node.id)) {
  13383 + this.delUpdateFn(key)
  13384 + return
  13385 + }
13327 const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.FLASH, data) 13386 const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.FLASH, data)
13328 let flashFlag = false 13387 let flashFlag = false
13329 const updateFn = () => { 13388 const updateFn = () => {
13330 node.setVisible(flashFlag) 13389 node.setVisible(flashFlag)
13331 flashFlag = !flashFlag 13390 flashFlag = !flashFlag
13332 } 13391 }
13333 - const key = node.id + DispatchCenter.enumDynamicEffectType.FLASH  
13334 if (!flag) { 13392 if (!flag) {
13335 flashFlag = true 13393 flashFlag = true
13336 this.insertOnceUpdateFn(node, updateFn) 13394 this.insertOnceUpdateFn(node, updateFn)
@@ -13399,7 +13457,7 @@ class HandleDynamicEffect { @@ -13399,7 +13457,7 @@ class HandleDynamicEffect {
13399 getBindData(subscriptionId, actionType) { 13457 getBindData(subscriptionId, actionType) {
13400 const nodeId = this.getNodeIdByCmdId(subscriptionId) 13458 const nodeId = this.getNodeIdByCmdId(subscriptionId)
13401 const temp = this.actNodeMapping.get(nodeId) 13459 const temp = this.actNodeMapping.get(nodeId)
13402 - return temp.get(actionType) 13460 + return temp.value.get(actionType)
13403 } 13461 }
13404 13462
13405 /** 13463 /**
@@ -13421,6 +13479,15 @@ class HandleDynamicEffect { @@ -13421,6 +13479,15 @@ class HandleDynamicEffect {
13421 return this.DispatchInstance.contentAllCell.find(item => item.id === nodeId) 13479 return this.DispatchInstance.contentAllCell.find(item => item.id === nodeId)
13422 } 13480 }
13423 13481
  13482 + /**
  13483 + * @description 验证优先级
  13484 + * @param {string} nodeId
  13485 + * @returns
  13486 + */
  13487 + validatePriority(nodeId) {
  13488 + return this.actNodeMapping.get(nodeId).display
  13489 + }
  13490 +
13424 } 13491 }
13425 13492
13426 class UpdateQueue { 13493 class UpdateQueue {