对数据中的双引号和&进行特殊处理;panelName显示异常;

This commit is contained in:
hyx
2022-11-17 15:21:17 +08:00
parent 7c4b16d443
commit 2b34f8bc26
3 changed files with 14 additions and 7 deletions

View File

@@ -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)

View File

@@ -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 : []

View File

@@ -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') {