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

View File

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