From 3985856f97183fccb83af243ce28b02f0b0b6592 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Wed, 16 Mar 2022 14:44:21 +0800 Subject: [PATCH] edit dashboard list --- src/store/modules/dashboard.ts | 6 ++- src/views/Service.vue | 3 +- src/views/dashboard/Edit.vue | 4 +- src/views/dashboard/List.vue | 69 ++++++++++++++++++++++++---------- 4 files changed, 57 insertions(+), 25 deletions(-) diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index 15d48295..8fa03d5e 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -92,7 +92,6 @@ export const dashboardStore = defineStore({ entity: string; id: string; }) { - console.log(item); this.currentDashboard = item; }, addControl(type: string) { @@ -343,7 +342,10 @@ export const dashboardStore = defineStore({ name: c.name, isRoot: c.isRoot, }); - sessionStorage.setItem(key, JSON.stringify(t)); + sessionStorage.setItem( + key, + JSON.stringify({ id: t.id, configuration: c }) + ); } sessionStorage.setItem("dashboards", JSON.stringify(list)); return res.data; diff --git a/src/views/Service.vue b/src/views/Service.vue index 67365b77..12c81496 100644 --- a/src/views/Service.vue +++ b/src/views/Service.vue @@ -204,7 +204,8 @@ watch( padding: 15px; background-color: #fff; margin: 30px 10px; - border-radius: 3px; + box-shadow: 0px 1px 4px 0px #00000029; + border-radius: 5px; max-height: 100%; overflow: auto; } diff --git a/src/views/dashboard/Edit.vue b/src/views/dashboard/Edit.vue index 3ada8530..1b55b6a9 100644 --- a/src/views/dashboard/Edit.vue +++ b/src/views/dashboard/Edit.vue @@ -54,7 +54,6 @@ const { t } = useI18n(); const p = useRoute().params; const layoutKey = `${p.layerId}_${p.entity}_${p.name}`; -appStore.setPageTitle("Dashboard Name"); setTemplate(); async function setTemplate() { @@ -62,9 +61,10 @@ async function setTemplate() { const c: { configuration: string; id: string } = JSON.parse( sessionStorage.getItem(layoutKey) || "{}" ); - const layout = JSON.parse(c.configuration || "{}"); + const layout: any = c.configuration || {}; dashboardStore.setLayout(layout.children || []); + appStore.setPageTitle(layout.name); } function handleClick(e: any) { e.stopPropagation(); diff --git a/src/views/dashboard/List.vue b/src/views/dashboard/List.vue index e06372bf..ec10fb71 100644 --- a/src/views/dashboard/List.vue +++ b/src/views/dashboard/List.vue @@ -43,8 +43,9 @@ limitations under the License. --> v-loading="loading" > - - + + +