fix association

This commit is contained in:
Qiuxia Fan 2022-07-14 15:13:00 +08:00
parent b5c07e023b
commit e395d2e129
5 changed files with 12 additions and 6 deletions

View File

@ -145,7 +145,7 @@ const msg = {
associateOptions: "Association Options", associateOptions: "Association Options",
widget: "Widget", widget: "Widget",
nameTip: nameTip:
"The name only supports Chinese and English, horizontal lines and underscores", "The name only supports Chinese and English, horizontal lines and underscores and is limited to 300 characters",
duplicateName: "Duplicate name", duplicateName: "Duplicate name",
seconds: "Seconds", seconds: "Seconds",
hourTip: "Select Hour", hourTip: "Select Hour",

View File

@ -146,7 +146,7 @@ const msg = {
widget: "Dispositivo pequeño", widget: "Dispositivo pequeño",
duplicateName: "Nombre duplicado", duplicateName: "Nombre duplicado",
nameTip: nameTip:
"Este nombre sólo admite chino e inglés, líneas cruzadas y subrayado", "Este nombre sólo admite chino e inglés, líneas horizontales y subrayado, y no más de 300 caracteres",
seconds: "Segundos", seconds: "Segundos",
hourTip: "Seleccione Hora", hourTip: "Seleccione Hora",
minuteTip: "Seleccione Minuto", minuteTip: "Seleccione Minuto",

View File

@ -142,7 +142,7 @@ const msg = {
begin: "开始", begin: "开始",
associateOptions: "关联选项", associateOptions: "关联选项",
widget: "部件", widget: "部件",
nameTip: "该名称仅支持中文和英文、横线和下划线", nameTip: "该名称仅支持中文和英文、横线和下划线, 并且限制长度为300个字符",
duplicateName: "重复的名称", duplicateName: "重复的名称",
seconds: "秒", seconds: "秒",
hourTip: "选择小时", hourTip: "选择小时",

View File

@ -51,9 +51,15 @@ const widgets = computed(() => {
const items = widgets.filter( const items = widgets.filter(
(d: { value: string; label: string } & LayoutConfig) => { (d: { value: string; label: string } & LayoutConfig) => {
if (dashboardStore.selectedGrid.id !== d.id) { if (dashboardStore.selectedGrid.id !== d.id) {
if (isLinear && d.type === "Widget" && d.widget && d.id) { if (
isLinear &&
d.type === "Widget" &&
d.widget &&
d.widget.name &&
d.id
) {
d.value = d.id; d.value = d.id;
d.label = d.widget.name || d.id; d.label = d.widget.name;
return d; return d;
} }
// if (isRank && d.type !== "Widget" && d.widget && d.id) { // if (isRank && d.type !== "Widget" && d.widget && d.id) {

View File

@ -74,7 +74,7 @@ function updateWidgetConfig(param: { [key: string]: string }) {
function updateWidgetName(param: { [key: string]: string }) { function updateWidgetName(param: { [key: string]: string }) {
const key = Object.keys(param)[0]; const key = Object.keys(param)[0];
const n = decodeURIComponent(param[key]); const n = decodeURIComponent(param[key]);
const pattern = /^[A-Za-z0-9-_\u4e00-\u9fa5]{1,30}$/; const pattern = /^[A-Za-z0-9-_\u4e00-\u9fa5]{1,300}$/;
if (!pattern.test(n)) { if (!pattern.test(n)) {
ElMessage.error(t("nameTip")); ElMessage.error(t("nameTip"));
return; return;