From b1763092c6d933f9d5c62efb3d0d92f85ddb6724 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 7 Sep 2023 15:30:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BD=91=E5=85=83=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/configuration/net-ele.ts | 2 + src/views/configuration/net-ele/index.vue | 371 ++++++++++++---------- 2 files changed, 203 insertions(+), 170 deletions(-) diff --git a/src/api/configuration/net-ele.ts b/src/api/configuration/net-ele.ts index 43d4fdb5..773fdc54 100644 --- a/src/api/configuration/net-ele.ts +++ b/src/api/configuration/net-ele.ts @@ -80,6 +80,7 @@ export async function getNeInfo(id: string | number) { * @returns object */ export function addNeInfo(data: Record) { + data.port = `${data.port}` return request({ url: `/systemManagement/v1/elementType/${data.ne_type}/objectType/neInfo`, method: 'post', @@ -93,6 +94,7 @@ export function addNeInfo(data: Record) { * @returns object */ export function updateNeInfo(data: Record) { + data.port = `${data.port}` return request({ url: `/systemManagement/v1/elementType/${data.ne_type}/objectType/neInfo`, method: 'put', diff --git a/src/views/configuration/net-ele/index.vue b/src/views/configuration/net-ele/index.vue index dd1fbd13..38047e9e 100644 --- a/src/views/configuration/net-ele/index.vue +++ b/src/views/configuration/net-ele/index.vue @@ -6,13 +6,6 @@ import { message, Modal, Form } from 'ant-design-vue/lib'; import { SizeType } from 'ant-design-vue/lib/config-provider'; import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface'; import { ColumnsType } from 'ant-design-vue/lib/table'; -import { - listNotice, - getNotice, - delNotice, - addNotice, - updateNotice, -} from '@/api/system/notice'; import { listNeInfo, getNeInfo, @@ -69,8 +62,6 @@ type TabeStateType = { loading: boolean; /**紧凑型 */ size: SizeType; - /**斑马纹 */ - striped: boolean; /**搜索栏 */ seached: boolean; /**记录数据 */ @@ -83,7 +74,6 @@ type TabeStateType = { let tableState: TabeStateType = reactive({ loading: false, size: 'middle', - striped: false, seached: true, data: [], selectedRowKeys: [], @@ -195,16 +185,6 @@ function fnTableSize({ key }: MenuInfo) { tableState.size = key as SizeType; } -/**表格斑马纹 */ -function fnTableStriped(_record: unknown, index: number) { - return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined; -} - -/**表格多选 */ -function fnTableSelectedRowKeys(keys: (string | number)[]) { - tableState.selectedRowKeys = keys; -} - /**对话框对象信息状态类型 */ type ModalStateType = { /**详情框是否显示 */ @@ -224,7 +204,19 @@ let modalState: ModalStateType = reactive({ visibleByView: false, visibleByEdit: false, title: '网元', - from: {}, + from: { + dn: '网络标识', + ip: '192.168.4.132', + ne_address: '192.160.0.107', + ne_id: '网元内部标识', + ne_name: '网元名称', + ne_type: 'AMF', + port: '3030', + province: '网元所在省份', + pv_flag: '', + rm_uid: '资源唯一标识', + vendor_name: '厂商名称', + }, confirmLoading: false, }); @@ -232,51 +224,21 @@ let modalState: ModalStateType = reactive({ const modalStateFrom = Form.useForm( modalState.from, reactive({ - noticeTitle: [ - { required: true, min: 2, max: 50, message: '请正确输入网元标题' }, - ], - noticeType: [{ required: true, message: '请选择网元类型' }], - noticeContent: [ - { - required: true, - min: 2, - max: 3000, - message: '请正确输入网元内容,限10-3000个字符', - }, - ], + ne_type: [{ required: true, message: '网元类型不能为空' }], + ne_id: [{ required: true, message: '网元内部标识不能为空' }], + rm_uid: [{ required: true, message: '资源唯一标识不能为空' }], + ip: [{ required: true, message: 'IP地址不能为空' }], + port: [{ required: true, message: '端口不能为空' }], + pv_flag: [{ required: true, message: '请选择网元虚拟化标识' }], + ne_name: [{ required: true, message: '网元名称不能为空' }], }) ); -/** - * 对话框弹出显示为 查看 - * @param noticeId 网元id - */ -function fnModalVisibleByVive(noticeId: string | number) { - if (!noticeId) { - message.error(`网元记录存在错误`, 2); - return; - } - if (modalState.confirmLoading) return; - const hide = message.loading('正在打开...', 0); - modalState.confirmLoading = true; - getNotice(noticeId).then(res => { - modalState.confirmLoading = false; - hide(); - if (res.code === 200) { - modalState.from = Object.assign(modalState.from, res.data); - modalState.title = '网元信息'; - modalState.visibleByView = true; - } else { - message.error(`获取网元信息失败`, 2); - } - }); -} - /** * 对话框弹出显示为 新增或者修改 * @param noticeId 网元id, 不传为新增 */ -function fnModalVisibleByEdit(row: Record) { +function fnModalVisibleByEdit(row?: Record) { if (!row) { modalStateFrom.resetFields(); modalState.title = '添加网元'; @@ -306,17 +268,17 @@ function fnModalVisibleByEdit(row: Record) { function fnModalOk() { modalStateFrom .validate() - .then(() => { + .then(e => { modalState.confirmLoading = true; const from = toRaw(modalState.from); - const notice = from.noticeId ? updateNeInfo(from) : addNeInfo(from); + const result = from.id ? updateNeInfo(from) : addNeInfo(from); const hide = message.loading({ content: t('loading') }); - notice + result .then(res => { - if (res.code === 200) { + if (res.code === 1) { message.success({ - content: t('msgSuccess', { msg: modalState.title }), - duration: 2, + content: t('common.msgSuccess', { msg: modalState.title }), + duration: 3, }); modalState.visibleByEdit = false; modalStateFrom.resetFields(); @@ -324,7 +286,7 @@ function fnModalOk() { } else { message.error({ content: `${res.msg}`, - duration: 2, + duration: 3, }); } }) @@ -334,7 +296,7 @@ function fnModalOk() { }); }) .catch(e => { - message.error(t('errorFields', { num: e.errorFields.length }), 2); + message.error(t('common.errorFields', { num: e.errorFields.length }), 3); }); } @@ -438,12 +400,12 @@ onMounted(() => { - 搜索 + {{ t('common.search') }} + - 重置 + {{ t('common.reset') }} + @@ -457,7 +419,7 @@ onMounted(() => { - 添加 + {{ t('common.addText') }} @@ -466,31 +428,22 @@ onMounted(() => { @@ -518,7 +477,6 @@ onMounted(() => { :loading="tableState.loading" :data-source="tableState.data" :size="tableState.size" - :row-class-name="fnTableStriped" :pagination="tablePagination" :scroll="{ x: true }" > @@ -526,7 +484,7 @@ onMounted(() => {