新增IMSI填写方式

This commit is contained in:
lai
2024-07-17 18:05:23 +08:00
parent c024c304d5
commit 15f6cf0b4c

View File

@@ -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'"
>
<!-- <a-input
v-model:value="modalState.typeFrom.tenancyKey"
allow-clear
></a-input> -->
<a-select
v-model:value="modalState.typeFrom.imsiMatch"
:options="[
{ label: t('views.neUser.sub.fuzzyMatch'), value: 'fuzzy' },
{ label: t('views.neUser.sub.prefixMatch'), value: 'prefix' },
]"
style="width: 20%"
>
</a-select>
<a-input
v-model:value="modalState.typeFrom.tenancyKey"
allow-clear
style="width: 80%"
></a-input>
</a-form-item>