提交 0aa2a69f authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

feat: 仪表板集成插件视图

上级 a2d63ace
...@@ -16,8 +16,15 @@ ...@@ -16,8 +16,15 @@
{{ $t('chart.chart_error_tips') }} {{ $t('chart.chart_error_tips') }}
</div> </div>
</div> </div>
<plugin-com
v-if="isPlugin"
:ref="element.propValue.id"
:component-name="chart.type + '-view'"
:obj="{chart, trackMenu, searchCount, terminalType: scaleCoefficientType}"
class="chart-class"
/>
<chart-component <chart-component
v-if="charViewShowFlag" v-else-if="charViewShowFlag"
:ref="element.propValue.id" :ref="element.propValue.id"
class="chart-class" class="chart-class"
:chart="chart" :chart="chart"
...@@ -28,7 +35,7 @@ ...@@ -28,7 +35,7 @@
@onJumpClick="jumpClick" @onJumpClick="jumpClick"
/> />
<chart-component-g2 <chart-component-g2
v-if="charViewG2ShowFlag" v-else-if="charViewG2ShowFlag"
:ref="element.propValue.id" :ref="element.propValue.id"
class="chart-class" class="chart-class"
:chart="chart" :chart="chart"
...@@ -38,7 +45,7 @@ ...@@ -38,7 +45,7 @@
@onJumpClick="jumpClick" @onJumpClick="jumpClick"
/> />
<chart-component-s2 <chart-component-s2
v-if="charViewS2ShowFlag" v-else-if="charViewS2ShowFlag"
:ref="element.propValue.id" :ref="element.propValue.id"
class="chart-class" class="chart-class"
:chart="chart" :chart="chart"
...@@ -48,13 +55,13 @@ ...@@ -48,13 +55,13 @@
@onJumpClick="jumpClick" @onJumpClick="jumpClick"
/> />
<table-normal <table-normal
v-if="tableShowFlag" v-else-if="tableShowFlag"
:ref="element.propValue.id" :ref="element.propValue.id"
:show-summary="chart.type === 'table-normal'" :show-summary="chart.type === 'table-normal'"
:chart="chart" :chart="chart"
class="table-class" class="table-class"
/> />
<label-normal v-if="labelShowFlag" :ref="element.propValue.id" :chart="chart" class="table-class" /> <label-normal v-else-if="labelShowFlag" :ref="element.propValue.id" :chart="chart" class="table-class" />
<div style="position: absolute;left: 8px;bottom:8px;"> <div style="position: absolute;left: 8px;bottom:8px;">
<drill-path :drill-filters="drillFilters" @onDrillJump="drillJump" /> <drill-path :drill-filters="drillFilters" @onDrillJump="drillJump" />
</div> </div>
...@@ -82,10 +89,11 @@ import ChartComponentG2 from '@/views/chart/components/ChartComponentG2' ...@@ -82,10 +89,11 @@ import ChartComponentG2 from '@/views/chart/components/ChartComponentG2'
import EditBarView from '@/components/canvas/components/Editor/EditBarView' import EditBarView from '@/components/canvas/components/Editor/EditBarView'
import { customAttrTrans, customStyleTrans, recursionTransObj } from '@/components/canvas/utils/style' import { customAttrTrans, customStyleTrans, recursionTransObj } from '@/components/canvas/utils/style'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2' import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
import { pluginTypes } from '@/api/chart/chart'
import PluginCom from '@/views/system/plugin/PluginCom'
export default { export default {
name: 'UserView', name: 'UserView',
components: { ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 }, components: { PluginCom, ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 },
props: { props: {
element: { element: {
type: Object, type: Object,
...@@ -108,6 +116,7 @@ export default { ...@@ -108,6 +116,7 @@ export default {
required: false, required: false,
default: false default: false
}, },
// eslint-disable-next-line vue/require-default-prop
componentIndex: { componentIndex: {
type: Number, type: Number,
required: false required: false
...@@ -153,7 +162,9 @@ export default { ...@@ -153,7 +162,9 @@ export default {
pre: null, pre: null,
preCanvasPanel: null, preCanvasPanel: null,
sourceCustomAttrStr: null, sourceCustomAttrStr: null,
sourceCustomStyleStr: null sourceCustomStyleStr: null,
isPlugin: false,
plugins: []
} }
}, },
computed: { computed: {
...@@ -260,6 +271,7 @@ export default { ...@@ -260,6 +271,7 @@ export default {
}, },
watch: { watch: {
'cfilters': { 'cfilters': {
handler: function(val1, val2) { handler: function(val1, val2) {
if (isChange(val1, val2) && !this.isFirstLoad) { if (isChange(val1, val2) && !this.isFirstLoad) {
...@@ -320,6 +332,7 @@ export default { ...@@ -320,6 +332,7 @@ export default {
} }
}, },
'chartType': function(newVal, oldVal) { 'chartType': function(newVal, oldVal) {
this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
if (newVal === 'map' && newVal !== oldVal) { if (newVal === 'map' && newVal !== oldVal) {
this.initAreas() this.initAreas()
} }
...@@ -334,6 +347,12 @@ export default { ...@@ -334,6 +347,12 @@ export default {
deep: true deep: true
} }
}, },
beforeCreate() {
pluginTypes().then(res => {
this.plugins = res.data
this.isPlugin = this.plugins.some(plugin => plugin.value === this.chart.type)
})
},
created() { created() {
this.refId = uuid.v1 this.refId = uuid.v1
if (this.element && this.element.propValue && this.element.propValue.viewId) { if (this.element && this.element.propValue && this.element.propValue.viewId) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论