diff --git a/core/frontend/src/views/chart/group/Group.vue b/core/frontend/src/views/chart/group/Group.vue index 422b5c4f5c..75196e3707 100644 --- a/core/frontend/src/views/chart/group/Group.vue +++ b/core/frontend/src/views/chart/group/Group.vue @@ -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 diff --git a/core/frontend/src/views/chart/view/ChartEdit.vue b/core/frontend/src/views/chart/view/ChartEdit.vue index f3562bb26e..4c716111d0 100644 --- a/core/frontend/src/views/chart/view/ChartEdit.vue +++ b/core/frontend/src/views/chart/view/ChartEdit.vue @@ -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 = {}