feat: UDM用户数据接口调整,页面优化加载等待

This commit is contained in:
TsMask
2024-06-14 17:02:33 +08:00
parent 8bdfd7ea28
commit 1d55c092b1
4 changed files with 540 additions and 213 deletions

142
src/api/neData/udm_auth.ts Normal file
View File

@@ -0,0 +1,142 @@
import { request } from '@/plugins/http-fetch';
/**
* UDM鉴权用户重载数据
* @param neId 网元ID
* @returns object
*/
export function resetUDMAuth(neId: string) {
return request({
url: `/neData/udm/auth/resetData/${neId}`,
method: 'put',
timeout: 180_000,
});
}
/**
* UDM鉴权用户列表
* @param query 查询参数
* @returns object
*/
export function listUDMAuth(query: Record<string, any>) {
return request({
url: '/neData/udm/auth/list',
method: 'get',
params: query,
});
}
/**
* UDM鉴权用户信息
* @param neId 网元ID
* @param imsi IMSI
* @returns object
*/
export function getUDMAuth(neId: string, imsi: string) {
return request({
url: `/neData/udm/auth/${neId}/${imsi}`,
method: 'get',
});
}
/**
* UDM鉴权用户新增
* @param data 鉴权对象
* @returns object
*/
export function addUDMAuth(data: Record<string, any>) {
return request({
url: `/neData/udm/auth/${data.neId}`,
method: 'post',
data: data,
timeout: 180_000,
});
}
/**
* UDM鉴权用户批量新增
* @param data 鉴权对象
* @param num 数量
* @returns object
*/
export function batchAddUDMAuth(data: Record<string, any>, num: number) {
return request({
url: `/neData/udm/auth/${data.neId}/${num}`,
method: 'post',
data: data,
timeout: 180_000,
});
}
/**
* UDM鉴权用户修改
* @param data 鉴权对象
* @returns object
*/
export function updateUDMAuth(data: Record<string, any>) {
return request({
url: `/neData/udm/auth/${data.neId}`,
method: 'put',
data: data,
timeout: 180_000,
});
}
/**
* UDM鉴权用户删除
* @param neId 网元ID
* @param imsi IMSI
* @returns object
*/
export function delUDMAuth(neId: string, imsi: string) {
return request({
url: `/neData/udm/auth/${neId}/${imsi}`,
method: 'delete',
timeout: 180_000,
});
}
/**
* UDM鉴权用户批量删除
* @param neId 网元ID
* @param imsi IMSI
* @param num 数量
* @returns object
*/
export function batchDelUDMAuth(neId: string, imsi: string, num: number) {
return request({
url: `/neData/udm/auth/${neId}/${imsi}/${num}`,
method: 'delete',
timeout: 180_000,
});
}
/**
* UDM鉴权用户导入
* @param neId 网元ID
* @param data 表单数据对象
* @returns object
*/
export function importUDMAuth(data: Record<string, any>) {
return request({
url: `/neData/udm/auth/import`,
method: 'post',
data,
timeout: 180_000,
});
}
/**
* UDM鉴权用户导出
* @param data 数据参数
* @returns bolb
*/
export function exportUDMAuth(data: Record<string, any>) {
return request({
url: '/neData/udm/auth/export',
method: 'post',
data,
responseType: 'blob',
timeout: 180_000,
});
}

140
src/api/neData/udm_sub.ts Normal file
View File

@@ -0,0 +1,140 @@
import { request } from '@/plugins/http-fetch';
/**
* UDM签约用户重载数据
* @param neId 网元ID
* @returns object
*/
export function resetUDMSub(neId: string) {
return request({
url: `/neData/udm/sub/resetData/${neId}`,
method: 'put',
timeout: 180_000,
});
}
/**
* UDM签约用户列表
* @param query 查询参数
* @returns object
*/
export function listUDMSub(query: Record<string, any>) {
return request({
url: '/neData/udm/sub/list',
method: 'get',
params: query,
});
}
/**
* UDM签约用户信息
* @param neId 网元ID
* @param imsi IMSI
* @returns object
*/
export function getUDMSub(neId: string, imsi: string) {
return request({
url: `/neData/udm/sub/${neId}/${imsi}`,
method: 'get',
});
}
/**
* UDM签约用户新增
* @param data 签约对象
* @returns object
*/
export function addUDMSub(data: Record<string, any>) {
return request({
url: `/neData/udm/sub/${data.neId}`,
method: 'post',
data: data,
timeout: 180_000,
});
}
/**
* UDM签约用户批量新增
* @param data 签约对象
* @param num 数量
* @returns object
*/
export function batchAddUDMSub(data: Record<string, any>, num: number) {
return request({
url: `/neData/udm/sub/${data.neId}/${num}`,
method: 'post',
data: data,
timeout: 180_000,
});
}
/**
* UDM签约用户修改
* @param data 签约对象
* @returns object
*/
export function updateUDMSub(data: Record<string, any>) {
return request({
url: `/neData/udm/sub/${data.neId}`,
method: 'put',
data: data,
timeout: 180_000,
});
}
/**
* UDM签约用户删除
* @param data 签约对象
* @returns object
*/
export function delUDMSub(neId: string, imsi: string) {
return request({
url: `/neData/udm/sub/${neId}/${imsi}`,
method: 'delete',
timeout: 180_000,
});
}
/**
* UDM签约用户批量删除
* @param neId 网元ID
* @param imsi IMSI
* @param num 数量
* @returns object
*/
export function batchDelUDMSub(neId: string, imsi: string, num: number) {
return request({
url: `/neData/udm/sub/${neId}/${imsi}/${num}`,
method: 'delete',
timeout: 180_000,
});
}
/**
* UDM签约用户导出
* @param data 数据参数
* @returns bolb
*/
export function exportUDMSub(data: Record<string, any>) {
return request({
url: '/neData/udm/sub/export',
method: 'post',
data,
responseType: 'blob',
timeout: 180_000,
});
}
/**
* UDM签约用户导入
* @param data 表单数据对象
* @returns object
*/
export function importUDMSub(data: Record<string, any>) {
return request({
url: `/neData/udm/sub/import`,
method: 'post',
data,
timeout: 180_000,
});
}

View File

@@ -7,22 +7,23 @@ import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/lib/table'; import { ColumnsType } from 'ant-design-vue/lib/table';
import UploadModal from '@/components/UploadModal/index.vue'; import UploadModal from '@/components/UploadModal/index.vue';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue'; import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import {
listAuth,
getAuth,
updateAuth,
addAuth,
delAuth,
loadAuth,
exportAuth,
importAuthData,
batchAuth,
batchDelAuth,
} from '@/api/neUser/auth';
import useNeInfoStore from '@/store/modules/neinfo'; import useNeInfoStore from '@/store/modules/neinfo';
import useI18n from '@/hooks/useI18n'; import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver';
import {
addUDMAuth,
updateUDMAuth,
batchAddUDMAuth,
batchDelUDMAuth,
delUDMAuth,
getUDMAuth,
exportUDMAuth,
importUDMAuth,
resetUDMAuth,
listUDMAuth,
} from '@/api/neData/udm_auth';
import { uploadFile } from '@/api/tool/file';
const { t } = useI18n(); const { t } = useI18n();
/**网元参数 */ /**网元参数 */
@@ -82,7 +83,7 @@ let tableState: TabeStateType = reactive({
}); });
/**表格字段列 */ /**表格字段列 */
let tableColumns: ColumnsType = [ let tableColumns = ref<ColumnsType>([
{ {
title: 'IMSI', title: 'IMSI',
dataIndex: 'imsi', dataIndex: 'imsi',
@@ -125,7 +126,7 @@ let tableColumns: ColumnsType = [
key: 'imsi', key: 'imsi',
align: 'left', align: 'left',
}, },
]; ]);
/**表格字段列排序 */ /**表格字段列排序 */
let tableColumnsDnd = ref<ColumnsType>([]); let tableColumnsDnd = ref<ColumnsType>([]);
@@ -291,8 +292,8 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
if (modalState.confirmLoading) return; if (modalState.confirmLoading) return;
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
modalState.confirmLoading = true; modalState.confirmLoading = true;
const neID = queryParams.neId || '-'; const neId = queryParams.neId || '-';
getAuth(neID, row.imsi) getUDMAuth(neId, row.imsi)
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
modalState.from = Object.assign(modalState.from, res.data); modalState.from = Object.assign(modalState.from, res.data);
@@ -340,7 +341,7 @@ function fnModalOk() {
const from = toRaw(modalState.from); const from = toRaw(modalState.from);
from.neId = queryParams.neId || '-'; from.neId = queryParams.neId || '-';
from.algoIndex = `${from.algoIndex}`; from.algoIndex = `${from.algoIndex}`;
const result = from.id ? updateAuth(from) : addAuth(from); const result = from.id ? updateUDMAuth(from) : addUDMAuth(from);
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
result result
.then(res => { .then(res => {
@@ -379,31 +380,35 @@ function fnBatchModalOk() {
.then(e => { .then(e => {
modalState.confirmLoading = true; modalState.confirmLoading = true;
const from = toRaw(modalState.BatchForm); const from = toRaw(modalState.BatchForm);
from.neID = queryParams.neId || '-'; from.neId = queryParams.neId || '-';
from.algoIndex = `${from.algoIndex}`; from.algoIndex = `${from.algoIndex}`;
const result = batchAuth(from); const result = batchAddUDMAuth(from, from.num);
const hide = message.loading(t('common.loading'), 0); result.then(res => {
result if (res.code === RESULT_CODE_SUCCESS) {
.then(res => { const timerS = Math.max(
if (res.code === RESULT_CODE_SUCCESS) { Math.ceil(+from.num / 500),
message.success({ `${from.num}`.length
content: t('common.msgSuccess', { msg: modalState.title }), );
duration: 3, notification.success({
}); message: modalState.title,
description: t('common.operateOk'),
duration: timerS,
});
setTimeout(() => {
modalState.confirmLoading = false;
modalState.visibleByBatch = false; modalState.visibleByBatch = false;
modalStateBatchFrom.resetFields(); modalStateBatchFrom.resetFields();
fnGetList(); fnGetList(1);
} else { }, timerS * 1000);
message.error({ } else {
content: `${res.msg}`,
duration: 3,
});
}
})
.finally(() => {
hide();
modalState.confirmLoading = false; modalState.confirmLoading = false;
}); notification.error({
message: modalState.title,
description: res.msg,
duration: 3,
});
}
});
}) })
.catch(e => { .catch(e => {
message.error(t('common.errorFields', { num: e.errorFields.length }), 3); message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
@@ -420,33 +425,30 @@ function fnBatchDelModalOk() {
.then(e => { .then(e => {
modalState.confirmLoading = true; modalState.confirmLoading = true;
const from = toRaw(modalState.BatchDelForm); const from = toRaw(modalState.BatchDelForm);
const neId = queryParams.neId || '-';
const neID = queryParams.neId || '-'; batchDelUDMAuth(neId, from.imsi, from.num).then(res => {
// const result = from.id ? updateAuth(from) : addAuth(neID, from); if (res.code === RESULT_CODE_SUCCESS) {
from.neID = neID; const timerS = Math.ceil(+from.num / 1500) + 1;
const result = batchDelAuth(from); notification.success({
const hide = message.loading(t('common.loading'), 0); message: modalState.title,
result description: t('common.operateOk'),
.then(res => { duration: timerS,
if (res.code === RESULT_CODE_SUCCESS) { });
message.success({ setTimeout(() => {
content: t('common.msgSuccess', { msg: modalState.title }),
duration: 3,
});
modalState.visibleByBatchDel = false; modalState.visibleByBatchDel = false;
modalState.confirmLoading = false;
modalStateBatchDelFrom.resetFields(); modalStateBatchDelFrom.resetFields();
fnGetList(); fnGetList(1);
} else { }, timerS * 1000);
message.error({ } else {
content: `${res.msg}`,
duration: 3,
});
}
})
.finally(() => {
hide();
modalState.confirmLoading = false; modalState.confirmLoading = false;
}); notification.error({
message: modalState.title,
description: res.msg,
duration: 3,
});
}
});
}) })
.catch(e => { .catch(e => {
message.error(t('common.errorFields', { num: e.errorFields.length }), 3); message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
@@ -485,8 +487,8 @@ function fnModalCancel() {
* @param imsi 编号imsi * @param imsi 编号imsi
*/ */
function fnRecordDelete(imsi: string) { function fnRecordDelete(imsi: string) {
const neID = queryParams.neId; const neId = queryParams.neId;
if (!neID) return; if (!neId) return;
let imsiMsg = imsi; let imsiMsg = imsi;
if (imsi === '0') { if (imsi === '0') {
imsiMsg = `${tableState.selectedRowKeys[0]}... ${t( imsiMsg = `${tableState.selectedRowKeys[0]}... ${t(
@@ -501,7 +503,7 @@ function fnRecordDelete(imsi: string) {
onOk() { onOk() {
modalState.loadDataLoading = true; modalState.loadDataLoading = true;
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
delAuth(neID, imsi) delUDMAuth(neId, imsi)
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
const msgContent = t('common.msgSuccess', { const msgContent = t('common.msgSuccess', {
@@ -557,56 +559,50 @@ function fnRecordExport(type: string = 'txt') {
/**列表导出 */ /**列表导出 */
function fnExportList(type: string) { function fnExportList(type: string) {
const neID = queryParams.neId; const neId = queryParams.neId;
if (!neID) return; if (!neId) return;
const key = 'exportAuth';
message.loading({ content: t('common.loading'), key }); const hide = message.loading(t('common.loading'), 0);
exportAuth({ exportUDMAuth({
neId: neID, neId: neId,
type: type, type: type,
}).then(res => { })
if (res.code === RESULT_CODE_SUCCESS) { .then(res => {
message.success({ if (res.code === RESULT_CODE_SUCCESS) {
content: t('common.msgSuccess', { msg: t('common.export') }), message.success(t('common.msgSuccess', { msg: t('common.export') }), 3);
key, saveAs(res.data, `UDMAuth_${Date.now()}.${type}`);
duration: 2, } else {
}); message.error(`${res.msg}`, 3);
saveAs(res.data, `UDMAuth_${Date.now()}.${type}`); }
} else { })
message.error({ .finally(() => {
content: `${res.msg}`, hide();
key, });
duration: 2,
});
}
});
} }
/**重新加载数据 */ /**重新加载数据 */
function fnLoadData() { function fnLoadData() {
const neID = queryParams.neId; const neId = queryParams.neId;
if (tableState.loading || !neID) return; if (tableState.loading || !neId) return;
modalState.loadDataLoading = true; modalState.loadDataLoading = true;
tablePagination.total = 0; tablePagination.total = 0;
tableState.data = []; tableState.data = [];
tableState.loading = true; // 表格loading tableState.loading = true; // 表格loading
loadAuth(neID).then(res => { resetUDMAuth(neId).then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
const num = res.data; const num = res.data;
const timerS = Math.ceil(+num / 2500);
notification.success({ notification.success({
message: t('views.neUser.auth.loadData'), message: t('views.neUser.auth.loadData'),
description: t('views.neUser.auth.loadDataTip', { num }), description: t('views.neUser.auth.loadDataTip', { num }),
duration: num < 10_0000 ? 10 : 30, duration: Math.ceil(+num / 2500),
}); });
// 延迟10s后关闭loading刷新列表 // 延迟10s后关闭loading刷新列表
setTimeout( setTimeout(() => {
() => { modalState.loadDataLoading = false;
modalState.loadDataLoading = false; tableState.loading = false; // 表格loading
tableState.loading = false; // 表格loading fnQueryReset();
fnQueryReset(); }, timerS * 1000);
},
num < 10_0000 ? 10_000 : 30_000
);
} else { } else {
message.error({ message.error({
content: t('common.getInfoFail'), content: t('common.getInfoFail'),
@@ -624,7 +620,7 @@ function fnGetList(pageNum?: number) {
queryParams.pageNum = pageNum; queryParams.pageNum = pageNum;
tablePagination.current = pageNum; tablePagination.current = pageNum;
} }
listAuth(toRaw(queryParams)).then(res => { listUDMAuth(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选 // 取消勾选
if (tableState.selectedRowKeys.length > 0) { if (tableState.selectedRowKeys.length > 0) {
@@ -675,26 +671,42 @@ function fnModalUploadImportOpen() {
/**对话框表格信息导入关闭窗口 */ /**对话框表格信息导入关闭窗口 */
function fnModalUploadImportClose() { function fnModalUploadImportClose() {
uploadImportState.visible = false; uploadImportState.visible = false;
fnGetList(); fnGetList(1);
} }
/**对话框表格信息导入上传 */ /**对话框表格信息导入上传 */
function fnModalUploadImportUpload(file: File) { function fnModalUploadImportUpload(file: File) {
const neID = queryParams.neId; const neId = queryParams.neId;
if (!neID) { if (!neId) {
return Promise.reject('Unknown network element'); return Promise.reject('Unknown network element');
} }
let formData = new FormData();
formData.append('file', file);
formData.append('neId', neID);
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
uploadImportState.loading = true; uploadImportState.loading = true;
importAuthData(formData) // 上传文件
let formData = new FormData();
formData.append('file', file);
formData.append('subPath', 'import');
uploadFile(formData)
.then(res => { .then(res => {
uploadImportState.msg = res.msg; if (res.code === RESULT_CODE_SUCCESS) {
return res.data.fileName;
} else {
uploadImportState.msg = res.msg;
uploadImportState.loading = false;
return '';
}
}) })
.catch((err: { code: number; msg: string }) => { .then((filePath: string) => {
message.error(` ${err.msg}`); if (!filePath) return;
// 文件导入
return importUDMAuth({
neId: neId,
uploadPath: filePath,
});
})
.then(res => {
if (!res) return;
uploadImportState.msg = res.msg;
}) })
.finally(() => { .finally(() => {
hide(); hide();
@@ -755,7 +767,11 @@ onMounted(() => {
</a-col> </a-col>
<a-col :lg="6" :md="12" :xs="24"> <a-col :lg="6" :md="12" :xs="24">
<a-form-item label="IMSI" name="imsi"> <a-form-item label="IMSI" name="imsi">
<a-input v-model:value="queryParams.imsi" allow-clear></a-input> <a-input
v-model:value="queryParams.imsi"
allow-clear
:placeholder="t('common.inputPlease')"
></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :xs="24"> <a-col :lg="6" :md="12" :xs="24">
@@ -1162,8 +1178,8 @@ onMounted(() => {
v-model:value="modalState.BatchForm.num" v-model:value="modalState.BatchForm.num"
style="width: 100%" style="width: 100%"
:min="1" :min="1"
:max="100000" :max="10000"
placeholder="<=100000" placeholder="<=10000"
></a-input-number> ></a-input-number>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -1348,8 +1364,8 @@ onMounted(() => {
v-model:value="modalState.BatchDelForm.num" v-model:value="modalState.BatchDelForm.num"
style="width: 100%" style="width: 100%"
:min="1" :min="1"
:max="100000" :max="10000"
placeholder="<=100000" placeholder="<=10000"
></a-input-number> ></a-input-number>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -1365,6 +1381,7 @@ onMounted(() => {
@close="fnModalUploadImportClose" @close="fnModalUploadImportClose"
v-model:visible="uploadImportState.visible" v-model:visible="uploadImportState.visible"
:ext="['.txt']" :ext="['.txt']"
:size="10"
> >
<template #default> <template #default>
<a-textarea <a-textarea

View File

@@ -7,22 +7,23 @@ import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
import { ColumnsType } from 'ant-design-vue/lib/table'; import { ColumnsType } from 'ant-design-vue/lib/table';
import UploadModal from '@/components/UploadModal/index.vue'; import UploadModal from '@/components/UploadModal/index.vue';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue'; import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import {
loadSub,
listSub,
getSub,
updateSub,
addSub,
delSub,
importSubData,
exportSub,
batchAddSub,
batchDelSub,
} from '@/api/neUser/sub';
import useNeInfoStore from '@/store/modules/neinfo'; import useNeInfoStore from '@/store/modules/neinfo';
import useI18n from '@/hooks/useI18n'; import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import saveAs from 'file-saver'; import saveAs from 'file-saver';
import {
addUDMSub,
batchAddUDMSub,
batchDelUDMSub,
delUDMSub,
exportUDMSub,
getUDMSub,
importUDMSub,
listUDMSub,
resetUDMSub,
updateUDMSub,
} from '@/api/neData/udm_sub';
import { uploadFile } from '@/api/tool/file';
const { t } = useI18n(); const { t } = useI18n();
/**网元参数 */ /**网元参数 */
@@ -85,7 +86,7 @@ let tableState: TabeStateType = reactive({
}); });
/**表格字段列 */ /**表格字段列 */
let tableColumns: ColumnsType = [ let tableColumns = ref<ColumnsType>([
{ {
title: 'IMSI', title: 'IMSI',
dataIndex: 'imsi', dataIndex: 'imsi',
@@ -163,7 +164,7 @@ let tableColumns: ColumnsType = [
fixed: 'right', fixed: 'right',
width: 100, width: 100,
}, },
]; ]);
/**表格字段列排序 */ /**表格字段列排序 */
let tableColumnsDnd = ref<ColumnsType>([]); let tableColumnsDnd = ref<ColumnsType>([]);
@@ -250,7 +251,7 @@ let modalState: ModalStateType = reactive({
visibleByBatchDel: false, visibleByBatchDel: false,
title: 'UDM签约用户', title: 'UDM签约用户',
from: { from: {
id: '', id: undefined,
msisdn: '', msisdn: '',
imsi: '', imsi: '',
ambr: 'def_ambr', ambr: 'def_ambr',
@@ -275,7 +276,7 @@ let modalState: ModalStateType = reactive({
ueType: 1, ueType: 1,
}, },
BatchForm: { BatchForm: {
num: '', num: 1,
msisdn: '', msisdn: '',
imsi: '', imsi: '',
ambr: 'def_ambr', ambr: 'def_ambr',
@@ -300,7 +301,7 @@ let modalState: ModalStateType = reactive({
ueType: 1, ueType: 1,
}, },
BatchDelForm: { BatchDelForm: {
num: '', num: 1,
imsi: '', imsi: '',
}, },
confirmLoading: false, confirmLoading: false,
@@ -419,8 +420,8 @@ function fnModalVisibleByEdit(imsi?: string) {
if (modalState.confirmLoading) return; if (modalState.confirmLoading) return;
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
modalState.confirmLoading = true; modalState.confirmLoading = true;
const neID = queryParams.neId || '-'; const neId = queryParams.neId || '-';
getSub(neID, imsi) getUDMSub(neId, imsi)
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
transformFormData(res.data.smData); transformFormData(res.data.smData);
@@ -646,8 +647,8 @@ function fnModalOk() {
.map((item: number) => `${item}`.padStart(2, '0')) .map((item: number) => `${item}`.padStart(2, '0'))
.join(''); .join('');
const neID = queryParams.neId || '-'; from.neId = queryParams.neId || '-';
const result = from.id ? updateSub(neID, from) : addSub(neID, from); const result = from.id ? updateUDMSub(from) : addUDMSub(from);
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
result result
.then(res => { .then(res => {
@@ -734,29 +735,32 @@ function fnBatchModalOk() {
.map((item: number) => `${item}`.padStart(2, '0')) .map((item: number) => `${item}`.padStart(2, '0'))
.join(''); .join('');
const neID = queryParams.neId || '-'; from.neId = queryParams.neId || '-';
from.neID = neID; batchAddUDMSub(from, from.num).then(res => {
const hide = message.loading(t('common.loading'), 0); if (res.code === RESULT_CODE_SUCCESS) {
batchAddSub(from) const timerS = Math.max(
.then(res => { Math.ceil(+from.num / 500),
if (res.code === RESULT_CODE_SUCCESS) { `${from.num}`.length * 5
message.success({ );
content: t('common.msgSuccess', { msg: modalState.title }), notification.success({
duration: 3, message: modalState.title,
}); description: t('common.operateOk'),
fnGetList(); duration: timerS,
} else { });
message.error({ setTimeout(() => {
content: `${res.msg}`, fnBatchModalCancel();
duration: 3, modalState.confirmLoading = false;
}); fnGetList(1);
} }, timerS * 1000);
}) } else {
.finally(() => {
hide();
fnBatchModalCancel();
modalState.confirmLoading = false; modalState.confirmLoading = false;
}); notification.error({
message: modalState.title,
description: res.msg,
duration: 3,
});
}
});
}) })
.catch(e => { .catch(e => {
message.error(t('common.errorFields', { num: e.errorFields.length }), 3); message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
@@ -787,29 +791,30 @@ function fnBatchDelModalOk() {
.then(e => { .then(e => {
modalState.confirmLoading = true; modalState.confirmLoading = true;
const from = toRaw(modalState.BatchDelForm); const from = toRaw(modalState.BatchDelForm);
from.neID = queryParams.neId || '-'; const neId = queryParams.neId || '-';
const hide = message.loading(t('common.loading'), 0); batchDelUDMSub(neId, from.imsi, from.num).then(res => {
batchDelSub(from) if (res.code === RESULT_CODE_SUCCESS) {
.then(res => { const timerS = Math.ceil(+from.num / 1500) + 1;
if (res.code === RESULT_CODE_SUCCESS) { notification.success({
message.success({ message: modalState.title,
content: t('common.msgSuccess', { msg: modalState.title }), description: t('common.operateOk'),
duration: 3, duration: timerS,
}); });
setTimeout(() => {
modalState.visibleByBatchDel = false; modalState.visibleByBatchDel = false;
modalState.confirmLoading = false;
modalStateBatchDelFrom.resetFields(); modalStateBatchDelFrom.resetFields();
fnGetList(); fnGetList(1);
} else { }, timerS * 1000);
message.error({ } else {
content: `${res.msg}`,
duration: 3,
});
}
})
.finally(() => {
hide();
modalState.confirmLoading = false; modalState.confirmLoading = false;
}); notification.error({
message: modalState.title,
description: res.msg,
duration: 3,
});
}
});
}) })
.catch(e => { .catch(e => {
message.error(t('common.errorFields', { num: e.errorFields.length }), 3); message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
@@ -895,8 +900,8 @@ function fnBatchDelModalCancel() {
* @param imsi 编号imsi * @param imsi 编号imsi
*/ */
function fnRecordDelete(imsi: string) { function fnRecordDelete(imsi: string) {
const neID = queryParams.neId; const neId = queryParams.neId;
if (!neID) return; if (!neId) return;
let imsiMsg = imsi; let imsiMsg = imsi;
if (imsi === '0') { if (imsi === '0') {
imsiMsg = `${tableState.selectedRowKeys[0]}... ${t( imsiMsg = `${tableState.selectedRowKeys[0]}... ${t(
@@ -911,7 +916,7 @@ function fnRecordDelete(imsi: string) {
onOk() { onOk() {
modalState.loadDataLoading = true; modalState.loadDataLoading = true;
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
delSub(neID, imsi) delUDMSub(neId, imsi)
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
const msgContent = t('common.msgSuccess', { const msgContent = t('common.msgSuccess', {
@@ -988,12 +993,12 @@ function fnRecordExport(type: string = 'txt') {
/**列表导出 */ /**列表导出 */
function fnExportList(type: string) { function fnExportList(type: string) {
const neID = queryParams.neId; const neId = queryParams.neId;
if (!neID) return; if (!neId) return;
const key = 'exportSub'; const key = 'exportSub';
message.loading({ content: t('common.loading'), key }); message.loading({ content: t('common.loading'), key });
exportSub({ exportUDMSub({
neId: neID, neId: neId,
type: type, type: type,
}).then(res => { }).then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
@@ -1015,29 +1020,27 @@ function fnExportList(type: string) {
/**重新加载数据 */ /**重新加载数据 */
function fnLoadData() { function fnLoadData() {
const neID = queryParams.neId; const neId = queryParams.neId;
if (tableState.loading || !neID) return; if (tableState.loading || !neId) return;
modalState.loadDataLoading = true; modalState.loadDataLoading = true;
tablePagination.total = 0; tablePagination.total = 0;
tableState.data = []; tableState.data = [];
tableState.loading = true; // 表格loading tableState.loading = true; // 表格loading
loadSub(neID).then(res => { resetUDMSub(neId).then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
const num = res.data; const num = res.data;
const timerS = Math.ceil(+num / 1500) + 1;
notification.success({ notification.success({
message: t('views.neUser.sub.loadData'), message: t('views.neUser.sub.loadData'),
description: t('views.neUser.sub.loadDataTip', { num }), description: t('views.neUser.sub.loadDataTip', { num }),
duration: num < 10_0000 ? 10 : 30, duration: timerS,
}); });
// 延迟20s后关闭loading刷新列表 // 延迟20s后关闭loading刷新列表
setTimeout( setTimeout(() => {
() => { modalState.loadDataLoading = false;
modalState.loadDataLoading = false; tableState.loading = false; // 表格loading
tableState.loading = false; // 表格loading fnQueryReset();
fnQueryReset(); }, timerS * 1000);
},
num < 10_0000 ? 10_000 : 30_000
);
} else { } else {
message.error({ message.error({
content: t('common.getInfoFail'), content: t('common.getInfoFail'),
@@ -1055,7 +1058,7 @@ function fnGetList(pageNum?: number) {
queryParams.pageNum = pageNum; queryParams.pageNum = pageNum;
tablePagination.current = pageNum; tablePagination.current = pageNum;
} }
listSub(toRaw(queryParams)).then(res => { listUDMSub(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选 // 取消勾选
if (tableState.selectedRowKeys.length > 0) { if (tableState.selectedRowKeys.length > 0) {
@@ -1112,21 +1115,37 @@ function fnModalUploadImportClose() {
/**对话框表格信息导入上传 */ /**对话框表格信息导入上传 */
function fnModalUploadImportUpload(file: File) { function fnModalUploadImportUpload(file: File) {
const neID = queryParams.neId; const neId = queryParams.neId;
if (!neID) { if (!neId) {
return Promise.reject('Unknown network element'); return Promise.reject('Unknown network element');
} }
let formData = new FormData();
formData.append('file', file);
formData.append('neId', neID);
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
uploadImportState.loading = true; uploadImportState.loading = true;
importSubData(formData) // 上传文件
let formData = new FormData();
formData.append('file', file);
formData.append('subPath', 'import');
uploadFile(formData)
.then(res => { .then(res => {
uploadImportState.msg = res.msg; if (res.code === RESULT_CODE_SUCCESS) {
return res.data.fileName;
} else {
uploadImportState.msg = res.msg;
uploadImportState.loading = false;
return '';
}
}) })
.catch((err: { code: number; msg: string }) => { .then((filePath: string) => {
message.error(` ${err.msg}`); if (!filePath) return;
// 文件导入
return importUDMSub({
neId: neId,
uploadPath: filePath,
});
})
.then(res => {
if (!res) return;
uploadImportState.msg = res.msg;
}) })
.finally(() => { .finally(() => {
hide(); hide();
@@ -1222,12 +1241,20 @@ onMounted(() => {
</a-col> </a-col>
<a-col :lg="6" :md="12" :xs="24"> <a-col :lg="6" :md="12" :xs="24">
<a-form-item label="IMSI" name="imsi"> <a-form-item label="IMSI" name="imsi">
<a-input v-model:value="queryParams.imsi" allow-clear></a-input> <a-input
v-model:value="queryParams.imsi"
allow-clear
:placeholder="t('common.inputPlease')"
></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :xs="24"> <a-col :lg="6" :md="12" :xs="24">
<a-form-item label="MSISDN" name="msisdn"> <a-form-item label="MSISDN" name="msisdn">
<a-input v-model:value="queryParams.msisdn" allow-clear></a-input> <a-input
v-model:value="queryParams.msisdn"
allow-clear
:placeholder="t('common.inputPlease')"
></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :xs="24"> <a-col :lg="6" :md="12" :xs="24">
@@ -2007,8 +2034,8 @@ onMounted(() => {
v-model:value="modalState.BatchForm.num" v-model:value="modalState.BatchForm.num"
style="width: 100%" style="width: 100%"
:min="1" :min="1"
:max="100000" :max="10000"
placeholder="<=100000" placeholder="<=10000"
></a-input-number> ></a-input-number>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -2568,8 +2595,8 @@ onMounted(() => {
v-model:value="modalState.BatchDelForm.num" v-model:value="modalState.BatchDelForm.num"
style="width: 100%" style="width: 100%"
:min="1" :min="1"
:max="100000" :max="10000"
placeholder="<=100000" placeholder="<=10000"
></a-input-number> ></a-input-number>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -2585,6 +2612,7 @@ onMounted(() => {
@close="fnModalUploadImportClose" @close="fnModalUploadImportClose"
v-model:visible="uploadImportState.visible" v-model:visible="uploadImportState.visible"
:ext="['.txt']" :ext="['.txt']"
:size="10"
> >
<template #default> <template #default>
<a-textarea <a-textarea