fix: 集成视图插件的render类型

This commit is contained in:
fit2cloud-chenyw 2022-03-30 18:00:12 +08:00
parent 8408b575b6
commit a6c49815e3
2 changed files with 19 additions and 5 deletions

View File

@ -204,7 +204,7 @@
<span style="float: right;"> <span style="float: right;">
<el-select v-model="view.render" class="render-select" style="width: 70px" size="mini"> <el-select v-model="view.render" class="render-select" style="width: 70px" size="mini">
<el-option <el-option
v-for="item in renderOptions" v-for="item in pluginRenderOptions"
:key="item.value" :key="item.value"
:value="item.value" :value="item.value"
:label="item.name" :label="item.name"
@ -429,6 +429,13 @@ export default {
}, },
panelInfo() { panelInfo() {
return this.$store.state.panel.panelInfo return this.$store.state.panel.panelInfo
},
pluginRenderOptions() {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
const pluginOptions = plugins.filter(plugin => !this.renderOptions.some(option => option.value === plugin.render)).map(plugin => {
return { name: plugin.render, value: plugin.render }
})
return [...this.renderOptions, ...pluginOptions]
} }
}, },
watch: { watch: {
@ -783,7 +790,7 @@ export default {
view.extBubble = JSON.stringify([]) view.extBubble = JSON.stringify([])
this.setChartDefaultOptions(view) this.setChartDefaultOptions(view)
const _this = this const _this = this
post('/chart/view/newOne/' + this.panelInfo.id, view,true).then(response => { post('/chart/view/newOne/' + this.panelInfo.id, view, true).then(response => {
this.closeCreateChart() this.closeCreateChart()
this.$store.dispatch('chart/setTableId', null) this.$store.dispatch('chart/setTableId', null)
this.$store.dispatch('chart/setTableId', this.table.id) this.$store.dispatch('chart/setTableId', this.table.id)

View File

@ -175,7 +175,7 @@
@change="changeChartType()" @change="changeChartType()"
> >
<el-option <el-option
v-for="item in renderOptions" v-for="item in pluginRenderOptions"
:key="item.value" :key="item.value"
:value="item.value" :value="item.value"
:label="item.name" :label="item.name"
@ -877,7 +877,7 @@
@onLegendChange="onLegendChange" @onLegendChange="onLegendChange"
/> />
</el-collapse-item> </el-collapse-item>
<el-collapse-item v-if="chart.customStyle.background" name="background" :title="$t('chart.background')"> <el-collapse-item v-if="chart.customStyle && chart.customStyle.background" name="background" :title="$t('chart.background')">
<background-color-selector <background-color-selector
:param="param" :param="param"
class="attr-selector" class="attr-selector"
@ -1378,7 +1378,14 @@ export default {
}, },
...mapState([ ...mapState([
'panelViewEditInfo' 'panelViewEditInfo'
]) ]),
pluginRenderOptions() {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
const pluginOptions = plugins.filter(plugin => !this.renderOptions.some(option => option.value === plugin.render)).map(plugin => {
return { name: plugin.render, value: plugin.render }
})
return [...this.renderOptions, ...pluginOptions]
}
}, },
watch: { watch: {
'param': function(val) { 'param': function(val) {