forked from github/dataease
Merge pull request #6309 from dataease/pr@dev@fix_plugin_view
fix: 视图插件类型选项出现重复#6220
This commit is contained in:
commit
81869d0fa2
@ -687,12 +687,22 @@ export default {
|
||||
this.getChartGroupTree()
|
||||
},
|
||||
methods: {
|
||||
distinctArray(arr, key) {
|
||||
const m = new Map()
|
||||
for (const item of arr) {
|
||||
if (!m.has(item[key])) {
|
||||
m.set(item[key], item)
|
||||
}
|
||||
}
|
||||
return [...m.values()]
|
||||
},
|
||||
loadPluginType() {
|
||||
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 }
|
||||
})
|
||||
this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions]
|
||||
const tempList = [...this.renderOptions, ...pluginOptions]
|
||||
this.pluginRenderOptions = this.distinctArray(tempList, 'value')
|
||||
},
|
||||
clickAdd(param) {
|
||||
this.currGroup = param.data
|
||||
|
@ -2098,7 +2098,17 @@ export default {
|
||||
const pluginOptions = plugins.filter(plugin => !this.renderOptions.some(option => option.value === plugin.render)).map(plugin => {
|
||||
return { name: plugin.render, value: plugin.render }
|
||||
})
|
||||
this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions]
|
||||
const tempList = [...this.renderOptions, ...pluginOptions]
|
||||
this.pluginRenderOptions = this.distinctArray(tempList, 'value')
|
||||
},
|
||||
distinctArray(arr, key) {
|
||||
const m = new Map()
|
||||
for (const item of arr) {
|
||||
if (!m.has(item[key])) {
|
||||
m.set(item[key], item)
|
||||
}
|
||||
}
|
||||
return [...m.values()]
|
||||
},
|
||||
emptyTableData(id) {
|
||||
this.table = {}
|
||||
|
Loading…
Reference in New Issue
Block a user