diff --git a/src/views/system/tenant/index.vue b/src/views/system/tenant/index.vue index 9de62723..149b95c1 100644 --- a/src/views/system/tenant/index.vue +++ b/src/views/system/tenant/index.vue @@ -185,10 +185,11 @@ let modalState: ModalStateType = reactive({ parentName: null, phone: '', tenancyKey: '', - tenancyType: '', + tenancyType: 'IMSI', status: '0', radioType: '5G', radioId: '', + imsiMatch: 'fuzzy', }, confirmLoading: false, }); @@ -460,7 +461,10 @@ function fnModalVisibleByType( modalState.typeTitle = t('common.addText') + t('views.system.tenant.type'); modalState.visibleByType = true; keyTip.value = ''; + fnTypeChange('IMSI'); } else { + // 定义规则 + //修改 if (modalState.confirmLoading) return; const hide = message.loading(t('common.loading'), 0); @@ -469,9 +473,10 @@ function fnModalVisibleByType( .then(res => { if (res.code === RESULT_CODE_SUCCESS && res.data) { modalState.typeFrom = Object.assign(modalState.typeFrom, res.data); + //动态表单 fnTypeChange(modalState.typeFrom.tenancyType); - + //对RADIO 特殊处理 if ( modalState.typeFrom.tenancyType == 'RADIO' && modalState.typeFrom.tenancyKey @@ -482,6 +487,24 @@ function fnModalVisibleByType( modalState.typeFrom.tenancyKey.split('_')[1]; } + //对IMSI 特殊处理 + if ( + modalState.typeFrom.tenancyType == 'IMSI' && + modalState.typeFrom.tenancyKey + ) { + const prefixRule: RegExp = /%$/; // 前缀匹配正则 + const fuzzyRule: RegExp = /^%.+%$/; // 模糊匹配正则 + if (fuzzyRule.test(modalState.typeFrom.tenancyKey)) { + modalState.typeFrom.imsiMatch = 'fuzzy'; + } else if (prefixRule.test(modalState.typeFrom.tenancyKey)) { + modalState.typeFrom.imsiMatch = 'prefix'; + } + + // 去除百分号 + modalState.typeFrom.tenancyKey = + modalState.typeFrom.tenancyKey.replace(/%/g, ''); + } + modalState.typeTitle = t('common.editText') + t('views.system.tenant.type'); modalState.visibleByType = true; @@ -515,6 +538,15 @@ function fnModalTypeOk() { } else { validateName.push('tenancyKey'); } + + if (from.tenancyType === 'IMSI') { + const imsiMatchRule: any = { + prefix: from.tenancyKey ? `${from.tenancyKey}%` : '', + fuzzy: from.tenancyKey ? `%${from.tenancyKey}%` : '', + }; + from.tenancyKey = imsiMatchRule[modalState.typeFrom.imsiMatch]; + } + modalStateTypeFrom .validate(validateName) .then(() => { @@ -971,14 +1003,26 @@ onMounted(() => { :extra="keyTip" :label-col="{ span: 4 }" v-bind="modalStateTypeFrom.validateInfos.tenancyKey" - v-show=" - modalState.typeFrom.tenancyType == 'IMSI' || - !modalState.typeFrom.tenancyType - " + v-show="modalState.typeFrom.tenancyType == 'IMSI'" > + + + +