From 4e4d7ad61ac1a7e5fec69018a3b42009ab82d3a9 Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Thu, 21 Sep 2023 19:48:04 +0800 Subject: [PATCH] =?UTF-8?q?--=E6=96=B0=E5=A2=9E=E5=88=A0=E9=99=A4=E9=89=B4?= =?UTF-8?q?=E6=9D=83=E7=94=A8=E6=88=B7,=E6=9B=B4=E6=96=B0=E4=B8=AD?= =?UTF-8?q?=E8=8B=B1=E6=96=87=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 4 +- src/api/neUser/auth.ts | 29 ++- src/i18n/locales/en-US.ts | 8 +- src/i18n/locales/zh-CN.ts | 9 +- src/views/configManage/neManage/index.vue | 2 +- src/views/index.vue | 10 +- src/views/neUser/auth/index.vue | 220 ++++++++-------------- vite.config.ts | 4 +- 8 files changed, 129 insertions(+), 157 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index dc19f43a..482784c5 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -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: '异常', }; } diff --git a/src/api/neUser/auth.ts b/src/api/neUser/auth.ts index ee081c08..fb42be81 100644 --- a/src/api/neUser/auth.ts +++ b/src/api/neUser/auth.ts @@ -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) { data: data, }); } + + +/** + * 新增鉴权 + * @param data 鉴权对象 + * @returns object + */ +export function addAuth(neID:string,data: Record) { + return request({ + url: `/udmUserManage/v1/auth/${neID}`, + method: 'post', + data: data, + }); +} + + +/** + * 删除鉴权 + * @param data 鉴权对象 + * @returns object + */ +export function delAuth(neId:string,data: Record) { + return request({ + url: `/udmUserManage/v1/auth/${neId}/${data.imsi}`, + method: 'delete', + }); +} \ No newline at end of file diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 3332acce..8c5f8c17 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -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', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 690aa774..742d4e0e 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -3,7 +3,7 @@ export default { i18n: '中文', hello: '你好', - // 通用 + // 网管通用 common: { title: '核心网管理系统', desc: '', @@ -40,6 +40,13 @@ export default { operate: '操作', }, + // 网元通用 + nfCommon:{ + getAll:'全部获取' + + }, + + // 全局页脚 globalFooter: { help: '', diff --git a/src/views/configManage/neManage/index.vue b/src/views/configManage/neManage/index.vue index 94c55211..e6bda9a6 100644 --- a/src/views/configManage/neManage/index.vue +++ b/src/views/configManage/neManage/index.vue @@ -310,7 +310,7 @@ function fnRecordDelete(row: Record) { 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, diff --git a/src/views/index.vue b/src/views/index.vue index 0395c434..7ff4958f 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -1,10 +1,10 @@ diff --git a/src/views/neUser/auth/index.vue b/src/views/neUser/auth/index.vue index 903f7318..752c258a 100644 --- a/src/views/neUser/auth/index.vue +++ b/src/views/neUser/auth/index.vue @@ -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) { } } + + + /** * 对话框弹出确认执行函数 * 进行表达规则校验 @@ -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) { 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 }" > - + @@ -413,6 +429,10 @@ onMounted(() => { {{ t('common.addText') }} + @@ -507,38 +527,38 @@ onMounted(() => { @ok="fnModalOk" @cancel="fnModalCancel" > - + -