feat: UDM用户数据接口调整,页面优化加载等待
This commit is contained in:
142
src/api/neData/udm_auth.ts
Normal file
142
src/api/neData/udm_auth.ts
Normal 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
140
src/api/neData/udm_sub.ts
Normal 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,
|
||||
});
|
||||
}
|
||||
@@ -7,22 +7,23 @@ import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
|
||||
import { ColumnsType } from 'ant-design-vue/lib/table';
|
||||
import UploadModal from '@/components/UploadModal/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 useI18n from '@/hooks/useI18n';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
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();
|
||||
|
||||
/**网元参数 */
|
||||
@@ -82,7 +83,7 @@ let tableState: TabeStateType = reactive({
|
||||
});
|
||||
|
||||
/**表格字段列 */
|
||||
let tableColumns: ColumnsType = [
|
||||
let tableColumns = ref<ColumnsType>([
|
||||
{
|
||||
title: 'IMSI',
|
||||
dataIndex: 'imsi',
|
||||
@@ -125,7 +126,7 @@ let tableColumns: ColumnsType = [
|
||||
key: 'imsi',
|
||||
align: 'left',
|
||||
},
|
||||
];
|
||||
]);
|
||||
|
||||
/**表格字段列排序 */
|
||||
let tableColumnsDnd = ref<ColumnsType>([]);
|
||||
@@ -291,8 +292,8 @@ 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 || '-';
|
||||
getAuth(neID, row.imsi)
|
||||
const neId = queryParams.neId || '-';
|
||||
getUDMAuth(neId, row.imsi)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
modalState.from = Object.assign(modalState.from, res.data);
|
||||
@@ -340,7 +341,7 @@ function fnModalOk() {
|
||||
const from = toRaw(modalState.from);
|
||||
from.neId = queryParams.neId || '-';
|
||||
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);
|
||||
result
|
||||
.then(res => {
|
||||
@@ -379,30 +380,34 @@ function fnBatchModalOk() {
|
||||
.then(e => {
|
||||
modalState.confirmLoading = true;
|
||||
const from = toRaw(modalState.BatchForm);
|
||||
from.neID = queryParams.neId || '-';
|
||||
from.neId = queryParams.neId || '-';
|
||||
from.algoIndex = `${from.algoIndex}`;
|
||||
const result = batchAuth(from);
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
result
|
||||
.then(res => {
|
||||
const result = batchAddUDMAuth(from, from.num);
|
||||
result.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.msgSuccess', { msg: modalState.title }),
|
||||
duration: 3,
|
||||
const timerS = Math.max(
|
||||
Math.ceil(+from.num / 500),
|
||||
`${from.num}`.length
|
||||
);
|
||||
notification.success({
|
||||
message: modalState.title,
|
||||
description: t('common.operateOk'),
|
||||
duration: timerS,
|
||||
});
|
||||
setTimeout(() => {
|
||||
modalState.confirmLoading = false;
|
||||
modalState.visibleByBatch = false;
|
||||
modalStateBatchFrom.resetFields();
|
||||
fnGetList();
|
||||
fnGetList(1);
|
||||
}, timerS * 1000);
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
modalState.confirmLoading = false;
|
||||
notification.error({
|
||||
message: modalState.title,
|
||||
description: res.msg,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
@@ -420,32 +425,29 @@ function fnBatchDelModalOk() {
|
||||
.then(e => {
|
||||
modalState.confirmLoading = true;
|
||||
const from = toRaw(modalState.BatchDelForm);
|
||||
|
||||
const neID = queryParams.neId || '-';
|
||||
// const result = from.id ? updateAuth(from) : addAuth(neID, from);
|
||||
from.neID = neID;
|
||||
const result = batchDelAuth(from);
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
result
|
||||
.then(res => {
|
||||
const neId = queryParams.neId || '-';
|
||||
batchDelUDMAuth(neId, from.imsi, from.num).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.msgSuccess', { msg: modalState.title }),
|
||||
duration: 3,
|
||||
const timerS = Math.ceil(+from.num / 1500) + 1;
|
||||
notification.success({
|
||||
message: modalState.title,
|
||||
description: t('common.operateOk'),
|
||||
duration: timerS,
|
||||
});
|
||||
setTimeout(() => {
|
||||
modalState.visibleByBatchDel = false;
|
||||
modalState.confirmLoading = false;
|
||||
modalStateBatchDelFrom.resetFields();
|
||||
fnGetList();
|
||||
fnGetList(1);
|
||||
}, timerS * 1000);
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
modalState.confirmLoading = false;
|
||||
notification.error({
|
||||
message: modalState.title,
|
||||
description: res.msg,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
@@ -485,8 +487,8 @@ function fnModalCancel() {
|
||||
* @param imsi 编号imsi
|
||||
*/
|
||||
function fnRecordDelete(imsi: string) {
|
||||
const neID = queryParams.neId;
|
||||
if (!neID) return;
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) return;
|
||||
let imsiMsg = imsi;
|
||||
if (imsi === '0') {
|
||||
imsiMsg = `${tableState.selectedRowKeys[0]}... ${t(
|
||||
@@ -501,7 +503,7 @@ function fnRecordDelete(imsi: string) {
|
||||
onOk() {
|
||||
modalState.loadDataLoading = true;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
delAuth(neID, imsi)
|
||||
delUDMAuth(neId, imsi)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const msgContent = t('common.msgSuccess', {
|
||||
@@ -557,56 +559,50 @@ function fnRecordExport(type: string = 'txt') {
|
||||
|
||||
/**列表导出 */
|
||||
function fnExportList(type: string) {
|
||||
const neID = queryParams.neId;
|
||||
if (!neID) return;
|
||||
const key = 'exportAuth';
|
||||
message.loading({ content: t('common.loading'), key });
|
||||
exportAuth({
|
||||
neId: neID,
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) return;
|
||||
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
exportUDMAuth({
|
||||
neId: neId,
|
||||
type: type,
|
||||
}).then(res => {
|
||||
})
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.msgSuccess', { msg: t('common.export') }),
|
||||
key,
|
||||
duration: 2,
|
||||
});
|
||||
message.success(t('common.msgSuccess', { msg: t('common.export') }), 3);
|
||||
saveAs(res.data, `UDMAuth_${Date.now()}.${type}`);
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
key,
|
||||
duration: 2,
|
||||
});
|
||||
message.error(`${res.msg}`, 3);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
});
|
||||
}
|
||||
|
||||
/**重新加载数据 */
|
||||
function fnLoadData() {
|
||||
const neID = queryParams.neId;
|
||||
if (tableState.loading || !neID) return;
|
||||
const neId = queryParams.neId;
|
||||
if (tableState.loading || !neId) return;
|
||||
modalState.loadDataLoading = true;
|
||||
tablePagination.total = 0;
|
||||
tableState.data = [];
|
||||
tableState.loading = true; // 表格loading
|
||||
loadAuth(neID).then(res => {
|
||||
resetUDMAuth(neId).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const num = res.data;
|
||||
const timerS = Math.ceil(+num / 2500);
|
||||
notification.success({
|
||||
message: t('views.neUser.auth.loadData'),
|
||||
description: t('views.neUser.auth.loadDataTip', { num }),
|
||||
duration: num < 10_0000 ? 10 : 30,
|
||||
duration: Math.ceil(+num / 2500),
|
||||
});
|
||||
// 延迟10s后关闭loading刷新列表
|
||||
setTimeout(
|
||||
() => {
|
||||
setTimeout(() => {
|
||||
modalState.loadDataLoading = false;
|
||||
tableState.loading = false; // 表格loading
|
||||
fnQueryReset();
|
||||
},
|
||||
num < 10_0000 ? 10_000 : 30_000
|
||||
);
|
||||
}, timerS * 1000);
|
||||
} else {
|
||||
message.error({
|
||||
content: t('common.getInfoFail'),
|
||||
@@ -624,7 +620,7 @@ function fnGetList(pageNum?: number) {
|
||||
queryParams.pageNum = 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 (tableState.selectedRowKeys.length > 0) {
|
||||
@@ -675,26 +671,42 @@ function fnModalUploadImportOpen() {
|
||||
/**对话框表格信息导入关闭窗口 */
|
||||
function fnModalUploadImportClose() {
|
||||
uploadImportState.visible = false;
|
||||
fnGetList();
|
||||
fnGetList(1);
|
||||
}
|
||||
|
||||
/**对话框表格信息导入上传 */
|
||||
function fnModalUploadImportUpload(file: File) {
|
||||
const neID = queryParams.neId;
|
||||
if (!neID) {
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) {
|
||||
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);
|
||||
uploadImportState.loading = true;
|
||||
importAuthData(formData)
|
||||
// 上传文件
|
||||
let formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('subPath', 'import');
|
||||
uploadFile(formData)
|
||||
.then(res => {
|
||||
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 }) => {
|
||||
message.error(` ${err.msg}`);
|
||||
.then((filePath: string) => {
|
||||
if (!filePath) return;
|
||||
// 文件导入
|
||||
return importUDMAuth({
|
||||
neId: neId,
|
||||
uploadPath: filePath,
|
||||
});
|
||||
})
|
||||
.then(res => {
|
||||
if (!res) return;
|
||||
uploadImportState.msg = res.msg;
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
@@ -755,7 +767,11 @@ onMounted(() => {
|
||||
</a-col>
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<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-col>
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
@@ -1162,8 +1178,8 @@ onMounted(() => {
|
||||
v-model:value="modalState.BatchForm.num"
|
||||
style="width: 100%"
|
||||
:min="1"
|
||||
:max="100000"
|
||||
placeholder="<=100000"
|
||||
:max="10000"
|
||||
placeholder="<=10000"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -1348,8 +1364,8 @@ onMounted(() => {
|
||||
v-model:value="modalState.BatchDelForm.num"
|
||||
style="width: 100%"
|
||||
:min="1"
|
||||
:max="100000"
|
||||
placeholder="<=100000"
|
||||
:max="10000"
|
||||
placeholder="<=10000"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -1365,6 +1381,7 @@ onMounted(() => {
|
||||
@close="fnModalUploadImportClose"
|
||||
v-model:visible="uploadImportState.visible"
|
||||
:ext="['.txt']"
|
||||
:size="10"
|
||||
>
|
||||
<template #default>
|
||||
<a-textarea
|
||||
|
||||
@@ -7,22 +7,23 @@ import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface';
|
||||
import { ColumnsType } from 'ant-design-vue/lib/table';
|
||||
import UploadModal from '@/components/UploadModal/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 useI18n from '@/hooks/useI18n';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
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();
|
||||
|
||||
/**网元参数 */
|
||||
@@ -85,7 +86,7 @@ let tableState: TabeStateType = reactive({
|
||||
});
|
||||
|
||||
/**表格字段列 */
|
||||
let tableColumns: ColumnsType = [
|
||||
let tableColumns = ref<ColumnsType>([
|
||||
{
|
||||
title: 'IMSI',
|
||||
dataIndex: 'imsi',
|
||||
@@ -163,7 +164,7 @@ let tableColumns: ColumnsType = [
|
||||
fixed: 'right',
|
||||
width: 100,
|
||||
},
|
||||
];
|
||||
]);
|
||||
|
||||
/**表格字段列排序 */
|
||||
let tableColumnsDnd = ref<ColumnsType>([]);
|
||||
@@ -250,7 +251,7 @@ let modalState: ModalStateType = reactive({
|
||||
visibleByBatchDel: false,
|
||||
title: 'UDM签约用户',
|
||||
from: {
|
||||
id: '',
|
||||
id: undefined,
|
||||
msisdn: '',
|
||||
imsi: '',
|
||||
ambr: 'def_ambr',
|
||||
@@ -275,7 +276,7 @@ let modalState: ModalStateType = reactive({
|
||||
ueType: 1,
|
||||
},
|
||||
BatchForm: {
|
||||
num: '',
|
||||
num: 1,
|
||||
msisdn: '',
|
||||
imsi: '',
|
||||
ambr: 'def_ambr',
|
||||
@@ -300,7 +301,7 @@ let modalState: ModalStateType = reactive({
|
||||
ueType: 1,
|
||||
},
|
||||
BatchDelForm: {
|
||||
num: '',
|
||||
num: 1,
|
||||
imsi: '',
|
||||
},
|
||||
confirmLoading: false,
|
||||
@@ -419,8 +420,8 @@ function fnModalVisibleByEdit(imsi?: string) {
|
||||
if (modalState.confirmLoading) return;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
modalState.confirmLoading = true;
|
||||
const neID = queryParams.neId || '-';
|
||||
getSub(neID, imsi)
|
||||
const neId = queryParams.neId || '-';
|
||||
getUDMSub(neId, imsi)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
transformFormData(res.data.smData);
|
||||
@@ -646,8 +647,8 @@ function fnModalOk() {
|
||||
.map((item: number) => `${item}`.padStart(2, '0'))
|
||||
.join('');
|
||||
|
||||
const neID = queryParams.neId || '-';
|
||||
const result = from.id ? updateSub(neID, from) : addSub(neID, from);
|
||||
from.neId = queryParams.neId || '-';
|
||||
const result = from.id ? updateUDMSub(from) : addUDMSub(from);
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
result
|
||||
.then(res => {
|
||||
@@ -734,28 +735,31 @@ function fnBatchModalOk() {
|
||||
.map((item: number) => `${item}`.padStart(2, '0'))
|
||||
.join('');
|
||||
|
||||
const neID = queryParams.neId || '-';
|
||||
from.neID = neID;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
batchAddSub(from)
|
||||
.then(res => {
|
||||
from.neId = queryParams.neId || '-';
|
||||
batchAddUDMSub(from, from.num).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.msgSuccess', { msg: modalState.title }),
|
||||
duration: 3,
|
||||
const timerS = Math.max(
|
||||
Math.ceil(+from.num / 500),
|
||||
`${from.num}`.length * 5
|
||||
);
|
||||
notification.success({
|
||||
message: modalState.title,
|
||||
description: t('common.operateOk'),
|
||||
duration: timerS,
|
||||
});
|
||||
fnGetList();
|
||||
setTimeout(() => {
|
||||
fnBatchModalCancel();
|
||||
modalState.confirmLoading = false;
|
||||
fnGetList(1);
|
||||
}, timerS * 1000);
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
modalState.confirmLoading = false;
|
||||
notification.error({
|
||||
message: modalState.title,
|
||||
description: res.msg,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
fnBatchModalCancel();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
@@ -787,28 +791,29 @@ function fnBatchDelModalOk() {
|
||||
.then(e => {
|
||||
modalState.confirmLoading = true;
|
||||
const from = toRaw(modalState.BatchDelForm);
|
||||
from.neID = queryParams.neId || '-';
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
batchDelSub(from)
|
||||
.then(res => {
|
||||
const neId = queryParams.neId || '-';
|
||||
batchDelUDMSub(neId, from.imsi, from.num).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.msgSuccess', { msg: modalState.title }),
|
||||
duration: 3,
|
||||
const timerS = Math.ceil(+from.num / 1500) + 1;
|
||||
notification.success({
|
||||
message: modalState.title,
|
||||
description: t('common.operateOk'),
|
||||
duration: timerS,
|
||||
});
|
||||
setTimeout(() => {
|
||||
modalState.visibleByBatchDel = false;
|
||||
modalState.confirmLoading = false;
|
||||
modalStateBatchDelFrom.resetFields();
|
||||
fnGetList();
|
||||
fnGetList(1);
|
||||
}, timerS * 1000);
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
modalState.confirmLoading = false;
|
||||
notification.error({
|
||||
message: modalState.title,
|
||||
description: res.msg,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
@@ -895,8 +900,8 @@ function fnBatchDelModalCancel() {
|
||||
* @param imsi 编号imsi
|
||||
*/
|
||||
function fnRecordDelete(imsi: string) {
|
||||
const neID = queryParams.neId;
|
||||
if (!neID) return;
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) return;
|
||||
let imsiMsg = imsi;
|
||||
if (imsi === '0') {
|
||||
imsiMsg = `${tableState.selectedRowKeys[0]}... ${t(
|
||||
@@ -911,7 +916,7 @@ function fnRecordDelete(imsi: string) {
|
||||
onOk() {
|
||||
modalState.loadDataLoading = true;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
delSub(neID, imsi)
|
||||
delUDMSub(neId, imsi)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const msgContent = t('common.msgSuccess', {
|
||||
@@ -988,12 +993,12 @@ function fnRecordExport(type: string = 'txt') {
|
||||
|
||||
/**列表导出 */
|
||||
function fnExportList(type: string) {
|
||||
const neID = queryParams.neId;
|
||||
if (!neID) return;
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) return;
|
||||
const key = 'exportSub';
|
||||
message.loading({ content: t('common.loading'), key });
|
||||
exportSub({
|
||||
neId: neID,
|
||||
exportUDMSub({
|
||||
neId: neId,
|
||||
type: type,
|
||||
}).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
@@ -1015,29 +1020,27 @@ function fnExportList(type: string) {
|
||||
|
||||
/**重新加载数据 */
|
||||
function fnLoadData() {
|
||||
const neID = queryParams.neId;
|
||||
if (tableState.loading || !neID) return;
|
||||
const neId = queryParams.neId;
|
||||
if (tableState.loading || !neId) return;
|
||||
modalState.loadDataLoading = true;
|
||||
tablePagination.total = 0;
|
||||
tableState.data = [];
|
||||
tableState.loading = true; // 表格loading
|
||||
loadSub(neID).then(res => {
|
||||
resetUDMSub(neId).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const num = res.data;
|
||||
const timerS = Math.ceil(+num / 1500) + 1;
|
||||
notification.success({
|
||||
message: t('views.neUser.sub.loadData'),
|
||||
description: t('views.neUser.sub.loadDataTip', { num }),
|
||||
duration: num < 10_0000 ? 10 : 30,
|
||||
duration: timerS,
|
||||
});
|
||||
// 延迟20s后关闭loading刷新列表
|
||||
setTimeout(
|
||||
() => {
|
||||
setTimeout(() => {
|
||||
modalState.loadDataLoading = false;
|
||||
tableState.loading = false; // 表格loading
|
||||
fnQueryReset();
|
||||
},
|
||||
num < 10_0000 ? 10_000 : 30_000
|
||||
);
|
||||
}, timerS * 1000);
|
||||
} else {
|
||||
message.error({
|
||||
content: t('common.getInfoFail'),
|
||||
@@ -1055,7 +1058,7 @@ function fnGetList(pageNum?: number) {
|
||||
queryParams.pageNum = 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 (tableState.selectedRowKeys.length > 0) {
|
||||
@@ -1112,21 +1115,37 @@ function fnModalUploadImportClose() {
|
||||
|
||||
/**对话框表格信息导入上传 */
|
||||
function fnModalUploadImportUpload(file: File) {
|
||||
const neID = queryParams.neId;
|
||||
if (!neID) {
|
||||
const neId = queryParams.neId;
|
||||
if (!neId) {
|
||||
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);
|
||||
uploadImportState.loading = true;
|
||||
importSubData(formData)
|
||||
// 上传文件
|
||||
let formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('subPath', 'import');
|
||||
uploadFile(formData)
|
||||
.then(res => {
|
||||
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 }) => {
|
||||
message.error(` ${err.msg}`);
|
||||
.then((filePath: string) => {
|
||||
if (!filePath) return;
|
||||
// 文件导入
|
||||
return importUDMSub({
|
||||
neId: neId,
|
||||
uploadPath: filePath,
|
||||
});
|
||||
})
|
||||
.then(res => {
|
||||
if (!res) return;
|
||||
uploadImportState.msg = res.msg;
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
@@ -1222,12 +1241,20 @@ onMounted(() => {
|
||||
</a-col>
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<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-col>
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
<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-col>
|
||||
<a-col :lg="6" :md="12" :xs="24">
|
||||
@@ -2007,8 +2034,8 @@ onMounted(() => {
|
||||
v-model:value="modalState.BatchForm.num"
|
||||
style="width: 100%"
|
||||
:min="1"
|
||||
:max="100000"
|
||||
placeholder="<=100000"
|
||||
:max="10000"
|
||||
placeholder="<=10000"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -2568,8 +2595,8 @@ onMounted(() => {
|
||||
v-model:value="modalState.BatchDelForm.num"
|
||||
style="width: 100%"
|
||||
:min="1"
|
||||
:max="100000"
|
||||
placeholder="<=100000"
|
||||
:max="10000"
|
||||
placeholder="<=10000"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -2585,6 +2612,7 @@ onMounted(() => {
|
||||
@close="fnModalUploadImportClose"
|
||||
v-model:visible="uploadImportState.visible"
|
||||
:ext="['.txt']"
|
||||
:size="10"
|
||||
>
|
||||
<template #default>
|
||||
<a-textarea
|
||||
|
||||
Reference in New Issue
Block a user