diff --git a/src/composables/config/useSubscription.ts b/src/composables/config/useSubscription.ts index 9a35defe..f2153399 100644 --- a/src/composables/config/useSubscription.ts +++ b/src/composables/config/useSubscription.ts @@ -159,7 +159,24 @@ export const useSubscriptionGroup = () => { const keys = Object.keys(value) const values = Object.values(value) const isAllEmpty = values.every((val) => !val?.length) - + const re = /^[0-9a-zA-Z]*$/g + 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 (!keys.length || isAllEmpty) { callback(new Error(t('config.subscribeSouthDriverDataRequired'))) } else { diff --git a/src/i18n/config.ts b/src/i18n/config.ts index a3e92237..54ac1b02 100644 --- a/src/i18n/config.ts +++ b/src/i18n/config.ts @@ -634,4 +634,12 @@ export default { zh: '请输入数组', en: 'Please enter an array', }, + subscribeSouthDriverDeviceIllegal: { + 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', + }, } diff --git a/src/views/config/components/SouthGroupsCheckbox.vue b/src/views/config/components/SouthGroupsCheckbox.vue index 6f70d6af..476fae5b 100644 --- a/src/views/config/components/SouthGroupsCheckbox.vue +++ b/src/views/config/components/SouthGroupsCheckbox.vue @@ -8,35 +8,37 @@
- - - -
- - - {{ group }} + {{ $t('common.emptyData') }}