新增批量删除接口

This commit is contained in:
lai
2023-09-23 10:37:37 +08:00
parent c627d9f768
commit 92434e0cd3
4 changed files with 64 additions and 18 deletions

View File

@@ -98,9 +98,9 @@ export function addAuth(data: Record<string, any>) {
* @param data 鉴权对象
* @returns object
*/
export function batchAuth(neID: string, data: Record<string, any>) {
export function batchAuth( data: Record<string, any>) {
return request({
url: `/udmUserManage/v1/auth/${neID}/${data.num}`,
url: `/udmUserManage/v1/auth/${data.neID}/${data.num}`,
method: 'post',
data: data,
});
@@ -117,3 +117,17 @@ export function delAuth(neId: string, data: Record<string, any>) {
method: 'delete',
});
}
/**
* 批量删除鉴权
* @param data 鉴权对象
* @returns object
*/
export function batchDelAuth(neId:string,data: Record<string, any>) {
return request({
url: `/udmUserManage/v1/auth/${neId}/${data.imsi}/${data.num}`,
method: 'delete',
});
}

View File

@@ -128,12 +128,13 @@ export default {
loadData: "LoadData",
num:'Number allocation',
batchAddText: 'Batch Add',
batchDelText: 'Batch Del',
},
sub:{
export: 'Export',
import: 'Import',
loadData: "LoadData"
},
sub:{
export: 'Export',
import: 'Import',
loadData: "LoadData"
},
base5G: {
neTypePlease: 'Query network element type',
neType: 'AMF Type',

View File

@@ -128,12 +128,13 @@ export default {
loadData: "更新数据",
num:'放号数',
batchAddText: '批量新增',
batchDelText: '批量删除',
},
sub:{
export: '导出',
import: '导入',
loadData: "更新数据"
},
sub:{
export: '导出',
import: '导入',
loadData: "更新数据"
},
base5G: {
neTypePlease: '查询网元类型',
neType: 'AMF网元类型',

View File

@@ -22,6 +22,7 @@ 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 { formItemProps } from 'ant-design-vue/lib/form';
const { t } = useI18n();
const route = useRoute();
@@ -161,12 +162,16 @@ type ModalStateType = {
visibleByEdit: boolean;
/**批量新增新增框是否显示 */
visibleByBatch: boolean;
/**批量新增删除框是否显示 */
visibleByBatchDel: boolean;
/**标题 */
title: string;
/**表单数据 */
from: Record<string, any>;
/**表单数据 */
BatchForm: Record<string, any>;
/**表单数据 */
BatchDelForm: Record<string, any>;
/**确定按钮 loading */
confirmLoading: boolean;
/**更新加载数据按钮 loading */
@@ -178,8 +183,10 @@ let modalState: ModalStateType = reactive({
visibleByView: false,
visibleByEdit: false,
visibleByBatch: false,
visibleByBatchDel: false,
title: 'UDM鉴权用户',
from: {
id:'',
imsi: '',
amf: '',
ki: '',
@@ -194,6 +201,10 @@ let modalState: ModalStateType = reactive({
algoIndex: '',
opc: '',
},
BatchDelForm: {
num: '',
imsi: '',
},
confirmLoading: false,
loadDataLoading: false,
});
@@ -210,7 +221,7 @@ const modalStateFrom = Form.useForm(
})
);
/**对话框内表单属性和校验规则 */
/**对话框内批量添加表单属性和校验规则 */
const modalStateBatchFrom = Form.useForm(
modalState.BatchForm,
reactive({
@@ -226,6 +237,18 @@ const modalStateBatchFrom = Form.useForm(
})
);
/**对话框内批量删除表单属性和校验规则 */
const modalStateBatchDelFrom = Form.useForm(
modalState.BatchDelForm,
reactive({
num: [{ required: true, message: '放号数不能为空' },
{ min: 1, max: 100, message: '放号数必须小于等于100' }],
imsi: [{ required: true, message: 'IMSI不能为空' }],
})
);
/**
* 对话框弹出显示为 新增或者修改
* @param noticeId 网元id, 不传为新增
@@ -266,7 +289,7 @@ function fnModalVisibleByBatch(batchFlag?: number) {
} else {
modalStateBatchFrom.resetFields(); //重置表单
modalState.title = '批量删除鉴权信息';
modalState.visibleByBatch = true;
modalState.visibleByBatchDel = true;
}
}
@@ -313,7 +336,7 @@ function fnModalOk() {
}
/**
* 对话框弹出确认执行函数
* 对话框弹出 批量操作确认执行函数
* 进行表达规则校验
*/
function fnBatchModalOk() {
@@ -324,7 +347,8 @@ function fnBatchModalOk() {
const from = toRaw(modalState.BatchForm);
const neID = queryParams.neId || '-';
// const result = from.id ? updateAuth(from) : addAuth(neID, from);
const result = batchAuth(neID, from);
from.neID=neID;
const result = batchAuth(from);
const hide = message.loading({ content: t('common.loading') });
result
.then(res => {
@@ -608,7 +632,12 @@ onMounted(() => {
</template>
{{ t('views.neUser.auth.batchAddText') }}
</a-button>
<a-button type="primary" danger ghost @click.prevent="fnModalVisibleByBatch(0)">
<template #icon>
<DeleteOutlined />
</template>
{{ t('views.neUser.auth.batchDelText') }}
</a-button>
<a-popconfirm
title="确认要重新加载数据吗?"
ok-text="确认"
@@ -753,7 +782,7 @@ onMounted(() => {
:label-col="{ span: 7 }"
>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-col :lg="12" :md="12" :xs="24"> {{ modalState.from }}
<a-form-item
label="IMSI"
name="imsi"
@@ -761,6 +790,7 @@ onMounted(() => {
>
<a-input
v-model:value="modalState.from.imsi"
:disabled="modalState.from.id!=''"
allow-clear
placeholder="请输入IMSI"
>