--新增删除鉴权用户,更新中英文库

This commit is contained in:
lai
2023-09-21 19:48:04 +08:00
parent 5cb99ff153
commit 4e4d7ad61a
8 changed files with 129 additions and 157 deletions

View File

@@ -26,7 +26,7 @@ export async function listMain() {
...systemState,
refresh: parseDateToStr(time),
ipAddress: ipAddress,
name: key,
name: key.split("/").join("_"),
status: '正常',
};
} else {
@@ -34,7 +34,7 @@ export async function listMain() {
version: '-',
refresh: parseDateToStr(time),
ipAddress: ipAddress,
name: key,
name: key.split("/").join("_"),
status: '异常',
};
}

View File

@@ -1,7 +1,7 @@
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils';
import { toRaw } from 'vue';
/**
* 查询鉴权列表
* @param query 查询参数
@@ -39,3 +39,30 @@ export function updateAuth(data: Record<string, any>) {
data: data,
});
}
/**
* 新增鉴权
* @param data 鉴权对象
* @returns object
*/
export function addAuth(neID:string,data: Record<string, any>) {
return request({
url: `/udmUserManage/v1/auth/${neID}`,
method: 'post',
data: data,
});
}
/**
* 删除鉴权
* @param data 鉴权对象
* @returns object
*/
export function delAuth(neId:string,data: Record<string, any>) {
return request({
url: `/udmUserManage/v1/auth/${neId}/${data.imsi}`,
method: 'delete',
});
}

View File

@@ -3,7 +3,7 @@ export default {
i18n: 'English',
hello: 'Hello',
// 通用
// 网管通用
common: {
title: 'Core network management system',
desc: '',
@@ -40,6 +40,12 @@ export default {
operate: "Operate",
},
// 网元通用
nfCommon:{
getAll:'Get ALL'
},
// 全局页脚
globalFooter: {
help: 'Help',

View File

@@ -3,7 +3,7 @@ export default {
i18n: '中文',
hello: '你好',
// 通用
// 网管通用
common: {
title: '核心网管理系统',
desc: '',
@@ -40,6 +40,13 @@ export default {
operate: '操作',
},
// 网元通用
nfCommon:{
getAll:'全部获取'
},
// 全局页脚
globalFooter: {
help: '',

View File

@@ -310,7 +310,7 @@ function fnRecordDelete(row: Record<string, any>) {
const key = 'delNotice';
message.loading({ content: '请稍等...', key });
delNeInfo(row).then(res => {
if (res.code === 200) {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
key,

View File

@@ -1,10 +1,10 @@
<script setup lang="ts">
import { PageContainer } from '@ant-design-vue/pro-layout';
import { ColumnsType } from 'ant-design-vue/lib/table';
import { reactive, toRaw, ref, onMounted } from 'vue';
import { message } from 'ant-design-vue/lib';
import { reactive, toRaw,ref,onMounted} from 'vue';
import { listMain } from '@/api/index';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
import { TooltipComponent } from 'echarts/components';
import { GaugeChart } from 'echarts/charts';
import { CanvasRenderer } from 'echarts/renderers';
@@ -12,8 +12,7 @@ import * as echarts from 'echarts/core';
import { TitleComponent, LegendComponent } from 'echarts/components';
import { PieChart } from 'echarts/charts';
import { LabelLayout } from 'echarts/features';
import message from 'ant-design-vue/lib/message';
const { t } = useI18n();
echarts.use([
TooltipComponent,
GaugeChart,
@@ -326,7 +325,7 @@ const closeDrawer = () => {
/**监听表格行事件*/
function rowClick(record:any, index:any) {
return {
onClick: () => {
onClick: (event:any) => {
console.log(toRaw(record), "666");
/* console.log( index, "666");
console.log( event, "666");*/
@@ -358,6 +357,7 @@ function rowClick(record:any, index:any) {
onMounted(() => {
fnGetList();
});
</script>

View File

@@ -14,7 +14,7 @@ import {
delNeInfo,
} from '@/api/configManage/neManage';
import { listAuth, getAuth, updateAuth } from '@/api/neUser/auth';
import { listAuth, getAuth, updateAuth,addAuth,delAuth} from '@/api/neUser/auth';
import { parseDateToStr } from '@/utils/date-utils';
import useNeInfoStore from '@/store/modules/neinfo';
import useI18n from '@/hooks/useI18n';
@@ -172,19 +172,13 @@ type ModalStateType = {
let modalState: ModalStateType = reactive({
visibleByView: false,
visibleByEdit: false,
title: '网元',
title: 'UDM鉴权用户',
from: {
dn: '网络标识',
ip: '192.168.4.132',
neAddress: '192.160.0.107',
neId: '网元内部标识',
neName: '网元名称',
neType: 'AMF',
port: '3030',
province: '网元所在省份',
pvFlag: '',
rmUid: '资源唯一标识',
vendorName: '厂商名称',
imsi: '',
amf: '',
ki: '',
algoIndex: '',
opc: '',
},
confirmLoading: false,
});
@@ -193,13 +187,11 @@ let modalState: ModalStateType = reactive({
const modalStateFrom = Form.useForm(
modalState.from,
reactive({
neType: [{ required: true, message: '网元类型不能为空' }],
neId: [{ required: true, message: '网元内部标识不能为空' }],
rmUid: [{ required: true, message: '资源唯一标识不能为空' }],
ip: [{ required: true, message: 'IP地址不能为空' }],
port: [{ required: true, message: '端口不能为空' }],
pvFlag: [{ required: true, message: '请选择网元虚拟化标识' }],
neName: [{ required: true, message: '网元名称不能为空' }],
imsi: [{ required: true, message: 'IMSI不能为空' }],
amf: [{ required: true, message: 'AMF不能为空' }],
ki: [{ required: true, message: 'KI不能为空' }],
algo: [{ required: true, message: 'algoIndex不能为空' }],
opc: [{ required: true, message: 'OPC能为空' }],
})
);
@@ -231,6 +223,9 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
}
}
/**
* 对话框弹出确认执行函数
* 进行表达规则校验
@@ -241,7 +236,8 @@ function fnModalOk() {
.then(e => {
modalState.confirmLoading = true;
const from = toRaw(modalState.from);
const result = from.id ? updateAuth(from) : addNeInfo(from);
const neID = queryParams.neId || '-';
const result = from.id ? updateAuth(from) : addAuth(neID,from);
const hide = message.loading({ content: t('common.loading') });
result
.then(res => {
@@ -281,18 +277,20 @@ function fnModalCancel() {
}
/**
* 网元删除
* UDM鉴权用户删除
* @param row 网元编号ID
*/
function fnRecordDelete(row: Record<string, any>) {
Modal.confirm({
title: '提示',
content: `确认删除网元编号为 ${row.id}数据项?`,
content: `确认删除IMSI编号为: ${row.imsi}用户嘛?`,
onOk() {
const key = 'delNotice';
message.loading({ content: '请稍等...', key });
delNeInfo(row).then(res => {
if (res.code === 200) {
const neID = queryParams.neId || '-';
delAuth(neID,row).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
key,
@@ -328,6 +326,24 @@ function fnGetList() {
});
}
/**全部获取 */
function fnGetAll() {
if (tableState.loading) return;
tableState.loading = true;
listAuth(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选
if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = [];
}
tablePagination.total = res.total;
tableState.data = res.rows;
}
tableState.loading = false;
});
}
onMounted(() => {
// 获取列表数据
fnGetList();
@@ -366,7 +382,7 @@ onMounted(() => {
:body-style="{ marginBottom: '24px', paddingBottom: 0 }"
>
<!-- 表格搜索栏 -->
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="UDM网元类型" name="neId ">
@@ -413,6 +429,10 @@ onMounted(() => {
<template #icon><PlusOutlined /></template>
{{ t('common.addText') }}
</a-button>
<!-- <a-button type="primary" @click.prevent="fnGetAll">
<template #icon><PlusOutlined /></template>
{{ t('nfCommon.getAll') }}
</a-button> -->
</a-space>
</template>
@@ -507,38 +527,38 @@ onMounted(() => {
@ok="fnModalOk"
@cancel="fnModalCancel"
>
<a-form name="modalStateFrom" layout="horizontal">
<a-form name="modalStateFrom" layout="horizontal" :label-col= "{ span: 7 }">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="网元类型"
name="neType"
v-bind="modalStateFrom.validateInfos.neType"
label="IMSI"
name="imsi"
v-bind="modalStateFrom.validateInfos.imsi"
>
<a-input
v-model:value="modalState.from.neType"
v-model:value="modalState.from.imsi"
allow-clear
placeholder="请输入网元类型"
placeholder="请输入IMSI"
>
<template #prefix>
<!-- <template #prefix>
<a-tooltip placement="topLeft">
<template #title> 填写创建的网元类型,:SMF </template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</template> -->
</a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="网元内部标识"
name="neId"
v-bind="modalStateFrom.validateInfos.neId"
label="AMF"
name="amf"
v-bind="modalStateFrom.validateInfos.amf"
>
<a-input
v-model:value="modalState.from.neId"
v-model:value="modalState.from.amf"
allow-clear
placeholder="请输入网元内部标识"
placeholder="请输入AMF"
></a-input>
</a-form-item>
</a-col>
@@ -547,71 +567,29 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="资源唯一标识"
name="rmUid"
v-bind="modalStateFrom.validateInfos.rmUid"
label="KI"
name="ki"
v-bind="modalStateFrom.validateInfos.ki"
>
<a-input
v-model:value="modalState.from.rmUid"
v-model:value="modalState.from.ki"
allow-clear
placeholder="请输入资源唯一标识"
placeholder="请输入KI"
>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="网元虚拟化标识"
name="pvFlag"
v-bind="modalStateFrom.validateInfos.pvFlag"
label="Algo Index"
name="algo"
v-bind="modalStateFrom.validateInfos.algo"
>
<a-select
v-model:value="modalState.from.pvFlag"
default-value="PNF"
placeholder="请选择网元虚拟化标识"
>
<a-select-opt-group label="物理网元">
<a-select-option value="PNF">PNF</a-select-option>
</a-select-opt-group>
<a-select-opt-group label="虚拟网元">
<a-select-option value="VNF">VNF</a-select-option>
</a-select-opt-group>
</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="IP地址"
name="ip"
v-bind="modalStateFrom.validateInfos.ip"
>
<a-input
v-model:value="modalState.from.ip"
<a-input
v-model:value="modalState.from.algoIndex"
allow-clear
placeholder="请输入IP地址"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="端口号"
name="port"
v-bind="modalStateFrom.validateInfos.port"
>
<a-input
v-model:value="modalState.from.port"
allow-clear
placeholder="请输入端口"
placeholder="请输入Algo Index"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title> <div>最大范围0~65535</div> </template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
</a-form-item>
</a-col>
@@ -620,62 +598,14 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="网元名称"
name="neName"
v-bind="modalStateFrom.validateInfos.neName"
label="OPC"
name="opc"
v-bind="modalStateFrom.validateInfos.opc"
>
<a-input
v-model:value="modalState.from.neName"
v-model:value="modalState.from.opc"
allow-clear
placeholder="请输入网元名称"
>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="网元地址" name="neAddress">
<a-input
v-model:value="modalState.from.neAddress"
allow-clear
placeholder="请输入网元地址"
><template #prefix>
<a-tooltip placement="topLeft">
<template #title>
<div>能够定位网元的物理地址MAC</div>
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip> </template
></a-input>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="网元所在省份" name="province">
<a-input
v-model:value="modalState.from.province"
allow-clear
placeholder="请输入网元所在省份"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="厂商名称" name="vendorName">
<a-input
v-model:value="modalState.from.vendorName"
allow-clear
placeholder="请输入厂商名称"
>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="网络标识" name="dn">
<a-input
v-model:value="modalState.from.dn"
allow-clear
placeholder="请输入网络标识"
placeholder="请输入OPC"
></a-input>
</a-form-item>
</a-col>

View File

@@ -20,7 +20,9 @@ export default defineConfig(({ mode }) => {
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
[env.VITE_API_BASE_URL]: {
target: 'http://192.168.2.119:3030/api/rest',
//target: 'http://192.168.2.119:3030/api/rest',
target: 'http://192.168.2.114:3040/api/rest',
changeOrigin: true,
rewrite: p => p.replace(/^\/dev-api/, ''),
},