update widget name

This commit is contained in:
Qiuxia Fan 2022-07-08 11:25:36 +08:00
parent ae294d48e8
commit 7330443f64
4 changed files with 5 additions and 2 deletions

View File

@ -146,6 +146,7 @@ const msg = {
widget: "Widget",
nameTip:
"The name only supports Chinese and English, horizontal lines and underscores",
duplicateName: "Duplicate name",
seconds: "Seconds",
hourTip: "Select Hour",
minuteTip: "Select Minute",

View File

@ -144,6 +144,7 @@ const msg = {
begin: "Inicio",
associateOptions: "Opciones de asociación",
widget: "Dispositivo pequeño",
duplicateName: "Nombre duplicado",
nameTip:
"Este nombre sólo admite chino e inglés, líneas cruzadas y subrayado",
seconds: "Segundos",

View File

@ -143,6 +143,7 @@ const msg = {
associateOptions: "关联选项",
widget: "部件",
nameTip: "该名称仅支持中文和英文、横线和下划线",
duplicateName: "重复的名称",
seconds: "秒",
hourTip: "选择小时",
minuteTip: "选择分钟",

View File

@ -76,7 +76,7 @@ function updateWidgetName(param: { [key: string]: string }) {
const n = decodeURIComponent(param[key]);
const pattern = /^[A-Za-z0-9-_\u4e00-\u9fa5]{1,30}$/;
if (!pattern.test(n)) {
ElMessage.warning(t("nameTip"));
ElMessage.error(t("nameTip"));
return;
}
const { widgets } = getDashboard(dashboardStore.currentDashboard);
@ -84,7 +84,7 @@ function updateWidgetName(param: { [key: string]: string }) {
(d: LayoutConfig) => d.widget && d.widget.name === n
);
if (item) {
ElMessage.warning("Duplicate name");
ElMessage.error("Duplicate name");
return;
}
updateWidgetConfig(param);