From f10bc91bed15484d2395ef8b6dd720c7d5f12e99 Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Fri, 22 Sep 2023 17:24:55 +0800 Subject: [PATCH] =?UTF-8?q?---=E5=AE=8C=E5=96=84UDM=E9=89=B4=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/neUser/auth.ts | 18 ++++++++++- src/i18n/locales/en-US.ts | 3 +- src/i18n/locales/zh-CN.ts | 1 + src/views/neUser/auth/index.vue | 56 +++++++++++++++++++++++++++------ 4 files changed, 66 insertions(+), 12 deletions(-) diff --git a/src/api/neUser/auth.ts b/src/api/neUser/auth.ts index fe6b6758..8e90e851 100644 --- a/src/api/neUser/auth.ts +++ b/src/api/neUser/auth.ts @@ -28,6 +28,22 @@ export function getAllAuth(neId:string) { }); } +/** + * 导出鉴权数据 + * @param neId 网元ID + * @returns object + */ +export function exportAuth(data: Record) { + console.log(toRaw(data)) + return request({ + url: 'udmUserManage/v1/authExport', + method: 'post', + data: data, + responseType: 'blob', + }); +} + + /** * 查询鉴权详细 * @param neId 网元ID @@ -91,4 +107,4 @@ export function delAuth(neId:string,data: Record) { url: `/udmUserManage/v1/auth/${neId}/${data.imsi}`, method: 'delete', }); -} \ No newline at end of file +} diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index f4e79c5e..2ce3476a 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -125,7 +125,8 @@ export default { auth: { getAll: 'Get ALL', num:'Number allocation', - batchAddText: '批量新增', + batchAddText: 'Batch Add', + export: 'Export', }, base5G: { neTypePlease: 'Query network element type', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index d35eafd1..dd4b1b0b 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -126,6 +126,7 @@ export default { getAll: '全部获取', num:'放号数', batchAddText: '批量新增', + export: '导出', }, base5G: { neTypePlease: '查询网元类型', diff --git a/src/views/neUser/auth/index.vue b/src/views/neUser/auth/index.vue index 3c9806da..042cd64e 100644 --- a/src/views/neUser/auth/index.vue +++ b/src/views/neUser/auth/index.vue @@ -6,11 +6,12 @@ import { message, Modal, Form } from 'ant-design-vue/lib'; import { SizeType } from 'ant-design-vue/lib/config-provider'; import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface'; 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 useNeInfoStore from '@/store/modules/neinfo'; import useI18n from '@/hooks/useI18n'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; +import {saveAs} from "file-saver"; const { t } = useI18n(); const route = useRoute(); @@ -23,11 +24,13 @@ let neOtions = ref[]>([]); /**全部获取开关*/ let getAllSwitch = ref(false); - - /**全部获取加载开关*/ let getAllLoading = ref(false); +/**导出开关*/ +let exportSwitch = ref(false); +/**全部获取加载开关*/ +let exportLoading = ref(false); /**查询参数 */ let queryParams = reactive({ @@ -225,11 +228,11 @@ const modalStateBatchFrom = Form.useForm( /** - * 对话框弹出显示为 新增或者修改,批量新增 + * 对话框弹出显示为 新增或者修改 * @param noticeId 网元id, 不传为新增 */ -function fnModalVisibleByEdit(batchFlag?: number, row?: Record) { - if (!row && !batchFlag) { +function fnModalVisibleByEdit(row?: Record) { + if (!row) { modalStateFrom.resetFields(); //重置表单 modalState.title = '添加鉴权信息'; modalState.visibleByEdit = true; @@ -253,7 +256,7 @@ function fnModalVisibleByEdit(batchFlag?: number, row?: Record) { } /** - * 对话框弹出显示为 新增或者修改,批量新增 + * 对话框弹出显示为 批量新增,批量删除 * @param noticeId 网元id, 不传为新增 */ 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(() => { // 获取列表数据 @@ -517,7 +547,7 @@ onMounted(() => { {{ t('views.neUser.auth.getAll') }} - + {{ t('views.neUser.auth.batchAddText') }} + + + {{ t('views.neUser.auth.export') }} + @@ -588,7 +624,7 @@ onMounted(() => { - +