From 9c88eb5cbf6f23f8229ad2da39e9ff17b607e35f Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Wed, 21 Dec 2022 11:40:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BA=A0=E6=AD=A3=E6=8B=BC=E5=86=99?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E3=80=81=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/layout/Header.vue | 4 +-- src/utils/tools.js | 30 ++++++++----------- .../networkOverview/NetworkOverviewTabs.vue | 4 +-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/components/layout/Header.vue b/src/components/layout/Header.vue index 9a120120..75e9762e 100644 --- a/src/components/layout/Header.vue +++ b/src/components/layout/Header.vue @@ -228,7 +228,7 @@ import { getTabList, overwriteUrl, urlParamsHandler, - combinDrilldownTableWithUserConfig, + combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue } from '@/utils/tools' @@ -594,7 +594,7 @@ export default { // const userId = localStorage.getItem(storageKey.userId) const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s') - const drillDownTableConfigs = await combinDrilldownTableWithUserConfig() + const drillDownTableConfigs = await combineDrilldownTableWithUserConfig() const currentTableConfig = drillDownTableConfigs.find(config => config.route === tableType) const tables = currentTableConfig ? currentTableConfig.tables : [] const commonTabList = currentTableConfig ? currentTableConfig.tabs : [] diff --git a/src/utils/tools.js b/src/utils/tools.js index 31b15b4f..8148205b 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -415,7 +415,6 @@ export function extensionEchartY (chart) { // 该div用来盛放文本显示内容的,方便对其悬浮位置进行处理 const id = document.getElementById('extension') if (!id) { - const div = "
" const contentDiv = document.createElement('div') contentDiv.setAttribute('id', 'extension') contentDiv.setAttribute('style', 'display:block') @@ -938,28 +937,25 @@ export async function getDefaultCurTab (tableType, metric, columnName) { export async function readDrilldownTableConfigByUser () { // 获取用户定制的自定义配置 const userId = localStorage.getItem(storageKey.userId) - const userLocalCongfig = await db[dbDrilldownTableConfig].get({ id: userId }) + const userLocalConfig = await db[dbDrilldownTableConfig].get({ id: userId }) let defaultDrillDownTableConfigs = [] - if (userLocalCongfig) { - defaultDrillDownTableConfigs = userLocalCongfig.config + if (userLocalConfig) { + defaultDrillDownTableConfigs = userLocalConfig.config } return defaultDrillDownTableConfigs } export async function getConfigVersion (id) { - let defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: id }) - let version - if (defaultCongfigInDb) { - version = defaultCongfigInDb ? defaultCongfigInDb.version : '' - } else { - defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' }) + let defaultConfigInDb = await db[dbDrilldownTableConfig].get({ id: id }) + if (!defaultConfigInDb) { + defaultConfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' }) } - return version + return defaultConfigInDb.version || '' } -export async function combinDrilldownTableWithUserConfig () { - const defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' }) - const defaultConfigGroup = defaultCongfigInDb ? defaultCongfigInDb.config : [] +export async function combineDrilldownTableWithUserConfig () { + const defaultConfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' }) + const defaultConfigGroup = defaultConfigInDb ? defaultConfigInDb.config : [] const currentUserConfigGroup = await readDrilldownTableConfigByUser() if (defaultConfigGroup && currentUserConfigGroup && currentUserConfigGroup.length > 0) { defaultConfigGroup.forEach(defaultConfig => { @@ -976,7 +972,7 @@ export async function combinDrilldownTableWithUserConfig () { defaultTab.checked = currentUserTab.checked if (defaultTab && defaultTab.hasMetricSearch === true) { defaultTab.metrics.forEach(metric => { - if(currentUserTableConfig.columns) { + if (currentUserTableConfig.columns) { const sortColumns = [] sortColumns.push(metric.columns[0]) currentUserTableConfig.columns.forEach((column, index) => { @@ -995,7 +991,7 @@ export async function combinDrilldownTableWithUserConfig () { } }) } else { - if(currentUserTableConfig.columns) { + if (currentUserTableConfig.columns) { const sortColumns = [] sortColumns.push(defaultTab.columns[0]) currentUserTableConfig.columns.forEach((column, index) => { @@ -1026,7 +1022,7 @@ export async function combinDrilldownTableWithUserConfig () { export async function getUserDrilldownTableConfig (tableType, curMetric) { let list = [] // 获取用户定制的自定义配置,如果没有,则使用默认的自定义配置 - const drillDownTableConfigs = await combinDrilldownTableWithUserConfig() + const drillDownTableConfigs = await combineDrilldownTableWithUserConfig() const currentTableConfig = drillDownTableConfigs.find(config => config.route === tableType) const commonTabList = currentTableConfig ? currentTableConfig.tabs : [] const tables = currentTableConfig ? currentTableConfig.tables : [] diff --git a/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue b/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue index 9fa32041..14457424 100644 --- a/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue +++ b/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue @@ -201,7 +201,7 @@ import { ref } from 'vue' import { operationType, unitTypes, networkTable, tableColumnType, networkDefaultLimit, curTabState, storageKey, dbDrilldownTableConfig, fromRoute } from '@/utils/constants' import { get } from '@/utils/http' import unitConvert from '@/utils/unit-convert' -import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combinDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools' +import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools' import { getSecond } from '@/utils/date-util' import chartMixin from '@/views/charts2/chart-mixin' import { db } from '@/indexedDB' @@ -1866,7 +1866,7 @@ export default { this.commonColumnList = null this.userId = localStorage.getItem(storageKey.userId) - this.drillDownTableConfigs = await combinDrilldownTableWithUserConfig() + this.drillDownTableConfigs = await combineDrilldownTableWithUserConfig() this.tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' // 是否需要dns的qtype和rcode的数据字典 if (this.tableType === fromRoute.dnsServiceInsights) {