diff --git a/src/utils/tools.js b/src/utils/tools.js index aed2ce20..ef932fa8 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -392,9 +392,12 @@ export function replaceUrlPlaceholder (url, params) { _.forIn(params, (value, key) => { url = url.replace('{{' + key + '}}', value) }) - return url + return doubleQuotationToSingle(url) +} +// 双引号替换为单引号 +export function doubleQuotationToSingle (content) { + return content.replace(/\"/g, "'") } - // 下划线转换驼峰 export function lineToHump (name) { return name.replace(/\_(\w)/g, function (all, letter) { diff --git a/src/views/charts/Chart.vue b/src/views/charts/Chart.vue index cfb5a7f0..085a02a3 100644 --- a/src/views/charts/Chart.vue +++ b/src/views/charts/Chart.vue @@ -519,9 +519,9 @@ export default { if (data.resultType === 'matrix') { let allZero = true try { - data.forEach(d => { + data.result.forEach(d => { d.values.forEach(r => { - if (r[1] && r[1] !== '0' && r[1] !== 0) { + if (r[1] && r[1] !== '0') { allZero = false throw new Error('break') } @@ -627,7 +627,6 @@ export default { tableQueryParams[chartParams.nameColumn] = [] // 处理两个图表不一样的地方 get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => { if (response.code === 200) { - console.info(response) if (this.$_.isEmpty(response.data.result)) { this.noData = true return diff --git a/src/views/entities/EntityExplorer.vue b/src/views/entities/EntityExplorer.vue index d95b2031..54776b2c 100644 --- a/src/views/entities/EntityExplorer.vue +++ b/src/views/entities/EntityExplorer.vue @@ -39,6 +39,7 @@ import LeftFilter from '@/components/entities/LeftFilter' import EntityList from '@/components/entities/EntityList' import { getEntityFilter, getEntityList, getEntityCount } from '@/utils/api' import Panel from '@/views/charts/Panel' +import { doubleQuotationToSingle } from '@/utils/tools' export default { name: 'EntityExplorer', data () { @@ -102,7 +103,7 @@ export default { } default: break } - const { topFilterData, bottomFilterData } = await this.queryFilterData({ column, q: this.doubleQuotationToSingle(this.searchContent), from: this.from }) + const { topFilterData, bottomFilterData } = await this.queryFilterData({ column, q: doubleQuotationToSingle(this.searchContent), from: this.from }) if (index === 1) { this.bottomFilterData = { ...this.bottomFilterData, @@ -118,7 +119,7 @@ export default { } }, async search () { - const params = { from: this.from, q: this.doubleQuotationToSingle(this.searchContent) } + const params = { from: this.from, q: doubleQuotationToSingle(this.searchContent) } this.listData = await getEntityList({ ...this.pageObjRight, ...params }) this.pageObjRight.total = await getEntityCount(params) const { topFilterData, bottomFilterData } = await this.queryFilterData(params) @@ -296,7 +297,7 @@ export default { default: break } const params = { - q: this.doubleQuotationToSingle(this.searchContent), + q: doubleQuotationToSingle(this.searchContent), from: this.from, pageNo: 1, where, @@ -312,10 +313,6 @@ export default { this.pageObjRight.pageNo = val this.search() }, - // 双引号转为单引号 - doubleQuotationToSingle (content) { - return content.replace(/\"/g, "'") - }, entityDetail (entity, tabs) { const entityName = entity.domain || entity.clientIP || entity.serverIP || entity.appId this.$store.commit('setEntityName', entityName)