ref: v3变更,,完成整合,同步v2.2508.4 -250902
This commit is contained in:
@@ -15,8 +15,6 @@ import { saveAs } from 'file-saver';
|
||||
import {
|
||||
addUDMAuth,
|
||||
updateUDMAuth,
|
||||
batchAddUDMAuth,
|
||||
batchDelUDMAuth,
|
||||
delUDMAuth,
|
||||
getUDMAuth,
|
||||
exportUDMAuth,
|
||||
@@ -26,15 +24,19 @@ import {
|
||||
} from '@/api/neData/udm_auth';
|
||||
import { uploadFile } from '@/api/tool/file';
|
||||
import { getNeViewFile } from '@/api/tool/neFile';
|
||||
import { currentCoreUid } from '@/hooks/useCoreUid';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
const { t } = useI18n();
|
||||
const neListStore = useNeStore();
|
||||
const neStore = useNeStore();
|
||||
/**网元参数 */
|
||||
let neOtions = ref<Record<string, any>[]>([]);
|
||||
|
||||
/**查询参数 */
|
||||
let queryParams = reactive({
|
||||
/**核心网标识 */
|
||||
coreUid: currentCoreUid(),
|
||||
/**网元ID */
|
||||
neId: undefined,
|
||||
neUid: undefined,
|
||||
/**移动编号 */
|
||||
imsi: '',
|
||||
/**排序字段 */
|
||||
@@ -89,33 +91,43 @@ let tableColumns = ref<ColumnsType>([
|
||||
{
|
||||
title: 'IMSI',
|
||||
dataIndex: 'imsi',
|
||||
align: 'center',
|
||||
align: 'left',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: 'AMF',
|
||||
dataIndex: 'amf',
|
||||
align: 'center',
|
||||
align: 'left',
|
||||
width: 80,
|
||||
},
|
||||
// {
|
||||
// title: 'KI',
|
||||
// dataIndex: 'ki',
|
||||
// align: 'center',
|
||||
// align: 'left',
|
||||
// width: 10,
|
||||
// },
|
||||
// {
|
||||
// title: 'OPC',
|
||||
// dataIndex: 'opc',
|
||||
// align: 'center',
|
||||
// align: 'left',
|
||||
// width: 10,
|
||||
// },
|
||||
{
|
||||
title: 'Algo Index',
|
||||
dataIndex: 'algoIndex',
|
||||
align: 'center',
|
||||
align: 'left',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: 'Create Time',
|
||||
dataIndex: 'createTime',
|
||||
align: 'left',
|
||||
width: 250,
|
||||
customRender(opt) {
|
||||
if (!opt.value) return '';
|
||||
return parseDateToStr(+opt.value);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t('common.operate'),
|
||||
@@ -205,7 +217,10 @@ let modalState: ModalStateType = reactive({
|
||||
title: 'UDM鉴权用户',
|
||||
from: {
|
||||
num: 1,
|
||||
id: '',
|
||||
id: undefined,
|
||||
coreUid: '',
|
||||
neUid: '',
|
||||
neType: 'UDM',
|
||||
imsi: '',
|
||||
amf: '8000',
|
||||
ki: '',
|
||||
@@ -232,12 +247,12 @@ const modalStateFrom = Form.useForm(
|
||||
],
|
||||
imsi: [
|
||||
{ required: true, message: 'IMSI' + t('common.unableNull') },
|
||||
{ min: 15, max: 15, message: t('views.neUser.auth.imsiConfirm') },
|
||||
{ min: 15, message: t('views.neUser.auth.imsiConfirm') },
|
||||
],
|
||||
amf: [{ required: true, message: 'AMF' + t('common.unableNull') }],
|
||||
ki: [
|
||||
{ required: true, message: 'KI' + t('common.unableNull') },
|
||||
{ min: 32, max: 32, message: t('views.neUser.auth.kiTip') },
|
||||
{ min: 32, message: t('views.neUser.auth.kiTip') },
|
||||
],
|
||||
algoIndex: [
|
||||
{ required: true, message: 'algoIndex' + t('common.unableNull') },
|
||||
@@ -272,8 +287,11 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
|
||||
if (modalState.confirmLoading) return;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
modalState.confirmLoading = true;
|
||||
const neId = queryParams.neId || '-';
|
||||
getUDMAuth(neId, row.imsi)
|
||||
getUDMAuth({
|
||||
coreUid: row.coreUid,
|
||||
neUid: row.neUid,
|
||||
imsi: row.imsi,
|
||||
})
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
modalState.from = Object.assign(modalState.from, res.data);
|
||||
@@ -313,12 +331,10 @@ function fnModalOk() {
|
||||
modalState.confirmLoading = true;
|
||||
const from = toRaw(modalState.from);
|
||||
from.algoIndex = `${from.algoIndex}`;
|
||||
from.neId = queryParams.neId || '-';
|
||||
const result = from.id
|
||||
? updateUDMAuth(from)
|
||||
: from.num === 1
|
||||
? addUDMAuth(from)
|
||||
: batchAddUDMAuth(from, from.num);
|
||||
from.coreUid = queryParams.coreUid || '-';
|
||||
from.neUid = queryParams.neUid || '-';
|
||||
from.neType = 'UDM';
|
||||
const result = from.id ? updateUDMAuth(from) : addUDMAuth(from);
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
result
|
||||
.then(res => {
|
||||
@@ -382,30 +398,33 @@ function fnBatchDelModalOk() {
|
||||
.then(e => {
|
||||
modalState.confirmLoading = true;
|
||||
const from = toRaw(modalState.BatchDelForm);
|
||||
const neId = queryParams.neId || '-';
|
||||
batchDelUDMAuth(neId, from.imsi, from.num).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const timerS = Math.ceil(+from.num / 800) + 1;
|
||||
notification.success({
|
||||
message: modalState.title,
|
||||
description: t('common.operateOk'),
|
||||
duration: timerS,
|
||||
});
|
||||
setTimeout(() => {
|
||||
modalState.openByBatchDel = false;
|
||||
const neUid = queryParams.neUid || '-';
|
||||
const coreUid = queryParams.coreUid || '-';
|
||||
delUDMAuth({ coreUid, neUid, imsi: from.imsi, num: from.num }).then(
|
||||
res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const timerS = Math.ceil(+from.num / 800) + 1;
|
||||
notification.success({
|
||||
message: modalState.title,
|
||||
description: t('common.operateOk'),
|
||||
duration: timerS,
|
||||
});
|
||||
setTimeout(() => {
|
||||
modalState.openByBatchDel = false;
|
||||
modalState.confirmLoading = false;
|
||||
modalStateBatchDelFrom.resetFields();
|
||||
fnGetList(1);
|
||||
}, timerS * 1000);
|
||||
} else {
|
||||
modalState.confirmLoading = false;
|
||||
modalStateBatchDelFrom.resetFields();
|
||||
fnGetList(1);
|
||||
}, timerS * 1000);
|
||||
} else {
|
||||
modalState.confirmLoading = false;
|
||||
notification.error({
|
||||
message: modalState.title,
|
||||
description: res.msg,
|
||||
duration: 3,
|
||||
});
|
||||
notification.error({
|
||||
message: modalState.title,
|
||||
description: res.msg,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
|
||||
@@ -435,8 +454,9 @@ function fnModalCancel() {
|
||||
* @param imsi 编号imsi
|
||||
*/
|
||||
function fnRecordDelete(imsi: string) {
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) return;
|
||||
const neUid = queryParams.neUid;
|
||||
const coreUid = queryParams.coreUid;
|
||||
if (!neUid || !coreUid) return;
|
||||
let imsiMsg = imsi;
|
||||
if (imsi === '0') {
|
||||
imsiMsg = `${tableState.selectedRowKeys[0]}... ${t(
|
||||
@@ -451,7 +471,7 @@ function fnRecordDelete(imsi: string) {
|
||||
onOk() {
|
||||
modalState.loadDataLoading = true;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
delUDMAuth(neId, imsi)
|
||||
delUDMAuth({ coreUid, neUid, imsi, num: 0 })
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const msgContent = t('common.msgSuccess', {
|
||||
@@ -483,10 +503,11 @@ function fnRecordDelete(imsi: string) {
|
||||
function fnRecordExport(type: string = 'txt') {
|
||||
const selectLen = tableState.selectedRowKeys.length;
|
||||
if (selectLen <= 0) return;
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) return;
|
||||
const neUid = queryParams.neUid;
|
||||
const coreUid = queryParams.coreUid;
|
||||
if (!neUid || !coreUid) return;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
exportUDMAuth({ type: type, neId: neId, imsis: tableState.selectedRowKeys })
|
||||
exportUDMAuth({ type, coreUid, neUid, imsis: tableState.selectedRowKeys })
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success(t('common.msgSuccess', { msg: t('common.export') }), 3);
|
||||
@@ -502,8 +523,9 @@ function fnRecordExport(type: string = 'txt') {
|
||||
|
||||
/**列表导出全部数据 */
|
||||
function fnExportList(type: string) {
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) return;
|
||||
const neUid = queryParams.neUid;
|
||||
const coreUid = queryParams.coreUid;
|
||||
if (!neUid || !coreUid) return;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
exportUDMAuth(Object.assign({ type: type }, queryParams))
|
||||
.then(res => {
|
||||
@@ -521,13 +543,14 @@ function fnExportList(type: string) {
|
||||
|
||||
/**重新加载数据 */
|
||||
function fnLoadData() {
|
||||
const neId = queryParams.neId;
|
||||
if (tableState.loading || !neId) return;
|
||||
const coreUid = queryParams.coreUid;
|
||||
const neUid = queryParams.neUid;
|
||||
if (tableState.loading || !neUid || !coreUid) return;
|
||||
modalState.loadDataLoading = true;
|
||||
tablePagination.total = 0;
|
||||
tableState.data = [];
|
||||
tableState.loading = true; // 表格loading
|
||||
resetUDMAuth(neId).then(res => {
|
||||
resetUDMAuth(coreUid, neUid).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const num = res.data;
|
||||
const timerS = Math.ceil(+num / 800) + 3;
|
||||
@@ -627,12 +650,12 @@ function fnModalUploadImportTypeChange() {
|
||||
|
||||
/**对话框表格信息导入失败原因 */
|
||||
function fnModalUploadImportFailReason() {
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) return;
|
||||
const neUid = queryParams.neUid;
|
||||
if (!neUid) return;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
getNeViewFile({
|
||||
neType: 'UDM',
|
||||
neId: neId,
|
||||
neUid: neUid,
|
||||
path: '/tmp',
|
||||
fileName: 'import_authdata_err_records.txt',
|
||||
})
|
||||
@@ -670,8 +693,9 @@ function fnModalUploadImportClose() {
|
||||
|
||||
/**对话框表格信息导入上传 */
|
||||
function fnModalUploadImportUpload(file: File) {
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) {
|
||||
const neUid = queryParams.neUid;
|
||||
const coreUid = queryParams.coreUid;
|
||||
if (!neUid || !coreUid) {
|
||||
return Promise.reject('Unknown network element');
|
||||
}
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
@@ -694,7 +718,8 @@ function fnModalUploadImportUpload(file: File) {
|
||||
if (!filePath) return;
|
||||
// 文件导入
|
||||
return importUDMAuth({
|
||||
neId: neId,
|
||||
coreUid: coreUid,
|
||||
neUid: neUid,
|
||||
uploadPath: filePath,
|
||||
...uploadImportState.from,
|
||||
});
|
||||
@@ -739,7 +764,7 @@ function fnModalDownloadImportTemplate() {
|
||||
|
||||
onMounted(() => {
|
||||
// 获取网元网元列表
|
||||
neListStore.neCascaderOptions.forEach(item => {
|
||||
neStore.neCascaderOptions.forEach(item => {
|
||||
if (item.value === 'UDM') {
|
||||
neOtions.value = JSON.parse(JSON.stringify(item.children));
|
||||
}
|
||||
@@ -752,7 +777,7 @@ onMounted(() => {
|
||||
return;
|
||||
}
|
||||
if (neOtions.value.length > 0) {
|
||||
queryParams.neId = neOtions.value[0].value;
|
||||
queryParams.neUid = neOtions.value[0].value;
|
||||
}
|
||||
|
||||
// 获取列表数据
|
||||
@@ -771,9 +796,9 @@ onMounted(() => {
|
||||
<a-form :model="queryParams" name="queryParams" layout="horizontal">
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<a-form-item label="UDM" name="neId ">
|
||||
<a-form-item label="UDM" name="neUid ">
|
||||
<a-select
|
||||
v-model:value="queryParams.neId"
|
||||
v-model:value="queryParams.neUid"
|
||||
:options="neOtions"
|
||||
:placeholder="t('common.selectPlease')"
|
||||
:disabled="modalState.loadDataLoading"
|
||||
@@ -865,6 +890,7 @@ onMounted(() => {
|
||||
ok-text="TXT"
|
||||
ok-type="default"
|
||||
@confirm="fnExportList('txt')"
|
||||
v-if="false"
|
||||
>
|
||||
<a-button type="dashed">
|
||||
<template #icon><ExportOutlined /></template>
|
||||
@@ -890,6 +916,7 @@ onMounted(() => {
|
||||
ok-type="default"
|
||||
@confirm="fnRecordExport('txt')"
|
||||
:disabled="tableState.selectedRowKeys.length <= 0"
|
||||
v-if="false"
|
||||
>
|
||||
<a-button
|
||||
type="default"
|
||||
|
||||
Reference in New Issue
Block a user