增加IMSI,ki限制位数以及合并新增批量新增按钮
This commit is contained in:
@@ -194,8 +194,6 @@ type ModalStateType = {
|
||||
/**表单数据 */
|
||||
from: Record<string, any>;
|
||||
/**表单数据 */
|
||||
BatchForm: Record<string, any>;
|
||||
/**表单数据 */
|
||||
BatchDelForm: Record<string, any>;
|
||||
/**确定按钮 loading */
|
||||
confirmLoading: boolean;
|
||||
@@ -210,15 +208,8 @@ let modalState: ModalStateType = reactive({
|
||||
visibleByBatchDel: false,
|
||||
title: 'UDM鉴权用户',
|
||||
from: {
|
||||
id: '',
|
||||
imsi: '',
|
||||
amf: '8000',
|
||||
ki: '',
|
||||
algoIndex: 0,
|
||||
opc: '',
|
||||
},
|
||||
BatchForm: {
|
||||
num: 1,
|
||||
id: '',
|
||||
imsi: '',
|
||||
amf: '8000',
|
||||
ki: '',
|
||||
@@ -236,19 +227,6 @@ let modalState: ModalStateType = reactive({
|
||||
/**对话框内表单属性和校验规则 */
|
||||
const modalStateFrom = Form.useForm(
|
||||
modalState.from,
|
||||
reactive({
|
||||
imsi: [{ required: true, message: 'IMSI' + t('common.unableNull') }],
|
||||
amf: [{ required: true, message: 'AMF' + t('common.unableNull') }],
|
||||
ki: [{ required: true, message: 'KI' + t('common.unableNull') }],
|
||||
algoIndex: [
|
||||
{ required: true, message: 'algoIndex' + t('common.unableNull') },
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
/**对话框内批量添加表单属性和校验规则 */
|
||||
const modalStateBatchFrom = Form.useForm(
|
||||
modalState.BatchForm,
|
||||
reactive({
|
||||
num: [
|
||||
{
|
||||
@@ -256,9 +234,15 @@ const modalStateBatchFrom = Form.useForm(
|
||||
message: t('views.neUser.auth.numAdd') + t('common.unableNull'),
|
||||
},
|
||||
],
|
||||
imsi: [{ required: true, message: 'IMSI' + t('common.unableNull') }],
|
||||
imsi: [
|
||||
{ required: true, message: 'IMSI' + t('common.unableNull') },
|
||||
{ min: 15, max: 15, message: t('views.neUser.auth.imsiConfirm') },
|
||||
],
|
||||
amf: [{ required: true, message: 'AMF' + t('common.unableNull') }],
|
||||
ki: [{ required: true, message: 'KI' + t('common.unableNull') }],
|
||||
ki: [
|
||||
{ required: true, message: 'KI' + t('common.unableNull') },
|
||||
{ min: 32, max: 32, message: t('views.neUser.auth.kiTip') },
|
||||
],
|
||||
algoIndex: [
|
||||
{ required: true, message: 'algoIndex' + t('common.unableNull') },
|
||||
],
|
||||
@@ -312,21 +296,14 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话框弹出显示为 批量新增,批量删除
|
||||
* 对话框弹出显示为 批量删除
|
||||
* @param noticeId 网元id, 不传为新增
|
||||
*/
|
||||
function fnModalVisibleByBatch(batchFlag?: number) {
|
||||
if (batchFlag) {
|
||||
modalStateBatchFrom.resetFields(); //重置表单
|
||||
modalState.title =
|
||||
t('views.neUser.auth.batchAddText') + t('views.neUser.auth.authInfo');
|
||||
modalState.visibleByBatch = true;
|
||||
} else {
|
||||
modalStateBatchFrom.resetFields(); //重置表单
|
||||
modalState.title =
|
||||
t('views.neUser.auth.batchDelText') + t('views.neUser.auth.authInfo');
|
||||
modalState.visibleByBatchDel = true;
|
||||
}
|
||||
function fnModalVisibleByBatch() {
|
||||
modalStateBatchDelFrom.resetFields(); //重置表单
|
||||
modalState.title =
|
||||
t('views.neUser.auth.batchDelText') + t('views.neUser.auth.authInfo');
|
||||
modalState.visibleByBatchDel = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,23 +318,52 @@ function fnModalOk() {
|
||||
const from = toRaw(modalState.from);
|
||||
from.neId = queryParams.neId || '-';
|
||||
from.algoIndex = `${from.algoIndex}`;
|
||||
const result = from.id ? updateUDMAuth(from) : addUDMAuth(from);
|
||||
const result = from.id
|
||||
? updateUDMAuth(from)
|
||||
: from.num === 1
|
||||
? addUDMAuth(from)
|
||||
: batchAddUDMAuth(from, from.num);
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
result
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.msgSuccess', { msg: modalState.title }),
|
||||
duration: 3,
|
||||
});
|
||||
if (from.num === 1) {
|
||||
//新增时
|
||||
message.success({
|
||||
content: t('common.msgSuccess', { msg: modalState.title }),
|
||||
duration: 3,
|
||||
});
|
||||
fnGetList();
|
||||
} else {
|
||||
//批量新增时
|
||||
const timerS = Math.max(
|
||||
Math.ceil(+from.num / 500),
|
||||
`${from.num}`.length
|
||||
);
|
||||
notification.success({
|
||||
message: modalState.title,
|
||||
description: t('common.operateOk'),
|
||||
duration: timerS,
|
||||
});
|
||||
setTimeout(() => {
|
||||
fnGetList(1);
|
||||
}, timerS * 1000);
|
||||
}
|
||||
modalState.visibleByEdit = false;
|
||||
modalStateFrom.resetFields();
|
||||
fnGetList();
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
duration: 3,
|
||||
});
|
||||
if (from.num === 1) {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
duration: 3,
|
||||
});
|
||||
} else {
|
||||
notification.error({
|
||||
message: modalState.title,
|
||||
description: res.msg,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -370,51 +376,6 @@ function fnModalOk() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话框弹出 批量新增操作确认执行函数
|
||||
* 进行表达规则校验
|
||||
*/
|
||||
function fnBatchModalOk() {
|
||||
modalStateBatchFrom
|
||||
.validate()
|
||||
.then(e => {
|
||||
modalState.confirmLoading = true;
|
||||
const from = toRaw(modalState.BatchForm);
|
||||
from.neId = queryParams.neId || '-';
|
||||
from.algoIndex = `${from.algoIndex}`;
|
||||
const result = batchAddUDMAuth(from, from.num);
|
||||
result.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
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(1);
|
||||
}, timerS * 1000);
|
||||
} else {
|
||||
modalState.confirmLoading = false;
|
||||
notification.error({
|
||||
message: modalState.title,
|
||||
description: res.msg,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话框弹出 批量删除确认执行函数
|
||||
* 进行表达规则校验
|
||||
@@ -455,15 +416,6 @@ function fnBatchDelModalOk() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加对话框弹出关闭执行函数
|
||||
* 进行表达规则校验
|
||||
*/
|
||||
function fnBatchModalCancel() {
|
||||
modalState.visibleByBatch = false;
|
||||
modalStateBatchFrom.resetFields();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除对话框弹出关闭执行函数
|
||||
* 进行表达规则校验
|
||||
@@ -831,13 +783,6 @@ onMounted(() => {
|
||||
{{ t('common.addText') }}
|
||||
</a-button>
|
||||
|
||||
<a-button type="primary" @click.prevent="fnModalVisibleByBatch(1)">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
{{ t('views.neUser.auth.batchAddText') }}
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
type="default"
|
||||
danger
|
||||
@@ -853,7 +798,7 @@ onMounted(() => {
|
||||
type="primary"
|
||||
danger
|
||||
ghost
|
||||
@click.prevent="fnModalVisibleByBatch(0)"
|
||||
@click.prevent="fnModalVisibleByBatch()"
|
||||
>
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
@@ -1040,6 +985,24 @@ onMounted(() => {
|
||||
:label-col="{ span: 6 }"
|
||||
:labelWrap="true"
|
||||
>
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-form-item
|
||||
:label="t('views.neUser.auth.numAdd')"
|
||||
name="num"
|
||||
v-bind="modalStateFrom.validateInfos.num"
|
||||
v-show="!modalState.from.id"
|
||||
>
|
||||
<a-input-number
|
||||
v-model:value="modalState.from.num"
|
||||
style="width: 100%"
|
||||
:min="1"
|
||||
:max="10000"
|
||||
placeholder="<=10000"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-form-item
|
||||
@@ -1175,175 +1138,6 @@ onMounted(() => {
|
||||
</a-form>
|
||||
</ProModal>
|
||||
|
||||
<!-- 批量新增框 -->
|
||||
<ProModal
|
||||
:drag="true"
|
||||
:width="800"
|
||||
:destroyOnClose="true"
|
||||
:keyboard="false"
|
||||
:mask-closable="false"
|
||||
:visible="modalState.visibleByBatch"
|
||||
:title="modalState.title"
|
||||
:confirm-loading="modalState.confirmLoading"
|
||||
@ok="fnBatchModalOk"
|
||||
@cancel="fnBatchModalCancel"
|
||||
>
|
||||
<a-form
|
||||
name="modalStateBatchFrom"
|
||||
layout="horizontal"
|
||||
:label-col="{ span: 6 }"
|
||||
:labelWrap="true"
|
||||
>
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-form-item
|
||||
:label="t('views.neUser.auth.numAdd')"
|
||||
name="num"
|
||||
v-bind="modalStateBatchFrom.validateInfos.num"
|
||||
>
|
||||
<a-input-number
|
||||
v-model:value="modalState.BatchForm.num"
|
||||
style="width: 100%"
|
||||
:min="1"
|
||||
:max="10000"
|
||||
placeholder="<=10000"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-form-item
|
||||
label="IMSI"
|
||||
name="imsi"
|
||||
v-bind="modalStateBatchFrom.validateInfos.imsi"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="modalState.BatchForm.imsi"
|
||||
allow-clear
|
||||
:maxlength="15"
|
||||
>
|
||||
<template #prefix>
|
||||
<a-tooltip placement="topLeft">
|
||||
<template #title>
|
||||
{{ t('views.neUser.auth.imsiTip') }}<br />
|
||||
{{ t('views.neUser.auth.imsiTip1') }}<br />
|
||||
{{ t('views.neUser.auth.imsiTip2') }}<br />
|
||||
{{ t('views.neUser.auth.imsiTip3') }}
|
||||
</template>
|
||||
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-form-item label="Status" name="status">
|
||||
<a-select value="1">
|
||||
<a-select-option value="1">Active</a-select-option>
|
||||
<a-select-option value="0">Inactive</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="16">
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-form-item
|
||||
label="AMF"
|
||||
name="amf"
|
||||
v-bind="modalStateBatchFrom.validateInfos.amf"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="modalState.BatchForm.amf"
|
||||
allow-clear
|
||||
:maxlength="4"
|
||||
>
|
||||
<template #prefix>
|
||||
<a-tooltip placement="topLeft">
|
||||
<template #title>
|
||||
{{ t('views.neUser.auth.amfTip') }}
|
||||
</template>
|
||||
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="12" :md="12" :xs="24">
|
||||
<a-form-item
|
||||
label="Algo Index"
|
||||
name="algo"
|
||||
v-bind="modalStateBatchFrom.validateInfos.algoIndex"
|
||||
>
|
||||
<a-input-number
|
||||
v-model:value="modalState.BatchForm.algoIndex"
|
||||
style="width: 100%"
|
||||
:min="0"
|
||||
:max="15"
|
||||
placeholder="0 ~ 15"
|
||||
>
|
||||
<template #prefix>
|
||||
<a-tooltip placement="topLeft">
|
||||
<template #title>
|
||||
{{ t('views.neUser.auth.algoIndexTip') }}
|
||||
</template>
|
||||
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-form-item
|
||||
label="KI"
|
||||
name="ki"
|
||||
v-bind="modalStateBatchFrom.validateInfos.ki"
|
||||
:label-col="{ span: 3 }"
|
||||
:labelWrap="true"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="modalState.BatchForm.ki"
|
||||
allow-clear
|
||||
:maxlength="32"
|
||||
>
|
||||
<template #prefix>
|
||||
<a-tooltip placement="topLeft">
|
||||
<template #title>
|
||||
{{ t('views.neUser.auth.kiTip') }}
|
||||
</template>
|
||||
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="OPC"
|
||||
name="opc"
|
||||
v-bind="modalStateBatchFrom.validateInfos.opc"
|
||||
:label-col="{ span: 3 }"
|
||||
:labelWrap="true"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="modalState.BatchForm.opc"
|
||||
allow-clear
|
||||
:maxlength="32"
|
||||
>
|
||||
<template #prefix>
|
||||
<a-tooltip placement="topLeft">
|
||||
<template #title>
|
||||
{{ t('views.neUser.auth.opcTip') }}
|
||||
</template>
|
||||
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ProModal>
|
||||
|
||||
<!-- 批量删除框 -->
|
||||
<ProModal
|
||||
:drag="true"
|
||||
|
||||
Reference in New Issue
Block a user