diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 79457f3a..7735e44d 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -143,6 +143,7 @@ const msg = { pause: "Pause", begin: "Start", associateOptions: "Association Options", + widget: "Widget", seconds: "Seconds", hourTip: "Select Hour", minuteTip: "Select Minute", diff --git a/src/locales/lang/es.ts b/src/locales/lang/es.ts index feb1aace..afd497e3 100644 --- a/src/locales/lang/es.ts +++ b/src/locales/lang/es.ts @@ -143,6 +143,7 @@ const msg = { pause: "Pausa", begin: "Inicio", associateOptions: "Opciones de asociación", + widget: "Dispositivo pequeño", seconds: "Segundos", hourTip: "Seleccione Hora", minuteTip: "Seleccione Minuto", diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 508e1771..bfa760cd 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -141,6 +141,7 @@ const msg = { pause: "暂停", begin: "开始", associateOptions: "关联选项", + widget: "部件", seconds: "秒", hourTip: "选择小时", minuteTip: "选择分钟", diff --git a/src/views/dashboard/Edit.vue b/src/views/dashboard/Edit.vue index ad4b8c95..0cfc481e 100644 --- a/src/views/dashboard/Edit.vue +++ b/src/views/dashboard/Edit.vue @@ -66,7 +66,8 @@ export default defineComponent({ sessionStorage.getItem(layoutKey.value) || "{}" ); const layout: any = c.configuration || {}; - dashboardStore.setLayout(layout.children || []); + + dashboardStore.setLayout(setWidgetsID(layout.children || [])); appStore.setPageTitle(layout.name); if (p.entity) { dashboardStore.setCurrentDashboard({ @@ -78,6 +79,24 @@ export default defineComponent({ }); } } + function setWidgetsID(widgets: any[]) { + for (const item of widgets) { + item.id = item.i; + if (item.type === "Tab") { + if (item.children && item.children.length) { + for (const [index, child] of item.children.entries()) { + if (child.children && child.children.length) { + child.children.map((d: { i: string; index: string } | any) => { + d.id = `${item.i}-${index}-${d.i}`; + return d; + }); + } + } + } + } + } + return widgets; + } function handleClick(e: any) { e.stopPropagation(); if (e.target.className === "ds-main") { diff --git a/src/views/dashboard/List.vue b/src/views/dashboard/List.vue index 7d2bf3c6..c2d15e62 100644 --- a/src/views/dashboard/List.vue +++ b/src/views/dashboard/List.vue @@ -232,12 +232,17 @@ function exportTemplates() { }, 2000); } function optimizeTemplate( - children: (LayoutConfig & { moved?: boolean; standard?: unknown })[] + children: (LayoutConfig & { + moved?: boolean; + standard?: unknown; + id?: string; + })[] ) { for (const child of children || []) { delete child.moved; delete child.activedTabIndex; delete child.standard; + delete child.id; if (isEmptyObject(child.graph)) { delete child.graph; } diff --git a/src/views/dashboard/configuration/widget/AssociateOptions.vue b/src/views/dashboard/configuration/widget/AssociateOptions.vue index c565f137..b87f93e1 100644 --- a/src/views/dashboard/configuration/widget/AssociateOptions.vue +++ b/src/views/dashboard/configuration/widget/AssociateOptions.vue @@ -14,26 +14,52 @@ See the License for the specific language governing permissions and limitations under the License. -->