diff --git a/src/components/layout/Header.vue b/src/components/layout/Header.vue index b502d0c9..1d6b8984 100644 --- a/src/components/layout/Header.vue +++ b/src/components/layout/Header.vue @@ -229,7 +229,8 @@ import { overwriteUrl, urlParamsHandler, combinDrilldownTableWithUserConfig, - getDnsMapData + getDnsMapData, + handleSpecialValue } from '@/utils/tools' import { getNowTime, getSecond } from '@/utils/date-util' @@ -527,7 +528,7 @@ export default { this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' AND ') } else { searchProps.forEach(item => { - queryCondition.push(item + '=\'' + value.replaceAll('\'', '\\\\\'') + '\'') + queryCondition.push(item + '=\'' + handleSpecialValue(value) + '\'') }) this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' OR ') } @@ -624,7 +625,7 @@ export default { child.columnName = columnName this.urlChangeParams[this.curTabState.thirdMenu] = columnName this.urlChangeParams[this.curTabState.fourthMenu] = '' - this.urlChangeParams[this.curTabState.panelName] = columnValue + this.urlChangeParams[this.curTabState.panelName] = columnName const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s') const curTab = getDefaultCurTab(tableType, metric, columnName) diff --git a/src/utils/tools.js b/src/utils/tools.js index 8f0017ac..b89e3a31 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -877,6 +877,12 @@ export async function getDnsMapData (type) { } return codeValueMap } +export function handleSpecialValue(value){ + value = value.replaceAll("'", "\\\\'") + .replaceAll('"','\\"') + .replaceAll('&','%26') + return value +} export function combineTabList (tableType, list, commonTabList) { const curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview const listInCode = curTableInCode ? curTableInCode.tabList : [] diff --git a/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue b/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue index a82f9f8b..c99804df 100644 --- a/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue +++ b/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue @@ -199,7 +199,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, getUserDrilldownTableGeo, readDrilldownTableConfigByUser, combinDrilldownTableWithUserConfig, getDnsMapData } from '@/utils/tools' +import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, getUserDrilldownTableGeo, readDrilldownTableConfigByUser, combinDrilldownTableWithUserConfig, getDnsMapData,handleSpecialValue } from '@/utils/tools' import { getSecond } from '@/utils/date-util' import chartMixin from '@/views/charts2/chart-mixin' import ChartNoData from '@/views/charts/charts/ChartNoData' @@ -616,7 +616,7 @@ export default { let conditionGroup = tabList.filter(item => item != '') let conditionHandleRlt = [] conditionGroup.forEach(condition => { - condition = condition.replaceAll("'", "\\\\'") + condition = handleSpecialValue(condition)//condition.replaceAll("'", "\\\\'") condition = "'"+condition+ "'" conditionHandleRlt.push(condition) }) @@ -1073,7 +1073,7 @@ export default { this.urlChangeParams[this.curTabState.networkOverviewBeforeTab] = tab.prop }, setQueryCondition (tab, value) { - value = value.replaceAll("'", "\\\\'") + value = handleSpecialValue(value)//value.replaceAll("'", "\\\\'") const queryCondition = [] if (tab.prop === 'protocolPort') { const valueGroup = value.split(':') @@ -1230,7 +1230,7 @@ export default { this.$store.commit('setRouterHistoryList', historyList) }, handleSearchParams (columnValue) { - columnValue = columnValue.replaceAll("'", "\\\\'") + columnValue = handleSpecialValue(columnValue)//columnValue.replaceAll("'", "\\\\'") const queryCondition = [] const curTab = this.getCurTab() if (curTab.prop === 'protocolPort') {