fix: 解决折线图显示不全的问题

This commit is contained in:
chenjinsong
2021-08-16 11:34:37 +08:00
parent 7203213257
commit 225a6824b9
3 changed files with 11 additions and 12 deletions

View File

@@ -392,9 +392,12 @@ export function replaceUrlPlaceholder (url, params) {
_.forIn(params, (value, key) => { _.forIn(params, (value, key) => {
url = url.replace('{{' + key + '}}', value) url = url.replace('{{' + key + '}}', value)
}) })
return url return doubleQuotationToSingle(url)
}
// 双引号替换为单引号
export function doubleQuotationToSingle (content) {
return content.replace(/\"/g, "'")
} }
// 下划线转换驼峰 // 下划线转换驼峰
export function lineToHump (name) { export function lineToHump (name) {
return name.replace(/\_(\w)/g, function (all, letter) { return name.replace(/\_(\w)/g, function (all, letter) {

View File

@@ -519,9 +519,9 @@ export default {
if (data.resultType === 'matrix') { if (data.resultType === 'matrix') {
let allZero = true let allZero = true
try { try {
data.forEach(d => { data.result.forEach(d => {
d.values.forEach(r => { d.values.forEach(r => {
if (r[1] && r[1] !== '0' && r[1] !== 0) { if (r[1] && r[1] !== '0') {
allZero = false allZero = false
throw new Error('break') throw new Error('break')
} }
@@ -627,7 +627,6 @@ export default {
tableQueryParams[chartParams.nameColumn] = [] // 处理两个图表不一样的地方 tableQueryParams[chartParams.nameColumn] = [] // 处理两个图表不一样的地方
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => { get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
if (response.code === 200) { if (response.code === 200) {
console.info(response)
if (this.$_.isEmpty(response.data.result)) { if (this.$_.isEmpty(response.data.result)) {
this.noData = true this.noData = true
return return

View File

@@ -39,6 +39,7 @@ import LeftFilter from '@/components/entities/LeftFilter'
import EntityList from '@/components/entities/EntityList' import EntityList from '@/components/entities/EntityList'
import { getEntityFilter, getEntityList, getEntityCount } from '@/utils/api' import { getEntityFilter, getEntityList, getEntityCount } from '@/utils/api'
import Panel from '@/views/charts/Panel' import Panel from '@/views/charts/Panel'
import { doubleQuotationToSingle } from '@/utils/tools'
export default { export default {
name: 'EntityExplorer', name: 'EntityExplorer',
data () { data () {
@@ -102,7 +103,7 @@ export default {
} }
default: break 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) { if (index === 1) {
this.bottomFilterData = { this.bottomFilterData = {
...this.bottomFilterData, ...this.bottomFilterData,
@@ -118,7 +119,7 @@ export default {
} }
}, },
async search () { 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.listData = await getEntityList({ ...this.pageObjRight, ...params })
this.pageObjRight.total = await getEntityCount(params) this.pageObjRight.total = await getEntityCount(params)
const { topFilterData, bottomFilterData } = await this.queryFilterData(params) const { topFilterData, bottomFilterData } = await this.queryFilterData(params)
@@ -296,7 +297,7 @@ export default {
default: break default: break
} }
const params = { const params = {
q: this.doubleQuotationToSingle(this.searchContent), q: doubleQuotationToSingle(this.searchContent),
from: this.from, from: this.from,
pageNo: 1, pageNo: 1,
where, where,
@@ -312,10 +313,6 @@ export default {
this.pageObjRight.pageNo = val this.pageObjRight.pageNo = val
this.search() this.search()
}, },
// 双引号转为单引号
doubleQuotationToSingle (content) {
return content.replace(/\"/g, "'")
},
entityDetail (entity, tabs) { entityDetail (entity, tabs) {
const entityName = entity.domain || entity.clientIP || entity.serverIP || entity.appId const entityName = entity.domain || entity.clientIP || entity.serverIP || entity.appId
this.$store.commit('setEntityName', entityName) this.$store.commit('setEntityName', entityName)