fix: 详情页异常处理
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
<slot name="title"></slot>
|
||||
</div>
|
||||
</div>
|
||||
<div class="single-value__content" v-if="type === 52">
|
||||
</div>
|
||||
<div class="single-value__content" v-if="type === 53">
|
||||
<div class="content__title"></div>
|
||||
<div class="content__data"></div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
:ref="`chart-${chart.id}`"
|
||||
>
|
||||
<template v-for="chart in tab.children">
|
||||
<chart v-if="activeTab == tab.id" :key="chart.id" :chart="chart" :time-filter="timeFilter" :ref="`chart-${chart.id}`"></chart>
|
||||
<chart v-if="activeTab == tab.id" :key="chart.id" :chart="chart" :time-filter="timeFilter" :ref="`chart-${chart.id}`" :entity="entity"></chart>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -166,6 +166,7 @@ import {
|
||||
isEchartsWithStatistics,
|
||||
isMapLine,
|
||||
isMapBlock,
|
||||
isSingleValueWithEcharts,
|
||||
isTabs,
|
||||
getChartColor
|
||||
} from '@/components/charts/chart-options'
|
||||
@@ -185,7 +186,8 @@ export default {
|
||||
name: 'Chart',
|
||||
props: {
|
||||
chart: Object, // 图表对象,包括id、name、type等数据
|
||||
timeFilter: Object
|
||||
timeFilter: Object,
|
||||
entity: Object
|
||||
},
|
||||
components: {
|
||||
EchartsFrame,
|
||||
@@ -221,6 +223,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
initChart () {
|
||||
try {
|
||||
const chartParams = this.chartInfo.params
|
||||
if (this.isMap) {
|
||||
const { chart, polygonSeries } = this.initMap(`chart${this.chartInfo.id}`)
|
||||
@@ -248,18 +251,27 @@ export default {
|
||||
} else if (this.isSingleValue) {
|
||||
if (chartParams) {
|
||||
this.singleValue.icon = chartParams.icon
|
||||
const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000) }
|
||||
const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), ...this.entity }
|
||||
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.singleValue.value = response.data.result
|
||||
}
|
||||
})
|
||||
if (this.isSingleValueWithEcharts) { // 带曲线的单值图
|
||||
get(replaceUrlPlaceholder(chartParams.urlLine, queryParams)).then(response => {
|
||||
if (response.code === 200) {
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if (this.isTabs) {
|
||||
if (!this.$_.isEmpty(this.chartInfo.children)) {
|
||||
this.activeTab = `${this.chartInfo.children[0].id}`
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
},
|
||||
reloadChart () {
|
||||
this.initChart()
|
||||
@@ -652,6 +664,7 @@ export default {
|
||||
isEchartsWithTable: isEchartsWithTable(props.chart.type),
|
||||
isEchartsWithStatistics: isEchartsWithStatistics(props.chart.type),
|
||||
isSingleValue: isSingleValue(props.chart.type),
|
||||
isSingleValueWithEcharts: isSingleValueWithEcharts(props.chart.type),
|
||||
isTable: isTable(props.chart.type),
|
||||
isMap: isMap(props.chart.type),
|
||||
isTitle: isTitle(props.chart.type),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<DateTimeRange class="date-time-range" :start-time="timeFilter.startTime" :end-time="timeFilter.endTime" ref="dateTimeRange" @change="reload"/>
|
||||
<TimeRefresh class="date-time-range" @change="timeRefreshChange" :end-time="timeFilter.endTime"/>
|
||||
</div>
|
||||
<chart v-for="chart in chartList" :key="chart.id" :chart="chart" :time-filter="timeFilter" :ref="`chart-${chart.id}`"></chart>
|
||||
<chart v-for="chart in chartList" :key="chart.id" :chart="chart" :time-filter="timeFilter" :ref="`chart-${chart.id}`" :entity="entity"></chart>
|
||||
<!-- <grid-layout v-model:layout="chartList"
|
||||
:col-num="12"
|
||||
:row-height="30"
|
||||
@@ -88,11 +88,7 @@ export default {
|
||||
}
|
||||
},
|
||||
recursionParamsConvert (chart) {
|
||||
console.info(chart)
|
||||
chart.params = chart.params ? JSON.parse(chart.params) : null
|
||||
if (this.entity) {
|
||||
chart.params = { ...chart.params, ...this.entity }
|
||||
}
|
||||
if (!this.$_.isEmpty(chart.children)) {
|
||||
chart.children.forEach(c => {
|
||||
this.recursionParamsConvert(c)
|
||||
|
||||
Reference in New Issue
Block a user