fix: 插件与内置图表类型重名导致内置图表被插件覆盖

This commit is contained in:
ulleo 2023-09-11 16:35:24 +08:00
parent bbc1139b1c
commit d3b842c314
4 changed files with 52 additions and 28 deletions

View File

@ -433,7 +433,7 @@ export default {
const trackMenuInfo = []
let linkageCount = 0
let jumpCount = 0
if(this.drillFilters.length && !this.chart.type.includes('table')){
if (this.drillFilters.length && !this.chart.type.includes('table')) {
const checkItem = this.drillFields[this.drillFilters.length]
const sourceInfo = this.chart.id + '#' + checkItem.id
if (this.nowPanelTrackInfo[sourceInfo]) {
@ -442,7 +442,7 @@ export default {
if (this.nowPanelJumpInfo[sourceInfo]) {
jumpCount++
}
}else{
} else {
this.chart.data && this.chart.data.fields && this.chart.data.fields.forEach(item => {
const sourceInfo = this.chart.id + '#' + item.id
if (this.nowPanelTrackInfo[sourceInfo]) {
@ -634,7 +634,7 @@ export default {
},
exportViewImg() {
this.imageDownloading = true
this.$refs['userViewDialog'].exportViewImg(()=>{
this.$refs['userViewDialog'].exportViewImg(() => {
this.imageDownloading = false
})
},

View File

@ -13,7 +13,7 @@
@click="add('group')"
/>
</el-row>
<el-divider/>
<el-divider />
<el-row style="margin-bottom: 10px">
<el-col :span="16">
<el-input
@ -31,7 +31,7 @@
size="mini"
type="primary"
>
{{ searchMap[searchType] }}<i class="el-icon-arrow-down el-icon--right"/>
{{ searchMap[searchType] }}<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="searchTypeClick('all')">{{ $t('commons.all') }}</el-dropdown-item>
@ -63,7 +63,7 @@
>
<span style="display: flex;flex: 1;width: 0;">
<span>
<i class="el-icon-folder"/>
<i class="el-icon-folder" />
</span>
<span
style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
@ -152,7 +152,7 @@
class="custom-tree-node-list father"
>
<span style="display: flex;flex: 1;width: 0;">
<span><svg-icon :icon-class="data.modelInnerType"/></span>
<span><svg-icon :icon-class="data.modelInnerType" /></span>
<span
style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"
:title="data.name"
@ -225,7 +225,7 @@
:label="$t('commons.name')"
prop="name"
>
<el-input v-model="groupForm.name"/>
<el-input v-model="groupForm.name" />
</el-form-item>
</el-form>
<div
@ -266,7 +266,7 @@
:label="$t('commons.name')"
prop="name"
>
<el-input v-model="tableForm.name"/>
<el-input v-model="tableForm.name" />
</el-form-item>
</el-form>
<div
@ -322,8 +322,8 @@
:active="createActive"
align-center
>
<el-step :title="$t('chart.select_dataset')"/>
<el-step :title="$t('chart.select_chart_type')"/>
<el-step :title="$t('chart.select_dataset')" />
<el-step :title="$t('chart.select_chart_type')" />
</el-steps>
<table-selector
@ -397,8 +397,8 @@
size="mini"
@click="createPreview"
>{{
$t('chart.preview')
}}
$t('chart.preview')
}}
</el-button>
<el-button
v-if="createActive === 1"
@ -447,8 +447,8 @@
size="mini"
@click="saveMoveGroup(tGroup)"
>{{
$t('dataset.confirm')
}}
$t('dataset.confirm')
}}
</el-button>
</div>
</el-dialog>
@ -481,8 +481,8 @@
size="mini"
@click="saveMoveDs(tDs)"
>{{
$t('dataset.confirm')
}}
$t('dataset.confirm')
}}
</el-button>
</div>
</el-dialog>
@ -630,6 +630,10 @@ export default {
},
panelInfo() {
return this.$store.state.panel.panelInfo
},
watchChartTypeChangeObj() {
const { type, render } = this.view
return { type, render }
}
},
watch: {
@ -649,8 +653,14 @@ export default {
this.searchPids = []
this.$refs.chartTreeRef.filter(this.filterText)
},
chartType(val) {
this.view.isPlugin = val && this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(val)
// chartType(val) {
// this.view.isPlugin = val && this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(val)
// },
watchChartTypeChangeObj(newVal, oldVal) {
if (newVal.type === oldVal.type && newVal.render === oldVal.render) {
return
}
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
}
},

View File

@ -1324,8 +1324,8 @@
ref="itemForm"
label-width="80px"
:model="itemForm"
@submit.native.prevent
:rules="itemFormRules"
@submit.native.prevent
>
<el-form-item
:label="$t('dataset.field_origin_name')"
@ -1997,6 +1997,10 @@ export default {
!equalsAny(this.view.type, 'liquid', 'bidirectional-bar',
'word-cloud', 'table-pivot', 'label', 'richTextView', 'flow-map')
},
watchChartTypeChangeObj() {
const { type, render } = this.view
return { type, render }
},
...mapState([
'curComponent',
'panelViewEditInfo',
@ -2032,8 +2036,17 @@ export default {
}
this.$emit('typeChange', newVal)
},
'view.type': function(newVal, oldVal) {
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal)
// 'view.type': function(newVal, oldVal) {
// this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal)
// },
watchChartTypeChangeObj(newVal, oldVal) {
if (newVal.type === oldVal.type && newVal.render === oldVal.render) {
return
}
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, newVal.type !== oldVal.type, newVal.render !== oldVal.render)
}
},
created() {
@ -2418,6 +2431,7 @@ export default {
view.extBubble = JSON.stringify(view.extBubble)
view.senior = JSON.stringify(view.senior)
delete view.data
return view
},
refreshAttrChange() {
@ -3330,12 +3344,12 @@ export default {
this.$store.commit('recordViewEdit', { viewId: this.param.id, hasEdit: status })
},
changeChartRender() {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, false, true)
// this.setChartDefaultOptions()
// this.calcData(true, 'chart', true, false, true)
},
changeChartType() {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, true)
// this.setChartDefaultOptions()
// this.calcData(true, 'chart', true, true)
},
setChartDefaultOptions() {

View File

@ -93,9 +93,9 @@ export default {
}
},
methods: {
currentIsPlugin(type) {
currentIsPlugin(type, render) {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
return plugins.some(plugin => plugin.value === type)
return plugins.some(plugin => plugin.value === type && plugin.render === render)
},
initTypes(plugins) {
plugins.forEach(plugin => {