diff --git a/src/api/neUser/auth.ts b/src/api/neUser/auth.ts index e3b3d49f..b83a138d 100644 --- a/src/api/neUser/auth.ts +++ b/src/api/neUser/auth.ts @@ -111,9 +111,9 @@ export function batchAuth(data: Record) { * @param data 鉴权对象 * @returns object */ -export function delAuth(neId: string, data: Record) { +export function delAuth(neId: string, imsi: string) { return request({ - url: `/ne/udm/auth/${neId}/${data.imsi}`, + url: `/ne/udm/auth/${neId}/${imsi}`, method: 'delete', }); } diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 3df6736a..233159e1 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -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', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 78afe6a8..e41a6973 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -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:'开启', diff --git a/src/views/neUser/auth/index.vue b/src/views/neUser/auth/index.vue index 7c369498..628f85f2 100644 --- a/src/views/neUser/auth/index.vue +++ b/src/views/neUser/auth/index.vue @@ -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) { +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[] = tableState.data.filter( + (row: Record) => + 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(() => { {{ t('views.neUser.auth.batchAddText') }} + + + + {{ t('views.neUser.auth.checkDel') }} + + { {{ t('views.neUser.auth.batchDelText') }} + { { {{ t('views.neUser.auth.export') }} + + + + + {{ t('views.neUser.auth.checkExport') }} + + @@ -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, + }" > {{ t('views.neUser.auth.batchDelText') }} + { { {{ t('views.neUser.sub.export') }} + + + + + {{ t('views.neUser.sub.checkExport') }} + + @@ -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, + }" >