增加IMSI,ki限制位数以及合并新增批量新增按钮

This commit is contained in:
lai
2024-09-05 16:36:05 +08:00
parent e38d7bbffa
commit e8ef2816df
4 changed files with 174 additions and 1026 deletions

View File

@@ -236,8 +236,6 @@ type ModalStateType = {
/**表单数据 */
from: Record<string, any>;
/**表单数据 */
BatchForm: Record<string, any>;
/**表单数据 */
BatchDelForm: Record<string, any>;
/**确定按钮 loading */
confirmLoading: boolean;
@@ -254,30 +252,6 @@ let modalState: ModalStateType = reactive({
title: 'UDM签约用户',
from: {
id: undefined,
msisdn: '',
imsi: '',
ambr: 'def_ambr',
nssai: 'def_nssai',
rat: '0',
arfb: 'def_arfb',
sar: 'def_sar',
cn: '3',
smData: '',
smfSel: 'def_snssai',
epsDat: '',
neId: '',
epsFlag: '1',
epsOdb: [2],
hplmnOdb: [3, 4],
ard: [1, 7],
epstpl: 'def_eps',
contextId: '1',
apnContext: [1, 2, 0, 0, 0, 0],
staticIp: '-',
rfsp: 1,
ueType: 1,
},
BatchForm: {
num: 1,
msisdn: '',
imsi: '',
@@ -395,18 +369,11 @@ function PrefixZero(num: any, n: any) {
* 对话框弹出显示为 批量新增,批量删除
* @param noticeId 网元id, 不传为新增
*/
function fnModalVisibleByBatch(batchFlag?: number) {
if (batchFlag) {
modalStateBatchFrom.resetFields(); //重置表单
modalState.title =
t('views.neUser.sub.batchAddText') + t('views.neUser.sub.subInfo');
modalState.visibleByBatch = true;
} else {
modalStateBatchFrom.resetFields(); //重置表单
modalState.title =
t('views.neUser.sub.batchDelText') + t('views.neUser.sub.subInfo');
modalState.visibleByBatchDel = true;
}
function fnModalVisibleByBatch() {
modalStateBatchDelFrom.resetFields(); //重置表单
modalState.title =
t('views.neUser.sub.batchDelText') + t('views.neUser.sub.subInfo');
modalState.visibleByBatchDel = true;
}
/**
@@ -483,7 +450,16 @@ function fnModalVisibleByEdit(imsi?: string) {
const modalStateFrom = Form.useForm(
modalState.from,
reactive({
imsi: [{ required: true, message: 'IMSI' + t('common.unableNull') }],
num: [
{
required: true,
message: t('views.neUser.sub.numAdd') + t('common.unableNull'),
},
],
imsi: [
{ required: true, message: 'IMSI' + t('common.unableNull') },
{ min: 15, max: 15, message: t('views.neUser.auth.imsiConfirm') },
],
msisdn: [{ required: true, message: 'MSISDN' + t('common.unableNull') }],
staticIp: [
{ required: true, message: 'static ip' + t('common.unableNull') },
@@ -650,21 +626,48 @@ function fnModalOk() {
.join('');
from.neId = queryParams.neId || '-';
const result = from.id ? updateUDMSub(from) : addUDMSub(from);
const result = from.id
? updateUDMSub(from)
: from.num === 1
? addUDMSub(from)
: batchAddUDMSub(from, from.num);
const hide = message.loading(t('common.loading'), 0);
result
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', { msg: modalState.title }),
duration: 3,
});
fnGetList();
if (from.num === 1) {
message.success({
content: t('common.msgSuccess', { msg: modalState.title }),
duration: 3,
});
fnGetList(1);
} else {
const timerS = Math.max(
Math.ceil(+from.num / 500),
`${from.num}`.length * 5
);
notification.success({
message: modalState.title,
description: t('common.operateOk'),
duration: timerS,
});
setTimeout(() => {
fnGetList(1);
}, timerS * 1000);
}
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
if (from.num === 1) {
message.error({
content: `${res.msg}`,
duration: 3,
});
} else {
notification.error({
message: modalState.title,
description: res.msg,
duration: 3,
});
}
}
})
.finally(() => {
@@ -678,97 +681,6 @@ function fnModalOk() {
});
}
/**对话框内批量添加表单属性和校验规则 */
const modalStateBatchFrom = Form.useForm(
modalState.BatchForm,
reactive({
num: [
{
required: true,
message: t('views.neUser.sub.numAdd') + t('common.unableNull'),
},
],
imsi: [{ required: true, message: 'IMSI' + t('common.unableNull') }],
msisdn: [{ required: true, message: 'MSISDN' + t('common.unableNull') }],
staticIp: [
{ required: true, message: 'static ip' + t('common.unableNull') },
],
})
);
/**
* 对话框弹出 批量新增操作确认执行函数
* 进行表达规则校验
*/
function fnBatchModalOk() {
const from = Object.assign({}, toRaw(modalState.BatchForm));
try {
from.smData = transformData(bigRows.value).join(';');
} catch (error: any) {
console.error(error.message);
return false;
}
modalStateBatchFrom
.validate()
.then(e => {
modalState.confirmLoading = true;
let ardArr = [0, 0, 0, 0, 0, 0, 0, 0];
let hplmnArr = [0, 0, 0, 0, 0, 0, 0, 0];
let odbArr = [0, 0, 0, 0, 0, 0, 0, 0, 0];
from.ard.forEach((item: any) => {
ardArr[item] = 1;
});
from.hplmnOdb.forEach((item: any) => {
hplmnArr[item] = 1;
});
from.epsOdb.forEach((item: any) => {
odbArr[item] = 1;
});
from.epsOdb = '' + parseInt(odbArr.join(''), 2);
from.hplmnOdb = '' + parseInt(hplmnArr.join(''), 2);
from.ard = '' + parseInt(ardArr.join(''), 2);
// 4G APN Context List
from.apnContext = from.apnContext
.map((item: number) => `${item}`.padStart(2, '0'))
.join('');
from.neId = queryParams.neId || '-';
batchAddUDMSub(from, from.num).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
const timerS = Math.max(
Math.ceil(+from.num / 500),
`${from.num}`.length * 5
);
notification.success({
message: modalState.title,
description: t('common.operateOk'),
duration: timerS,
});
setTimeout(() => {
fnBatchModalCancel();
modalState.confirmLoading = false;
fnGetList(1);
}, timerS * 1000);
} else {
modalState.confirmLoading = false;
notification.error({
message: modalState.title,
description: res.msg,
duration: 3,
});
}
});
})
.catch(e => {
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
});
}
/**对话框内批量添加表单属性和校验规则 */
const modalStateBatchDelFrom = Form.useForm(
modalState.BatchDelForm,
@@ -855,38 +767,6 @@ function fnModalCancel() {
smallRowIndexCounter = 0;
}
/**
* 批量添加对话框弹出关闭执行函数
* 进行表达规则校验
*/
function fnBatchModalCancel() {
modalState.visibleByBatch = false;
modalState.visibleByView = false;
modalStateBatchFrom.resetFields();
bigRows.value = [
{
id: 0,
sst: '',
sd: '',
smallRows: [
{
id: 0,
dnn: '',
smStaticIp: '',
msIp: '',
},
{
id: 1,
dnn: 'ims',
smStaticIp: '',
msIp: '',
},
],
},
];
smallRowIndexCounter = 0;
}
/**
* 批量删除对话框弹出关闭执行函数
* 进行表达规则校验
@@ -1294,13 +1174,6 @@ onMounted(() => {
{{ t('common.addText') }}
</a-button>
<a-button type="primary" @click.prevent="fnModalVisibleByBatch(1)">
<template #icon>
<PlusOutlined />
</template>
{{ t('views.neUser.auth.batchAddText') }}
</a-button>
<a-button
type="default"
danger
@@ -1316,7 +1189,7 @@ onMounted(() => {
type="primary"
danger
ghost
@click.prevent="fnModalVisibleByBatch(0)"
@click.prevent="fnModalVisibleByBatch()"
>
<template #icon>
<DeleteOutlined />
@@ -1525,6 +1398,25 @@ onMounted(() => {
:label-col="{ span: 6 }"
:labelWrap="true"
>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
:label="t('views.neUser.sub.numAdd')"
name="num"
v-bind="modalStateFrom.validateInfos.num"
v-show="!modalState.from.id"
>
<a-input-number
v-model:value="modalState.from.num"
style="width: 100%"
:min="1"
:max="10000"
placeholder="<=10000"
></a-input-number>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
@@ -2048,568 +1940,6 @@ onMounted(() => {
</a-form>
</ProModal>
<!-- 批量增加框 -->
<ProModal
:drag="true"
:width="800"
:destroyOnClose="true"
style="top: 0px"
:body-style="{ maxHeight: '650px', 'overflow-y': 'auto' }"
:keyboard="false"
:mask-closable="false"
:visible="modalState.visibleByBatch"
:title="modalState.title"
:confirm-loading="modalState.confirmLoading"
@ok="fnBatchModalOk"
@cancel="fnBatchModalCancel"
>
<a-form
name="modalStateBatchFrom"
layout="horizontal"
:labelWrap="true"
:label-col="{ span: 6 }"
>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
:label="t('views.neUser.sub.numAdd')"
name="num"
v-bind="modalStateBatchFrom.validateInfos.num"
>
<a-input-number
v-model:value="modalState.BatchForm.num"
style="width: 100%"
:min="1"
:max="10000"
placeholder="<=10000"
></a-input-number>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="IMSI"
name="imsi"
v-bind="modalStateBatchFrom.validateInfos.imsi"
>
<a-input v-model:value="modalState.BatchForm.imsi" allow-clear>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.imsiTip') }}<br />
{{ t('views.neUser.sub.imsiTip1') }}<br />
{{ t('views.neUser.sub.imsiTip2') }}<br />
{{ t('views.neUser.sub.imsiTip3') }}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="MSISDN"
name="msisdn"
v-bind="modalStateBatchFrom.validateInfos.msisdn"
>
<a-input
v-model:value="modalState.BatchForm.msisdn"
allow-clear
max
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.msisdnTip', { num: '32' }) }}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
</a-form-item>
</a-col>
</a-row>
<!-- SM Data ---- S -->
<a-divider orientation="left">
Subscribed SM Data
<a-tooltip title="Add SM Data">
<a-button
shape="circle"
@click="addBigRow"
style="margin-left: 10px"
>
<template #icon><plus-outlined /></template>
</a-button> </a-tooltip
></a-divider>
<!-- 大数组布局 -->
<div v-for="(row, index) in bigRows" :key="String(row.id)">
<a-row :gutter="16">
<a-col :lg="6" :md="6" :xs="24">
<a-form-item
label="SST"
name="row.sst"
:label-col="{ span: 12 }"
:validateTrigger="[]"
:required="true"
>
<a-input-number
v-model:value="row.sst"
:min="1"
:max="3"
:step="1"
/>
</a-form-item>
</a-col>
<a-col :lg="8" :md="8" :xs="24">
<a-form-item label="SD" name="row.sst" :label-col="{ span: 5 }">
<a-input v-model:value="row.sd" :maxlength="6" />
</a-form-item>
</a-col>
<a-col :lg="10" :md="10" :xs="24">
<a-row :gutter="8">
<a-col :span="4">
<a-tooltip title="Add DNN">
<a-button shape="circle" @click="addSmallRow(row.id)">
<template #icon><plus-square-outlined /></template>
</a-button>
</a-tooltip>
</a-col>
<a-col :span="4">
<a-tooltip title="Delete SM Data" v-if="index !== 0">
<a-button danger shape="circle" @click="delBigRow(index)">
<template #icon><minus-outlined /></template>
</a-button>
</a-tooltip>
</a-col>
</a-row>
</a-col>
</a-row>
<!-- 小数组布局 -->
<div
v-for="(smallRow, smallIndex) in row.smallRows"
:key="String(smallRow.id)"
>
<a-row :gutter="16">
<a-col :lg="6" :md="7" :xs="24">
<a-form-item
label="DNN/APN"
name="dnn"
:validateTrigger="[]"
:required="true"
:label-col="{ span: 12 }"
>
<a-input v-model:value="smallRow.dnn" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :lg="8" :md="6" :xs="24">
<a-form-item
label="Static IP"
name="smStaticIp"
:label-col="{ span: 5 }"
>
<a-input
v-model:value="smallRow.smStaticIp"
allow-clear
></a-input>
</a-form-item>
</a-col>
<a-col :lg="8" :md="8" :xs="24">
<a-form-item label="Routing Behind MS IP" name="msIp">
<a-input v-model:value="smallRow.msIp" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :lg="1" :md="1" :xs="24" v-if="smallIndex !== 0">
<a-tooltip title="Delete DNN">
<a-button
danger
shape="circle"
@click="delDNN(smallIndex, row.id)"
>
<template #icon><close-square-outlined /></template>
</a-button>
</a-tooltip>
</a-col>
</a-row>
</div>
</div>
<!-- SM Data ---- E -->
<a-collapse :bordered="false" ghost>
<a-collapse-panel key="5G">
<template #header>
<a-divider orientation="left" style="margin: -2px">5G</a-divider>
</template>
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="5GC Flag"
name="cnFlag"
:help="t('views.neUser.sub.cnFlag')"
>
<a-select v-model:value="modalState.BatchForm.cn">
<a-select-option value="3">
{{ t('views.neUser.sub.enable') }}
</a-select-option>
<a-select-option value="0">
{{ t('views.neUser.sub.disable') }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="5G Subscribed UE AMBR Template"
name="ambr"
v-bind="modalStateBatchFrom.validateInfos.ambr"
>
<a-input
v-model:value="modalState.BatchForm.ambr"
allow-clear
:maxlength="50"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.inputTip', { num: '50' }) }}
</template>
<InfoCircleOutlined
style="color: rgba(0, 0, 0, 0.45)"
/>
</a-tooltip>
</template>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="5G Subscribed SNSSAIs Template"
name="nssai"
v-bind="modalStateBatchFrom.validateInfos.nssai"
>
<a-input
v-model:value="modalState.BatchForm.nssai"
allow-clear
:maxlength="50"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.inputTip', { num: '50' }) }}
</template>
<InfoCircleOutlined
style="color: rgba(0, 0, 0, 0.45)"
/>
</a-tooltip>
</template>
</a-input>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="5G Subscribed SMF Selection Data Template"
name="smfSel"
>
<a-input
v-model:value="modalState.BatchForm.smfSel"
allow-clear
:maxlength="50"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.inputTip', { num: '50' }) }}
</template>
<InfoCircleOutlined
style="color: rgba(0, 0, 0, 0.45)"
/>
</a-tooltip>
</template>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="5G Forbidden Areas Template"
name="arfb"
:maxlength="50"
>
<a-input
v-model:value="modalState.BatchForm.arfb"
allow-clear
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.arfbTip') }}
</template>
<InfoCircleOutlined
style="color: rgba(0, 0, 0, 0.45)"
/>
</a-tooltip>
</template>
</a-input>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="5G Service Area Restriction Template"
name="sar"
>
<a-input
v-model:value="modalState.BatchForm.sar"
allow-clear
:maxlength="50"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.sarTip') }}
</template>
<InfoCircleOutlined
style="color: rgba(0, 0, 0, 0.45)"
/>
</a-tooltip>
</template>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item label="5G RFSP Index" name="rfsp">
<a-input-number
v-model:value="modalState.BatchForm.rfsp"
style="width: 100%"
:min="0"
:max="127"
placeholder="0 ~ 127"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.rfspTip') }}
</template>
<InfoCircleOutlined
style="color: rgba(0, 0, 0, 0.45)"
/>
</a-tooltip>
</template>
</a-input-number>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="5G MICO Mode"
name="mico"
:help="t('views.neUser.sub.micoTip')"
>
<a-select value="1">
<a-select-option value="1">
{{ t('views.neUser.sub.enable') }}
</a-select-option>
<a-select-option value="0">
{{ t('views.neUser.sub.disable') }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item label="5G UE Usage Type" name="ueType">
<a-input-number
v-model:value="modalState.BatchForm.ueType"
style="width: 100%"
:min="0"
:max="127"
placeholder="0 ~ 127"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.ueTypeTip') }}
</template>
<InfoCircleOutlined
style="color: rgba(0, 0, 0, 0.45)"
/>
</a-tooltip>
</template>
</a-input-number>
</a-form-item>
</a-col>
</a-row>
</a-collapse-panel>
<a-collapse-panel key="4G">
<template #header>
<a-divider orientation="left" style="margin: -2px">4G</a-divider>
</template>
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="4G EPS Flag"
name="epsFlag"
:help="t('views.neUser.sub.epsFlagTip')"
>
<a-select v-model:value="modalState.BatchForm.epsFlag">
<a-select-option value="1">
{{ t('views.neUser.sub.enable') }}
</a-select-option>
<a-select-option value="0">
{{ t('views.neUser.sub.disable') }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="4G EPS User Template Name"
name="epstpl"
v-bind="modalStateFrom.validateInfos.epstpl"
>
<a-input
v-model:value="modalState.BatchForm.epstpl"
allow-clear
:maxlength="50"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.inputTip', { num: '50' }) }}
</template>
<InfoCircleOutlined
style="color: rgba(0, 0, 0, 0.45)"
/>
</a-tooltip>
</template>
</a-input>
</a-form-item>
</a-col>
</a-row>
<a-form-item
label="4G Static IP"
v-bind="modalStateFrom.validateInfos.staticIp"
name="staticIp"
>
<a-input
v-model:value="modalState.BatchForm.staticIp"
allow-clear
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.staticIpTip') }}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
</a-form-item>
<a-form-item label="4G Context ID" name="contextId">
<a-input
v-model:value="modalState.BatchForm.contextId"
allow-clear
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.sub.contextIdTip') }}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
</a-form-item>
<a-form-item
label="4G APN Context List"
name="apnContext"
:help="t('views.neUser.sub.apnContextTip')"
>
<a-input-group compact>
<a-input-number
v-for="(_, i) in modalState.BatchForm.apnContext"
:key="i"
:title="i"
style="width: 16.5%"
:min="0"
:max="99"
v-model:value="modalState.BatchForm.apnContext[i]"
></a-input-number>
</a-input-group>
</a-form-item>
<a-form-item
label="4G EPS ODB"
name="epsOdb"
v-bind="modalStateFrom.validateInfos.epsOdb"
>
<a-tooltip
:title="t('views.neUser.sub.epsOdbTip')"
placement="topLeft"
>
<a-select
v-model:value="modalState.BatchForm.epsOdb"
mode="multiple"
style="width: 100%"
placeholder="Please select"
:options="modalStateFromOption.odbJson"
@change=""
>
</a-select>
</a-tooltip>
</a-form-item>
<a-form-item label="4G HPLMN ODB" name="hplmnOdb">
<a-tooltip
:title="t('views.neUser.sub.hplmnOdbTip')"
placement="topLeft"
>
<a-select
v-model:value="modalState.BatchForm.hplmnOdb"
mode="multiple"
style="width: 100%"
:options="modalStateFromOption.hplmnOdb"
@change=""
>
</a-select>
</a-tooltip>
</a-form-item>
<a-form-item label="4G Access Restriction Data" name="ard">
<a-tooltip
:title="t('views.neUser.sub.ardTip')"
placement="topLeft"
>
<a-select
v-model:value="modalState.BatchForm.ard"
mode="multiple"
style="width: 100%"
:options="modalStateFromOption.ardJson"
@change=""
>
</a-select>
</a-tooltip>
</a-form-item>
</a-collapse-panel>
</a-collapse>
</a-form>
</ProModal>
<!-- 批量删除框 -->
<ProModal
:drag="true"