feat: 兼容插件视图样式设置

This commit is contained in:
fit2cloud-chenyw 2022-02-17 18:39:44 +08:00
parent 173d808371
commit 4671ea996e
4 changed files with 38 additions and 8 deletions

View File

@ -1,14 +1,15 @@
<template>
<component
:is="mode"
:ref="refId"
:obj="obj"
v-bind="$attrs"
v-on="$listeners"
:obj="obj"
/>
</template>
<script>
import { uuid } from 'vue-uuid'
import { get } from '@/api/system/dynamic'
export default {
@ -28,7 +29,8 @@ export default {
data() {
return {
resData: '',
mode: ''
mode: '',
refId: null
}
},
watch: {
@ -59,8 +61,13 @@ export default {
}
}
},
created() {
this.refId = uuid.v1
},
methods: {
chartResize() {
this.$refs[this.refId] && this.$refs[this.refId].chartResize && this.$refs[this.refId].chartResize()
}
}
}
</script>

View File

@ -76,7 +76,7 @@ import ChartComponent from '@/views/chart/components/ChartComponent.vue'
import TableNormal from '@/views/chart/components/table/TableNormal'
import LabelNormal from '../../../views/chart/components/normal/LabelNormal'
import { uuid } from 'vue-uuid'
import bus from '@/utils/bus'
import { mapState } from 'vuex'
import { isChange } from '@/utils/conditionUtil'
import { BASE_CHART_STRING } from '@/views/chart/chart/chart'
@ -164,6 +164,9 @@ export default {
sourceCustomStyleStr: null
}
},
mounted() {
this.bindPluginEvent()
},
computed: {
scaleCoefficient() {
if (this.terminal === 'pc' && !this.mobileLayoutStatus) {
@ -354,6 +357,10 @@ export default {
}
},
methods: {
bindPluginEvent() {
bus.$on('plugin-chart-click', this.chartClick)
bus.$on('plugin-jump-click', this.jumpClick)
},
//
mergeScale() {
const scale = Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient

View File

@ -220,7 +220,7 @@
</el-row>
</el-row>
<plugin-com v-if="view.isPlugin" :component-name="view.type + '-data'" :obj="{view, param, chart}" />
<plugin-com v-if="view.isPlugin" :component-name="view.type + '-data'" :obj="{view, param, chart, dimensionData, quotaData}" />
<div v-else>
<el-row v-if="view.type ==='map'" class="padding-lr">
@ -591,7 +591,15 @@
</el-tab-pane>
<el-tab-pane :label="$t('chart.chart_style')" class="padding-tab" style="width: 360px;">
<el-row class="view-panel">
<plugin-com
v-if="view.isPlugin"
style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;"
class="attr-style theme-border-class"
:component-name="view.type + '-style'"
:obj="{view, param, chart}"
/>
<div
v-else
style="overflow:auto;border-right: 1px solid #e6e6e6;height: 100%;width: 100%;"
class="attr-style theme-border-class"
>
@ -1238,7 +1246,9 @@ export default {
bus.$on('show-rename', this.showRename)
bus.$on('show-quota-edit-filter', this.showQuotaEditFilter)
bus.$on('show-quota-edit-compare', this.showQuotaEditCompare)
bus.$on('show-edit-filter', this.showEditFilter)
bus.$on('calc-data', this.calcData)
bus.$on('plugins-calc-style', this.calcStyle)
},
initTableData(id) {
if (id != null) {

View File

@ -2,6 +2,7 @@
<div>
<async-component
v-if="showAsync"
:ref="refId"
:url="url"
:obj="obj"
@execute-axios="executeAxios"
@ -19,7 +20,7 @@ import AsyncComponent from '@/components/AsyncComponent'
import i18n from '@/lang'
import bus from '@/utils/bus'
import { execute } from '@/api/system/dynamic'
import { uuid } from 'vue-uuid'
export default {
name: 'PluginCom',
components: {
@ -39,10 +40,12 @@ export default {
return {
showAsync: false,
baseUrl: '/api/pluginCommon/component/',
url: null
url: null,
refId: null
}
},
created() {
this.refId = uuid.v1
if (this.componentName) {
this.showAsync = true
this.url = this.baseUrl + this.componentName
@ -75,6 +78,9 @@ export default {
pluginCallBack(param) {
const { eventName, eventParam } = param
bus.$emit(eventName, eventParam)
},
chartResize() {
this.$refs[this.refId] && this.$refs[this.refId].chartResize && this.$refs[this.refId].chartResize()
}
}
}