---完善UDM鉴权

This commit is contained in:
lai
2023-09-22 17:24:55 +08:00
parent fb9f465e12
commit f10bc91bed
4 changed files with 66 additions and 12 deletions

View File

@@ -28,6 +28,22 @@ export function getAllAuth(neId:string) {
}); });
} }
/**
* 导出鉴权数据
* @param neId 网元ID
* @returns object
*/
export function exportAuth(data: Record<string, any>) {
console.log(toRaw(data))
return request({
url: 'udmUserManage/v1/authExport',
method: 'post',
data: data,
responseType: 'blob',
});
}
/** /**
* 查询鉴权详细 * 查询鉴权详细
* @param neId 网元ID * @param neId 网元ID
@@ -91,4 +107,4 @@ export function delAuth(neId:string,data: Record<string, any>) {
url: `/udmUserManage/v1/auth/${neId}/${data.imsi}`, url: `/udmUserManage/v1/auth/${neId}/${data.imsi}`,
method: 'delete', method: 'delete',
}); });
} }

View File

@@ -125,7 +125,8 @@ export default {
auth: { auth: {
getAll: 'Get ALL', getAll: 'Get ALL',
num:'Number allocation', num:'Number allocation',
batchAddText: '批量新增', batchAddText: 'Batch Add',
export: 'Export',
}, },
base5G: { base5G: {
neTypePlease: 'Query network element type', neTypePlease: 'Query network element type',

View File

@@ -126,6 +126,7 @@ export default {
getAll: '全部获取', getAll: '全部获取',
num:'放号数', num:'放号数',
batchAddText: '批量新增', batchAddText: '批量新增',
export: '导出',
}, },
base5G: { base5G: {
neTypePlease: '查询网元类型', neTypePlease: '查询网元类型',

View File

@@ -6,11 +6,12 @@ import { message, Modal, Form } from 'ant-design-vue/lib';
import { SizeType } from 'ant-design-vue/lib/config-provider'; import { SizeType } from 'ant-design-vue/lib/config-provider';
import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface'; 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 { listAuth, getAuth, updateAuth, addAuth, delAuth, getAllAuth, batchAuth } from '@/api/neUser/auth'; import { listAuth, getAuth, updateAuth, addAuth, delAuth, getAllAuth,exportAuth,batchAuth } from '@/api/neUser/auth';
import { parseDateToStr } from '@/utils/date-utils'; import { parseDateToStr } from '@/utils/date-utils';
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";
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@@ -23,11 +24,13 @@ let neOtions = ref<Record<string, any>[]>([]);
/**全部获取开关*/ /**全部获取开关*/
let getAllSwitch = ref<boolean>(false); let getAllSwitch = ref<boolean>(false);
/**全部获取加载开关*/ /**全部获取加载开关*/
let getAllLoading = ref<boolean>(false); let getAllLoading = ref<boolean>(false);
/**导出开关*/
let exportSwitch = ref<boolean>(false);
/**全部获取加载开关*/
let exportLoading = ref<boolean>(false);
/**查询参数 */ /**查询参数 */
let queryParams = reactive({ let queryParams = reactive({
@@ -225,11 +228,11 @@ const modalStateBatchFrom = Form.useForm(
/** /**
* 对话框弹出显示为 新增或者修改,批量新增 * 对话框弹出显示为 新增或者修改
* @param noticeId 网元id, 不传为新增 * @param noticeId 网元id, 不传为新增
*/ */
function fnModalVisibleByEdit(batchFlag?: number, row?: Record<string, any>) { function fnModalVisibleByEdit(row?: Record<string, any>) {
if (!row && !batchFlag) { if (!row) {
modalStateFrom.resetFields(); //重置表单 modalStateFrom.resetFields(); //重置表单
modalState.title = '添加鉴权信息'; modalState.title = '添加鉴权信息';
modalState.visibleByEdit = true; modalState.visibleByEdit = true;
@@ -253,7 +256,7 @@ function fnModalVisibleByEdit(batchFlag?: number, row?: Record<string, any>) {
} }
/** /**
* 对话框弹出显示为 新增或者修改,批量新增 * 对话框弹出显示为 批量新增,批量删除
* @param noticeId 网元id, 不传为新增 * @param noticeId 网元id, 不传为新增
*/ */
function fnModalVisibleByBatch(batchFlag?: number) { function fnModalVisibleByBatch(batchFlag?: number) {
@@ -444,6 +447,33 @@ function fnGetAll() {
}); });
} }
/**导出鉴权用户 */
function fnExport() {
const neID = queryParams.neId || '-';
exportSwitch.value = true;
exportLoading.value = true;
const key = 'exportAuthUser';
exportAuth({neId:neID,type:"csv"}).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
key,
duration: 2,
});
saveAs(res.data, `udm_${Date.now()}.csv`);
exportSwitch.value = false;
exportLoading.value = false;
} else {
exportSwitch.value = false;
exportLoading.value = false;
message.error({
content: `${res.msg}`,
key,
duration: 2,
});
}
});
}
onMounted(() => { onMounted(() => {
// 获取列表数据 // 获取列表数据
@@ -517,7 +547,7 @@ onMounted(() => {
<!-- 插槽-卡片左侧侧 --> <!-- 插槽-卡片左侧侧 -->
<template #title> <template #title>
<a-space :size="8" align="center"> <a-space :size="8" align="center">
<a-button type="primary" @click.prevent="fnModalVisibleByEdit(0)"> <a-button type="primary" @click.prevent="fnModalVisibleByEdit()">
<template #icon> <template #icon>
<PlusOutlined /> <PlusOutlined />
</template> </template>
@@ -529,12 +559,18 @@ onMounted(() => {
</template> </template>
{{ t('views.neUser.auth.getAll') }} {{ t('views.neUser.auth.getAll') }}
</a-button> </a-button>
<a-button type="primary" @click.prevent="fnModalVisibleByEdit(1)"> <a-button type="primary" @click.prevent="fnModalVisibleByBatch(1)">
<template #icon> <template #icon>
<PlusOutlined /> <PlusOutlined />
</template> </template>
{{ t('views.neUser.auth.batchAddText') }} {{ t('views.neUser.auth.batchAddText') }}
</a-button> </a-button>
<a-button type="primary" @click.prevent="fnExport" :disabled="exportSwitch" :loading="exportLoading">
<template #icon>
<DownloadOutlined />
</template>
{{ t('views.neUser.auth.export') }}
</a-button>
</a-space> </a-space>
</template> </template>
@@ -588,7 +624,7 @@ onMounted(() => {
<a-space :size="8" align="center"> <a-space :size="8" align="center">
<a-tooltip> <a-tooltip>
<template #title>{{ t('common.editText') }}</template> <template #title>{{ t('common.editText') }}</template>
<a-button type="link" @click.prevent="fnModalVisibleByEdit(0, record)"> <a-button type="link" @click.prevent="fnModalVisibleByEdit(record)">
<template #icon> <template #icon>
<FormOutlined /> <FormOutlined />
</template> </template>