2021-06-20 13:31:55 +08:00
|
|
|
|
<template>
|
2021-07-01 21:39:10 +08:00
|
|
|
|
<!-- 标题 -->
|
2021-06-25 19:11:00 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-if="isTitle"
|
|
|
|
|
|
class="cn-chart cn-chart__title"
|
|
|
|
|
|
:style="computePosition">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</div>
|
2021-07-01 21:39:10 +08:00
|
|
|
|
<!-- Tabs -->
|
2021-07-05 17:40:43 +08:00
|
|
|
|
<el-tabs
|
2021-07-01 21:39:10 +08:00
|
|
|
|
class="cn-chart cn-chart__tabs"
|
2021-07-21 22:46:08 +08:00
|
|
|
|
v-else-if="isTabs"
|
2021-07-05 17:40:43 +08:00
|
|
|
|
v-model="activeTab"
|
|
|
|
|
|
@tab-click="changeTab"
|
|
|
|
|
|
:style="computePosition"
|
2021-07-22 18:30:45 +08:00
|
|
|
|
:ref="`chart-${chart.id}`"
|
2021-07-05 17:40:43 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-tab-pane
|
2021-07-05 22:58:12 +08:00
|
|
|
|
v-for="tab in chartInfo.children"
|
2021-07-05 17:40:43 +08:00
|
|
|
|
:label="tab.i18n ? $t(tab.i18n) : tab.name" :name="`${tab.id}`"
|
|
|
|
|
|
:key="tab.id"
|
2021-07-22 18:30:45 +08:00
|
|
|
|
:ref="`chart-${chart.id}`"
|
2021-07-05 17:40:43 +08:00
|
|
|
|
>
|
2021-07-21 22:46:08 +08:00
|
|
|
|
<template v-for="chart in tab.children">
|
2021-08-06 15:03:30 +08:00
|
|
|
|
<chart v-if="activeTab == tab.id" :key="chart.id" :chart="chart" :time-filter="timeFilter" :ref="`chart-${chart.id}`" :entity="entity"></chart>
|
2021-07-05 22:58:12 +08:00
|
|
|
|
</template>
|
2021-07-05 17:40:43 +08:00
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
</el-tabs>
|
2021-06-24 17:59:51 +08:00
|
|
|
|
<!-- 地图 -->
|
|
|
|
|
|
<chart-map
|
2021-06-25 19:11:00 +08:00
|
|
|
|
v-else-if="isMap"
|
2021-06-24 17:59:51 +08:00
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #title>{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</template>
|
|
|
|
|
|
<template #operations>
|
2021-07-14 15:40:05 +08:00
|
|
|
|
<!-- <i class="cn-icon cn-icon-more-light"></i>-->
|
2021-07-10 11:18:40 +08:00
|
|
|
|
<!-- <i class="cn-icon cn-icon-refresh" @click="loadMap"></i>-->
|
2021-06-24 17:59:51 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template #default>
|
|
|
|
|
|
<div class="chart-drawing" :id="`chart${chartInfo.id}`"></div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</chart-map>
|
|
|
|
|
|
<!-- echarts类的图,如饼图、柱状图、折线图等 -->
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<echarts-frame
|
2021-06-24 17:59:51 +08:00
|
|
|
|
v-else-if="isEcharts"
|
2021-06-20 13:31:55 +08:00
|
|
|
|
:layout="layout"
|
|
|
|
|
|
:style="computePosition"
|
2021-06-23 15:57:34 +08:00
|
|
|
|
:chartInfo="chartInfo"
|
2021-06-20 13:31:55 +08:00
|
|
|
|
>
|
2021-07-06 15:58:24 +08:00
|
|
|
|
<template #title v-if="layout.indexOf(layoutConstant.HEADER) > -1">
|
|
|
|
|
|
{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}
|
2021-07-07 15:51:52 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template #operations v-if="layout.indexOf(layoutConstant.HEADER) > -1">
|
2021-07-14 15:40:05 +08:00
|
|
|
|
<div class="header__operation header__operation--echarts" v-if="chart.type === 31">
|
2021-07-06 15:58:24 +08:00
|
|
|
|
<el-select
|
|
|
|
|
|
size="mini"
|
2021-07-07 15:51:52 +08:00
|
|
|
|
v-model="orderPieTable"
|
2021-07-14 15:40:05 +08:00
|
|
|
|
class="option__select select-column"
|
2021-07-06 15:58:24 +08:00
|
|
|
|
placeholder=""
|
|
|
|
|
|
popper-class="option-popper"
|
2021-07-07 15:51:52 +08:00
|
|
|
|
@change="orderPieTableChange"
|
2021-07-06 15:58:24 +08:00
|
|
|
|
>
|
2021-07-07 15:51:52 +08:00
|
|
|
|
<el-option v-for="item in chartPieTableTopOptions" :key="item.value" :value="item.value"> {{item.name}}</el-option>
|
2021-07-06 15:58:24 +08:00
|
|
|
|
</el-select>
|
2021-07-07 15:51:52 +08:00
|
|
|
|
</div>
|
2021-07-14 15:40:05 +08:00
|
|
|
|
<!-- <i class="cn-icon cn-icon-more-light margin-l-10"></i>-->
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template #default>
|
|
|
|
|
|
<div class="chart-drawing" :id="`chart${chartInfo.id}`"></div>
|
|
|
|
|
|
</template>
|
2021-07-21 22:46:08 +08:00
|
|
|
|
<template #footer v-if="layout.indexOf(layoutConstant.FOOTER) > -1">
|
2021-06-22 21:19:04 +08:00
|
|
|
|
<!-- 带Table的饼图,展示Table -->
|
|
|
|
|
|
<template v-if="isEchartsWithTable">
|
2021-07-21 22:46:08 +08:00
|
|
|
|
<pie-table :tableData="pieTableData" ref="pieTable" :chartInfo="chartInfo" :time-filter="timeFilter" :order="orderPieTable"/>
|
2021-07-05 22:58:12 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="isEchartsWithStatistics">
|
2021-07-22 21:35:06 +08:00
|
|
|
|
<statistics-legend :data="statisticsData" :chart-info="chartInfo" @toggleLegend="toggleStatisticsLegend"></statistics-legend>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</template>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</echarts-frame>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
<!-- 单值图 -->
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<single-value
|
|
|
|
|
|
v-else-if="isSingleValue"
|
|
|
|
|
|
:type="chartInfo.type"
|
|
|
|
|
|
:style="computePosition"
|
2021-07-06 17:51:17 +08:00
|
|
|
|
:icon="singleValue.icon"
|
2021-06-20 13:31:55 +08:00
|
|
|
|
>
|
2021-07-06 18:29:46 +08:00
|
|
|
|
<template #title><span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span></template>
|
2021-07-13 18:38:32 +08:00
|
|
|
|
<template #data>
|
2021-07-20 18:58:55 +08:00
|
|
|
|
<span>{{handleSingleValue[0]}}</span>
|
2021-07-21 22:46:08 +08:00
|
|
|
|
<span class="single-value__unit">{{handleSingleValue[1]}}</span>
|
2021-07-13 18:38:32 +08:00
|
|
|
|
</template>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</single-value>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
<!-- 表格 -->
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<chart-table
|
|
|
|
|
|
v-else-if="isTable"
|
2021-06-21 20:33:39 +08:00
|
|
|
|
:table-columns="table.tableColumns"
|
|
|
|
|
|
:table-data="table.currentPageData"
|
2021-06-20 13:31:55 +08:00
|
|
|
|
:style="computePosition"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #title>{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</template>
|
|
|
|
|
|
<template #operations>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
<!-- <div class="header__operation header__operation--table">
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<span class="option__button"><i class="cn-icon cn-icon-download"></i></span>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
</div>-->
|
2021-06-21 20:33:39 +08:00
|
|
|
|
<div class="header__operation header__operation--table">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
v-model="table.limit"
|
2021-06-22 21:19:04 +08:00
|
|
|
|
class="option__select select-topn"
|
2021-06-21 20:33:39 +08:00
|
|
|
|
placeholder=""
|
2021-06-22 21:19:04 +08:00
|
|
|
|
popper-class="option-popper"
|
2021-07-09 21:58:49 +08:00
|
|
|
|
@change="tableLimitChange"
|
2021-06-21 20:33:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-option v-for="item in chartTableTopOptions" :key="item" :value="item">TOP {{item}}</el-option>
|
|
|
|
|
|
<template #prefix>TOP </template>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="header__operation header__operation--table">
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
v-model="table.orderBy"
|
2021-06-22 21:19:04 +08:00
|
|
|
|
class="option__select select-column"
|
2021-07-22 21:35:06 +08:00
|
|
|
|
:placeholder="$t('overall.field')"
|
2021-06-22 21:19:04 +08:00
|
|
|
|
popper-class="option-popper"
|
2021-07-09 21:58:49 +08:00
|
|
|
|
@change="tableLimitChange"
|
2021-06-21 20:33:39 +08:00
|
|
|
|
>
|
2021-07-13 18:49:41 +08:00
|
|
|
|
<template v-for="(item, index) in table.tableColumns" :key="item.prop">
|
|
|
|
|
|
<el-option v-if="index > 0" :value="item.prop">{{item.prop}}</el-option>
|
|
|
|
|
|
</template>
|
2021-06-21 20:33:39 +08:00
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
2021-06-22 21:19:04 +08:00
|
|
|
|
<!-- <div class="header__operation header__operation--table">
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<span class="option__button"><i class="cn-icon cn-icon-style"></i></span>
|
|
|
|
|
|
<div class="icon-group-divide"></div>
|
|
|
|
|
|
<span class="option__button"><i class="cn-icon cn-icon-dropdown"></i></span>
|
2021-07-14 15:40:05 +08:00
|
|
|
|
</div>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
<div class="header__operation header__operation--table">
|
|
|
|
|
|
<span class="option__button"><i class="cn-icon cn-icon-full-screen"></i></span>
|
2021-07-14 15:40:05 +08:00
|
|
|
|
</div>-->
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</template>
|
2021-06-21 20:33:39 +08:00
|
|
|
|
<template #footer>
|
|
|
|
|
|
<chart-table-pagination
|
|
|
|
|
|
:total="table.tableData.length"
|
|
|
|
|
|
@pageJump="pageJump"
|
|
|
|
|
|
></chart-table-pagination>
|
|
|
|
|
|
</template>
|
2021-06-20 13:31:55 +08:00
|
|
|
|
</chart-table>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import * as echarts from 'echarts'
|
2021-06-24 17:59:51 +08:00
|
|
|
|
import * as am4Core from '@amcharts/amcharts4/core'
|
|
|
|
|
|
import * as am4Maps from '@amcharts/amcharts4/maps'
|
2021-07-05 22:58:12 +08:00
|
|
|
|
import { shallowRef } from 'vue'
|
2021-07-20 18:58:55 +08:00
|
|
|
|
import { allTableTitle, legendMapping } from '@/components/charts/chart-table-title'
|
2021-06-24 17:59:51 +08:00
|
|
|
|
import {
|
|
|
|
|
|
isEcharts,
|
|
|
|
|
|
isSingleValue,
|
|
|
|
|
|
isTable,
|
2021-06-25 19:11:00 +08:00
|
|
|
|
isTitle,
|
2021-06-24 17:59:51 +08:00
|
|
|
|
isMap,
|
|
|
|
|
|
getOption,
|
|
|
|
|
|
getTypeCategory,
|
|
|
|
|
|
getLayout,
|
|
|
|
|
|
layoutConstant,
|
|
|
|
|
|
isEchartsWithTable,
|
2021-07-05 22:58:12 +08:00
|
|
|
|
isEchartsWithStatistics,
|
2021-07-01 21:39:10 +08:00
|
|
|
|
isMapLine,
|
2021-07-10 12:11:59 +08:00
|
|
|
|
isMapBlock,
|
2021-08-06 15:03:30 +08:00
|
|
|
|
isSingleValueWithEcharts,
|
2021-07-06 10:55:09 +08:00
|
|
|
|
isTabs,
|
|
|
|
|
|
getChartColor
|
2021-06-24 17:59:51 +08:00
|
|
|
|
} from '@/components/charts/chart-options'
|
2021-06-20 13:31:55 +08:00
|
|
|
|
import EchartsFrame from '@/components/charts/EchartsFrame'
|
|
|
|
|
|
import SingleValue from '@/components/charts/ChartSingleValue'
|
2021-06-24 17:59:51 +08:00
|
|
|
|
import ChartTable from '@/components/charts/ChartTable'
|
|
|
|
|
|
import ChartMap from '@/components/charts/ChartMap'
|
2021-06-23 15:57:34 +08:00
|
|
|
|
import PieTable from '@/components/charts/PieTable'
|
2021-07-05 22:58:12 +08:00
|
|
|
|
import StatisticsLegend from '@/components/charts/StatisticsLegend'
|
2021-06-21 20:33:39 +08:00
|
|
|
|
import ChartTablePagination from '@/components/charts/ChartTablePagination'
|
2021-07-21 22:46:08 +08:00
|
|
|
|
import unitConvert, { getUnitType } from '@/utils/unit-convert'
|
|
|
|
|
|
import { chartTableDefaultPageSize, chartTableTopOptions, storageKey, chartPieTableTopOptions, unitTypes } from '@/utils/constants'
|
2021-06-20 13:31:55 +08:00
|
|
|
|
import { get } from '@/utils/http'
|
2021-07-14 15:40:05 +08:00
|
|
|
|
import { replaceUrlPlaceholder, getCapitalGeo, getGeoData, lineToSpace } from '@/utils/tools'
|
2021-06-20 13:31:55 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'Chart',
|
|
|
|
|
|
props: {
|
2021-06-23 15:57:34 +08:00
|
|
|
|
chart: Object, // 图表对象,包括id、name、type等数据
|
2021-08-06 15:03:30 +08:00
|
|
|
|
timeFilter: Object,
|
|
|
|
|
|
entity: Object
|
2021-06-20 13:31:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
components: {
|
|
|
|
|
|
EchartsFrame,
|
|
|
|
|
|
SingleValue,
|
2021-06-21 20:33:39 +08:00
|
|
|
|
ChartTablePagination,
|
2021-06-24 17:59:51 +08:00
|
|
|
|
ChartTable,
|
|
|
|
|
|
PieTable,
|
2021-07-05 22:58:12 +08:00
|
|
|
|
StatisticsLegend,
|
2021-07-05 17:40:43 +08:00
|
|
|
|
ChartMap
|
2021-06-20 13:31:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2021-06-21 20:33:39 +08:00
|
|
|
|
table: {
|
|
|
|
|
|
pageSize: chartTableDefaultPageSize,
|
|
|
|
|
|
limit: chartTableTopOptions[0], // top-n
|
2021-07-07 18:47:52 +08:00
|
|
|
|
orderBy: 'sessions',
|
2021-06-21 20:33:39 +08:00
|
|
|
|
tableColumns: [], // table字段
|
|
|
|
|
|
tableData: [], // table的所有数据
|
|
|
|
|
|
currentPageData: [] // table当前页的数据
|
2021-06-23 15:57:34 +08:00
|
|
|
|
},
|
2021-06-25 19:11:00 +08:00
|
|
|
|
pieTableData: [],
|
2021-07-06 17:51:17 +08:00
|
|
|
|
singleValue: {
|
|
|
|
|
|
value: '-',
|
|
|
|
|
|
icon: ''
|
|
|
|
|
|
},
|
2021-07-05 17:40:43 +08:00
|
|
|
|
activeTab: '',
|
2021-07-07 15:51:52 +08:00
|
|
|
|
statisticsData: [],
|
|
|
|
|
|
orderPieTable: chartPieTableTopOptions[0].value,
|
2021-07-22 18:30:45 +08:00
|
|
|
|
selectPieChartName: '',
|
2021-07-23 11:39:10 +08:00
|
|
|
|
allSelectPieChartName: [],
|
2021-07-22 18:30:45 +08:00
|
|
|
|
chartOption: null
|
2021-06-20 13:31:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
initChart () {
|
2021-08-06 15:03:30 +08:00
|
|
|
|
try {
|
|
|
|
|
|
const chartParams = this.chartInfo.params
|
|
|
|
|
|
if (this.isMap) {
|
|
|
|
|
|
const { chart, polygonSeries } = this.initMap(`chart${this.chartInfo.id}`)
|
|
|
|
|
|
!this.myChart && (this.myChart = chart)
|
|
|
|
|
|
if (chartParams) {
|
|
|
|
|
|
this.loadMap(polygonSeries)
|
2021-06-23 15:57:34 +08:00
|
|
|
|
}
|
2021-08-06 15:03:30 +08:00
|
|
|
|
} else if (this.isEcharts) {
|
|
|
|
|
|
const dom = document.getElementById(`chart${this.chartInfo.id}`)
|
|
|
|
|
|
!this.myChart && (this.myChart = echarts.init(dom))
|
|
|
|
|
|
this.chartOption = this.$_.cloneDeep(getOption(this.chart.type))
|
|
|
|
|
|
if (chartParams) {
|
|
|
|
|
|
if (this.isEchartsWithTable) {
|
|
|
|
|
|
this.initEchartsWithPieTable(chartParams)
|
|
|
|
|
|
} else if (this.isEchartsWithStatistics) {
|
|
|
|
|
|
this.initEchartsWithStatistics(chartParams)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.initECharts(chartParams)
|
2021-07-01 21:39:10 +08:00
|
|
|
|
}
|
2021-08-06 15:03:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else if (this.isTable) {
|
|
|
|
|
|
if (chartParams) {
|
|
|
|
|
|
this.initChartTable(chartParams)
|
|
|
|
|
|
}
|
|
|
|
|
|
} 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), ...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}`
|
|
|
|
|
|
}
|
2021-07-05 17:40:43 +08:00
|
|
|
|
}
|
2021-08-06 15:03:30 +08:00
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error(e)
|
2021-06-20 13:31:55 +08:00
|
|
|
|
}
|
2021-06-21 20:33:39 +08:00
|
|
|
|
},
|
2021-07-21 22:46:08 +08:00
|
|
|
|
reloadChart () {
|
|
|
|
|
|
this.initChart()
|
|
|
|
|
|
this.$nextTick(() => {
|
2021-07-22 18:30:45 +08:00
|
|
|
|
if (!this.$_.isEmpty(this.chart.children)) {
|
|
|
|
|
|
this.chart.children.forEach(chart => {
|
|
|
|
|
|
this.$refs[`chart-${chart.id}`].reloadChart()
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-07-21 22:46:08 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-07-16 10:56:04 +08:00
|
|
|
|
getTitle (r) {
|
|
|
|
|
|
let title = ''
|
|
|
|
|
|
if (r.establishLatency || r.httpResponseLatency || r.sslConLatency) {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
title = `${title}: ${unitConvert(r.establishLatency || r.httpResponseLatency || r.sslConLatency, unitTypes.time).join(' ')}`
|
2021-07-16 10:56:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (r.sequenceGapLossPercent || r.pktRetransPercent) {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
title = `${title}: ${unitConvert(r.sequenceGapLossPercent || r.pktRetransPercent, unitTypes.number).join(' ')} %`
|
2021-07-16 10:56:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (r.sessions) {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
title = `${title}\nSessions: ${unitConvert(r.sessions, unitTypes.number).join(' ')}`
|
2021-07-16 10:56:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (r.bytes) {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
title = `${title}\nBytes: ${unitConvert(r.bytes, unitTypes.byte).join(' ')}`
|
2021-07-16 10:56:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
return title
|
2021-07-01 15:39:48 +08:00
|
|
|
|
},
|
2021-07-05 17:40:43 +08:00
|
|
|
|
changeTab (tab) {
|
|
|
|
|
|
this.activeTab = tab.paneName
|
|
|
|
|
|
},
|
2021-06-24 17:59:51 +08:00
|
|
|
|
initMap (id) {
|
2021-06-29 19:45:44 +08:00
|
|
|
|
const chart = am4Core.create(id, am4Maps.MapChart)
|
2021-07-07 15:28:11 +08:00
|
|
|
|
chart.geodata = getGeoData(storageKey.iso36112WorldLow)
|
2021-06-29 19:45:44 +08:00
|
|
|
|
chart.projection = new am4Maps.projections.Miller()
|
|
|
|
|
|
const polygonSeries = chart.series.push(new am4Maps.MapPolygonSeries())
|
|
|
|
|
|
polygonSeries.useGeodata = true
|
|
|
|
|
|
polygonSeries.exclude = ['AQ'] // 排除南极洲
|
|
|
|
|
|
// 鼠标悬停提示
|
2021-07-06 15:58:24 +08:00
|
|
|
|
/* const polygonTemplate = polygonSeries.mapPolygons.template
|
2021-07-01 15:39:48 +08:00
|
|
|
|
polygonTemplate.tooltipText = '{name}'
|
|
|
|
|
|
polygonTemplate.fontSize = '12px'
|
2021-06-29 19:45:44 +08:00
|
|
|
|
const hs = polygonTemplate.states.create('hover')
|
2021-07-06 15:58:24 +08:00
|
|
|
|
hs.properties.fill = am4Core.color('#ccc') */
|
2021-07-10 12:11:59 +08:00
|
|
|
|
return {
|
|
|
|
|
|
chart,
|
|
|
|
|
|
polygonSeries
|
|
|
|
|
|
}
|
2021-06-24 17:59:51 +08:00
|
|
|
|
},
|
2021-07-10 12:11:59 +08:00
|
|
|
|
loadMap (polygonSeries) {
|
2021-07-13 18:38:32 +08:00
|
|
|
|
const chartParams = this.chartInfo.params
|
2021-07-21 22:46:08 +08:00
|
|
|
|
const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), country: '', region: '' } // 统计数据的查询参数
|
2021-07-08 18:02:57 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
const data = response.data.result
|
|
|
|
|
|
data.forEach(r => {
|
|
|
|
|
|
const serverCountryCapital = r.serverId && getCapitalGeo(r.serverId)
|
|
|
|
|
|
const clientCountryCapital = r.clientId && getCapitalGeo(r.clientId)
|
|
|
|
|
|
serverCountryCapital && (r.serverLongitude = serverCountryCapital.capitalLongitude)
|
|
|
|
|
|
serverCountryCapital && (r.serverLatitude = serverCountryCapital.capitalLatitude)
|
|
|
|
|
|
clientCountryCapital && (r.clientLongitude = clientCountryCapital.capitalLongitude)
|
|
|
|
|
|
clientCountryCapital && (r.clientLatitude = clientCountryCapital.capitalLatitude)
|
|
|
|
|
|
})
|
|
|
|
|
|
if (this.isMapLine) {
|
|
|
|
|
|
const lineSeries = this.myChart.series.push(new am4Maps.MapLineSeries())
|
|
|
|
|
|
const lineTemplate = lineSeries.mapLines.template
|
|
|
|
|
|
lineTemplate.stroke = am4Core.color('#A258EC')
|
|
|
|
|
|
lineTemplate.line.nonScalingStroke = true
|
|
|
|
|
|
lineTemplate.line.strokeDasharray = '4 3'
|
|
|
|
|
|
lineTemplate.nonScalingStroke = true
|
|
|
|
|
|
lineTemplate.arrow.nonScaling = true
|
|
|
|
|
|
lineTemplate.arrow.width = 4
|
|
|
|
|
|
lineTemplate.arrow.height = 6
|
|
|
|
|
|
lineSeries.data = [
|
|
|
|
|
|
{
|
|
|
|
|
|
multiGeoLine: data.map(d => {
|
|
|
|
|
|
return [
|
|
|
|
|
|
{
|
|
|
|
|
|
latitude: parseFloat(d.serverLatitude),
|
|
|
|
|
|
longitude: parseFloat(d.serverLongitude)
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
latitude: parseFloat(d.clientLatitude),
|
|
|
|
|
|
longitude: parseFloat(d.clientLongitude)
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
const imageSeries = this.myChart.series.push(new am4Maps.MapImageSeries())
|
|
|
|
|
|
imageSeries.dataFields.value = 'sessions'
|
|
|
|
|
|
const imageSeriesTemplate = imageSeries.mapImages.template
|
|
|
|
|
|
const circle = imageSeriesTemplate.createChild(am4Core.Circle)
|
|
|
|
|
|
|
|
|
|
|
|
circle.fillOpacity = 0.7
|
|
|
|
|
|
circle.nonScaling = true
|
|
|
|
|
|
circle.tooltipText = '{title}'
|
|
|
|
|
|
const radiusHeat = imageSeries.heatRules.push({
|
|
|
|
|
|
target: circle,
|
|
|
|
|
|
property: 'radius',
|
|
|
|
|
|
min: 8,
|
|
|
|
|
|
max: 30
|
|
|
|
|
|
})
|
|
|
|
|
|
const colorHeat = imageSeries.heatRules.push({
|
|
|
|
|
|
target: circle,
|
|
|
|
|
|
property: 'fill',
|
|
|
|
|
|
min: am4Core.color('#D2A8FF'),
|
|
|
|
|
|
max: am4Core.color('#A258EC')
|
|
|
|
|
|
})
|
|
|
|
|
|
imageSeriesTemplate.propertyFields.latitude = 'latitude'
|
|
|
|
|
|
imageSeriesTemplate.propertyFields.longitude = 'longitude'
|
|
|
|
|
|
|
|
|
|
|
|
const pointData = []
|
|
|
|
|
|
data.forEach(d => {
|
|
|
|
|
|
pointData.push({
|
|
|
|
|
|
...d,
|
|
|
|
|
|
latitude: parseFloat(d.serverLatitude),
|
|
|
|
|
|
longitude: parseFloat(d.serverLongitude),
|
|
|
|
|
|
title: this.getTitle(d)
|
|
|
|
|
|
})
|
|
|
|
|
|
pointData.push({
|
|
|
|
|
|
...d,
|
|
|
|
|
|
latitude: parseFloat(d.clientLatitude),
|
|
|
|
|
|
longitude: parseFloat(d.clientLongitude),
|
|
|
|
|
|
title: this.getTitle(d)
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
imageSeries.data = pointData
|
2021-07-10 12:11:59 +08:00
|
|
|
|
} else if (this.isMapBlock) {
|
|
|
|
|
|
polygonSeries.heatRules.push({
|
|
|
|
|
|
property: 'fill',
|
|
|
|
|
|
target: polygonSeries.mapPolygons.template,
|
|
|
|
|
|
min: am4Core.color('#FFFF00'),
|
|
|
|
|
|
max: am4Core.color('#E66767')
|
|
|
|
|
|
})
|
|
|
|
|
|
polygonSeries.data = response.data.result.map(r => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
id: r.serverId,
|
2021-07-16 10:56:04 +08:00
|
|
|
|
title: this.getTitle(r),
|
|
|
|
|
|
value: r.establishLatency || r.httpResponseLatency || r.sslConLatency || r.sequenceGapLossPercent || r.pktRetransPercent || r.sessions
|
2021-07-10 12:11:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
const polygonTemplate = polygonSeries.mapPolygons.template
|
2021-07-16 10:56:04 +08:00
|
|
|
|
polygonTemplate.tooltipText = '{name}{title}'
|
2021-07-15 19:21:23 +08:00
|
|
|
|
// polygonTemplate.numberFormatter = new am4Core.NumberFormatter().bigNumberPrefixes
|
2021-07-10 12:11:59 +08:00
|
|
|
|
polygonTemplate.nonScalingStroke = true
|
|
|
|
|
|
polygonTemplate.strokeWidth = 0.5
|
2021-07-08 18:02:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-06-21 20:33:39 +08:00
|
|
|
|
pageJump (val) {
|
|
|
|
|
|
this.table.currentPageData = this.getTargetPageData(val, this.table.pageSize, this.table.tableData)
|
|
|
|
|
|
},
|
|
|
|
|
|
getTargetPageData (pageNum, pageSize, tableData) {
|
|
|
|
|
|
return this.$_.slice(tableData, (pageNum - 1) * pageSize, pageNum * pageSize)
|
2021-07-07 15:51:52 +08:00
|
|
|
|
},
|
2021-07-22 21:35:06 +08:00
|
|
|
|
toggleStatisticsLegend (index) {
|
|
|
|
|
|
this.statisticsData[index].active = !this.statisticsData[index].active
|
|
|
|
|
|
this.statisticsData.forEach((d, i) => {
|
|
|
|
|
|
if (d.active) {
|
|
|
|
|
|
this.myChart.dispatchAction({
|
|
|
|
|
|
type: 'legendSelect',
|
|
|
|
|
|
name: d.legend
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.myChart.dispatchAction({
|
|
|
|
|
|
type: 'legendUnSelect',
|
|
|
|
|
|
name: d.legend
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-07-07 15:51:52 +08:00
|
|
|
|
orderPieTableChange () {
|
2021-07-08 11:08:40 +08:00
|
|
|
|
if (this.chart.type === 31) {
|
2021-07-14 15:40:05 +08:00
|
|
|
|
const chartParams = this.chartInfo.params || null // 图表参数
|
2021-07-10 11:18:40 +08:00
|
|
|
|
this.initEchartsWithPieTable(chartParams)
|
2021-07-08 11:08:40 +08:00
|
|
|
|
}
|
2021-07-07 15:51:52 +08:00
|
|
|
|
},
|
2021-07-10 11:18:40 +08:00
|
|
|
|
initECharts (chartParams) {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000) }
|
2021-07-10 11:18:40 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
const seriesTemplate = this.chartOption.series[0]
|
|
|
|
|
|
this.chartOption.series = response.data.result.map(r => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...seriesTemplate,
|
2021-07-14 15:40:05 +08:00
|
|
|
|
name: legendMapping[r.legend] ? legendMapping[r.legend] : lineToSpace(r.legend),
|
2021-07-21 22:46:08 +08:00
|
|
|
|
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1]), chartParams.unitType])
|
2021-07-10 11:18:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-07-21 22:46:08 +08:00
|
|
|
|
if (chartParams.unitType === unitTypes.byte) {
|
|
|
|
|
|
this.chartOption.yAxis.axisLabel.formatter = function (value, index, a, b) {
|
|
|
|
|
|
return unitConvert(value, unitTypes.byte).join(' ')
|
|
|
|
|
|
}
|
|
|
|
|
|
this.chartOption.grid.left = 75
|
|
|
|
|
|
}
|
2021-07-10 11:18:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.myChart.resize()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
initEchartsWithStatistics (chartParams) {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000) }
|
2021-07-10 11:18:40 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2021-07-22 21:35:06 +08:00
|
|
|
|
this.statisticsData = response.data.result.map(d => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...d,
|
|
|
|
|
|
active: true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-07-10 11:18:40 +08:00
|
|
|
|
const seriesTemplate = this.chartOption.series[0]
|
|
|
|
|
|
this.chartOption.series = response.data.result.map((r, i) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
...seriesTemplate,
|
|
|
|
|
|
name: r.legend,
|
2021-07-21 22:46:08 +08:00
|
|
|
|
data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1]), chartParams.unitType]),
|
2021-07-10 11:18:40 +08:00
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: getChartColor[i]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.myChart.resize()
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
initEchartsWithPieTable (chartParams) {
|
2021-07-07 18:33:05 +08:00
|
|
|
|
const self = this
|
2021-07-07 15:51:52 +08:00
|
|
|
|
chartParams.valueColumn = this.orderPieTable
|
2021-07-21 22:46:08 +08:00
|
|
|
|
const unitType = getUnitType(chartParams.valueColumn)
|
|
|
|
|
|
const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), limit: 10, order: this.orderPieTable } // 统计数据的查询参数
|
|
|
|
|
|
const tableQueryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), limit: 10, order: this.orderPieTable } // 统计数据的查询参数
|
2021-07-07 15:51:52 +08:00
|
|
|
|
tableQueryParams[chartParams.nameColumn] = [] // 处理两个图表不一样的地方
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2021-07-14 22:06:56 +08:00
|
|
|
|
const data = response.data.result.map(d => {
|
2021-07-08 10:18:16 +08:00
|
|
|
|
tableQueryParams[chartParams.nameColumn].push(d[chartParams.nameColumn])
|
2021-07-07 15:51:52 +08:00
|
|
|
|
return {
|
|
|
|
|
|
data: d,
|
|
|
|
|
|
name: d[chartParams.nameColumn],
|
2021-07-21 22:46:08 +08:00
|
|
|
|
value: parseInt(d[chartParams.valueColumn]),
|
|
|
|
|
|
unitType: unitType
|
2021-07-07 15:51:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-07-23 11:39:10 +08:00
|
|
|
|
this.allSelectPieChartName = tableQueryParams[chartParams.nameColumn]
|
2021-07-14 22:06:56 +08:00
|
|
|
|
this.chartOption.series[0].data = data
|
2021-07-07 15:51:52 +08:00
|
|
|
|
if (this.chartOption.series[0].data && this.chartOption.series[0].data.length > 10) { // pieWithTable 图例超过10个改为滚动显示
|
|
|
|
|
|
this.chartOption.legend.type = 'scroll'
|
|
|
|
|
|
}
|
|
|
|
|
|
this.myChart.setOption(this.chartOption)
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.myChart.resize()
|
|
|
|
|
|
})
|
|
|
|
|
|
get(replaceUrlPlaceholder(chartParams.urlTable, tableQueryParams)).then(response2 => {
|
|
|
|
|
|
if (response2.code === 200) {
|
|
|
|
|
|
this.pieTableData = response2.data.result
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2021-07-14 22:06:56 +08:00
|
|
|
|
// legend点击事件
|
2021-07-23 10:22:47 +08:00
|
|
|
|
this.myChart.off('legendselectchanged')
|
2021-07-10 12:30:06 +08:00
|
|
|
|
this.myChart.on('legendselectchanged', function (params) {
|
|
|
|
|
|
self.myChart.setOption({
|
|
|
|
|
|
legend: { selected: { [params.name]: true } }
|
|
|
|
|
|
})
|
2021-07-23 10:11:09 +08:00
|
|
|
|
const index = self.chartOption.series[0].data.findIndex(d => d.name === params.name)
|
|
|
|
|
|
if (self.selectPieChartName !== params.name) {
|
|
|
|
|
|
self.myChart.dispatchAction({
|
|
|
|
|
|
type: 'select',
|
|
|
|
|
|
seriesIndex: 0,
|
|
|
|
|
|
dataIndex: index
|
|
|
|
|
|
})
|
|
|
|
|
|
self.selectPieChartName = params.name
|
|
|
|
|
|
self.loadPieTableData(params.name)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
self.myChart.dispatchAction({
|
|
|
|
|
|
type: 'unselect',
|
|
|
|
|
|
seriesIndex: 0,
|
|
|
|
|
|
dataIndex: index
|
|
|
|
|
|
})
|
|
|
|
|
|
self.selectPieChartName = ''
|
|
|
|
|
|
self.loadPieTableData(this.allSelectPieChartName)
|
|
|
|
|
|
}
|
2021-07-10 12:30:06 +08:00
|
|
|
|
})
|
2021-07-14 22:06:56 +08:00
|
|
|
|
// 饼图色块点击事件
|
2021-07-23 10:22:47 +08:00
|
|
|
|
this.myChart.off('click')
|
2021-07-07 15:51:52 +08:00
|
|
|
|
this.myChart.on('click', function (echartParams) {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
// 若是已选,则点击后取消选择,并查询全部数据
|
|
|
|
|
|
if (echartParams.name === self.selectPieChartName) {
|
|
|
|
|
|
self.selectPieChartName = ''
|
2021-07-23 10:11:09 +08:00
|
|
|
|
self.loadPieTableData(this.allSelectPieChartName)
|
2021-07-21 22:46:08 +08:00
|
|
|
|
} else { // 否则查询当前name数据
|
|
|
|
|
|
self.selectPieChartName = echartParams.name
|
|
|
|
|
|
self.loadPieTableData(echartParams.name)
|
|
|
|
|
|
}
|
2021-07-14 22:06:56 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
loadPieTableData (name = '') {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
const childrenParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), limit: 10, order: this.orderPieTable }
|
2021-07-14 22:06:56 +08:00
|
|
|
|
childrenParams[this.chartInfo.params.nameColumn] = name
|
|
|
|
|
|
get(replaceUrlPlaceholder(this.chartInfo.params.urlTable, childrenParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.pieTableData = response.data.result
|
2021-07-07 15:51:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-07-09 21:58:49 +08:00
|
|
|
|
tableLimitChange () {
|
2021-07-14 15:40:05 +08:00
|
|
|
|
const chartParams = this.chartInfo.params || null // 图表参数
|
2021-07-07 18:47:52 +08:00
|
|
|
|
this.initChartTable(chartParams)
|
|
|
|
|
|
},
|
|
|
|
|
|
initChartTable (chartParams) {
|
2021-07-21 22:46:08 +08:00
|
|
|
|
const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000), limit: this.table.limit, order: this.table.orderBy }
|
2021-07-07 18:47:52 +08:00
|
|
|
|
get(replaceUrlPlaceholder(chartParams.url, queryParams)).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
2021-07-08 10:43:48 +08:00
|
|
|
|
this.table.tableColumns = allTableTitle['tableTitles' + this.chart.id]
|
2021-07-07 18:47:52 +08:00
|
|
|
|
this.table.tableData = response.data.result
|
|
|
|
|
|
this.table.currentPageData = this.getTargetPageData(1, this.table.pageSize, this.table.tableData)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2021-06-20 13:31:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
computePosition () {
|
|
|
|
|
|
const gridColumn = `${this.chartInfo.x} / ${this.chartInfo.x + this.chartInfo.w}`
|
|
|
|
|
|
const gridRow = `${this.chartInfo.y} / ${this.chartInfo.y + this.chartInfo.h}`
|
|
|
|
|
|
return {
|
|
|
|
|
|
gridColumn,
|
|
|
|
|
|
gridRow
|
|
|
|
|
|
}
|
2021-07-13 18:38:32 +08:00
|
|
|
|
},
|
|
|
|
|
|
handleSingleValue () {
|
2021-07-20 18:58:55 +08:00
|
|
|
|
const value = this.singleValue.value
|
2021-07-21 22:46:08 +08:00
|
|
|
|
const unitType = this.chartInfo.params.unitType
|
|
|
|
|
|
const result = unitConvert(value, unitType)
|
|
|
|
|
|
switch (unitType) {
|
|
|
|
|
|
case unitTypes.number: {
|
|
|
|
|
|
result[0] = result[0] < 0.01 ? '< 0.01' : result[0]
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
case unitTypes.time: {
|
|
|
|
|
|
result[0] = result[0] < 1 ? '< 1' : result[0]
|
|
|
|
|
|
break
|
2021-07-14 15:40:05 +08:00
|
|
|
|
}
|
2021-07-21 22:46:08 +08:00
|
|
|
|
default: break
|
2021-07-13 18:38:32 +08:00
|
|
|
|
}
|
2021-07-21 22:46:08 +08:00
|
|
|
|
return result
|
2021-06-20 13:31:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted () {
|
|
|
|
|
|
this.initChart()
|
|
|
|
|
|
},
|
2021-07-09 21:58:49 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
chart: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n, o) {
|
|
|
|
|
|
if (o) {
|
|
|
|
|
|
this.initChart()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-22 18:30:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
timeFilter: {
|
|
|
|
|
|
immediate: true,
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
handler (n, o) {
|
2021-08-02 13:22:15 +08:00
|
|
|
|
if (n && o) {
|
2021-07-22 18:30:45 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.initChart()
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-09 21:58:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2021-06-20 13:31:55 +08:00
|
|
|
|
setup (props) {
|
|
|
|
|
|
const chartInfo = JSON.parse(JSON.stringify(props.chart))
|
|
|
|
|
|
chartInfo.category = getTypeCategory(props.chart.type)
|
|
|
|
|
|
return {
|
|
|
|
|
|
chartInfo,
|
|
|
|
|
|
layoutConstant,
|
2021-06-21 20:33:39 +08:00
|
|
|
|
chartTableTopOptions,
|
2021-07-07 15:51:52 +08:00
|
|
|
|
chartPieTableTopOptions,
|
2021-06-20 13:31:55 +08:00
|
|
|
|
isEcharts: isEcharts(props.chart.type),
|
2021-06-22 21:19:04 +08:00
|
|
|
|
isEchartsWithTable: isEchartsWithTable(props.chart.type),
|
2021-07-05 22:58:12 +08:00
|
|
|
|
isEchartsWithStatistics: isEchartsWithStatistics(props.chart.type),
|
2021-06-20 13:31:55 +08:00
|
|
|
|
isSingleValue: isSingleValue(props.chart.type),
|
2021-08-06 15:03:30 +08:00
|
|
|
|
isSingleValueWithEcharts: isSingleValueWithEcharts(props.chart.type),
|
2021-06-20 13:31:55 +08:00
|
|
|
|
isTable: isTable(props.chart.type),
|
2021-06-24 17:59:51 +08:00
|
|
|
|
isMap: isMap(props.chart.type),
|
2021-06-25 19:11:00 +08:00
|
|
|
|
isTitle: isTitle(props.chart.type),
|
2021-06-24 17:59:51 +08:00
|
|
|
|
isMapLine: isMapLine(props.chart.type),
|
2021-07-10 12:11:59 +08:00
|
|
|
|
isMapBlock: isMapBlock(props.chart.type),
|
2021-07-01 21:39:10 +08:00
|
|
|
|
isTabs: isTabs(props.chart.type),
|
2021-07-05 22:58:12 +08:00
|
|
|
|
layout: getLayout(props.chart.type),
|
2021-07-22 18:30:45 +08:00
|
|
|
|
myChart: shallowRef(null)
|
2021-06-20 13:31:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|