fix: UDM-IMS数据批量新增/批量删除命令调整

This commit is contained in:
TsMask
2025-06-24 16:58:35 +08:00
parent 04f81af6c3
commit b9659837c2
2 changed files with 138 additions and 35 deletions

View File

@@ -88,10 +88,11 @@ export function batchAddIMSSub(data: Record<string, any>, num: number) {
* @param data 签约对象
* @returns object
*/
export function delIMSSub(neId: string, imsi: string) {
export function delIMSSub(neId: string, imsi_msisdn: string, tag: string) {
return request({
url: `/ue/udm/imsuser/${neId}/${imsi}`,
url: `/ue/udm/imsuser/${neId}/${imsi_msisdn}`,
method: 'delete',
params: { volte: tag },
timeout: 180_000,
});
}
@@ -103,10 +104,16 @@ export function delIMSSub(neId: string, imsi: string) {
* @param num 数量
* @returns object
*/
export function batchDelIMSSub(neId: string, imsi: string, num: number) {
export function batchDelIMSSub(
neId: string,
imsi: string,
num: number,
tag: string
) {
return request({
url: `/ue/udm/imsuser/${neId}/${imsi}/${num}`,
method: 'delete',
params: { volte: tag },
timeout: 180_000,
});
}

View File

@@ -80,6 +80,7 @@ type TabeStateType = {
data: object[];
/**勾选记录 */
selectedRowKeys: (string | number)[];
selectedRowIMSIs: Record<string, any>[];
};
/**表格状态 */
@@ -89,6 +90,7 @@ let tableState: TabeStateType = reactive({
seached: true,
data: [],
selectedRowKeys: [],
selectedRowIMSIs: [],
});
/**表格字段列 */
@@ -236,8 +238,15 @@ function fnTableChange(pagination: any, filters: any, sorter: any, extra: any) {
}
/**表格多选 */
function fnTableSelectedRowKeys(keys: (string | number)[]) {
function fnTableSelectedRowKeys(keys: (string | number)[], rows: any[]) {
tableState.selectedRowKeys = keys;
tableState.selectedRowIMSIs = rows.map(item => {
return {
imsi: item.imsi,
msisdn: item.msisdn,
tag: item.tag,
};
});
}
/**对话框对象信息状态类型 */
@@ -269,13 +278,15 @@ let modalState: ModalStateType = reactive({
from: {
imsi: '',
msisdn: '',
tag: undefined,
tag: 1,
vni: '',
num: 1,
},
BatchDelForm: {
num: 1,
imsi: '',
msisdn: '',
tag: 1,
},
confirmLoading: false,
loadDataLoading: false,
@@ -318,6 +329,8 @@ const modalStateBatchDelFrom = Form.useForm(
},
],
imsi: [{ required: true, message: 'IMSI' + t('common.unableNull') }],
msisdn: [{ required: true, message: 'MSISDN' + t('common.unableNull') }],
tag: [{ required: true, message: t('common.selectPlease') }],
})
);
@@ -375,6 +388,10 @@ function fnModalOk() {
const from = Object.assign({}, toRaw(modalState.from));
modalState.confirmLoading = true;
from.neId = queryParams.neId || '-';
// 如果是VoIP, 则MSISDN和IMSI相同
if (from.tag === 0) {
from.imsi = from.msisdn;
}
const result =
from.num === 1 ? addIMSSub(from) : batchAddIMSSub(from, from.num);
const hide = message.loading(t('common.loading'), 0);
@@ -434,13 +451,30 @@ function fnModalOk() {
* 进行表达规则校验
*/
function fnBatchDelModalOk() {
const from = toRaw(modalState.BatchDelForm);
const neId = queryParams.neId || '-';
// 校验规则
let validateArr = ['num', 'tag'];
// 如果是VoIP, 则MSISDN和IMSI相同
if (from.tag === 0) {
modalState.BatchDelForm.imsi = from.msisdn;
from.imsi = from.msisdn;
validateArr.push('msisdn');
} else {
validateArr.push('imsi');
validateArr.push('msisdn');
}
modalStateBatchDelFrom
.validate()
.validate(validateArr)
.then(e => {
modalState.confirmLoading = true;
const from = toRaw(modalState.BatchDelForm);
const neId = queryParams.neId || '-';
batchDelIMSSub(neId, from.imsi, from.num).then(res => {
batchDelIMSSub(
neId,
`${from.imsi}_${from.msisdn}`,
from.num,
from.tag
).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
const timerS = Math.ceil(+from.num / 1500) + 1;
notification.success({
@@ -491,39 +525,48 @@ function fnModalCancel() {
* UDM鉴权用户删除
* @param imsi 编号imsi
*/
function fnRecordDelete(imsi: string) {
function fnRecordDelete(id: string) {
const neId = queryParams.neId;
if (!neId) return;
let imsiMsg = imsi;
if (imsi === '0') {
imsiMsg = `${tableState.selectedRowKeys[0]}... ${t(
'views.neUser.auth.numDel'
)} ${tableState.selectedRowKeys.length}`;
imsi = tableState.selectedRowKeys.join(',');
let msg = id;
if (id === '0') {
msg = `${tableState.selectedRowIMSIs[0].imsi}... ${tableState.selectedRowIMSIs.length}`;
}
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.neUser.auth.delSure', { imsi: imsiMsg }),
content: t('views.neUser.auth.delSure', { imsi: msg }),
onOk() {
modalState.loadDataLoading = true;
const hide = message.loading(t('common.loading'), 0);
delIMSSub(neId, imsi)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
const msgContent = t('common.msgSuccess', {
msg: t('common.deleteText'),
});
message.success({
content: `${msgContent} : ${imsiMsg}`,
duration: 3,
});
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
let reqArr: any[] = [];
if (id === '0') {
const volteArr = tableState.selectedRowIMSIs
.filter(item => item.tag == '1')
.map(item => `${item.imsi}_${item.msisdn}`)
.join(',');
if (volteArr.length > 0) {
reqArr.push(delIMSSub(neId, volteArr, '1'));
}
const voipArr = tableState.selectedRowIMSIs
.filter(item => item.tag == '0')
.map(item => `${item.imsi}_${item.msisdn}`)
.join(',');
if (voipArr.length > 0) {
reqArr.push(delIMSSub(neId, voipArr, '0'));
}
} else {
const record: any = tableState.data.find((item: any) => item.id === id);
if (record) {
reqArr = [
delIMSSub(neId, `${record.imsi}_${record.msisdn}`, record.tag),
];
}
}
Promise.all(reqArr)
.then(() => {
message.success(t('common.operateOk'), 3);
fnGetList();
})
.finally(() => {
hide();
@@ -1039,7 +1082,7 @@ onMounted(() => {
<!-- 表格列表 -->
<a-table
class="table"
row-key="imsi"
row-key="id"
:columns="tableColumnsDnd"
:loading="tableState.loading"
:data-source="tableState.data"
@@ -1061,7 +1104,7 @@ onMounted(() => {
<template #title>{{ t('common.deleteText') }}</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.imsi)"
@click.prevent="fnRecordDelete(record.id)"
>
<template #icon>
<DeleteOutlined />
@@ -1217,6 +1260,28 @@ onMounted(() => {
>
<a-row>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="TAG"
name="tag"
v-bind="modalStateBatchDelFrom.validateInfos.tag"
>
<a-select
v-model:value="modalState.BatchDelForm.tag"
:placeholder="t('common.selectPlease')"
:options="[
{ label: 'VoIP', value: 0 },
{ label: 'VoLTE', value: 1 },
]"
>
</a-select>
</a-form-item>
</a-col>
<a-col
:lg="24"
:md="24"
:xs="24"
v-if="modalState.BatchDelForm.tag == 1"
>
<a-form-item
:label="t('views.neUser.auth.startIMSI')"
name="imsi"
@@ -1240,6 +1305,37 @@ onMounted(() => {
</template>
</a-input>
</a-form-item>
<a-form-item
label="Start MSISDN"
name="msisdn"
v-bind="modalStateBatchDelFrom.validateInfos.msisdn"
>
<a-input
v-model:value="modalState.BatchDelForm.msisdn"
allow-clear
:maxlength="15"
>
</a-input>
</a-form-item>
</a-col>
<a-col
:lg="24"
:md="24"
:xs="24"
v-if="modalState.BatchDelForm.tag == 0"
>
<a-form-item
label="Start MSISDN"
name="msisdn"
v-bind="modalStateBatchDelFrom.validateInfos.msisdn"
>
<a-input
v-model:value="modalState.BatchDelForm.msisdn"
allow-clear
:maxlength="15"
>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item