提交 0d7e913a authored 作者: wangjiahao's avatar wangjiahao

refactor: 插件样式设置兼容

上级 7db5e731
...@@ -256,6 +256,7 @@ export default { ...@@ -256,6 +256,7 @@ export default {
}) })
// 监听画布div变动事件 // 监听画布div变动事件
const tempCanvas = document.getElementById('canvasInfoTemp') const tempCanvas = document.getElementById('canvasInfoTemp')
if (tempCanvas) {
erd.listenTo(document.getElementById('canvasInfoTemp'), element => { erd.listenTo(document.getElementById('canvasInfoTemp'), element => {
_this.$nextTick(() => { _this.$nextTick(() => {
// 将mainHeight 修改为px 临时解决html2canvas 截图不全的问题 // 将mainHeight 修改为px 临时解决html2canvas 截图不全的问题
...@@ -263,6 +264,7 @@ export default { ...@@ -263,6 +264,7 @@ export default {
this.$emit('mainHeightChange', _this.mainHeight) this.$emit('mainHeightChange', _this.mainHeight)
}) })
}) })
}
eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog) eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog)
_this.$store.commit('clearLinkageSettingInfo', false) _this.$store.commit('clearLinkageSettingInfo', false)
_this.canvasStyleDataInit() _this.canvasStyleDataInit()
......
...@@ -125,7 +125,8 @@ const data = { ...@@ -125,7 +125,8 @@ const data = {
changeProperties: { changeProperties: {
customStyle: {}, customStyle: {},
customAttr: {} customAttr: {}
} },
allViewRender: []
}, },
mutations: { mutations: {
...animation.mutations, ...animation.mutations,
...@@ -550,7 +551,7 @@ const data = { ...@@ -550,7 +551,7 @@ const data = {
// get view base info // get view base info
const viewBaseInfo = state.componentViewsData[id] const viewBaseInfo = state.componentViewsData[id]
// get properties // get properties
const viewConfig = TYPE_CONFIGS.filter(item => item.render === viewBaseInfo.render && item.value === viewBaseInfo.type) const viewConfig = state.allViewRender.filter(item => item.render === viewBaseInfo.render && item.value === viewBaseInfo.type)
const viewProperties = viewConfig ? viewConfig[0].properties : [] const viewProperties = viewConfig ? viewConfig[0].properties : []
if (state.mixProperties.length > 0) { if (state.mixProperties.length > 0) {
// If it exists , taking the intersection // If it exists , taking the intersection
...@@ -641,6 +642,12 @@ const data = { ...@@ -641,6 +642,12 @@ const data = {
customStyle: {}, customStyle: {},
customAttr: {} customAttr: {}
} }
},
initViewRender(state, pluginViews) {
pluginViews.forEach(plugin => {
plugin.isPlugin = true
})
state.allViewRender = [...TYPE_CONFIGS, ...pluginViews]
} }
}, },
modules: { modules: {
......
...@@ -652,7 +652,7 @@ ...@@ -652,7 +652,7 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('chart.chart_style')" class="padding-tab" style="width: 300px"> <el-tab-pane :label="$t('chart.chart_style')" class="padding-tab" style="width: 300px">
<chart-style <chart-style
v-if="chartProperties || view.isPlugin" v-if="chartProperties"
:param="param" :param="param"
:view="view" :view="view"
:chart="chart" :chart="chart"
...@@ -1170,7 +1170,7 @@ export default { ...@@ -1170,7 +1170,7 @@ export default {
chartProperties() { chartProperties() {
const _this = this const _this = this
if (_this.chart && _this.chart.render) { if (_this.chart && _this.chart.render) {
const viewConfig = TYPE_CONFIGS.filter(item => item.render === _this.chart.render && item.value === _this.chart.type) const viewConfig = this.allViewRender.filter(item => item.render === _this.chart.render && item.value === _this.chart.type)
if (viewConfig && viewConfig.length) { if (viewConfig && viewConfig.length) {
return viewConfig[0].properties return viewConfig[0].properties
} else { } else {
...@@ -1188,7 +1188,8 @@ export default { ...@@ -1188,7 +1188,8 @@ export default {
}, },
...mapState([ ...mapState([
'curComponent', 'curComponent',
'panelViewEditInfo' 'panelViewEditInfo',
'allViewRender'
]) ])
/* pluginRenderOptions() { /* pluginRenderOptions() {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || [] const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
......
...@@ -30,6 +30,7 @@ import PanelList from '../list/PanelList' ...@@ -30,6 +30,7 @@ import PanelList from '../list/PanelList'
import PanelViewShow from '../list/PanelViewShow' import PanelViewShow from '../list/PanelViewShow'
import ShareTree from '../GrantAuth/shareTree' import ShareTree from '../GrantAuth/shareTree'
import Enshrine from '../enshrine/index' import Enshrine from '../enshrine/index'
import { pluginTypes } from '@/api/chart/chart'
export default { export default {
name: 'PanelMain', name: 'PanelMain',
...@@ -59,6 +60,20 @@ export default { ...@@ -59,6 +60,20 @@ export default {
} }
}, },
mounted() { mounted() {
// init all views (include plugins) base info
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views'))
if (plugins) {
this.$store.commit('initViewRender', plugins)
} else {
pluginTypes().then(res => {
const plugins = res.data
localStorage.setItem('plugin-views', JSON.stringify(plugins))
this.$store.commit('initViewRender', plugins)
}).catch(e => {
localStorage.setItem('plugin-views', null)
this.$store.commit('initViewRender', plugins)
})
}
this.clear() this.clear()
}, },
methods: { methods: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论