fix: 终端UDM数据勾选导出和勾选删除

This commit is contained in:
TsMask
2023-12-25 20:56:43 +08:00
parent 864be2ba3b
commit dd14a32329
5 changed files with 273 additions and 50 deletions

View File

@@ -111,9 +111,9 @@ export function batchAuth(data: Record<string, any>) {
* @param data 鉴权对象
* @returns object
*/
export function delAuth(neId: string, data: Record<string, any>) {
export function delAuth(neId: string, imsi: string) {
return request({
url: `/ne/udm/auth/${neId}/${data.imsi}`,
url: `/ne/udm/auth/${neId}/${imsi}`,
method: 'delete',
});
}

View File

@@ -475,6 +475,8 @@ export default {
neType: 'UDM Object',
export: 'Export',
exportConfirm: 'Are you sure to export all authentication user data?',
checkExport : 'Check Export',
checkExportConfirm: 'Confirm exporting the checked authenticated user data?',
import: 'Import',
loadDataConfirm: 'Are you sure you want to reload the data?',
loadData: 'Load Data',
@@ -484,6 +486,7 @@ export default {
batchDelText: 'Batch Delete',
numAdd: 'Number of releases',
numDel: 'Number of deleted',
checkDel: 'Check Delete',
imsiTip: 'IMSI=MCC+MNC+MSIN',
imsiTip1: 'MCC=Mobile Country Code, consisting of three digits.',
imsiTip2: 'MNC = Mobile Network Number, consisting of two digits',
@@ -492,19 +495,22 @@ export default {
algoIndexTip: 'Algorithm index, between 0 and 15',
kiTip: 'User signing key information, the maximum length of 32',
opcTip: 'The authentication key, OPC, is calculated from Ki and OP, OP is the root key of the operator, ki is the authentication key, and the maximum length is 32.',
delSure:'Are you sure you want to delete the user with IMSI number: {imsi}?',
delSure:'Are you sure you want to delete the user with IMSI number: {imsi} ?',
},
sub: {
subInfo:' Subscription Info',
neType: 'UDM Object',
export: 'Export',
exportConfirm: 'Are you sure to export all signed user data?',
checkExport : 'Check Export',
checkExportConfirm: 'Are you sure to export the data of the checked subscribers?',
import: 'Import',
loadDataConfirm: 'Are you sure you want to reload the data?',
loadData: 'Load Data',
loadDataTip: 'Successfully fetched load data: {num} entries, the system is internally updating the data. You can click reset to refresh the data list after the loading is finished, please don it repeat click to get update!!!!',
numAdd: 'Number of releases',
numDel: 'Number of deleted',
checkDel: 'Check Delete',
batchAddText: 'Batch Add',
batchDelText: 'Batch Delete',
enable:'Enable',

View File

@@ -463,8 +463,8 @@ export default {
requireEnum: "{display} 不是合理的枚举值",
requireBool: "{display} 不是合理的布尔类型的值",
editOkTip: "确认更新该{num}属性值吗?",
updateItemTip: "确认更新Index为 【{num}】 的数据项?",
delItemTip: "确认删除Index为 【{num}】 的数据项?",
updateItemTip: "确认更新Index为 【{num}】 的数据项",
delItemTip: "确认删除Index为 【{num}】 的数据项",
arrayMore: "展开",
},
},
@@ -474,9 +474,11 @@ export default {
neTypePlease: '查询网元类型',
neType: 'UDM网元对象',
export: '导出',
exportConfirm: '确认导出全部鉴权用户数据吗?',
exportConfirm: '确认导出全部鉴权用户数据吗',
checkExport : '勾选导出',
checkExportConfirm: '确认导出已勾选的鉴权用户数据吗?',
import: '导入',
loadDataConfirm: '确认要重新加载数据吗?',
loadDataConfirm: '确认要重新加载数据吗',
loadData: '加载数据',
loadDataTip: '成功获取加载数据:{num}条,系统内部正在进行数据更新。加载结束后可点击重置刷新数据列表,请勿重复点击获取更新!!!',
startIMSI: '起始IMSI',
@@ -484,6 +486,7 @@ export default {
batchDelText: '批量删除',
numAdd: '放号个数',
numDel:'删除个数',
checkDel:'勾选删除',
imsiTip: 'IMSI=MCC+MNC+MSIN',
imsiTip1: 'MCC=移动国家号码, 由三位数字组成',
imsiTip2: 'MNC=移动网络号,由两位数字组成',
@@ -498,13 +501,16 @@ export default {
subInfo:'签约信息',
neType: 'UDM网元类型',
export: '导出',
exportConfirm: '确认导出全部签约用户数据吗?',
exportConfirm: '确认导出全部签约用户数据吗',
checkExport : '勾选导出',
checkExportConfirm: '确认导出已勾选的签约用户数据吗?',
import: '导入',
loadDataConfirm: '确认要重新加载数据吗?',
loadDataConfirm: '确认要重新加载数据吗',
loadData: '加载数据',
loadDataTip: '成功获取加载数据:{num}条,系统内部正在进行数据更新。加载结束后可点击重置刷新数据列表,请勿重复点击获取更新!!!',
numAdd: '放号个数',
numDel: '删除个数',
checkDel:'勾选删除',
batchAddText: '批量新增',
batchDelText: '批量删除',
enable:'开启',

View File

@@ -70,6 +70,8 @@ type TabeStateType = {
seached: boolean;
/**记录数据 */
data: object[];
/**勾选记录 */
selectedRowKeys: (string | number)[];
};
/**表格状态 */
@@ -79,6 +81,7 @@ let tableState: TabeStateType = reactive({
striped: false,
seached: true,
data: [],
selectedRowKeys: [],
});
/**表格字段列 */
@@ -180,6 +183,11 @@ function fnTableChange(pagination: any, filters: any, sorter: any, extra: any) {
fnGetList(1);
}
/**表格多选 */
function fnTableSelectedRowKeys(keys: (string | number)[]) {
tableState.selectedRowKeys = keys;
}
/**对话框对象信息状态类型 */
type ModalStateType = {
/**新增框或修改框是否显示 */
@@ -482,36 +490,79 @@ function fnModalCancel() {
/**
* UDM鉴权用户删除
* @param row 网元编号ID
* @param imsi 编号imsi
*/
function fnRecordDelete(row: Record<string, any>) {
function fnRecordDelete(imsi: 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(',');
}
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.neUser.auth.delSure', { imsi: row.imsi }),
content: t('views.neUser.auth.delSure', { imsi: imsiMsg }),
onOk() {
const key = 'delNotice';
message.loading({ content: t('common.loading'), key });
const neID = queryParams.neId || '-';
delAuth(neID, row).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', { msg: t('common.deleteText') }),
key,
duration: 2,
});
modalState.loadDataLoading = true;
const hide = message.loading({ content: t('common.loading') });
delAuth(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,
});
}
})
.finally(() => {
hide();
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key: key,
duration: 2,
});
}
});
modalState.loadDataLoading = false;
});
},
});
}
/**
* UDM鉴权用户导出
*/
function fnRecordExport(type: string = 'txt') {
const selectLen = tableState.selectedRowKeys.length;
if (selectLen <= 0) return;
const rows: Record<string, any>[] = tableState.data.filter(
(row: Record<string, any>) =>
tableState.selectedRowKeys.indexOf(row.imsi) >= 0
);
let content = '';
if (type == 'txt') {
for (const row of rows) {
content += `${row.imsi},${row.ki},${row.algoIndex},${row.amf},${row.opc}\r\n`;
}
}
if (type == 'csv') {
content = `IMSI,ki,Algo Index,AMF,OPC\r\n`;
for (const row of rows) {
content += `${row.imsi},${row.ki},${row.algoIndex},${row.amf},${row.opc}\r\n`;
}
}
const blob = new Blob([content], { type: 'text/plain;charset=utf-8' });
saveAs(blob, `UDMAuth_${Date.now()}.${type}`);
}
/**列表导出 */
function fnExportList(type: string) {
const neID = queryParams.neId;
@@ -583,6 +634,10 @@ function fnGetList(pageNum?: number) {
}
listAuth(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选
if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = [];
}
tablePagination.total = res.total;
tableState.data = res.rows;
}
@@ -742,6 +797,18 @@ onMounted(() => {
</template>
{{ t('views.neUser.auth.batchAddText') }}
</a-button>
<a-button
type="default"
danger
:disabled="tableState.selectedRowKeys.length <= 0"
:loading="modalState.loadDataLoading"
@click.prevent="fnRecordDelete('0')"
>
<template #icon><DeleteOutlined /></template>
{{ t('views.neUser.auth.checkDel') }}
</a-button>
<a-button
type="primary"
danger
@@ -753,6 +820,7 @@ onMounted(() => {
</template>
{{ t('views.neUser.auth.batchDelText') }}
</a-button>
<a-popconfirm
:title="t('views.neUser.auth.loadDataConfirm')"
:ok-text="t('common.ok')"
@@ -778,6 +846,7 @@ onMounted(() => {
<a-popconfirm
:title="t('views.neUser.auth.exportConfirm')"
placement="topRight"
ok-text="TXT"
ok-type="default"
@confirm="fnExportList('txt')"
@@ -790,6 +859,26 @@ onMounted(() => {
{{ t('views.neUser.auth.export') }}
</a-button>
</a-popconfirm>
<a-popconfirm
:title="t('views.neUser.auth.checkExportConfirm')"
placement="topRight"
ok-text="TXT"
ok-type="default"
@confirm="fnRecordExport('txt')"
:show-cancel="false"
cancel-text="CSV"
@cancel="fnRecordExport('csv')"
:disabled="tableState.selectedRowKeys.length <= 0"
>
<a-button
type="default"
:disabled="tableState.selectedRowKeys.length <= 0"
>
<template #icon><ExportOutlined /></template>
{{ t('views.neUser.auth.checkExport') }}
</a-button>
</a-popconfirm>
</div>
</template>
@@ -864,6 +953,11 @@ onMounted(() => {
:scroll="{ y: 'calc(100vh - 480px)' }"
@change="fnTableChange"
@resizeColumn="(w:number, col:any) => (col.width = w)"
:row-selection="{
type: 'checkbox',
selectedRowKeys: tableState.selectedRowKeys,
onChange: fnTableSelectedRowKeys,
}"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'imsi'">
@@ -881,7 +975,10 @@ onMounted(() => {
</a-tooltip>
<a-tooltip>
<template #title>{{ t('common.deleteText') }}</template>
<a-button type="link" @click.prevent="fnRecordDelete(record)">
<a-button
type="link"
@click.prevent="fnRecordDelete(record.imsi)"
>
<template #icon>
<DeleteOutlined />
</template>

View File

@@ -73,6 +73,8 @@ type TabeStateType = {
seached: boolean;
/**记录数据 */
data: object[];
/**勾选记录 */
selectedRowKeys: (string | number)[];
};
/**表格状态 */
@@ -82,6 +84,7 @@ let tableState: TabeStateType = reactive({
striped: false,
seached: true,
data: [],
selectedRowKeys: [],
});
/**表格字段列 */
@@ -218,6 +221,11 @@ function fnTableChange(pagination: any, filters: any, sorter: any, extra: any) {
fnGetList(1);
}
/**表格多选 */
function fnTableSelectedRowKeys(keys: (string | number)[]) {
tableState.selectedRowKeys = keys;
}
/**对话框对象信息状态类型 */
type ModalStateType = {
/**详情框是否显示 */
@@ -711,37 +719,100 @@ function fnBatchDelModalCancel() {
/**
* UDM签约用户删除
* @param imsi 网元编号ID
* @param imsi 编号imsi
*/
function fnRecordDelete(imsi: string) {
const neID = queryParams.neId;
if (!neID) return;
let imsiMsg = imsi;
if (imsi === '0') {
imsiMsg = `${tableState.selectedRowKeys[0]}... ${t(
'views.neUser.sub.numDel'
)} ${tableState.selectedRowKeys.length}`;
imsi = tableState.selectedRowKeys.join(',');
}
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.neUser.auth.delSure', { imsi: imsi }),
content: t('views.neUser.auth.delSure', { imsi: imsiMsg }),
onOk() {
const key = 'delSub';
message.loading({ content: t('common.loading'), key });
delSub(neID, imsi).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', { msg: t('common.deleteText') }),
key,
duration: 2,
});
modalState.loadDataLoading = true;
const hide = message.loading({ content: t('common.loading') });
delSub(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,
});
}
})
.finally(() => {
hide();
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key: key,
duration: 2,
});
}
});
modalState.loadDataLoading = false;
});
},
});
}
/**
* UDM签约用户导出
*/
function fnRecordExport(type: string = 'txt') {
const selectLen = tableState.selectedRowKeys.length;
if (selectLen <= 0) return;
const rows: Record<string, any>[] = tableState.data.filter(
(row: Record<string, any>) =>
tableState.selectedRowKeys.indexOf(row.imsi) >= 0
);
let content = '';
if (type == 'txt') {
for (const row of rows) {
debugger;
const epsDat = [
row.epsFlag,
row.epsOdb,
row.hplmnOdb,
row.ard,
row.epstpl,
row.contextId,
row.apnContext,
row.staticIp,
].join(',');
content += `${row.imsi},${row.msisdn},${row.ambr},${row.nssai},${row.arfb},${row.sar},${row.rat},${row.cn},${row.smfSel},${row.smData},${epsDat}\r\n`;
}
}
if (type == 'csv') {
content = `imsi,msisdn,ambr,nssai,arfb,sar,rat,cn,smf_sel,sm_dat,eps_dat\r\n`;
for (const row of rows) {
const epsDat = [
row.epsFlag,
row.epsOdb,
row.hplmnOdb,
row.ard,
row.epstpl,
row.contextId,
row.apnContext,
row.staticIp,
].join(',');
content += `${row.imsi},${row.msisdn},${row.ambr},${row.nssai},${row.arfb},${row.sar},${row.rat},${row.cn},${row.smfSel},${row.smData},${epsDat}\r\n`;
}
}
const blob = new Blob([content], { type: 'text/plain;charset=utf-8' });
saveAs(blob, `UDMSub_${Date.now()}.${type}`);
}
/**列表导出 */
function fnExportList(type: string) {
const neID = queryParams.neId;
@@ -813,6 +884,10 @@ function fnGetList(pageNum?: number) {
}
listSub(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选
if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = [];
}
tablePagination.total = res.total;
tableState.data = res.rows;
}
@@ -977,6 +1052,18 @@ onMounted(() => {
</template>
{{ t('views.neUser.auth.batchAddText') }}
</a-button>
<a-button
type="default"
danger
:disabled="tableState.selectedRowKeys.length <= 0"
:loading="modalState.loadDataLoading"
@click.prevent="fnRecordDelete('0')"
>
<template #icon><DeleteOutlined /></template>
{{ t('views.neUser.sub.checkDel') }}
</a-button>
<a-button
type="primary"
danger
@@ -988,6 +1075,7 @@ onMounted(() => {
</template>
{{ t('views.neUser.auth.batchDelText') }}
</a-button>
<a-popconfirm
:title="t('views.neUser.sub.loadDataConfirm')"
:ok-text="t('common.ok')"
@@ -1017,6 +1105,7 @@ onMounted(() => {
<a-popconfirm
:title="t('views.neUser.sub.exportConfirm')"
placement="topRight"
ok-text="TXT"
ok-type="default"
@confirm="fnExportList('txt')"
@@ -1031,6 +1120,26 @@ onMounted(() => {
{{ t('views.neUser.sub.export') }}
</a-button>
</a-popconfirm>
<a-popconfirm
:title="t('views.neUser.sub.checkExportConfirm')"
placement="topRight"
ok-text="TXT"
ok-type="default"
@confirm="fnRecordExport('txt')"
:show-cancel="false"
cancel-text="CSV"
@cancel="fnRecordExport('csv')"
:disabled="tableState.selectedRowKeys.length <= 0"
>
<a-button
type="default"
:disabled="tableState.selectedRowKeys.length <= 0"
>
<template #icon><ExportOutlined /></template>
{{ t('views.neUser.sub.checkExport') }}
</a-button>
</a-popconfirm>
</div>
</template>
@@ -1105,6 +1214,11 @@ onMounted(() => {
:scroll="{ y: 'calc(100vh - 480px)' }"
@change="fnTableChange"
@resizeColumn="(w:number, col:any) => (col.width = w)"
:row-selection="{
type: 'checkbox',
selectedRowKeys: tableState.selectedRowKeys,
onChange: fnTableSelectedRowKeys,
}"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'imsi'">