租户管理增加基站id

This commit is contained in:
lai
2024-07-11 10:18:18 +08:00
parent 9a88364d8b
commit 0d5cbe6459

View File

@@ -17,7 +17,7 @@ import useDictStore from '@/store/modules/dict';
import { parseDateToStr } from '@/utils/date-utils'; import { parseDateToStr } from '@/utils/date-utils';
import { Form, Modal, message } from 'ant-design-vue'; import { Form, Modal, message } from 'ant-design-vue';
import { listNeInfo } from '@/api/ne/neInfo'; import { listNeInfo } from '@/api/ne/neInfo';
import { AnyARecord } from 'dns'; import { listBase5G } from '@/api/neUser/base5G';
const neInfoStore = useNeInfoStore(); const neInfoStore = useNeInfoStore();
const { getDict } = useDictStore(); const { getDict } = useDictStore();
@@ -71,10 +71,13 @@ let dict: {
sysTenancyType: DictType[]; sysTenancyType: DictType[];
/**实时的UPF RMUID 不是字典 */ /**实时的UPF RMUID 不是字典 */
allRmUid: any[]; allRmUid: any[];
/**实时的RADIO ID不是字典 */
allRadio: any[];
} = reactive({ } = reactive({
sysNormalDisable: [], sysNormalDisable: [],
sysTenancyType: [], sysTenancyType: [],
allRmUid: [], allRmUid: [],
allRadio: [],
}); });
/**查询参数 */ /**查询参数 */
@@ -184,6 +187,8 @@ let modalState: ModalStateType = reactive({
tenancyKey: '', tenancyKey: '',
tenancyType: '', tenancyType: '',
status: '0', status: '0',
radioType: '5G',
radioId: '',
}, },
confirmLoading: false, confirmLoading: false,
}); });
@@ -203,7 +208,7 @@ const modalStateFrom = Form.useForm(
}) })
); );
/**对话框内表单属性和校验规则 */ /**租赁类型对话框内表单属性和校验规则 */
const modalStateTypeFrom = Form.useForm( const modalStateTypeFrom = Form.useForm(
modalState.typeFrom, modalState.typeFrom,
reactive({ reactive({
@@ -223,6 +228,22 @@ const modalStateTypeFrom = Form.useForm(
message: t('views.system.tenant.key') + t('common.unableNull'), message: t('views.system.tenant.key') + t('common.unableNull'),
}, },
], ],
radioType: [
{
required: true,
min: 1,
max: 50,
message: t('views.system.tenant.key') + t('common.unableNull'),
},
],
radioId: [
{
required: true,
min: 1,
max: 50,
message: t('views.system.tenant.key') + t('common.unableNull'),
},
],
}) })
); );
@@ -447,9 +468,19 @@ function fnModalVisibleByType(
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS && res.data) { if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.typeFrom = Object.assign(modalState.typeFrom, res.data); modalState.typeFrom = Object.assign(modalState.typeFrom, res.data);
if (modalState.typeFrom.tenancyType === 'UPF') { //动态表单
fnTypeChange('UPF'); fnTypeChange(modalState.typeFrom.tenancyType);
if (
modalState.typeFrom.tenancyType == 'RADIO' &&
modalState.typeFrom.tenancyKey
) {
modalState.typeFrom.radioType =
modalState.typeFrom.tenancyKey.split('_')[0];
modalState.typeFrom.radioId =
modalState.typeFrom.tenancyKey.split('_')[1];
} }
modalState.typeTitle = modalState.typeTitle =
t('common.editText') + t('views.system.tenant.type'); t('common.editText') + t('views.system.tenant.type');
modalState.visibleByType = true; modalState.visibleByType = true;
@@ -473,11 +504,20 @@ function fnModalVisibleByType(
* 进行表达规则校验 * 进行表达规则校验
*/ */
function fnModalTypeOk() { function fnModalTypeOk() {
const from = toRaw(modalState.typeFrom);
let validateName = ['tenancyType'];
if (from.tenancyType === 'RADIO') {
validateName.push('radioType', 'radioId');
from.tenancyKey = from.radioType + '_' + from.radioId;
} else {
validateName.push('tenancyKey');
}
modalStateTypeFrom modalStateTypeFrom
.validate() .validate(validateName)
.then(() => { .then(() => {
modalState.confirmLoading = true; modalState.confirmLoading = true;
const from = toRaw(modalState.typeFrom);
from.parentId = state.selectedNode; from.parentId = state.selectedNode;
const tenant = from.tenantId ? updateTenant(from) : addTenant(from); const tenant = from.tenantId ? updateTenant(from) : addTenant(from);
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
@@ -554,6 +594,10 @@ function fnTypeChange(value: any) {
}); });
} }
if (value === 'RADIO') {
fnRadioIdChange(modalState.typeFrom.radioType);
}
const tipMapping: any = { const tipMapping: any = {
UPF: t('views.system.tenant.upfTip'), UPF: t('views.system.tenant.upfTip'),
IMSI: t('views.system.tenant.imsiTip'), IMSI: t('views.system.tenant.imsiTip'),
@@ -563,6 +607,58 @@ function fnTypeChange(value: any) {
keyTip.value = tipMapping[value]; keyTip.value = tipMapping[value];
} }
//为后续批量请求使用
let promises = ref<any[]>([]);
let neCascaderOptions = ref<Record<string, any>[]>([]);
/**查询基站ID */
function fnRadioIdChange(value: any) {
const typeMapping: any = {
'4G': ['MME'],
'5G': ['AMF'],
};
const typeArr: any = [];
typeArr.value = typeMapping[value] || ['AMF'];
neCascaderOptions.value = neInfoStore.getNeCascaderOptions.filter(
(item: any) => {
return typeArr.value.includes(item.value);
}
);
promises.value = [];
//获取4G或者5G基站ID
neCascaderOptions.value.map((item: any) => {
item.children.forEach((child: any) => {
promises.value.push(
listBase5G({
neId: child.neId,
neType: child.neType,
pageNum: queryParams.pageNum,
pageSize: 10000,
})
);
});
});
Promise.allSettled(promises.value).then(results => {
results.forEach(result => {
if (result.status === 'fulfilled') {
const allBaseData = result.value;
if (
allBaseData.code === RESULT_CODE_SUCCESS &&
Array.isArray(allBaseData.rows)
) {
// 处理成功结果
dict.allRadio = allBaseData.rows
.filter((item: any) => item.id !== '') // 排除 item.id 为空字符串的情况
.map((item: any) => ({ option: item.id, value: item.id }));
}
}
});
});
}
//自动完成框不区分大小写 //自动完成框不区分大小写
function filterOption(input: string, option: any) { function filterOption(input: string, option: any) {
return option.value.toUpperCase().indexOf(input.toUpperCase()) >= 0; return option.value.toUpperCase().indexOf(input.toUpperCase()) >= 0;
@@ -589,8 +685,22 @@ onMounted(() => {
} }
}); });
// 初始渲染左侧树状数据 neInfoStore
fnGetList(undefined, 'tree'); .fnNelist()
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
if (res.data.length == 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
}
}
})
.finally(() => {
// 初始渲染左侧树状数据
fnGetList(undefined, 'tree');
});
}); });
</script> </script>
<template> <template>
@@ -839,7 +949,7 @@ onMounted(() => {
:labelWrap="true" :labelWrap="true"
> >
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="12"> <a-col :lg="12" :md="24" :xs="24">
<a-form-item <a-form-item
:label="t('views.system.tenant.type')" :label="t('views.system.tenant.type')"
name="type" name="type"
@@ -863,20 +973,70 @@ onMounted(() => {
:extra="keyTip" :extra="keyTip"
:label-col="{ span: 4 }" :label-col="{ span: 4 }"
v-bind="modalStateTypeFrom.validateInfos.tenancyKey" v-bind="modalStateTypeFrom.validateInfos.tenancyKey"
v-show="
modalState.typeFrom.tenancyType == 'IMSI' ||
modalState.typeFrom.tenancyType == ''
"
> >
<a-input <a-input
v-model:value="modalState.typeFrom.tenancyKey" v-model:value="modalState.typeFrom.tenancyKey"
allow-clear allow-clear
v-show="modalState.typeFrom.tenancyType != 'UPF'"
></a-input> ></a-input>
</a-form-item>
<a-form-item
:label="t('views.system.tenant.key')"
name="key"
:extra="keyTip"
:label-col="{ span: 4 }"
v-bind="modalStateTypeFrom.validateInfos.tenancyKey"
v-show="modalState.typeFrom.tenancyType == 'UPF'"
>
<a-auto-complete <a-auto-complete
v-model:value="modalState.typeFrom.tenancyKey" v-model:value="modalState.typeFrom.tenancyKey"
allow-clear allow-clear
v-show="modalState.typeFrom.tenancyType == 'UPF'"
:options="dict.allRmUid" :options="dict.allRmUid"
:filter-option="filterOption" :filter-option="filterOption"
/> />
</a-form-item> </a-form-item>
<a-row
:gutter="16"
v-show="modalState.typeFrom.tenancyType == 'RADIO'"
>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
:label="t('views.system.tenant.key')"
name="radioType"
:extra="keyTip"
v-bind="modalStateTypeFrom.validateInfos.radioType"
>
<a-select
v-model:value="modalState.typeFrom.radioType"
:options="[
{ label: '4G', value: '4G' },
{ label: '5G', value: '5G' },
]"
@change="fnRadioIdChange"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
name="radioId"
v-bind="modalStateTypeFrom.validateInfos.radioId"
>
<a-auto-complete
v-model:value="modalState.typeFrom.radioId"
:options="dict.allRadio"
:filter-option="filterOption"
style="width: 200px"
allow-clear
/>
</a-form-item>
</a-col>
</a-row>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="16"> <a-row :gutter="16">