2021-03-25 19:16:32 +08:00
|
|
|
|
<template>
|
2021-07-13 18:11:42 +08:00
|
|
|
|
<div
|
2021-11-16 15:06:02 +08:00
|
|
|
|
v-loading="loadingFlag"
|
2021-07-13 18:11:42 +08:00
|
|
|
|
:class="[
|
|
|
|
|
{
|
|
|
|
|
['active']: active
|
|
|
|
|
},
|
|
|
|
|
'rect-shape'
|
|
|
|
|
]"
|
|
|
|
|
>
|
2022-02-23 12:10:40 +08:00
|
|
|
|
<EditBarView v-if="editBarViewShowFlag" :is-edit="isEdit" :view-id="element.propValue.viewId" @showViewDetails="openChartDetailsDialog" />
|
|
|
|
|
<div v-if="requestStatus==='error'" class="chart-error-class">
|
|
|
|
|
<div class="chart-error-message-class">
|
|
|
|
|
{{ message }},{{ $t('chart.chart_show_error') }}
|
|
|
|
|
<br>
|
|
|
|
|
{{ $t('chart.chart_error_tips') }}
|
2021-06-22 11:25:59 +08:00
|
|
|
|
</div>
|
2021-08-11 18:41:05 +08:00
|
|
|
|
</div>
|
2022-02-23 12:10:40 +08:00
|
|
|
|
<plugin-com
|
|
|
|
|
v-if="chart.isPlugin"
|
|
|
|
|
:ref="element.propValue.id"
|
|
|
|
|
:component-name="chart.type + '-view'"
|
|
|
|
|
:obj="{chart, trackMenu, searchCount, terminalType: scaleCoefficientType}"
|
|
|
|
|
class="chart-class"
|
|
|
|
|
/>
|
|
|
|
|
<chart-component
|
|
|
|
|
v-else-if="charViewShowFlag"
|
|
|
|
|
:ref="element.propValue.id"
|
|
|
|
|
class="chart-class"
|
|
|
|
|
:chart="chart"
|
|
|
|
|
:track-menu="trackMenu"
|
|
|
|
|
:search-count="searchCount"
|
|
|
|
|
:terminal-type="scaleCoefficientType"
|
|
|
|
|
@onChartClick="chartClick"
|
|
|
|
|
@onJumpClick="jumpClick"
|
|
|
|
|
/>
|
|
|
|
|
<chart-component-g2
|
|
|
|
|
v-else-if="charViewG2ShowFlag"
|
|
|
|
|
:ref="element.propValue.id"
|
|
|
|
|
class="chart-class"
|
|
|
|
|
:chart="chart"
|
|
|
|
|
:track-menu="trackMenu"
|
|
|
|
|
:search-count="searchCount"
|
|
|
|
|
@onChartClick="chartClick"
|
|
|
|
|
@onJumpClick="jumpClick"
|
|
|
|
|
/>
|
|
|
|
|
<chart-component-s2
|
|
|
|
|
v-else-if="charViewS2ShowFlag"
|
|
|
|
|
:ref="element.propValue.id"
|
|
|
|
|
class="chart-class"
|
|
|
|
|
:chart="chart"
|
|
|
|
|
:track-menu="trackMenu"
|
|
|
|
|
:search-count="searchCount"
|
|
|
|
|
@onChartClick="chartClick"
|
|
|
|
|
@onJumpClick="jumpClick"
|
|
|
|
|
/>
|
|
|
|
|
<table-normal
|
|
|
|
|
v-else-if="tableShowFlag"
|
|
|
|
|
:ref="element.propValue.id"
|
|
|
|
|
:show-summary="chart.type === 'table-normal'"
|
|
|
|
|
:chart="chart"
|
|
|
|
|
class="table-class"
|
|
|
|
|
/>
|
|
|
|
|
<label-normal v-else-if="labelShowFlag" :ref="element.propValue.id" :chart="chart" class="table-class" />
|
2022-03-10 13:34:19 +08:00
|
|
|
|
<label-normal-text v-else-if="labelTextShowFlag" :ref="element.propValue.id" :chart="chart" class="table-class" />
|
2022-02-23 12:10:40 +08:00
|
|
|
|
<div style="position: absolute;left: 8px;bottom:8px;">
|
|
|
|
|
<drill-path :drill-filters="drillFilters" @onDrillJump="drillJump" />
|
|
|
|
|
</div>
|
2021-03-25 19:16:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
2021-05-06 23:40:34 +08:00
|
|
|
|
import { viewData } from '@/api/panel/panel'
|
2021-07-29 16:46:17 +08:00
|
|
|
|
import { viewInfo } from '@/api/link'
|
2021-03-25 19:16:32 +08:00
|
|
|
|
import ChartComponent from '@/views/chart/components/ChartComponent.vue'
|
2021-05-05 23:48:05 +08:00
|
|
|
|
import TableNormal from '@/views/chart/components/table/TableNormal'
|
2021-05-18 16:38:24 +08:00
|
|
|
|
import LabelNormal from '../../../views/chart/components/normal/LabelNormal'
|
2021-05-26 16:15:54 +08:00
|
|
|
|
import { uuid } from 'vue-uuid'
|
2022-02-17 18:39:44 +08:00
|
|
|
|
import bus from '@/utils/bus'
|
2021-05-05 22:14:23 +08:00
|
|
|
|
import { mapState } from 'vuex'
|
2021-06-08 16:03:49 +08:00
|
|
|
|
import { isChange } from '@/utils/conditionUtil'
|
2021-06-22 14:14:31 +08:00
|
|
|
|
import { BASE_CHART_STRING } from '@/views/chart/chart/chart'
|
2021-07-09 16:44:36 +08:00
|
|
|
|
import eventBus from '@/components/canvas/utils/eventBus'
|
|
|
|
|
import { deepCopy } from '@/components/canvas/utils/utils'
|
2021-07-29 16:46:17 +08:00
|
|
|
|
import { getToken, getLinkToken } from '@/utils/auth'
|
2021-08-11 18:41:05 +08:00
|
|
|
|
import DrillPath from '@/views/chart/view/DrillPath'
|
2021-08-12 15:11:57 +08:00
|
|
|
|
import { areaMapping } from '@/api/map/map'
|
2021-09-08 17:17:24 +08:00
|
|
|
|
import ChartComponentG2 from '@/views/chart/components/ChartComponentG2'
|
2021-12-10 17:00:19 +08:00
|
|
|
|
import EditBarView from '@/components/canvas/components/Editor/EditBarView'
|
2021-12-17 18:11:39 +08:00
|
|
|
|
import { customAttrTrans, customStyleTrans, recursionTransObj } from '@/components/canvas/utils/style'
|
2022-01-31 12:07:10 +08:00
|
|
|
|
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
|
2022-02-14 10:08:28 +08:00
|
|
|
|
import PluginCom from '@/views/system/plugin/PluginCom'
|
2022-03-10 13:34:19 +08:00
|
|
|
|
import LabelNormalText from '@/views/chart/components/normal/LabelNormalText'
|
2021-03-25 19:16:32 +08:00
|
|
|
|
export default {
|
|
|
|
|
name: 'UserView',
|
2022-03-10 13:34:19 +08:00
|
|
|
|
components: { LabelNormalText, PluginCom, ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 },
|
2021-03-25 19:16:32 +08:00
|
|
|
|
props: {
|
|
|
|
|
element: {
|
2021-06-07 17:08:57 +08:00
|
|
|
|
type: Object,
|
|
|
|
|
default: null
|
2021-04-19 18:20:15 +08:00
|
|
|
|
},
|
2021-05-26 16:15:54 +08:00
|
|
|
|
outStyle: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: false,
|
|
|
|
|
default: function() {
|
|
|
|
|
return {}
|
|
|
|
|
}
|
2021-06-22 12:40:29 +08:00
|
|
|
|
},
|
|
|
|
|
searchCount: {
|
|
|
|
|
type: Number,
|
|
|
|
|
required: false,
|
|
|
|
|
default: 0
|
2021-07-13 18:11:42 +08:00
|
|
|
|
},
|
|
|
|
|
active: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false
|
2021-08-03 12:05:29 +08:00
|
|
|
|
},
|
2022-02-14 10:08:28 +08:00
|
|
|
|
// eslint-disable-next-line vue/require-default-prop
|
2021-08-03 12:05:29 +08:00
|
|
|
|
componentIndex: {
|
|
|
|
|
type: Number,
|
|
|
|
|
required: false
|
2021-12-10 17:00:19 +08:00
|
|
|
|
},
|
|
|
|
|
inTab: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
|
|
|
|
isEdit: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
require: false,
|
|
|
|
|
default: true
|
2021-12-17 18:11:39 +08:00
|
|
|
|
},
|
|
|
|
|
terminal: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'pc'
|
2022-01-27 11:06:29 +08:00
|
|
|
|
},
|
|
|
|
|
filters: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => []
|
2021-04-19 18:20:15 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2021-03-25 19:16:32 +08:00
|
|
|
|
data() {
|
|
|
|
|
return {
|
2022-01-27 11:06:29 +08:00
|
|
|
|
isFirstLoad: true, // 是否是第一次加载
|
2021-05-26 16:15:54 +08:00
|
|
|
|
refId: null,
|
2021-06-22 14:14:31 +08:00
|
|
|
|
chart: BASE_CHART_STRING,
|
2022-01-18 16:52:28 +08:00
|
|
|
|
requestStatus: 'success',
|
2021-08-11 18:32:10 +08:00
|
|
|
|
message: null,
|
2021-08-11 18:41:05 +08:00
|
|
|
|
drillClickDimensionList: [],
|
2021-08-12 10:15:10 +08:00
|
|
|
|
drillFilters: [],
|
2021-08-12 15:11:57 +08:00
|
|
|
|
drillFields: [],
|
2021-08-12 17:19:26 +08:00
|
|
|
|
places: [],
|
|
|
|
|
httpRequest: {
|
|
|
|
|
status: true,
|
|
|
|
|
msg: ''
|
2021-08-16 18:31:32 +08:00
|
|
|
|
},
|
|
|
|
|
timeMachine: null,
|
2021-12-17 18:11:39 +08:00
|
|
|
|
scaleTimeMachine: null,
|
2021-11-24 11:25:01 +08:00
|
|
|
|
changeIndex: 0,
|
2021-12-17 18:11:39 +08:00
|
|
|
|
changeScaleIndex: 0,
|
2021-11-24 11:25:01 +08:00
|
|
|
|
pre: null,
|
2021-12-17 18:11:39 +08:00
|
|
|
|
preCanvasPanel: null,
|
|
|
|
|
sourceCustomAttrStr: null,
|
2022-02-17 14:22:30 +08:00
|
|
|
|
sourceCustomStyleStr: null
|
2021-03-25 19:16:32 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-02-21 12:42:02 +08:00
|
|
|
|
|
2021-06-08 16:03:49 +08:00
|
|
|
|
computed: {
|
2021-12-17 18:11:39 +08:00
|
|
|
|
scaleCoefficient() {
|
2021-12-20 12:14:57 +08:00
|
|
|
|
if (this.terminal === 'pc' && !this.mobileLayoutStatus) {
|
2021-12-17 18:11:39 +08:00
|
|
|
|
return 1.1
|
|
|
|
|
} else {
|
2021-12-20 12:14:57 +08:00
|
|
|
|
return 4.5
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scaleCoefficientType() {
|
|
|
|
|
if (this.terminal === 'pc' && !this.mobileLayoutStatus) {
|
|
|
|
|
return 'pc'
|
|
|
|
|
} else {
|
|
|
|
|
return 'mobile'
|
2021-12-17 18:11:39 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2021-12-10 17:00:19 +08:00
|
|
|
|
editBarViewShowFlag() {
|
2021-12-27 12:06:42 +08:00
|
|
|
|
return this.active && this.inTab && !this.mobileLayoutStatus
|
2021-12-10 17:00:19 +08:00
|
|
|
|
},
|
2021-11-24 11:25:01 +08:00
|
|
|
|
charViewShowFlag() {
|
2022-03-10 13:34:19 +08:00
|
|
|
|
return this.httpRequest.status && this.chart.type && !this.chart.type.includes('table') && !this.chart.type.includes('text') && this.chart.type !== 'label' && this.renderComponent() === 'echarts'
|
2021-11-24 11:25:01 +08:00
|
|
|
|
},
|
|
|
|
|
charViewG2ShowFlag() {
|
2022-03-10 13:34:19 +08:00
|
|
|
|
return this.httpRequest.status && this.chart.type && !this.chart.type.includes('table') && !this.chart.type.includes('text') && this.chart.type !== 'label' && this.renderComponent() === 'antv'
|
2021-11-24 11:25:01 +08:00
|
|
|
|
},
|
2022-01-31 12:07:10 +08:00
|
|
|
|
charViewS2ShowFlag() {
|
2022-03-10 13:34:19 +08:00
|
|
|
|
return this.httpRequest.status && this.chart.type && this.chart.type.includes('table') && !this.chart.type.includes('text') && this.chart.type !== 'label' && this.renderComponent() === 'antv'
|
2022-01-31 12:07:10 +08:00
|
|
|
|
},
|
2021-11-24 11:25:01 +08:00
|
|
|
|
tableShowFlag() {
|
2022-01-31 12:07:10 +08:00
|
|
|
|
return this.httpRequest.status && this.chart.type && this.chart.type.includes('table') && this.renderComponent() === 'echarts'
|
2021-11-24 11:25:01 +08:00
|
|
|
|
},
|
|
|
|
|
labelShowFlag() {
|
|
|
|
|
return this.httpRequest.status && this.chart.type && this.chart.type.includes('text')
|
|
|
|
|
},
|
2022-03-10 13:34:19 +08:00
|
|
|
|
labelTextShowFlag() {
|
|
|
|
|
return this.httpRequest.status && this.chart.type && this.chart.type === 'label'
|
|
|
|
|
},
|
2021-11-16 15:06:02 +08:00
|
|
|
|
loadingFlag() {
|
|
|
|
|
return (this.canvasStyleData.refreshViewLoading || this.searchCount === 0) && this.requestStatus === 'waiting'
|
|
|
|
|
},
|
2021-10-28 17:05:16 +08:00
|
|
|
|
panelInfo() {
|
|
|
|
|
return this.$store.state.panel.panelInfo
|
|
|
|
|
},
|
2021-06-08 16:03:49 +08:00
|
|
|
|
filter() {
|
|
|
|
|
const filter = {}
|
2022-01-27 11:06:29 +08:00
|
|
|
|
filter.filter = this.isFirstLoad ? this.filters : this.cfilters
|
2021-08-10 15:50:00 +08:00
|
|
|
|
filter.linkageFilters = this.element.linkageFilters
|
2022-03-26 21:17:22 +08:00
|
|
|
|
filter.outerParamsFilters = this.element.outerParamsFilters
|
2021-08-11 18:32:10 +08:00
|
|
|
|
filter.drill = this.drillClickDimensionList
|
2021-11-24 11:25:01 +08:00
|
|
|
|
filter.resultCount = this.resultCount
|
|
|
|
|
filter.resultMode = this.resultMode
|
|
|
|
|
filter.queryFrom = 'panel'
|
2021-06-08 16:03:49 +08:00
|
|
|
|
return filter
|
|
|
|
|
},
|
2022-01-27 11:06:29 +08:00
|
|
|
|
cfilters() {
|
2021-06-08 16:03:49 +08:00
|
|
|
|
// 必要 勿删勿该 watch数组,哪怕发生变化 oldValue等于newValue ,深拷贝解决
|
2021-06-08 18:33:28 +08:00
|
|
|
|
if (!this.element.filters) return []
|
2021-06-08 16:03:49 +08:00
|
|
|
|
return JSON.parse(JSON.stringify(this.element.filters))
|
|
|
|
|
},
|
2021-08-10 15:50:00 +08:00
|
|
|
|
linkageFilters() {
|
|
|
|
|
// 必要 勿删勿该 watch数组,哪怕发生变化 oldValue等于newValue ,深拷贝解决
|
|
|
|
|
if (!this.element.linkageFilters) return []
|
|
|
|
|
return JSON.parse(JSON.stringify(this.element.linkageFilters))
|
|
|
|
|
},
|
2021-08-12 10:15:10 +08:00
|
|
|
|
trackMenu() {
|
|
|
|
|
const trackMenuInfo = []
|
|
|
|
|
let linkageCount = 0
|
2021-10-28 17:05:16 +08:00
|
|
|
|
let jumpCount = 0
|
2021-09-10 11:22:41 +08:00
|
|
|
|
this.chart.data && this.chart.data.sourceFields && this.chart.data.sourceFields.forEach(item => {
|
2021-08-12 10:15:10 +08:00
|
|
|
|
const sourceInfo = this.chart.id + '#' + item.id
|
|
|
|
|
if (this.nowPanelTrackInfo[sourceInfo]) {
|
|
|
|
|
linkageCount++
|
|
|
|
|
}
|
|
|
|
|
})
|
2021-10-28 17:05:16 +08:00
|
|
|
|
this.chart.data && this.chart.data.sourceFields && this.chart.data.sourceFields.forEach(item => {
|
|
|
|
|
const sourceInfo = this.chart.id + '#' + item.id
|
|
|
|
|
if (this.nowPanelJumpInfo[sourceInfo]) {
|
|
|
|
|
jumpCount++
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
jumpCount && trackMenuInfo.push('jump')
|
2021-08-12 10:15:10 +08:00
|
|
|
|
linkageCount && trackMenuInfo.push('linkage')
|
|
|
|
|
this.drillFields.length && trackMenuInfo.push('drill')
|
|
|
|
|
return trackMenuInfo
|
|
|
|
|
},
|
2021-08-13 17:06:24 +08:00
|
|
|
|
chartType() {
|
|
|
|
|
return this.chart.type
|
|
|
|
|
},
|
2021-08-16 18:31:32 +08:00
|
|
|
|
hw() {
|
|
|
|
|
return this.outStyle.width * this.outStyle.height
|
|
|
|
|
},
|
2021-11-24 11:25:01 +08:00
|
|
|
|
resultMode() {
|
|
|
|
|
return this.canvasStyleData.panel.resultMode
|
|
|
|
|
},
|
|
|
|
|
resultCount() {
|
|
|
|
|
return this.canvasStyleData.panel.resultCount
|
|
|
|
|
},
|
2021-06-08 16:03:49 +08:00
|
|
|
|
...mapState([
|
2021-08-12 10:15:10 +08:00
|
|
|
|
'canvasStyleData',
|
2021-10-28 17:05:16 +08:00
|
|
|
|
'nowPanelTrackInfo',
|
2021-12-14 11:43:41 +08:00
|
|
|
|
'nowPanelJumpInfo',
|
2021-12-17 18:11:39 +08:00
|
|
|
|
'publicLinkStatus',
|
2021-12-20 12:14:57 +08:00
|
|
|
|
'previewCanvasScale',
|
2021-12-28 18:09:54 +08:00
|
|
|
|
'mobileLayoutStatus',
|
2022-03-14 21:15:33 +08:00
|
|
|
|
'componentData',
|
|
|
|
|
'panelViewDetailsInfo'
|
2021-06-08 16:03:49 +08:00
|
|
|
|
])
|
|
|
|
|
},
|
|
|
|
|
|
2021-06-07 17:08:57 +08:00
|
|
|
|
watch: {
|
2022-02-14 10:08:28 +08:00
|
|
|
|
|
2022-01-27 11:06:29 +08:00
|
|
|
|
'cfilters': {
|
|
|
|
|
handler: function(val1, val2) {
|
|
|
|
|
if (isChange(val1, val2) && !this.isFirstLoad) {
|
|
|
|
|
this.getData(this.element.propValue.viewId)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
deep: true
|
2021-06-07 17:08:57 +08:00
|
|
|
|
},
|
2021-08-10 15:50:00 +08:00
|
|
|
|
linkageFilters: {
|
|
|
|
|
handler(newVal, oldVal) {
|
2021-08-12 18:18:37 +08:00
|
|
|
|
if (isChange(newVal, oldVal)) {
|
|
|
|
|
this.getData(this.element.propValue.viewId)
|
|
|
|
|
}
|
2021-08-10 15:50:00 +08:00
|
|
|
|
},
|
|
|
|
|
deep: true
|
|
|
|
|
},
|
2021-06-07 17:08:57 +08:00
|
|
|
|
// deep监听panel 如果改变 提交到 store
|
|
|
|
|
canvasStyleData: {
|
|
|
|
|
handler(newVal, oldVla) {
|
|
|
|
|
this.mergeStyle()
|
2021-11-24 11:25:01 +08:00
|
|
|
|
// 如果视图结果模式模式 或者 视图结果获取数量改变 刷新视图
|
|
|
|
|
if (!this.preCanvasPanel || this.preCanvasPanel.resultCount !== newVal.panel.resultCount || this.preCanvasPanel.resultMode !== newVal.panel.resultMode) {
|
|
|
|
|
this.getData(this.element.propValue.viewId, false)
|
|
|
|
|
}
|
2021-12-30 11:47:26 +08:00
|
|
|
|
// 如果gap有变化刷新
|
|
|
|
|
if (this.preCanvasPanel && this.preCanvasPanel.gap !== newVal.panel.gap) {
|
2022-02-18 17:44:16 +08:00
|
|
|
|
this.chart.isPlugin
|
|
|
|
|
? this.$refs[this.element.propValue.id].callPluginInner({ methodName: 'chartResize' })
|
|
|
|
|
: this.$refs[this.element.propValue.id].chartResize()
|
2021-12-30 11:47:26 +08:00
|
|
|
|
}
|
2021-11-24 11:25:01 +08:00
|
|
|
|
this.preCanvasPanel = deepCopy(newVal.panel)
|
2021-06-07 17:08:57 +08:00
|
|
|
|
},
|
|
|
|
|
deep: true
|
|
|
|
|
},
|
2021-08-13 13:58:27 +08:00
|
|
|
|
// 监听外部的样式变化 (非实时性要求)
|
2021-08-16 18:31:32 +08:00
|
|
|
|
'hw': {
|
|
|
|
|
handler(newVal, oldVla) {
|
2021-10-09 00:02:06 +08:00
|
|
|
|
if (newVal !== oldVla && this.$refs[this.element.propValue.id]) {
|
|
|
|
|
if (this.chart.type === 'map') {
|
|
|
|
|
this.destroyTimeMachine()
|
|
|
|
|
this.changeIndex++
|
|
|
|
|
this.chartResize(this.changeIndex)
|
|
|
|
|
} else {
|
2022-02-18 17:44:16 +08:00
|
|
|
|
this.chart.isPlugin
|
|
|
|
|
? this.$refs[this.element.propValue.id].callPluginInner({ methodName: 'chartResize' })
|
|
|
|
|
: this.$refs[this.element.propValue.id].chartResize()
|
2021-10-09 00:02:06 +08:00
|
|
|
|
}
|
2021-08-16 18:31:32 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
deep: true
|
|
|
|
|
},
|
|
|
|
|
// 监听外部的样式变化 (非实时性要求)
|
2021-06-07 17:08:57 +08:00
|
|
|
|
outStyle: {
|
|
|
|
|
handler(newVal, oldVla) {
|
|
|
|
|
},
|
|
|
|
|
deep: true
|
2021-06-22 12:40:29 +08:00
|
|
|
|
},
|
|
|
|
|
// 监听外部计时器变化
|
|
|
|
|
searchCount: function(val1) {
|
2021-10-29 17:46:04 +08:00
|
|
|
|
if (val1 > 0 && this.requestStatus !== 'waiting') {
|
2021-06-22 12:40:29 +08:00
|
|
|
|
this.getData(this.element.propValue.viewId)
|
|
|
|
|
}
|
2021-08-13 17:06:24 +08:00
|
|
|
|
},
|
|
|
|
|
'chartType': function(newVal, oldVal) {
|
2022-02-17 14:22:30 +08:00
|
|
|
|
// this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
|
2022-02-18 17:44:16 +08:00
|
|
|
|
if ((newVal === 'map' || newVal === 'buddle-map') && newVal !== oldVal) {
|
2021-08-13 17:06:24 +08:00
|
|
|
|
this.initAreas()
|
|
|
|
|
}
|
2021-12-17 18:11:39 +08:00
|
|
|
|
},
|
|
|
|
|
// 监控缩放比例
|
|
|
|
|
previewCanvasScale: {
|
|
|
|
|
handler(newVal, oldVal) {
|
|
|
|
|
this.destroyScaleTimeMachine()
|
|
|
|
|
this.changeScaleIndex++
|
|
|
|
|
this.chartScale(this.changeScaleIndex)
|
|
|
|
|
},
|
|
|
|
|
deep: true
|
2021-06-07 17:08:57 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-02-21 12:42:02 +08:00
|
|
|
|
mounted() {
|
|
|
|
|
this.bindPluginEvent()
|
|
|
|
|
},
|
2022-02-17 14:22:30 +08:00
|
|
|
|
|
2021-03-25 19:16:32 +08:00
|
|
|
|
created() {
|
2021-06-07 17:08:57 +08:00
|
|
|
|
this.refId = uuid.v1
|
2021-10-14 14:58:35 +08:00
|
|
|
|
if (this.element && this.element.propValue && this.element.propValue.viewId) {
|
2022-01-18 16:52:28 +08:00
|
|
|
|
// 如果watch.filters 已经进行数据初始化时候,此处放弃数据初始化
|
2022-01-27 11:06:29 +08:00
|
|
|
|
|
|
|
|
|
this.getData(this.element.propValue.viewId, false)
|
2021-10-14 14:58:35 +08:00
|
|
|
|
}
|
2021-03-25 19:16:32 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2022-02-17 18:39:44 +08:00
|
|
|
|
bindPluginEvent() {
|
2022-02-21 12:42:02 +08:00
|
|
|
|
bus.$on('plugin-chart-click', param => {
|
|
|
|
|
param.viewId && param.viewId === this.element.propValue.viewId && this.chartClick(param)
|
|
|
|
|
})
|
|
|
|
|
bus.$on('plugin-jump-click', param => {
|
|
|
|
|
param.viewId && param.viewId === this.element.propValue.viewId && this.jumpClick(param)
|
|
|
|
|
})
|
|
|
|
|
bus.$on('plugin-add-view-track-filter', param => {
|
|
|
|
|
param.viewId && param.viewId === this.element.propValue.viewId && this.addViewTrackFilter(param)
|
|
|
|
|
})
|
2022-03-10 10:38:33 +08:00
|
|
|
|
bus.$on('view-in-cache', param => {
|
|
|
|
|
param.viewId && param.viewId === this.element.propValue.viewId && this.getDataEdit(param)
|
|
|
|
|
})
|
2022-02-18 17:44:16 +08:00
|
|
|
|
},
|
2022-02-21 12:42:02 +08:00
|
|
|
|
|
2022-02-18 17:44:16 +08:00
|
|
|
|
addViewTrackFilter(linkageParam) {
|
|
|
|
|
this.$store.commit('addViewTrackFilter', linkageParam)
|
2022-02-17 18:39:44 +08:00
|
|
|
|
},
|
2021-12-17 18:11:39 +08:00
|
|
|
|
// 根据仪表板的缩放比例,修改视图内部参数
|
|
|
|
|
mergeScale() {
|
|
|
|
|
const scale = Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient
|
|
|
|
|
const customAttrChart = JSON.parse(this.sourceCustomAttrStr)
|
|
|
|
|
const customStyleChart = JSON.parse(this.sourceCustomStyleStr)
|
2021-12-20 12:14:57 +08:00
|
|
|
|
recursionTransObj(customAttrTrans, customAttrChart, scale, this.scaleCoefficientType)
|
|
|
|
|
recursionTransObj(customStyleTrans, customStyleChart, scale, this.scaleCoefficientType)
|
|
|
|
|
|
|
|
|
|
// 移动端地图标签不显示
|
|
|
|
|
if (this.chart.type === 'map' && this.scaleCoefficientType === 'mobile') {
|
|
|
|
|
customAttrChart.label.show = false
|
|
|
|
|
}
|
2021-12-17 18:11:39 +08:00
|
|
|
|
this.chart = {
|
|
|
|
|
...this.chart,
|
|
|
|
|
customAttr: JSON.stringify(customAttrChart),
|
|
|
|
|
customStyle: JSON.stringify(customStyleChart)
|
|
|
|
|
}
|
|
|
|
|
this.mergeStyle()
|
|
|
|
|
},
|
2021-05-06 23:40:34 +08:00
|
|
|
|
mergeStyle() {
|
|
|
|
|
if ((this.requestStatus === 'success' || this.requestStatus === 'merging') && this.chart.stylePriority === 'panel' && this.canvasStyleData.chart) {
|
|
|
|
|
const customAttrChart = JSON.parse(this.chart.customAttr)
|
|
|
|
|
const customStyleChart = JSON.parse(this.chart.customStyle)
|
|
|
|
|
const customAttrPanel = JSON.parse(this.canvasStyleData.chart.customAttr)
|
|
|
|
|
const customStylePanel = JSON.parse(this.canvasStyleData.chart.customStyle)
|
|
|
|
|
// 组件样式-背景设置
|
2021-05-07 19:20:47 +08:00
|
|
|
|
customStyleChart.background = customStylePanel.background
|
2021-05-06 23:40:34 +08:00
|
|
|
|
// 图形属性-颜色设置
|
2021-06-17 18:21:13 +08:00
|
|
|
|
if (this.chart.type.includes('table')) {
|
|
|
|
|
customAttrChart.color = customAttrPanel.tableColor
|
|
|
|
|
} else {
|
|
|
|
|
customAttrChart.color = customAttrPanel.color
|
|
|
|
|
}
|
2021-05-06 23:40:34 +08:00
|
|
|
|
this.chart = {
|
|
|
|
|
...this.chart,
|
|
|
|
|
customAttr: JSON.stringify(customAttrChart),
|
2021-05-07 19:20:47 +08:00
|
|
|
|
customStyle: JSON.stringify(customStyleChart)
|
2021-05-06 23:40:34 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-11-24 11:25:01 +08:00
|
|
|
|
getData(id, cache = true) {
|
2021-03-25 19:16:32 +08:00
|
|
|
|
if (id) {
|
2021-05-05 23:48:05 +08:00
|
|
|
|
this.requestStatus = 'waiting'
|
|
|
|
|
this.message = null
|
2021-07-29 16:46:17 +08:00
|
|
|
|
|
|
|
|
|
// 增加判断 仪表板公共连接中使用viewInfo 正常使用viewData
|
|
|
|
|
let method = viewData
|
2021-08-13 12:09:41 +08:00
|
|
|
|
const token = this.$store.getters.token || getToken()
|
|
|
|
|
const linkToken = this.$store.getters.linkToken || getLinkToken()
|
|
|
|
|
if (!token && linkToken) {
|
2021-07-29 16:46:17 +08:00
|
|
|
|
method = viewInfo
|
|
|
|
|
}
|
2021-11-24 11:25:01 +08:00
|
|
|
|
const requestInfo = {
|
|
|
|
|
...this.filter,
|
2022-03-10 10:38:33 +08:00
|
|
|
|
cache: cache,
|
|
|
|
|
queryFrom: this.isEdit ? 'panel_edit' : 'panel'
|
2021-11-24 11:25:01 +08:00
|
|
|
|
}
|
2022-03-01 20:59:52 +08:00
|
|
|
|
if (this.panelInfo.proxy) {
|
|
|
|
|
// method = viewInfo
|
|
|
|
|
requestInfo.proxy = { userId: this.panelInfo.proxy }
|
|
|
|
|
}
|
2022-02-28 11:17:26 +08:00
|
|
|
|
method(id, this.panelInfo.id, requestInfo).then(response => {
|
2021-03-25 19:16:32 +08:00
|
|
|
|
// 将视图传入echart组件
|
2021-05-05 23:48:05 +08:00
|
|
|
|
if (response.success) {
|
|
|
|
|
this.chart = response.data
|
2022-03-14 21:15:33 +08:00
|
|
|
|
this.chart['position'] = this.inTab ? 'tab' : 'panel'
|
|
|
|
|
// 记录当前数据
|
|
|
|
|
this.panelViewDetailsInfo[id] = JSON.stringify(this.chart)
|
2021-12-17 18:11:39 +08:00
|
|
|
|
this.sourceCustomAttrStr = this.chart.customAttr
|
|
|
|
|
this.sourceCustomStyleStr = this.chart.customStyle
|
2021-08-11 18:32:10 +08:00
|
|
|
|
this.chart.drillFields = this.chart.drillFields ? JSON.parse(this.chart.drillFields) : []
|
|
|
|
|
if (!response.data.drill) {
|
|
|
|
|
this.drillClickDimensionList.splice(this.drillClickDimensionList.length - 1, 1)
|
2021-09-15 16:35:14 +08:00
|
|
|
|
this.resetDrill()
|
2021-08-11 18:32:10 +08:00
|
|
|
|
}
|
2021-10-14 18:06:19 +08:00
|
|
|
|
this.drillFilters = JSON.parse(JSON.stringify(response.data.drillFilters ? response.data.drillFilters : []))
|
2021-08-12 10:15:10 +08:00
|
|
|
|
this.drillFields = JSON.parse(JSON.stringify(response.data.drillFields))
|
2021-05-06 23:40:34 +08:00
|
|
|
|
this.requestStatus = 'merging'
|
2021-12-17 18:11:39 +08:00
|
|
|
|
this.mergeScale()
|
2021-05-05 23:48:05 +08:00
|
|
|
|
this.requestStatus = 'success'
|
2021-08-12 17:19:26 +08:00
|
|
|
|
this.httpRequest.status = true
|
2021-05-05 23:48:05 +08:00
|
|
|
|
} else {
|
|
|
|
|
this.requestStatus = 'error'
|
2021-06-21 15:33:52 +08:00
|
|
|
|
this.message = response.message
|
2021-05-05 23:48:05 +08:00
|
|
|
|
}
|
2022-01-27 11:06:29 +08:00
|
|
|
|
this.isFirstLoad = false
|
2021-05-05 23:48:05 +08:00
|
|
|
|
return true
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
this.requestStatus = 'error'
|
2021-12-01 11:19:53 +08:00
|
|
|
|
if (err.message && err.message.indexOf('timeout') > -1) {
|
|
|
|
|
this.message = this.$t('panel.timeout_refresh')
|
2021-06-22 11:25:59 +08:00
|
|
|
|
} else {
|
2021-12-01 11:19:53 +08:00
|
|
|
|
this.httpRequest.status = err.response.data.success
|
|
|
|
|
this.httpRequest.msg = err.response.data.message
|
|
|
|
|
if (err && err.response && err.response.data) {
|
|
|
|
|
this.message = err.response.data.message
|
|
|
|
|
} else {
|
|
|
|
|
this.message = err
|
|
|
|
|
}
|
2021-06-22 11:25:59 +08:00
|
|
|
|
}
|
2022-01-27 11:06:29 +08:00
|
|
|
|
this.isFirstLoad = false
|
2021-05-05 23:48:05 +08:00
|
|
|
|
return true
|
2021-03-25 19:16:32 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2021-06-08 16:03:49 +08:00
|
|
|
|
},
|
|
|
|
|
viewIdMatch(viewIds, viewId) {
|
|
|
|
|
return !viewIds || viewIds.length === 0 || viewIds.includes(viewId)
|
2021-07-09 16:44:36 +08:00
|
|
|
|
},
|
|
|
|
|
openChartDetailsDialog() {
|
|
|
|
|
const tableChart = deepCopy(this.chart)
|
|
|
|
|
tableChart.customAttr = JSON.parse(this.chart.customAttr)
|
|
|
|
|
tableChart.customStyle = JSON.parse(this.chart.customStyle)
|
|
|
|
|
tableChart.customAttr.color.tableHeaderBgColor = '#f8f8f9'
|
|
|
|
|
tableChart.customAttr.color.tableItemBgColor = '#ffffff'
|
|
|
|
|
tableChart.customAttr.color.tableFontColor = '#7c7e81'
|
|
|
|
|
tableChart.customAttr.color.tableStripe = true
|
|
|
|
|
tableChart.customStyle.text.show = false
|
|
|
|
|
tableChart.customAttr = JSON.stringify(tableChart.customAttr)
|
|
|
|
|
tableChart.customStyle = JSON.stringify(tableChart.customStyle)
|
|
|
|
|
eventBus.$emit('openChartDetailsDialog', { chart: this.chart, tableChart: tableChart })
|
2021-08-11 18:32:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
chartClick(param) {
|
|
|
|
|
if (this.drillClickDimensionList.length < this.chart.drillFields.length - 1) {
|
2022-02-18 17:44:16 +08:00
|
|
|
|
(this.chart.type === 'map' || this.chart.type === 'buddle-map') && this.sendToChildren(param)
|
2021-08-11 18:32:10 +08:00
|
|
|
|
this.drillClickDimensionList.push({ dimensionList: param.data.dimensionList })
|
|
|
|
|
this.getData(this.element.propValue.viewId)
|
2021-08-17 15:26:05 +08:00
|
|
|
|
} else if (this.chart.drillFields.length > 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'error',
|
|
|
|
|
message: this.$t('chart.last_layer'),
|
|
|
|
|
showClose: true
|
|
|
|
|
})
|
2021-08-11 18:32:10 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2021-10-28 17:05:16 +08:00
|
|
|
|
jumpClick(param) {
|
2022-03-28 09:19:18 +08:00
|
|
|
|
let dimension, jumpInfo, sourceInfo, jumpFieldName
|
2021-11-02 11:04:00 +08:00
|
|
|
|
// 倒序取最后一个能匹配的
|
|
|
|
|
for (let i = param.dimensionList.length - 1; i >= 0; i--) {
|
|
|
|
|
dimension = param.dimensionList[i]
|
|
|
|
|
sourceInfo = param.viewId + '#' + dimension.id
|
|
|
|
|
jumpInfo = this.nowPanelJumpInfo[sourceInfo]
|
|
|
|
|
if (jumpInfo) {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-28 17:05:16 +08:00
|
|
|
|
if (jumpInfo) {
|
2021-11-02 11:04:00 +08:00
|
|
|
|
param.sourcePanelId = this.panelInfo.id
|
|
|
|
|
param.sourceViewId = param.viewId
|
|
|
|
|
param.sourceFieldId = dimension.id
|
2021-10-28 17:05:16 +08:00
|
|
|
|
// 内部仪表板跳转
|
|
|
|
|
if (jumpInfo.linkType === 'inner') {
|
|
|
|
|
if (jumpInfo.targetPanelId) {
|
|
|
|
|
localStorage.setItem('jumpInfoParam', JSON.stringify(param))
|
2021-12-14 11:43:41 +08:00
|
|
|
|
if (this.publicLinkStatus) {
|
|
|
|
|
// 判断是否有公共链接ID
|
|
|
|
|
if (jumpInfo.publicJumpId) {
|
|
|
|
|
const url = '/link/' + jumpInfo.publicJumpId
|
|
|
|
|
window.open(url, jumpInfo.jumpType)
|
|
|
|
|
} else {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'warn',
|
2021-12-14 15:22:03 +08:00
|
|
|
|
message: this.$t('panel.public_link_tips'),
|
2021-12-14 11:43:41 +08:00
|
|
|
|
showClose: true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const url = '#/preview/' + jumpInfo.targetPanelId
|
|
|
|
|
window.open(url, jumpInfo.jumpType)
|
|
|
|
|
}
|
2021-10-28 17:05:16 +08:00
|
|
|
|
} else {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'warn',
|
|
|
|
|
message: '未指定跳转仪表板',
|
|
|
|
|
showClose: true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-03-28 09:19:18 +08:00
|
|
|
|
let url = jumpInfo.content
|
|
|
|
|
// 是否追加点击参数
|
|
|
|
|
if (jumpInfo.attachParams && this.chart.data && this.chart.data.sourceFields) {
|
|
|
|
|
this.chart.data.sourceFields.forEach(item => {
|
|
|
|
|
if (item.id === dimension.id) {
|
|
|
|
|
jumpFieldName = item.name
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const urlAttachParams = jumpFieldName + '=' + dimension.value
|
|
|
|
|
if (url.indexOf('?') > -1) {
|
|
|
|
|
url = url + '&' + urlAttachParams
|
|
|
|
|
} else {
|
|
|
|
|
url = url + '?' + urlAttachParams
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-29 12:53:25 +08:00
|
|
|
|
window.open(url, jumpInfo.jumpType)
|
2021-10-28 17:05:16 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'warn',
|
|
|
|
|
message: '未获取跳转信息',
|
|
|
|
|
showClose: true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2021-08-11 18:32:10 +08:00
|
|
|
|
resetDrill() {
|
2021-08-12 15:11:57 +08:00
|
|
|
|
const length = this.drillClickDimensionList.length
|
2021-08-11 18:32:10 +08:00
|
|
|
|
this.drillClickDimensionList = []
|
2022-02-18 17:44:16 +08:00
|
|
|
|
if (this.chart.type === 'map' || this.chart.type === 'buddle-map') {
|
2021-08-12 15:11:57 +08:00
|
|
|
|
this.backToParent(0, length)
|
2021-08-16 13:34:23 +08:00
|
|
|
|
const current = this.$refs[this.element.propValue.id]
|
2022-02-18 17:44:16 +08:00
|
|
|
|
|
|
|
|
|
if (this.chart.isPlugin) {
|
2022-03-21 14:06:46 +08:00
|
|
|
|
current && current.callPluginInner && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: null })
|
2022-02-18 17:44:16 +08:00
|
|
|
|
} else {
|
|
|
|
|
current && current.registerDynamicMap && current.registerDynamicMap(null)
|
|
|
|
|
}
|
2021-08-12 15:11:57 +08:00
|
|
|
|
}
|
2021-08-11 18:32:10 +08:00
|
|
|
|
},
|
2021-08-12 15:16:10 +08:00
|
|
|
|
|
2021-08-11 18:32:10 +08:00
|
|
|
|
drillJump(index) {
|
2021-08-12 15:11:57 +08:00
|
|
|
|
const length = this.drillClickDimensionList.length
|
2021-08-11 18:32:10 +08:00
|
|
|
|
this.drillClickDimensionList = this.drillClickDimensionList.slice(0, index)
|
2022-02-18 17:44:16 +08:00
|
|
|
|
if (this.chart.type === 'map' || this.chart.type === 'buddle-map') {
|
2021-08-12 15:11:57 +08:00
|
|
|
|
this.backToParent(index, length)
|
|
|
|
|
}
|
2021-08-11 18:32:10 +08:00
|
|
|
|
this.getData(this.element.propValue.viewId)
|
2021-08-12 15:11:57 +08:00
|
|
|
|
},
|
|
|
|
|
// 回到父级地图
|
|
|
|
|
backToParent(index, length) {
|
|
|
|
|
if (length <= 0) return
|
|
|
|
|
const times = length - 1 - index
|
|
|
|
|
|
|
|
|
|
let temp = times
|
|
|
|
|
let tempNode = this.currentAcreaNode
|
|
|
|
|
while (temp >= 0) {
|
|
|
|
|
tempNode = this.findEntityByCode(tempNode.pcode, this.places)
|
|
|
|
|
temp--
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.currentAcreaNode = tempNode
|
|
|
|
|
const current = this.$refs[this.element.propValue.id]
|
2022-02-18 17:44:16 +08:00
|
|
|
|
if (this.chart.isPlugin) {
|
2022-03-21 14:06:46 +08:00
|
|
|
|
current && current.callPluginInner && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: this.currentAcreaNode.code })
|
2022-02-18 17:44:16 +08:00
|
|
|
|
} else {
|
|
|
|
|
current && current.registerDynamicMap && current.registerDynamicMap(this.currentAcreaNode.code)
|
|
|
|
|
}
|
2021-08-12 15:11:57 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 切换下一级地图
|
|
|
|
|
sendToChildren(param) {
|
|
|
|
|
const length = param.data.dimensionList.length
|
|
|
|
|
const name = param.data.dimensionList[length - 1].value
|
|
|
|
|
let aCode = null
|
|
|
|
|
if (this.currentAcreaNode) {
|
|
|
|
|
aCode = this.currentAcreaNode.code
|
|
|
|
|
}
|
|
|
|
|
const customAttr = JSON.parse(this.chart.customAttr)
|
|
|
|
|
const currentNode = this.findEntityByCode(aCode || customAttr.areaCode, this.places)
|
|
|
|
|
if (currentNode && currentNode.children && currentNode.children.length > 0) {
|
|
|
|
|
const nextNode = currentNode.children.find(item => item.name === name)
|
|
|
|
|
this.currentAcreaNode = nextNode
|
|
|
|
|
const current = this.$refs[this.element.propValue.id]
|
2022-02-18 17:44:16 +08:00
|
|
|
|
if (this.chart.isPlugin) {
|
2022-03-21 14:06:46 +08:00
|
|
|
|
nextNode && current && current.callPluginInner && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: nextNode.code })
|
2022-02-18 17:44:16 +08:00
|
|
|
|
} else {
|
|
|
|
|
nextNode && current && current.registerDynamicMap && current.registerDynamicMap(nextNode.code)
|
|
|
|
|
}
|
2021-08-12 15:11:57 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2021-08-12 18:18:37 +08:00
|
|
|
|
|
2021-08-12 15:11:57 +08:00
|
|
|
|
findEntityByCode(code, array) {
|
|
|
|
|
if (array === null || array.length === 0) array = this.places
|
|
|
|
|
for (let index = 0; index < array.length; index++) {
|
|
|
|
|
const node = array[index]
|
|
|
|
|
if (node.code === code) return node
|
|
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
|
|
const temp = this.findEntityByCode(code, node.children)
|
|
|
|
|
if (temp) return temp
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
initAreas() {
|
|
|
|
|
Object.keys(this.places).length === 0 && areaMapping().then(res => {
|
|
|
|
|
this.places = res.data
|
|
|
|
|
})
|
2021-08-12 18:18:37 +08:00
|
|
|
|
},
|
|
|
|
|
doMapLink(linkFilters) {
|
|
|
|
|
if (!linkFilters && linkFilters.length === 0) return
|
|
|
|
|
const value = linkFilters[0].value
|
|
|
|
|
if (!value && value.length === 0) return
|
|
|
|
|
const name = value[0]
|
|
|
|
|
if (!name) return
|
|
|
|
|
const areaNode = this.findEntityByname(name, [])
|
|
|
|
|
if (!areaNode) return
|
|
|
|
|
const current = this.$refs[this.element.propValue.id]
|
2022-02-18 17:44:16 +08:00
|
|
|
|
|
|
|
|
|
if (this.chart.isPlugin) {
|
2022-03-21 14:06:46 +08:00
|
|
|
|
current && current.callPluginInner && current.callPluginInner({ methodName: 'registerDynamicMap', methodParam: areaNode.code })
|
2022-02-18 17:44:16 +08:00
|
|
|
|
} else {
|
|
|
|
|
current && current.registerDynamicMap && current.registerDynamicMap(areaNode.code)
|
|
|
|
|
}
|
2021-08-12 18:18:37 +08:00
|
|
|
|
},
|
|
|
|
|
// 根据地名获取areaCode
|
|
|
|
|
findEntityByname(name, array) {
|
|
|
|
|
if (array === null || array.length === 0) array = this.places
|
|
|
|
|
for (let index = 0; index < array.length; index++) {
|
|
|
|
|
const node = array[index]
|
|
|
|
|
if (node.name === name) return node
|
|
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
|
|
const temp = this.findEntityByname(name, node.children)
|
|
|
|
|
if (temp) return temp
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-13 14:10:15 +08:00
|
|
|
|
},
|
2021-08-16 18:31:32 +08:00
|
|
|
|
destroyTimeMachine() {
|
|
|
|
|
this.timeMachine && clearTimeout(this.timeMachine)
|
|
|
|
|
this.timeMachine = null
|
|
|
|
|
},
|
2021-12-17 18:11:39 +08:00
|
|
|
|
destroyScaleTimeMachine() {
|
|
|
|
|
this.scaleTimeMachine && clearTimeout(this.scaleTimeMachine)
|
|
|
|
|
this.scaleTimeMachine = null
|
|
|
|
|
},
|
2021-08-16 18:31:32 +08:00
|
|
|
|
|
|
|
|
|
// 边框变化
|
|
|
|
|
chartResize(index) {
|
2021-08-13 14:10:15 +08:00
|
|
|
|
if (this.$refs[this.element.propValue.id]) {
|
2021-08-16 18:31:32 +08:00
|
|
|
|
this.timeMachine = setTimeout(() => {
|
|
|
|
|
if (index === this.changeIndex) {
|
2022-02-18 17:44:16 +08:00
|
|
|
|
this.chart.isPlugin
|
|
|
|
|
? this.$refs[this.element.propValue.id].callPluginInner({ methodName: 'chartResize' })
|
|
|
|
|
: this.$refs[this.element.propValue.id].chartResize()
|
2021-08-16 18:31:32 +08:00
|
|
|
|
}
|
|
|
|
|
this.destroyTimeMachine()
|
2021-09-16 16:10:16 +08:00
|
|
|
|
}, 50)
|
2021-08-13 14:10:15 +08:00
|
|
|
|
}
|
2021-09-08 17:17:24 +08:00
|
|
|
|
},
|
|
|
|
|
|
2021-12-17 18:11:39 +08:00
|
|
|
|
// 边框变化 修改视图内部参数
|
|
|
|
|
chartScale(index) {
|
|
|
|
|
if (this.$refs[this.element.propValue.id]) {
|
|
|
|
|
this.scaleTimeMachine = setTimeout(() => {
|
|
|
|
|
if (index === this.changeScaleIndex) {
|
|
|
|
|
this.mergeScale()
|
|
|
|
|
}
|
|
|
|
|
this.destroyScaleTimeMachine()
|
|
|
|
|
}, 100)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2021-09-08 17:17:24 +08:00
|
|
|
|
renderComponent() {
|
2021-10-14 18:06:19 +08:00
|
|
|
|
return this.chart.render
|
2022-03-10 10:38:33 +08:00
|
|
|
|
},
|
|
|
|
|
getDataEdit(param) {
|
|
|
|
|
this.$store.state.styleChangeTimes++
|
|
|
|
|
if (param.type === 'propChange') {
|
|
|
|
|
this.getData(param.viewId, false)
|
|
|
|
|
} else if (param.type === 'styleChange') {
|
|
|
|
|
this.chart.customAttr = param.viewInfo.customAttr
|
|
|
|
|
this.chart.customStyle = param.viewInfo.customStyle
|
2022-03-11 16:32:23 +08:00
|
|
|
|
this.chart.senior = param.viewInfo.senior
|
2022-03-10 10:38:33 +08:00
|
|
|
|
this.sourceCustomAttrStr = this.chart.customAttr
|
|
|
|
|
this.sourceCustomStyleStr = this.chart.customStyle
|
|
|
|
|
this.mergeScale()
|
|
|
|
|
}
|
2021-03-25 19:16:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-11-24 11:25:01 +08:00
|
|
|
|
.rect-shape {
|
2021-03-25 19:16:32 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2021-05-19 16:29:19 +08:00
|
|
|
|
overflow: hidden;
|
2021-11-24 11:25:01 +08:00
|
|
|
|
}
|
2021-07-13 18:11:42 +08:00
|
|
|
|
|
2021-11-24 11:25:01 +08:00
|
|
|
|
.chart-class {
|
|
|
|
|
height: 100%;
|
2022-02-28 12:14:49 +08:00
|
|
|
|
padding: 0px!important;
|
2021-11-24 11:25:01 +08:00
|
|
|
|
}
|
2021-07-13 18:11:42 +08:00
|
|
|
|
|
2021-11-24 11:25:01 +08:00
|
|
|
|
.table-class {
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
2021-07-09 16:44:36 +08:00
|
|
|
|
|
2021-11-24 11:25:01 +08:00
|
|
|
|
.chart-error-class {
|
|
|
|
|
text-align: center;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
background-color: #ece7e7;
|
|
|
|
|
}
|
2021-07-09 16:44:36 +08:00
|
|
|
|
|
2021-11-24 11:25:01 +08:00
|
|
|
|
.chart-error-message-class {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: #9ea6b2;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
2021-07-09 16:44:36 +08:00
|
|
|
|
|
2021-11-24 11:25:01 +08:00
|
|
|
|
.active {
|
2021-07-09 16:44:36 +08:00
|
|
|
|
|
2021-11-24 11:25:01 +08:00
|
|
|
|
}
|
2021-07-09 16:44:36 +08:00
|
|
|
|
|
2021-11-24 11:25:01 +08:00
|
|
|
|
.active > > > .icon-fangda {
|
|
|
|
|
z-index: 2;
|
|
|
|
|
display: block !important;
|
|
|
|
|
}
|
2021-07-13 18:11:42 +08:00
|
|
|
|
|
2021-12-10 17:00:19 +08:00
|
|
|
|
/*.rect-shape > i {*/
|
|
|
|
|
/* right: 5px;*/
|
|
|
|
|
/* color: gray;*/
|
|
|
|
|
/* position: absolute;*/
|
|
|
|
|
/*}*/
|
2021-11-24 11:25:01 +08:00
|
|
|
|
|
2021-12-10 17:00:19 +08:00
|
|
|
|
/*.rect-shape > > > i:hover {*/
|
|
|
|
|
/* color: red;*/
|
|
|
|
|
/*}*/
|
2021-11-24 11:25:01 +08:00
|
|
|
|
|
2021-12-10 17:00:19 +08:00
|
|
|
|
/*.rect-shape:hover > > > .icon-fangda {*/
|
|
|
|
|
/* z-index: 2;*/
|
|
|
|
|
/* display: block;*/
|
|
|
|
|
/*}*/
|
2021-11-24 11:25:01 +08:00
|
|
|
|
|
2021-12-10 17:00:19 +08:00
|
|
|
|
/*.rect-shape > > > .icon-fangda {*/
|
|
|
|
|
/* display: none*/
|
|
|
|
|
/*}*/
|
2021-11-24 11:25:01 +08:00
|
|
|
|
|
2021-12-10 17:00:19 +08:00
|
|
|
|
/*.rect-shape:hover > > > .icon-shezhi {*/
|
|
|
|
|
/* z-index: 2;*/
|
|
|
|
|
/* display: block;*/
|
|
|
|
|
/*}*/
|
2021-11-24 11:25:01 +08:00
|
|
|
|
|
2021-12-10 17:00:19 +08:00
|
|
|
|
/*.rect-shape > > > .icon-shezhi {*/
|
|
|
|
|
/* display: none*/
|
|
|
|
|
/*}*/
|
2021-03-25 19:16:32 +08:00
|
|
|
|
</style>
|