---完善UDM鉴权
This commit is contained in:
@@ -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<Record<string, any>[]>([]);
|
||||
|
||||
/**全部获取开关*/
|
||||
let getAllSwitch = ref<boolean>(false);
|
||||
|
||||
|
||||
/**全部获取加载开关*/
|
||||
let getAllLoading = ref<boolean>(false);
|
||||
|
||||
/**导出开关*/
|
||||
let exportSwitch = ref<boolean>(false);
|
||||
/**全部获取加载开关*/
|
||||
let exportLoading = ref<boolean>(false);
|
||||
|
||||
/**查询参数 */
|
||||
let queryParams = reactive({
|
||||
@@ -225,11 +228,11 @@ const modalStateBatchFrom = Form.useForm(
|
||||
|
||||
|
||||
/**
|
||||
* 对话框弹出显示为 新增或者修改,批量新增
|
||||
* 对话框弹出显示为 新增或者修改
|
||||
* @param noticeId 网元id, 不传为新增
|
||||
*/
|
||||
function fnModalVisibleByEdit(batchFlag?: number, row?: Record<string, any>) {
|
||||
if (!row && !batchFlag) {
|
||||
function fnModalVisibleByEdit(row?: Record<string, any>) {
|
||||
if (!row) {
|
||||
modalStateFrom.resetFields(); //重置表单
|
||||
modalState.title = '添加鉴权信息';
|
||||
modalState.visibleByEdit = true;
|
||||
@@ -253,7 +256,7 @@ function fnModalVisibleByEdit(batchFlag?: number, row?: Record<string, any>) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话框弹出显示为 新增或者修改,批量新增
|
||||
* 对话框弹出显示为 批量新增,批量删除
|
||||
* @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(() => {
|
||||
<!-- 插槽-卡片左侧侧 -->
|
||||
<template #title>
|
||||
<a-space :size="8" align="center">
|
||||
<a-button type="primary" @click.prevent="fnModalVisibleByEdit(0)">
|
||||
<a-button type="primary" @click.prevent="fnModalVisibleByEdit()">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
@@ -529,12 +559,18 @@ onMounted(() => {
|
||||
</template>
|
||||
{{ t('views.neUser.auth.getAll') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click.prevent="fnModalVisibleByEdit(1)">
|
||||
<a-button type="primary" @click.prevent="fnModalVisibleByBatch(1)">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
{{ t('views.neUser.auth.batchAddText') }}
|
||||
</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>
|
||||
</template>
|
||||
|
||||
@@ -588,7 +624,7 @@ onMounted(() => {
|
||||
<a-space :size="8" align="center">
|
||||
<a-tooltip>
|
||||
<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>
|
||||
<FormOutlined />
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user