fix widget name

This commit is contained in:
Fine 2022-08-29 16:47:27 +08:00
parent 82b348a766
commit 6a6f2390d2

View File

@ -40,15 +40,16 @@ const widgetIds = ref<string[]>(
associate.map((d: { widgetId: string }) => d.widgetId) associate.map((d: { widgetId: string }) => d.widgetId)
); );
const widgets: any = computed(() => { const widgets: any = computed(() => {
const all = getDashboard(dashboardStore.currentDashboard).widgets; const widgetList = getDashboard(dashboardStore.currentDashboard).widgets;
const items = all.filter((d: any) => { const items = [];
for (const d of widgetList) {
const isLinear = ["Bar", "Line", "Area"].includes( const isLinear = ["Bar", "Line", "Area"].includes(
(d.graph && d.graph.type) || "" (d.graph && d.graph.type) || ""
); );
if (isLinear && d.id && dashboardStore.selectedGrid.id !== d.id) { if (isLinear && d.id && dashboardStore.selectedGrid.id !== d.id) {
return { value: d.id, label: (d.widget && d.widget.name) || d.id }; items.push({ value: d.id, label: (d.widget && d.widget.name) || d.id });
} }
}); }
return items; return items;
}); });
function updateWidgetConfig(options: Option[]) { function updateWidgetConfig(options: Option[]) {