From e8b8cf5fb4e38978bc5802f7cbb30d756493a34f Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Sun, 27 Mar 2022 22:53:07 +0800 Subject: [PATCH] update graph --- src/views/dashboard/configuration/widget/metric/Index.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/dashboard/configuration/widget/metric/Index.vue b/src/views/dashboard/configuration/widget/metric/Index.vue index c0d9f5e7..197a7f76 100644 --- a/src/views/dashboard/configuration/widget/metric/Index.vue +++ b/src/views/dashboard/configuration/widget/metric/Index.vue @@ -159,8 +159,8 @@ states.visTypes = setVisTypes(); setDashboards(); setMetricType(); -async function setMetricType() { - const { graph } = dashboardStore.selectedGrid; +async function setMetricType(chart?: any) { + const graph = chart || dashboardStore.selectedGrid.graph; const json = await dashboardStore.fetchMetricList(); if (json.errors) { ElMessage.error(json.errors); @@ -203,6 +203,7 @@ async function setMetricType() { ...dashboardStore.selectedGrid, metrics: states.metrics, metricTypes: states.metricTypes, + graph, }); states.metricTypeList = []; for (const metric of metrics) { @@ -266,7 +267,6 @@ function setVisTypes() { function changeChartType(item: Option) { const graph = DefaultGraphConfig[item.value]; - dashboardStore.selectWidget({ ...dashboardStore.selectedGrid, graph }); states.isList = ListChartTypes.includes(graph.type); if (states.isList) { dashboardStore.selectWidget({ @@ -278,7 +278,7 @@ function changeChartType(item: Option) { states.metricTypes = [""]; defaultLen.value = 5; } - setMetricType(); + setMetricType(graph); setDashboards(); states.dashboardName = ""; defaultLen.value = 10;