From 747912434222195f9ee70c2638b6a1cd76d6a458 Mon Sep 17 00:00:00 2001 From: oucb Date: Fri, 15 Sep 2023 11:12:03 +0800 Subject: [PATCH] refactor(useSubscription.ts): only check device name --- src/composables/config/useSubscription.ts | 15 +++------------ src/i18n/config.ts | 4 ---- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/composables/config/useSubscription.ts b/src/composables/config/useSubscription.ts index f2153399..7bc6a5e9 100644 --- a/src/composables/config/useSubscription.ts +++ b/src/composables/config/useSubscription.ts @@ -155,6 +155,7 @@ type AddSubscriptionProps = Readonly<{ export const useSubscriptionGroup = () => { const { t } = useI18n() + const { isGewuPugin } = useDriverInfo() const checkDriverGroups = async (rule: unknown, value: string, callback: any) => { const keys = Object.keys(value) const values = Object.values(value) @@ -163,18 +164,8 @@ export const useSubscriptionGroup = () => { const nodeGroups = Object.entries(value) nodeGroups.forEach(([key, groups]) => { const groupLen = groups.length - if (groupLen) { - if (!re.test(key)) { - callback(new Error(t('config.subscribeSouthDriverDeviceIllegal'))) - } else { - Object.values(groups).forEach((item) => { - // 数据更新 - console.log(re.test(item)) - if (!re.test(item)) { - callback(new Error(t('config.subscribeSouthDriverGroupIllegal'))) - } - }) - } + if (groupLen && isGewuPugin.value && !re.test(key)) { + callback(new Error(t('config.subscribeSouthDriverDeviceIllegal'))) } }) if (!keys.length || isAllEmpty) { diff --git a/src/i18n/config.ts b/src/i18n/config.ts index 54ac1b02..9def5a53 100644 --- a/src/i18n/config.ts +++ b/src/i18n/config.ts @@ -638,8 +638,4 @@ export default { zh: '注册的设备,名称只能包含数字和字母', en: 'Subscribed devices, names can only contain numbers and letters', }, - subscribeSouthDriverGroupIllegal: { - zh: '设备下的分组,名称只能包含数字和字母', - en: 'The group name under the device can only contain numbers and letters', - }, }