# Conflicts:
#	src/views/charts/PanelChart.vue
This commit is contained in:
@changcode
2022-01-26 17:10:41 +08:00
3 changed files with 16 additions and 7 deletions

View File

@@ -75,7 +75,7 @@ import {
isAppRelatedDomain,
isBlock
} from './charts/tools'
import { tableTitleMapping } from '@/components/charts/chart-table-title'
import { tableTitleMapping, legendMapping } from '@/components/charts/chart-table-title'
import { replaceUrlPlaceholder } from '@/utils/tools'
import { getNowTime, getSecond } from '@/utils/date-util'
import { chartPieTableTopOptions, chartTableDefaultPageSize, chartTableTopOptions } from '@/utils/constants'
@@ -166,6 +166,7 @@ export default {
methods: {
/* 参数 extraParams 额外请求参数isRefresh 是否是刷新 */
getChartData (url, extraParams = {}, isRefresh) {
const vm = this
this.loading = true
this.standaloneTimeRange.use = !!isRefresh
try {
@@ -194,6 +195,13 @@ export default {
response = testData.data2
}
if (response.code === 200) {
if (Array.isArray(response.data.result)) {
response.data.result.forEach(item => {
if (item.legend && legendMapping[`${this.entity && this.entity.ip ? 'ip_' : ''}${item.legend}`]) {
item.legend = vm.$t(legendMapping[`${this.entity && this.entity.ip ? 'ip_' : ''}${item.legend}`])
}
})
}
this.chartData = response.data.result
this.table.tableData = response.data.result
this.table.tableColumns = this.getTableTitle(response.data.result)