From f0c5c181c2d5e3924426b8e145b08e3f13fcd852 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Fri, 18 Mar 2022 15:51:46 +0800 Subject: [PATCH] update content --- src/locales/lang/en.ts | 1 + src/locales/lang/zh.ts | 1 + src/store/modules/dashboard.ts | 4 +++- src/views/dashboard/List.vue | 2 +- src/views/dashboard/New.vue | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index f52ec8d1..a9950aea 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -108,6 +108,7 @@ const msg = { tableHeaderCol2: "Name of the second column of the table", showXAxis: "Show X Axis", showYAxis: "Show Y Axis", + nameError: "The dashboard name cannot be duplicate", hourTip: "Select Hour", minuteTip: "Select Minute", secondTip: "Select Second", diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 5ba39161..774b4e55 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -108,6 +108,7 @@ const msg = { tableHeaderCol2: "表格的第二列的名称", showXAxis: "显示X轴", showYAxis: "显示Y轴", + nameError: "仪表板名称不能重复", hourTip: "选择小时", minuteTip: "选择分钟", secondTip: "选择秒数", diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index c3f9b6d0..30a465c4 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -26,6 +26,7 @@ import { NewControl } from "../data"; import { Duration } from "@/types/app"; import { AxiosResponse } from "axios"; import { ElMessage } from "element-plus"; +import { useI18n } from "vue-i18n"; interface DashboardState { showConfig: boolean; layout: LayoutConfig[]; @@ -368,7 +369,8 @@ export const dashboardStore = defineStore({ d.layer === this.currentDashboard.layerId ); if (index > -1) { - ElMessage.error("The dashboard name cannot be duplicate."); + const { t } = useI18n(); + ElMessage.error(t("nameError")); return; } res = await graphql diff --git a/src/views/dashboard/List.vue b/src/views/dashboard/List.vue index 34897fdc..e65a9571 100644 --- a/src/views/dashboard/List.vue +++ b/src/views/dashboard/List.vue @@ -158,7 +158,7 @@ async function importTemplates(event: any) { d.name === name && d.entity === entity && d.layer === layer && !item.id ); if (index > -1) { - return ElMessage.error("The dashboard name cannot be duplicate."); + return ElMessage.error(t("nameError")); } } loading.value = true; diff --git a/src/views/dashboard/New.vue b/src/views/dashboard/New.vue index 684afc8a..1ba4e5bb 100644 --- a/src/views/dashboard/New.vue +++ b/src/views/dashboard/New.vue @@ -82,7 +82,7 @@ const onCreate = () => { states.selectedLayer === d.layer ); if (index > -1) { - ElMessage.error("The dashboard name cannot be duplicate."); + ElMessage.error(t("nameError")); return; } dashboardStore.setCurrentDashboard({