feat: UDM用户数据代码完善

This commit is contained in:
TsMask
2023-11-23 21:49:57 +08:00
parent 5101b1bae3
commit 10a48af368
4 changed files with 700 additions and 357 deletions

View File

@@ -112,7 +112,7 @@ let tableColumns: ColumnsType = [
// width: 10,
// },
{
title: 'ALGO Index',
title: 'Algo Index',
dataIndex: 'algoIndex',
align: 'center',
width: 4,
@@ -122,7 +122,7 @@ let tableColumns: ColumnsType = [
key: 'imsi',
align: 'center',
fixed: 'right',
width: 5,
width: 2,
},
];
@@ -173,8 +173,6 @@ function fnTableChange(pagination: any, filters: any, sorter: any, extra: any) {
/**对话框对象信息状态类型 */
type ModalStateType = {
/**详情框是否显示 */
visibleByView: boolean;
/**新增框或修改框是否显示 */
visibleByEdit: boolean;
/**批量新增新增框是否显示 */
@@ -197,7 +195,6 @@ type ModalStateType = {
/**对话框对象信息状态 */
let modalState: ModalStateType = reactive({
visibleByView: false,
visibleByEdit: false,
visibleByBatch: false,
visibleByBatchDel: false,
@@ -207,19 +204,19 @@ let modalState: ModalStateType = reactive({
imsi: '',
amf: '8000',
ki: '',
algoIndex: '0',
algoIndex: 0,
opc: '',
},
BatchForm: {
num: '',
num: 1,
imsi: '',
amf: '',
amf: '8000',
ki: '',
algoIndex: '',
algoIndex: 0,
opc: '',
},
BatchDelForm: {
num: '',
num: 1,
imsi: '',
},
confirmLoading: false,
@@ -246,7 +243,7 @@ const modalStateBatchFrom = Form.useForm(
num: [
{
required: true,
message: t('views.neUser.auth.num') + t('common.unableNull'),
message: t('views.neUser.auth.numAdd') + t('common.unableNull'),
},
],
imsi: [{ required: true, message: 'IMSI' + t('common.unableNull') }],
@@ -265,39 +262,13 @@ const modalStateBatchDelFrom = Form.useForm(
num: [
{
required: true,
message: t('views.neUser.auth.delNum') + t('common.unableNull'),
message: t('views.neUser.auth.numDel') + t('common.unableNull'),
},
],
imsi: [{ required: true, message: 'IMSI' + t('common.unableNull') }],
})
);
/**
* 对话框弹出显示为 详情框
* @param imsi 网元id, 不传为新增
*/
function fnModalVisibleByVive(imsi: string) {
if (modalState.confirmLoading) return;
const hide = message.loading('Waiting...', 0);
modalState.confirmLoading = true;
const neID = queryParams.neId || '-';
getAuth(neID, imsi)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title =
t('common.viewText') + t('views.neUser.auth.authInfo');
modalState.visibleByView = true;
} else {
message.error(t('common.getInfoFail'), 2);
}
})
.finally(() => {
hide();
modalState.confirmLoading = false;
});
}
/**
* 对话框弹出显示为 新增或者修改
* @param noticeId 网元id, 不传为新增
@@ -312,7 +283,7 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
const hide = message.loading(t('common.loading'), 0);
modalState.confirmLoading = true;
const neID = queryParams.neId || '-';
getAuth(neID, row?.imsi)
getAuth(neID, row.imsi)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
modalState.from = Object.assign(modalState.from, res.data);
@@ -353,14 +324,13 @@ function fnModalVisibleByBatch(batchFlag?: number) {
* 进行表达规则校验
*/
function fnModalOk() {
const neID = queryParams.neId;
if (!neID) return;
modalStateFrom
.validate()
.then(e => {
modalState.confirmLoading = true;
const from = toRaw(modalState.from);
from.neId = neID;
from.neId = queryParams.neId || '-';
from.algoIndex = `${from.algoIndex}`;
const result = from.id ? updateAuth(from) : addAuth(from);
const hide = message.loading({ content: t('common.loading') });
result
@@ -400,9 +370,8 @@ function fnBatchModalOk() {
.then(e => {
modalState.confirmLoading = true;
const from = toRaw(modalState.BatchForm);
const neID = queryParams.neId || '-';
// const result = from.id ? updateAuth(from) : addAuth(neID, from);
from.neID = neID;
from.neID = queryParams.neId || '-';
from.algoIndex = `${from.algoIndex}`;
const result = batchAuth(from);
const hide = message.loading({ content: t('common.loading') });
result
@@ -481,7 +450,6 @@ function fnBatchDelModalOk() {
*/
function fnBatchModalCancel() {
modalState.visibleByBatch = false;
modalState.visibleByView = false;
modalStateBatchFrom.resetFields();
}
@@ -491,7 +459,6 @@ function fnBatchModalCancel() {
*/
function fnBatchDelModalCancel() {
modalState.visibleByBatchDel = false;
modalState.visibleByView = false;
modalStateBatchDelFrom.resetFields();
}
@@ -501,7 +468,6 @@ function fnBatchDelModalCancel() {
*/
function fnModalCancel() {
modalState.visibleByEdit = false;
modalState.visibleByView = false;
modalStateFrom.resetFields();
}
@@ -579,12 +545,12 @@ function fnLoadData() {
description: t('views.neUser.auth.loadDataTip', { num: res.data }),
duration: 10,
});
// 延迟3s后关闭loading刷新列表
// 延迟5s后关闭loading刷新列表
setTimeout(() => {
modalState.loadDataLoading = false;
tableState.loading = false; // 表格loading
fnQueryReset();
}, 3000);
}, 5000);
} else {
message.error({
content: t('common.getInfoFail'),
@@ -687,7 +653,7 @@ onMounted(() => {
}
} else {
message.warning({
content: t('views.neUser.auth.noListData'),
content: t('common.noData'),
duration: 2,
});
}
@@ -877,17 +843,6 @@ onMounted(() => {
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'imsi'">
<a-space :size="8" align="center">
<a-tooltip>
<template #title>{{ t('common.viewText') }}</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByVive(record.imsi)"
>
<template #icon>
<ProfileOutlined />
</template>
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>{{ t('common.editText') }}</template>
<a-button
@@ -913,53 +868,6 @@ onMounted(() => {
</a-table>
</a-card>
<!-- 详情框 -->
<a-modal
width="800px"
:visible="modalState.visibleByView"
:title="modalState.title"
@cancel="fnModalCancel"
>
<a-form layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="IMSI" name="imsi">
{{ modalState.from.imsi }}
</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">
{{ modalState.from.amf }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="ALGO Index" name="algo">
{{ modalState.from.algoIndex }}
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="KI" name="ki">
{{ modalState.from.ki }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="OPC" name="opc">
{{ modalState.from.opc }}
</a-form-item>
</a-col>
</a-row>
</a-form>
<template #footer>
<a-button key="cancel" @click="fnModalCancel">{{
t('common.close')
}}</a-button>
</template>
</a-modal>
<!-- 新增框或修改框 -->
<a-modal
width="800px"
@@ -971,7 +879,12 @@ onMounted(() => {
@ok="fnModalOk"
@cancel="fnModalCancel"
>
<a-form name="modalStateFrom" layout="horizontal">
<a-form
name="modalStateFrom"
layout="horizontal"
:label-col="{ span: 6 }"
:labelWrap="true"
>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
@@ -979,11 +892,18 @@ onMounted(() => {
name="imsi"
v-bind="modalStateFrom.validateInfos.imsi"
>
<a-input
v-model:value="modalState.from.imsi"
:disabled="modalState.from.id != ''"
allow-clear
>
<a-input v-model:value="modalState.from.imsi" allow-clear>
<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>
@@ -996,6 +916,7 @@ onMounted(() => {
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
@@ -1006,18 +927,41 @@ onMounted(() => {
<a-input
v-model:value="modalState.from.amf"
allow-clear
></a-input>
: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"
label="Algo Index"
name="algo"
v-bind="modalStateFrom.validateInfos.algoIndex"
>
<a-input v-model:value="modalState.from.algoIndex" allow-clear>
</a-input>
<a-input-number
v-model:value="modalState.from.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>
@@ -1032,8 +976,16 @@ onMounted(() => {
<a-input
v-model:value="modalState.from.ki"
allow-clear
:disabled="modalState.from.id !== ''"
: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-col>
@@ -1046,8 +998,17 @@ onMounted(() => {
<a-input
v-model:value="modalState.from.opc"
allow-clear
:disabled="modalState.from.id !== ''"
></a-input>
: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-col>
</a-row>
@@ -1065,17 +1026,25 @@ onMounted(() => {
@ok="fnBatchModalOk"
@cancel="fnBatchModalCancel"
>
<a-form name="modalStateBatchFrom" layout="horizontal">
<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.num')"
: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="100"
placeholder="<=100"
></a-input-number>
</a-form-item>
</a-col>
@@ -1089,6 +1058,17 @@ onMounted(() => {
v-bind="modalStateBatchFrom.validateInfos.imsi"
>
<a-input v-model:value="modalState.BatchForm.imsi" allow-clear>
<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>
@@ -1112,20 +1092,41 @@ onMounted(() => {
<a-input
v-model:value="modalState.BatchForm.amf"
allow-clear
></a-input>
: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"
label="Algo Index"
name="algo"
v-bind="modalStateBatchFrom.validateInfos.algoIndex"
>
<a-input
<a-input-number
v-model:value="modalState.BatchForm.algoIndex"
allow-clear
style="width: 100%"
:min="0"
:max="15"
placeholder="0 ~ 15"
>
</a-input>
<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>
@@ -1137,7 +1138,19 @@ onMounted(() => {
name="ki"
v-bind="modalStateBatchFrom.validateInfos.ki"
>
<a-input v-model:value="modalState.BatchForm.ki" allow-clear>
<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-col>
@@ -1150,7 +1163,17 @@ onMounted(() => {
<a-input
v-model:value="modalState.BatchForm.opc"
allow-clear
></a-input>
: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-col>
</a-row>
@@ -1168,16 +1191,11 @@ onMounted(() => {
@ok="fnBatchDelModalOk"
@cancel="fnBatchDelModalCancel"
>
<a-form
name="modalStateBatchDelFrom"
layout="horizontal"
:label-col="{ span: 7.5 }"
:labelWrap="true"
>
<a-form name="modalStateBatchDelFrom" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
:label="t('views.neUser.sub.startIMSI')"
:label="t('views.neUser.auth.startIMSI')"
name="imsi"
v-bind="modalStateBatchDelFrom.validateInfos.imsi"
>
@@ -1185,7 +1203,10 @@ onMounted(() => {
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.auth.imsiTip') }}
{{ 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>
@@ -1195,13 +1216,16 @@ onMounted(() => {
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
:label="t('views.neUser.sub.num')"
:label="t('views.neUser.auth.numDel')"
name="num"
v-bind="modalStateBatchDelFrom.validateInfos.num"
>
<a-input-number
v-model:value="modalState.BatchDelForm.num"
style="width: 100%"
:min="1"
:max="100"
placeholder="<=100"
></a-input-number>
</a-form-item>
</a-col>