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

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

View File

@@ -1,7 +1,7 @@
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { request } from '@/plugins/http-fetch'; import { request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils'; import { parseObjLineToHump } from '@/utils/parse-utils';
import { toRaw } from 'vue';
/** /**
* 查询鉴权列表 * 查询鉴权列表
* @param query 查询参数 * @param query 查询参数
@@ -39,3 +39,30 @@ export function updateAuth(data: Record<string, any>) {
data: data, 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', i18n: 'English',
hello: 'Hello', hello: 'Hello',
// 通用 // 网管通用
common: { common: {
title: 'Core network management system', title: 'Core network management system',
desc: '', desc: '',
@@ -40,6 +40,12 @@ export default {
operate: "Operate", operate: "Operate",
}, },
// 网元通用
nfCommon:{
getAll:'Get ALL'
},
// 全局页脚 // 全局页脚
globalFooter: { globalFooter: {
help: 'Help', help: 'Help',

View File

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

View File

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

View File

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

View File

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

View File

@@ -20,7 +20,9 @@ export default defineConfig(({ mode }) => {
proxy: { proxy: {
// https://cn.vitejs.dev/config/#server-proxy // https://cn.vitejs.dev/config/#server-proxy
[env.VITE_API_BASE_URL]: { [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, changeOrigin: true,
rewrite: p => p.replace(/^\/dev-api/, ''), rewrite: p => p.replace(/^\/dev-api/, ''),
}, },