Commit 2beb161adf9702c2e6da826d01c1efd731ee4479
1 parent
edb4d5a6
perf: chart component add legend && title
Showing
1 changed file
with
148 additions
and
34 deletions
@@ -5924,9 +5924,9 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -5924,9 +5924,9 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
5924 | [componentType.VARIABLE]: getSubmitValue, | 5924 | [componentType.VARIABLE]: getSubmitValue, |
5925 | [componentType.LINE]: getSubmitValue, | 5925 | [componentType.LINE]: getSubmitValue, |
5926 | [componentType.REAL_TIME]: getSubmitValue, | 5926 | [componentType.REAL_TIME]: getSubmitValue, |
5927 | - [componentType.LINE_CHART]: getSubmitValue, | ||
5928 | - [componentType.BAR_CHART]: getSubmitValue, | ||
5929 | - [componentType.DASHBOARD_CHART]: getSubmitValue, | 5927 | + [componentType.LINE_CHART]: getChartSubmitValue, |
5928 | + [componentType.BAR_CHART]: getChartSubmitValue, | ||
5929 | + [componentType.DASHBOARD_CHART]: getChartSubmitValue, | ||
5930 | [componentType.DEFAULT]: getSubmitValue, | 5930 | [componentType.DEFAULT]: getSubmitValue, |
5931 | [componentType.VIDEO]: getVideoSubmitValue, | 5931 | [componentType.VIDEO]: getVideoSubmitValue, |
5932 | [componentType.SWITCH]: getSwitchSubmitValue, | 5932 | [componentType.SWITCH]: getSwitchSubmitValue, |
@@ -5941,7 +5941,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -5941,7 +5941,6 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
5941 | function getSubmitValue(field) { | 5941 | function getSubmitValue(field) { |
5942 | const ENABLED_FLAG = 'on' | 5942 | const ENABLED_FLAG = 'on' |
5943 | const additionalKey = HandleDataSource.enumConst | 5943 | const additionalKey = HandleDataSource.enumConst |
5944 | - | ||
5945 | const value = { | 5944 | const value = { |
5946 | configurationId, | 5945 | configurationId, |
5947 | contentId: currentPageId.id, | 5946 | contentId: currentPageId.id, |
@@ -5962,6 +5961,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -5962,6 +5961,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
5962 | } : null | 5961 | } : null |
5963 | }, | 5962 | }, |
5964 | } | 5963 | } |
5964 | + | ||
5965 | const allType = [...interactionList, ...dynamicEffectList] | 5965 | const allType = [...interactionList, ...dynamicEffectList] |
5966 | for (const item of allType) { | 5966 | for (const item of allType) { |
5967 | if (field[item.type] === ENABLED_FLAG) { | 5967 | if (field[item.type] === ENABLED_FLAG) { |
@@ -5982,6 +5982,37 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -5982,6 +5982,37 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
5982 | return value | 5982 | return value |
5983 | } | 5983 | } |
5984 | 5984 | ||
5985 | + function getChartSubmitValue() { | ||
5986 | + const additionalKey = HandleDataSource.enumConst | ||
5987 | + | ||
5988 | + const value = { | ||
5989 | + configurationId, | ||
5990 | + contentId: currentPageId.id, | ||
5991 | + nodeId: graphId, | ||
5992 | + [enumCategory.ACT]: [], | ||
5993 | + [enumCategory.EVENT]: [], | ||
5994 | + [enumCategory.DATA_SOURCE]: { | ||
5995 | + [enumDataSourceConst.ORG_ID]: field[enumDataSourceConst.ORG_ID], | ||
5996 | + [enumDataSourceConst.DEVICE_ID]: field[enumDataSourceConst.DEVICE_ID], | ||
5997 | + [enumDataSourceConst.SLAVE_DEVICE_ID]: field[enumDataSourceConst.SLAVE_DEVICE_ID] ? field[enumDataSourceConst.SLAVE_DEVICE_ID] : '', | ||
5998 | + [enumDataSourceConst.ATTR]: field[enumDataSourceConst.ATTR], | ||
5999 | + [enumDataSourceConst.ADDITIONAL]: { | ||
6000 | + [additionalKey.ORG_NAME]: field[additionalKey.ORG_NAME], | ||
6001 | + [additionalKey.DEVICE_NAME]: field[additionalKey.DEVICE_NAME], | ||
6002 | + [additionalKey.SLAVE_DEVICE_NAME]: field[additionalKey.SLAVE_DEVICE_NAME], | ||
6003 | + [additionalKey.ATTR_NAME]: field[additionalKey.ATTR_NAME], | ||
6004 | + [additionalKey.AGG]: field[additionalKey.AGG], | ||
6005 | + [additionalKey.DATA_TYPE]: field[additionalKey.DATA_TYPE], | ||
6006 | + [additionalKey.INTERVAL]: field[additionalKey.INTERVAL], | ||
6007 | + [additionalKey.EFFECT_SCOPE]: field[additionalKey.EFFECT_SCOPE], | ||
6008 | + ...(field[additionalKey.UNIT] ? { [additionalKey.UNIT]: field[additionalKey.UNIT] } : {}) | ||
6009 | + } | ||
6010 | + }, | ||
6011 | + } | ||
6012 | + | ||
6013 | + return value | ||
6014 | + } | ||
6015 | + | ||
5985 | function getVideoSubmitValue() { | 6016 | function getVideoSubmitValue() { |
5986 | const value = { | 6017 | const value = { |
5987 | configurationId, | 6018 | configurationId, |
@@ -7738,13 +7769,24 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7738,13 +7769,24 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7738 | SLAVE_DEVICE_ID: 'slaveDeviceId', | 7769 | SLAVE_DEVICE_ID: 'slaveDeviceId', |
7739 | ATTR: 'attr', | 7770 | ATTR: 'attr', |
7740 | GATEWAY: 'GATEWAY', | 7771 | GATEWAY: 'GATEWAY', |
7772 | + ORG_NAME: 'orgName', | ||
7773 | + DEVICE_NAME: 'deviceName', | ||
7774 | + SLAVE_DEVICE_NAME: 'slaveDeviceName', | ||
7775 | + ATTR_NAME: 'attrName' | ||
7741 | } | 7776 | } |
7777 | + | ||
7742 | /** | 7778 | /** |
7743 | * @description | 7779 | * @description |
7744 | * @type {{id: string, deviceType: string, name: string}[]} | 7780 | * @type {{id: string, deviceType: string, name: string}[]} |
7745 | */ | 7781 | */ |
7746 | let deviceList = [] | 7782 | let deviceList = [] |
7747 | 7783 | ||
7784 | + /** | ||
7785 | + * @description | ||
7786 | + * @type {{id: string, deviceType: string, name: string}[]} | ||
7787 | + */ | ||
7788 | + let slaveDeviceList = [] | ||
7789 | + | ||
7748 | const component = document.createElement('div') | 7790 | const component = document.createElement('div') |
7749 | 7791 | ||
7750 | $(component) | 7792 | $(component) |
@@ -7761,6 +7803,25 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7761,6 +7803,25 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7761 | generatorDeviceSelect() | 7803 | generatorDeviceSelect() |
7762 | generatorSlaveDevice() | 7804 | generatorSlaveDevice() |
7763 | generatorAttrSelect() | 7805 | generatorAttrSelect() |
7806 | + generateDeviceNameInput() | ||
7807 | + } | ||
7808 | + | ||
7809 | + async function generateDeviceNameInput() { | ||
7810 | + const template = ` | ||
7811 | + <div class="layui-form-item" style="margin-bottom: 0"> | ||
7812 | + <input style="display: none" type="text" name="${enumDataSourceConst.ORG_NAME}" class="layui-input"> | ||
7813 | + </div> | ||
7814 | + <div class="layui-form-item" style="margin-bottom: 0"> | ||
7815 | + <input style="display: none" type="text" name="${enumDataSourceConst.DEVICE_NAME}" class="layui-input"> | ||
7816 | + </div> | ||
7817 | + <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 | + <input style="display: none" type="text" name="${enumDataSourceConst.ATTR_NAME}" class="layui-input"> | ||
7822 | + </div> | ||
7823 | + ` | ||
7824 | + $(component).append(template) | ||
7764 | } | 7825 | } |
7765 | 7826 | ||
7766 | 7827 | ||
@@ -7780,7 +7841,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7780,7 +7841,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7780 | */ | 7841 | */ |
7781 | async function getSlaveDeviceByMasterDeviceId(orgId, deviceId) { | 7842 | async function getSlaveDeviceByMasterDeviceId(orgId, deviceId) { |
7782 | if (deviceId && currentCheckedOrgNode) { | 7843 | if (deviceId && currentCheckedOrgNode) { |
7783 | - const items = await ConfigurationNodeApi.getSlaveDevice(orgId, deviceId); | 7844 | + const items = slaveDeviceList = await ConfigurationNodeApi.getSlaveDevice(orgId, deviceId); |
7784 | $(`#${componentId} `).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: items })) | 7845 | $(`#${componentId} `).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: items })) |
7785 | form.render('select', componentFilter) | 7846 | form.render('select', componentFilter) |
7786 | } | 7847 | } |
@@ -7823,9 +7884,13 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7823,9 +7884,13 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7823 | click(node) { | 7884 | click(node) { |
7824 | currentCheckedOrgNode = node.data.id | 7885 | currentCheckedOrgNode = node.data.id |
7825 | form.val(componentFilter, { | 7886 | form.val(componentFilter, { |
7887 | + [enumDataSourceConst.ORG_NAME]: node.data.title, | ||
7826 | [enumDataSourceConst.DEVICE_ID]: null, | 7888 | [enumDataSourceConst.DEVICE_ID]: null, |
7827 | [enumDataSourceConst.SLAVE_DEVICE_ID]: null, | 7889 | [enumDataSourceConst.SLAVE_DEVICE_ID]: null, |
7828 | [enumDataSourceConst.ATTR]: null, | 7890 | [enumDataSourceConst.ATTR]: null, |
7891 | + [enumDataSourceConst.DEVICE_NAME]: null, | ||
7892 | + [enumDataSourceConst.SLAVE_DEVICE_NAME]: null, | ||
7893 | + [enumDataSourceConst.ATTR_NAME]: null, | ||
7829 | }) | 7894 | }) |
7830 | getDevicesByOrgId(node.data.id) | 7895 | getDevicesByOrgId(node.data.id) |
7831 | }, | 7896 | }, |
@@ -7847,8 +7912,11 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7847,8 +7912,11 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7847 | const { value } = data | 7912 | const { value } = data |
7848 | const selected = deviceList.find(item => item.id === value) | 7913 | const selected = deviceList.find(item => item.id === value) |
7849 | form.val(componentFilter, { | 7914 | form.val(componentFilter, { |
7915 | + [enumDataSourceConst.DEVICE_NAME]: selected.name, | ||
7850 | [enumDataSourceConst.SLAVE_DEVICE_ID]: null, | 7916 | [enumDataSourceConst.SLAVE_DEVICE_ID]: null, |
7851 | [enumDataSourceConst.ATTR]: null, | 7917 | [enumDataSourceConst.ATTR]: null, |
7918 | + [enumDataSourceConst.SLAVE_DEVICE_NAME]: null, | ||
7919 | + [enumDataSourceConst.ATTR_NAME]: null, | ||
7852 | }) | 7920 | }) |
7853 | if (!selected) return | 7921 | if (!selected) return |
7854 | if (selected.deviceType === enumDataSourceConst.GATEWAY) { | 7922 | if (selected.deviceType === enumDataSourceConst.GATEWAY) { |
@@ -7878,8 +7946,11 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7878,8 +7946,11 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7878 | className: 'data-source__component-select', | 7946 | className: 'data-source__component-select', |
7879 | onClick(data) { | 7947 | onClick(data) { |
7880 | const { value } = data | 7948 | const { value } = data |
7949 | + const selected = slaveDeviceList.find(item => item.id === value) | ||
7881 | form.val(componentFilter, { | 7950 | form.val(componentFilter, { |
7951 | + [enumDataSourceConst.SLAVE_DEVICE_NAME]: selected.name, | ||
7882 | [enumDataSourceConst.ATTR]: null, | 7952 | [enumDataSourceConst.ATTR]: null, |
7953 | + [enumDataSourceConst.ATTR_NAME]: null, | ||
7883 | }) | 7954 | }) |
7884 | getAttrByDeviceId(value) | 7955 | getAttrByDeviceId(value) |
7885 | }, | 7956 | }, |
@@ -7897,6 +7968,12 @@ DataFormatPanel.prototype.addDataFont = function (container) { | @@ -7897,6 +7968,12 @@ DataFormatPanel.prototype.addDataFont = function (container) { | ||
7897 | layFilter: `${componentFilter}--${enumDataSourceConst.ATTR}`, | 7968 | layFilter: `${componentFilter}--${enumDataSourceConst.ATTR}`, |
7898 | className: 'data-source__component-select', | 7969 | className: 'data-source__component-select', |
7899 | ...validateRule, | 7970 | ...validateRule, |
7971 | + onClick(data) { | ||
7972 | + const { value } = data | ||
7973 | + form.val(componentFilter, { | ||
7974 | + [enumDataSourceConst.ATTR_NAME]: value, | ||
7975 | + }) | ||
7976 | + } | ||
7900 | }) | 7977 | }) |
7901 | $(component).append(attrsSelect) | 7978 | $(component).append(attrsSelect) |
7902 | } | 7979 | } |
@@ -13130,7 +13207,7 @@ class DispatchCenter { | @@ -13130,7 +13207,7 @@ class DispatchCenter { | ||
13130 | this.graph = editor.graph | 13207 | this.graph = editor.graph |
13131 | this.currentPage = currentPage | 13208 | this.currentPage = currentPage |
13132 | // this.contentAllCell = this.graph.getDefaultParent().children || [] | 13209 | // this.contentAllCell = this.graph.getDefaultParent().children || [] |
13133 | - this.contentAllCell = Object.entries(this.graph?.getModel()?.cells || {}).map(([_, item]) => item) || [] | 13210 | + this.contentAllCell = Object.entries(this.graph?.getModel()?.cells || {}).map(([_, item]) => item) || [] |
13134 | } | 13211 | } |
13135 | 13212 | ||
13136 | /** | 13213 | /** |
@@ -13286,7 +13363,27 @@ class HandleDataSource { | @@ -13286,7 +13363,27 @@ class HandleDataSource { | ||
13286 | /** | 13363 | /** |
13287 | * @description 绑定数据类型 | 13364 | * @description 绑定数据类型 |
13288 | */ | 13365 | */ |
13289 | - DATA_TYPE: 'dataType' | 13366 | + DATA_TYPE: 'dataType', |
13367 | + | ||
13368 | + /** | ||
13369 | + * @description 组织名称 | ||
13370 | + */ | ||
13371 | + ORG_NAME: 'orgName', | ||
13372 | + | ||
13373 | + /** | ||
13374 | + * @description 设备名称 | ||
13375 | + */ | ||
13376 | + DEVICE_NAME: 'deviceName', | ||
13377 | + | ||
13378 | + /** | ||
13379 | + * @description 子设备名称 | ||
13380 | + */ | ||
13381 | + SLAVE_DEVICE_NAME: 'slaveDeviceName', | ||
13382 | + | ||
13383 | + /** | ||
13384 | + * @description 属性名称 | ||
13385 | + */ | ||
13386 | + ATTR_NAME: 'attrName' | ||
13290 | } | 13387 | } |
13291 | 13388 | ||
13292 | 13389 | ||
@@ -13353,7 +13450,7 @@ class HandleDataSource { | @@ -13353,7 +13450,7 @@ class HandleDataSource { | ||
13353 | 13450 | ||
13354 | get contentAllCell() { | 13451 | get contentAllCell() { |
13355 | // return this.graph.getDefaultParent().children || [] | 13452 | // return this.graph.getDefaultParent().children || [] |
13356 | - return Object.entries(this.graph?.getModel()?.cells || {}).map(([_, item]) => item) || [] | 13453 | + return Object.entries(this.graph?.getModel()?.cells || {}).map(([_, item]) => item) || [] |
13357 | } | 13454 | } |
13358 | 13455 | ||
13359 | /** | 13456 | /** |
@@ -13549,7 +13646,7 @@ class HandleDataSource { | @@ -13549,7 +13646,7 @@ class HandleDataSource { | ||
13549 | const chartInstanceId = node.getAttribute(enumConst.CHART_INSTANCE_ID) | 13646 | const chartInstanceId = node.getAttribute(enumConst.CHART_INSTANCE_ID) |
13550 | const chartInstanceType = node.getAttribute(enumConst.COMPONENT_TYPE) | 13647 | const chartInstanceType = node.getAttribute(enumConst.COMPONENT_TYPE) |
13551 | const instance = chartInstanceMap.get(chartInstanceId) | 13648 | const instance = chartInstanceMap.get(chartInstanceId) |
13552 | - const { attr = [[]] } = this.getBindData(subscriptionId) | 13649 | + const { attr = [[]], additional } = this.getBindData(subscriptionId) |
13553 | const realDataList = data[attr] || [] | 13650 | const realDataList = data[attr] || [] |
13554 | 13651 | ||
13555 | const action = agg === 'NONE' ? 'unshift' : 'push' | 13652 | const action = agg === 'NONE' ? 'unshift' : 'push' |
@@ -13558,12 +13655,13 @@ class HandleDataSource { | @@ -13558,12 +13655,13 @@ class HandleDataSource { | ||
13558 | const isActive = instance.isActive | 13655 | const isActive = instance.isActive |
13559 | if (!isActive) { | 13656 | if (!isActive) { |
13560 | instance.isActive = true | 13657 | instance.isActive = true |
13561 | - const chartOption = this.getChartComponentOption(chartInstanceType, { chartType: chartInstanceType, attr, dataList: realDataList, action, nodeId: node.id }) | 13658 | + const chartOption = this.getChartComponentOption(chartInstanceType, { chartType: chartInstanceType, attr, dataList: realDataList, action, nodeId: node.id , additional}) |
13659 | + console.log(chartOption) | ||
13562 | instance.setOption(chartOption) | 13660 | instance.setOption(chartOption) |
13563 | 13661 | ||
13564 | } else { | 13662 | } else { |
13565 | const oldOptions = instance.getOption() | 13663 | const oldOptions = instance.getOption() |
13566 | - const options = this.getRealTimeUpdateChartOption(chartInstanceType, { oldOptions, dataList: realDataList }) | 13664 | + const options = this.getRealTimeUpdateChartOption(chartInstanceType, { oldOptions, dataList: realDataList , additional}) |
13567 | if (!instance) clearInterval(interval) | 13665 | if (!instance) clearInterval(interval) |
13568 | instance && instance.setOption(options) | 13666 | instance && instance.setOption(options) |
13569 | } | 13667 | } |
@@ -13581,12 +13679,12 @@ class HandleDataSource { | @@ -13581,12 +13679,12 @@ class HandleDataSource { | ||
13581 | const chartInstanceId = node.getAttribute(enumConst.CHART_INSTANCE_ID) | 13679 | const chartInstanceId = node.getAttribute(enumConst.CHART_INSTANCE_ID) |
13582 | const chartInstanceType = node.getAttribute(enumConst.COMPONENT_TYPE) | 13680 | const chartInstanceType = node.getAttribute(enumConst.COMPONENT_TYPE) |
13583 | const instance = chartInstanceMap.get(chartInstanceId) | 13681 | const instance = chartInstanceMap.get(chartInstanceId) |
13584 | - const { attr = [[]] } = this.getBindData(subscriptionId) | 13682 | + const { attr = [[]], additional } = this.getBindData(subscriptionId) |
13585 | const historyDataList = data[attr] || [] | 13683 | const historyDataList = data[attr] || [] |
13586 | const showNumberOf = 4 | 13684 | const showNumberOf = 4 |
13587 | const action = agg === 'NONE' ? 'unshift' : 'push' | 13685 | const action = agg === 'NONE' ? 'unshift' : 'push' |
13588 | 13686 | ||
13589 | - const chartOption = this.getChartComponentOption(chartInstanceType, { dataList: historyDataList, attr, chartType: chartInstanceType, action }) | 13687 | + const chartOption = this.getChartComponentOption(chartInstanceType, { dataList: historyDataList, attr, chartType: chartInstanceType, action, additional }) |
13590 | 13688 | ||
13591 | let interval | 13689 | let interval |
13592 | // TODO 清除定时器 | 13690 | // TODO 清除定时器 |
@@ -13624,14 +13722,14 @@ class HandleDataSource { | @@ -13624,14 +13722,14 @@ class HandleDataSource { | ||
13624 | } | 13722 | } |
13625 | 13723 | ||
13626 | getChartComponentOption(chartInstanceType, params) { | 13724 | getChartComponentOption(chartInstanceType, params) { |
13627 | - const { LINE_CHART, BAR_CHART, DASHBOARD_CHART } = Sidebar.prototype.enumComponentType | 13725 | + const { LINE_CHART, BAR_CHART, DASHBOARD_CHART, additional } = Sidebar.prototype.enumComponentType |
13628 | switch (chartInstanceType) { | 13726 | switch (chartInstanceType) { |
13629 | case LINE_CHART: | 13727 | case LINE_CHART: |
13630 | - return this.getBasicChartOption(Object.assign(params, { chartType: 'line' })) | 13728 | + return this.getBasicChartOption(Object.assign(params, { chartType: 'line' }, additional)) |
13631 | case BAR_CHART: | 13729 | case BAR_CHART: |
13632 | - return this.getBasicChartOption(Object.assign(params, { chartType: 'bar' })) | 13730 | + return this.getBasicChartOption(Object.assign(params, { chartType: 'bar' }), additional) |
13633 | case DASHBOARD_CHART: | 13731 | case DASHBOARD_CHART: |
13634 | - return this.getDashboardChartOption(params) | 13732 | + return this.getDashboardChartOption(Object.assign(params, additional)) |
13635 | default: | 13733 | default: |
13636 | return {} | 13734 | return {} |
13637 | } | 13735 | } |
@@ -13656,9 +13754,9 @@ class HandleDataSource { | @@ -13656,9 +13754,9 @@ class HandleDataSource { | ||
13656 | * @param {@} params | 13754 | * @param {@} params |
13657 | * @returns | 13755 | * @returns |
13658 | */ | 13756 | */ |
13659 | - getBasicChartOption(params = { dataList: [], attr: '', chartType: 'bar', action }) { | ||
13660 | - const { dataList = [], attr = '', chartType = 'bar', action } = params | ||
13661 | - | 13757 | + getBasicChartOption(params = { dataList: [], attr: '', chartType: 'bar', action, additional }) { |
13758 | + const { dataList = [], attr = '', chartType = 'bar', action, additional = {} } = params | ||
13759 | + const { deviceName, slaveDeviceName, attrName } = additional | ||
13662 | const xAxisData = [] | 13760 | const xAxisData = [] |
13663 | const seriesValue = [] | 13761 | const seriesValue = [] |
13664 | 13762 | ||
@@ -13667,13 +13765,13 @@ class HandleDataSource { | @@ -13667,13 +13765,13 @@ class HandleDataSource { | ||
13667 | xAxisData[action](new Date(Number(timespan)).toLocaleTimeString()) | 13765 | xAxisData[action](new Date(Number(timespan)).toLocaleTimeString()) |
13668 | seriesValue[action](Number(value)) | 13766 | seriesValue[action](Number(value)) |
13669 | }) | 13767 | }) |
13670 | - | ||
13671 | return { | 13768 | return { |
13672 | title: { | 13769 | title: { |
13770 | + text: slaveDeviceName || deviceName, | ||
13673 | subtext: dataList.length ? '' : '暂无数据', | 13771 | subtext: dataList.length ? '' : '暂无数据', |
13674 | - x: 'center', | ||
13675 | - y: 'center', | ||
13676 | - itemGap: -20, | 13772 | + x: dataList.length ? '' : 'center', |
13773 | + y: dataList.length ? '' : 'center', | ||
13774 | + // itemGap: -20, | ||
13677 | subtextStyle: { | 13775 | subtextStyle: { |
13678 | fontSize: 16 | 13776 | fontSize: 16 |
13679 | } | 13777 | } |
@@ -13684,6 +13782,9 @@ class HandleDataSource { | @@ -13684,6 +13782,9 @@ class HandleDataSource { | ||
13684 | type: 'shadow' | 13782 | type: 'shadow' |
13685 | } | 13783 | } |
13686 | }, | 13784 | }, |
13785 | + legend: { | ||
13786 | + data: [attrName] | ||
13787 | + }, | ||
13687 | grid: { | 13788 | grid: { |
13688 | left: '3%', | 13789 | left: '3%', |
13689 | right: '3%', | 13790 | right: '3%', |
@@ -13711,6 +13812,7 @@ class HandleDataSource { | @@ -13711,6 +13812,7 @@ class HandleDataSource { | ||
13711 | }, | 13812 | }, |
13712 | series: [ | 13813 | series: [ |
13713 | { | 13814 | { |
13815 | + name: attrName, | ||
13714 | data: seriesValue, | 13816 | data: seriesValue, |
13715 | type: chartType, | 13817 | type: chartType, |
13716 | } | 13818 | } |
@@ -13724,8 +13826,9 @@ class HandleDataSource { | @@ -13724,8 +13826,9 @@ class HandleDataSource { | ||
13724 | } | 13826 | } |
13725 | } | 13827 | } |
13726 | 13828 | ||
13727 | - getRealTimeUpdateBasicChartOption(params = { oldOptions: {}, dataList: [] }) { | ||
13728 | - const { oldOptions, dataList } = params | 13829 | + getRealTimeUpdateBasicChartOption(params = { oldOptions: {}, dataList: [], additional: {} }) { |
13830 | + const { oldOptions, dataList, additional = {} } = params | ||
13831 | + const { slaveDeviceName, deviceName, attrName } = additional | ||
13729 | const xAxisData = oldOptions.xAxis[0].data || [] | 13832 | const xAxisData = oldOptions.xAxis[0].data || [] |
13730 | const seriesValue = oldOptions.series[0].data || [] | 13833 | const seriesValue = oldOptions.series[0].data || [] |
13731 | const oldEndValue = Number(oldOptions.dataZoom[0].endValue) || 0 | 13834 | const oldEndValue = Number(oldOptions.dataZoom[0].endValue) || 0 |
@@ -13748,13 +13851,20 @@ class HandleDataSource { | @@ -13748,13 +13851,20 @@ class HandleDataSource { | ||
13748 | 13851 | ||
13749 | return { | 13852 | return { |
13750 | title: { | 13853 | title: { |
13751 | - subtext: '' | 13854 | + text: slaveDeviceName || deviceName, |
13855 | + subtext: '', | ||
13856 | + x: dataList.length ? '' : 'center', | ||
13857 | + y: dataList.length ? '' : 'center', | ||
13858 | + }, | ||
13859 | + legend: { | ||
13860 | + data: [attrName] | ||
13752 | }, | 13861 | }, |
13753 | xAxis: { | 13862 | xAxis: { |
13754 | data: xAxisData | 13863 | data: xAxisData |
13755 | }, | 13864 | }, |
13756 | series: [ | 13865 | series: [ |
13757 | { | 13866 | { |
13867 | + name: attrName, | ||
13758 | data: seriesValue | 13868 | data: seriesValue |
13759 | } | 13869 | } |
13760 | ], | 13870 | ], |
@@ -13767,8 +13877,9 @@ class HandleDataSource { | @@ -13767,8 +13877,9 @@ class HandleDataSource { | ||
13767 | } | 13877 | } |
13768 | } | 13878 | } |
13769 | 13879 | ||
13770 | - getDashboardChartOption(params = { dataList: [], nodeId }) { | ||
13771 | - const { dataList = [], nodeId } = params | 13880 | + getDashboardChartOption(params = { dataList: [], nodeId, additional: {} }) { |
13881 | + const { dataList = [], nodeId, additional = {} } = params | ||
13882 | + const { deviceName, slaveDeviceName, attrName } = additional | ||
13772 | const dataSource = this.DispatchInstance.contentData.dataSources.find(item => item.nodeId === nodeId) || {} | 13883 | const dataSource = this.DispatchInstance.contentData.dataSources.find(item => item.nodeId === nodeId) || {} |
13773 | const { additional: { unit = '°C' } = {} } = dataSource | 13884 | const { additional: { unit = '°C' } = {} } = dataSource |
13774 | 13885 | ||
@@ -13825,7 +13936,8 @@ class HandleDataSource { | @@ -13825,7 +13936,8 @@ class HandleDataSource { | ||
13825 | show: false | 13936 | show: false |
13826 | }, | 13937 | }, |
13827 | title: { | 13938 | title: { |
13828 | - show: false | 13939 | + text: slaveDeviceName || deviceName, |
13940 | + // show: false | ||
13829 | }, | 13941 | }, |
13830 | detail: { | 13942 | detail: { |
13831 | valueAnimation: true, | 13943 | valueAnimation: true, |
@@ -13851,13 +13963,15 @@ class HandleDataSource { | @@ -13851,13 +13963,15 @@ class HandleDataSource { | ||
13851 | /** | 13963 | /** |
13852 | * @description 获取仪表盘配置 | 13964 | * @description 获取仪表盘配置 |
13853 | */ | 13965 | */ |
13854 | - getRealTimeUpdateDashboardChartOption(params = { dataList: [] }) { | ||
13855 | - const { dataList = [], oldOptions } = params | 13966 | + getRealTimeUpdateDashboardChartOption(params = { dataList: [] , additional: {}}) { |
13967 | + const { dataList = [], oldOptions, additional } = params | ||
13968 | + const { attrName } = additional | ||
13856 | const [timespan, value] = dataList[0] || [] | 13969 | const [timespan, value] = dataList[0] || [] |
13857 | console.log(value) | 13970 | console.log(value) |
13858 | return { | 13971 | return { |
13859 | series: [ | 13972 | series: [ |
13860 | { | 13973 | { |
13974 | + name: attrName, | ||
13861 | data: [ | 13975 | data: [ |
13862 | { | 13976 | { |
13863 | value | 13977 | value |
@@ -13872,7 +13986,7 @@ class HandleDataSource { | @@ -13872,7 +13986,7 @@ class HandleDataSource { | ||
13872 | * @description 获取绑定的数据 | 13986 | * @description 获取绑定的数据 |
13873 | * @param subscriptionId | 13987 | * @param subscriptionId |
13874 | * @param actionType | 13988 | * @param actionType |
13875 | - * @return {*} | 13989 | + * @return {{attr: string, additional: { agg: string, dataType: string, effectScope: string, interval: string, unit: string, orgName: string, deviceName: string, slaveDeviceName: string, attrName: string }}} |
13876 | */ | 13990 | */ |
13877 | getBindData(subscriptionId) { | 13991 | getBindData(subscriptionId) { |
13878 | const nodeId = this.getNodeIdByCmdId(subscriptionId) | 13992 | const nodeId = this.getNodeIdByCmdId(subscriptionId) |
@@ -14491,7 +14605,7 @@ class HandleDynamicEffect { | @@ -14491,7 +14605,7 @@ class HandleDynamicEffect { | ||
14491 | 14605 | ||
14492 | get contentAllCell() { | 14606 | get contentAllCell() { |
14493 | // return this.graph.getDefaultParent().children || [] | 14607 | // return this.graph.getDefaultParent().children || [] |
14494 | - return Object.entries(this.graph?.getModel()?.cells || {}).map(([_, item]) => item) || [] | 14608 | + return Object.entries(this.graph?.getModel()?.cells || {}).map(([_, item]) => item) || [] |
14495 | } | 14609 | } |
14496 | 14610 | ||
14497 | /** | 14611 | /** |