feat:neinfo表格结构修改,增加定时刷新

This commit is contained in:
zhongzm
2025-09-12 13:34:02 +08:00
parent 905d8c3bb2
commit c7dd92d3b3

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { reactive, onMounted, toRaw, defineAsyncComponent, ref, computed } from 'vue'; import { reactive, onMounted, onBeforeUnmount,toRaw, defineAsyncComponent, ref, computed } from 'vue';
import { PageContainer } from 'antdv-pro-layout'; import { PageContainer } from 'antdv-pro-layout';
import { message, Modal, Table } from 'ant-design-vue/es'; import { message, Modal, Table } from 'ant-design-vue/es';
import { SizeType } from 'ant-design-vue/es/config-provider'; import { SizeType } from 'ant-design-vue/es/config-provider';
@@ -8,7 +8,7 @@ import { ColumnsType } from 'ant-design-vue/es/table';
import useI18n from '@/hooks/useI18n'; import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useNeInfoStore from '@/store/modules/neinfo'; import useNeInfoStore from '@/store/modules/neinfo';
import { listNeInfo, delNeInfo, stateNeInfo } from '@/api/ne/neInfo'; import { listNeInfo, delNeInfo } from '@/api/ne/neInfo';
import { NE_TYPE_LIST } from '@/constants/ne-constants'; import { NE_TYPE_LIST } from '@/constants/ne-constants';
import useDictStore from '@/store/modules/dict'; import useDictStore from '@/store/modules/dict';
import useNeOptions from './hooks/useNeOptions'; import useNeOptions from './hooks/useNeOptions';
@@ -93,31 +93,17 @@ let tableState: TabeStateType = reactive({
selectedRowKeys: [], selectedRowKeys: [],
}); });
/**父表格列配置(网元类型分组) */ /**自动刷新相关 */
let parentTableColumns: ColumnsType = [ let autoRefreshTimer: number | null = null;
Table.EXPAND_COLUMN,
/**表格列配置 */
let tableColumns: ColumnsType = [
{ {
title: t('views.ne.common.neType'), title: t('views.ne.common.neType'),
dataIndex: 'neType', dataIndex: 'neType',
align: 'left', align: 'left',
width: 700, width: 150,
}, },
// {
// title: t('views.ne.neInfo.neCount'),
// dataIndex: 'neName',
// align: 'left',
// width: 150,
// },
// {
// title: t('views.ne.neInfo.summary'),
// key: 'summary',
// align: 'left',
// },
];
/**子表格列配置(具体网元) */
let childTableColumns: ColumnsType = [
Table.EXPAND_COLUMN,
{ {
title: t('views.ne.common.neId'), title: t('views.ne.common.neId'),
dataIndex: 'neId', dataIndex: 'neId',
@@ -162,6 +148,12 @@ let childTableColumns: ColumnsType = [
}, },
]; ];
/**表格列配置(包含展开列) */
const finalTableColumns = [
Table.EXPAND_COLUMN,
...tableColumns
];
/**表格分页器参数 */ /**表格分页器参数 */
let tablePagination = reactive({ let tablePagination = reactive({
/**当前页数 */ /**当前页数 */
@@ -197,11 +189,19 @@ function fnTableSize({ key }: MenuInfo) {
/**表格多选 */ /**表格多选 */
function fnTableSelectedRowKeys(keys: (string | number)[]) { function fnTableSelectedRowKeys(keys: (string | number)[]) {
// 过滤掉父节点的key只保留子节点的key tableState.selectedRowKeys = keys;
const childKeys = keys.filter(key => !String(key).startsWith('parent_'));
tableState.selectedRowKeys = childKeys;
} }
/**获取可选择的网元ID过滤掉分组行ID */
function getSelectableRowKeys() {
return tableState.selectedRowKeys.filter(key => {
// 检查是否是分组行ID
const record = tableState.data.find(item => item.id === key);
return !record || !record.children || record.children.length === 0;
});
}
/**对话框对象信息状态类型 */ /**对话框对象信息状态类型 */
type ModalStateType = { type ModalStateType = {
/**配置备份框是否显示 */ /**配置备份框是否显示 */
@@ -254,27 +254,32 @@ function fnModalEditOk(from: Record<string, any>) {
return; return;
} }
// 编辑时局部更新信息 // 编辑时局部更新信息
stateNeInfo(from.neType, from.neId) // stateNeInfo(from.neType, from.neId)
.then(res => { // .then(res => {
// 在树状结构中找到编辑更新的网元 // 在树状表格结构中找到编辑更新的网元
let foundItem = null; let foundItem = null;
let parentItem = null;
for (const parent of tableState.data) { for (const item of tableState.data) {
if (parent.childrenData && Array.isArray(parent.childrenData)) { if (item.children && item.children.length > 0) {
const child = parent.childrenData.find(c => c.id === from.id); const child = item.children.find((c: any) => c.id === from.id);
if (child) { if (child) {
foundItem = child; foundItem = child;
parentItem = parent;
break; break;
} }
} else if (item.id === from.id) {
foundItem = item;
break;
} }
} }
if (foundItem && res.code === RESULT_CODE_SUCCESS) { // if (foundItem && res.code === RESULT_CODE_SUCCESS) {
// 检查网元类型是否发生变化 // // 检查网元类型是否发生变化
const oldNeType = foundItem.neType; // const oldNeType = foundItem.neType;
const newNeType = from.neType; // const newNeType = from.neType;
if (foundItem) {
// 检查网元类型是否发生变化
const oldNeType = foundItem.neType;
const newNeType = from.neType;
// 更新网元信息 // 更新网元信息
foundItem.neType = from.neType; foundItem.neType = from.neType;
@@ -284,27 +289,34 @@ function fnModalEditOk(from: Record<string, any>) {
foundItem.ip = from.ip; foundItem.ip = from.ip;
foundItem.port = from.port; foundItem.port = from.port;
if (res.data.online) { // if (res.data.online) {
foundItem.status = '1'; // foundItem.status = '1';
if (res.data.standby) { // if (res.data.standby) {
foundItem.status = '3'; // foundItem.status = '3';
} // }
} else { // } else {
foundItem.status = '0'; // foundItem.status = '0';
} // }
Object.assign(foundItem.serverState, res.data); // Object.assign(foundItem.serverState, res.data);
const resouresUsage = parseResouresUsage(foundItem.serverState); // const resouresUsage = parseResouresUsage(foundItem.serverState);
Reflect.set(foundItem, 'resoures', resouresUsage); // Reflect.set(foundItem, 'resoures', resouresUsage);
//
// // 如果网元类型发生变化,需要重新组织数据结构
// if (oldNeType !== newNeType) {
// fnGetList(); // 重新获取数据以重新组织表格结构
// }
// }
// })
// .finally(() => {
// useNeInfoStore().fnRefreshNelist();
// });
// 如果网元类型发生变化,需要重新组织数据结构
if (oldNeType !== newNeType) {
fnGetList(); // 重新获取数据以重新组织表格结构
}
}
// 如果网元类型发生变化,需要重新组织数据结构 useNeInfoStore().fnRefreshNelist();
if (oldNeType !== newNeType) {
fnGetList(); // 重新获取数据以重新组织树状结构
}
}
})
.finally(() => {
useNeInfoStore().fnRefreshNelist();
});
} }
/** /**
@@ -326,8 +338,9 @@ function fnRecordDelete(id: string) {
if (!id || modalState.confirmLoading) return; if (!id || modalState.confirmLoading) return;
let msg = t('views.ne.neInfo.delTip'); let msg = t('views.ne.neInfo.delTip');
if (id === '0') { if (id === '0') {
msg = `${msg} ...${tableState.selectedRowKeys.length}`; const selectableKeys = getSelectableRowKeys();
id = tableState.selectedRowKeys.join(','); msg = `${msg} ...${selectableKeys.length}`;
id = selectableKeys.join(',');
} }
Modal.confirm({ Modal.confirm({
@@ -340,34 +353,49 @@ function fnRecordDelete(id: string) {
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('common.operateOk'), 3); message.success(t('common.operateOk'), 3);
// 树状结构中过滤掉删除的id // 树状表格中过滤掉删除的id
const deletedIds = id.indexOf(',') > -1 ? id.split(',') : [id]; const deletedIds = id.indexOf(',') > -1 ? id.split(',') : [id];
const idsToDelete = new Set(deletedIds);
tableState.data = tableState.data.map(parentItem => { // 收集所有需要删除的ID包括分组行和子网元
if (parentItem.childrenData && Array.isArray(parentItem.childrenData)) { tableState.data.forEach(item => {
// 过滤子节点 if (deletedIds.includes(item.id) && item.children && item.children.length > 0) {
const filteredChildren = parentItem.childrenData.filter(child => // 如果删除的是分组行添加所有子网元ID
!deletedIds.includes(child.id) item.children.forEach((child: any) => {
); idsToDelete.add(child.id);
});
}
});
// 如果该分组下没有子节点了,移除整个父节点 tableState.data = tableState.data.filter(item => {
if (filteredChildren.length === 0) { if (item.children && item.children.length > 0) {
return null; // 如果分组行被删除,移除整个分组
if (idsToDelete.has(item.id)) {
return false;
} }
// 更新子节点数量显示和汇总信息 // 过滤分组中的子节点
const onlineCount = filteredChildren.filter(item => item.status === '1' || item.status === '3').length; const filteredChildren = item.children.filter((child: any) =>
const offlineCount = filteredChildren.length - onlineCount; !idsToDelete.has(child.id)
);
return { if (filteredChildren.length === 0) {
...parentItem, return false; // 移除整个分组
neName: `${filteredChildren.length} 个网元`, } else if (filteredChildren.length === 1) {
summary: `在线 ${onlineCount} | 离线 ${offlineCount}`, // 如果只剩一个,转换为单行显示
childrenData: filteredChildren const singleItem = filteredChildren[0];
}; Object.assign(item, singleItem);
item.children = undefined;
} else {
// 更新分组
item.children = filteredChildren;
}
} else {
// 单行项目,检查是否在删除列表中
return !idsToDelete.has(item.id);
} }
return parentItem; return true;
}).filter(item => item !== null); });
// 清空选择 // 清空选择
tableState.selectedRowKeys = []; tableState.selectedRowKeys = [];
@@ -430,8 +458,8 @@ function fnRecordMore(type: string | number, row: Record<string, any>) {
} }
} }
/**将扁平数据转换为分组结构 */ /**将扁平数据转换为树状表格结构 */
function transformToNestedTableData(flatData: Record<string, any>[]) { function transformToTreeTableData(flatData: Record<string, any>[]) {
// 按 neType 分组 // 按 neType 分组
const groupedData = flatData.reduce((groups, item) => { const groupedData = flatData.reduce((groups, item) => {
const neType = item.neType; const neType = item.neType;
@@ -442,36 +470,36 @@ function transformToNestedTableData(flatData: Record<string, any>[]) {
return groups; return groups;
}, {} as Record<string, any[]>); }, {} as Record<string, any[]>);
// 转换为父表格数据结构(只包含父节点) const result: Record<string, any>[] = [];
const parentTableData = Object.entries(groupedData).map(([neType, items]) => {
// 按 neId 排序子节点 Object.entries(groupedData).forEach(([neType, items]) => {
// 按 neId 排序
const sortedItems = items.sort((a: Record<string, any>, b: Record<string, any>) => a.neId.localeCompare(b.neId)); const sortedItems = items.sort((a: Record<string, any>, b: Record<string, any>) => a.neId.localeCompare(b.neId));
// 统计在线/离线数量 if (sortedItems.length === 1) {
const onlineCount = sortedItems.filter((item: Record<string, any>) => item.status === '1' || item.status === '3').length; // 只有一个网元,直接显示在第一层
const offlineCount = sortedItems.length - onlineCount; result.push({
...sortedItems[0],
// 清理子节点数据,移除可能干扰父表格显示的属性 children: undefined // 确保没有children属性
const cleanedChildren = sortedItems.map((item: Record<string, any>) => ({ });
...item, } else {
isParent: false // 多个网元创建分组行使用children字段
})); const groupRow = {
id: `group_${neType}_${Math.random().toString(36).substr(2, 9)}`,
// 创建父节点(分组节点)- 确保这是唯一的父节点数据 neType: neType,
const parentNode = { neId: '', // 空白显示
id: `parent_${neType}`, rmUid: '', // 空白显示
neType: neType, neName: '', // 空白显示
neName: `${items.length} 个网元`, ip: '', // 空白显示
summary: `在线 ${onlineCount} | 离线 ${offlineCount}`, port: '', // 空白显示
childrenData: cleanedChildren, // 重命名避免与ant-design的children属性冲突 status: '', // 空白显示
isParent: true, // 明确标识为父节点 children: sortedItems // 使用children字段Ant Design会自动处理展开
}; };
result.push(groupRow);
return parentNode; }
}); });
// 确保只返回父节点,不包含子节点 return result;
return parentTableData;
} }
/**查询列表, pageNum初始页数 */ /**查询列表, pageNum初始页数 */
@@ -489,26 +517,27 @@ function fnGetList(pageNum?: number) {
tableState.selectedRowKeys = []; tableState.selectedRowKeys = [];
} }
tablePagination.total = res.total; tablePagination.total = res.total;
// 遍历处理资源情况数值 // // 遍历处理资源情况数值
const processedData = res.rows.map(item => { // const processedData = res.rows.map(item => {
let resouresUsage = { // let resouresUsage = {
sysDiskUsage: 0, // sysDiskUsage: 0,
sysMemUsage: 0, // sysMemUsage: 0,
sysCpuUsage: 0, // sysCpuUsage: 0,
nfCpuUsage: 0, // nfCpuUsage: 0,
}; // };
const neState = item.serverState; // const neState = item.serverState;
if (neState) { // if (neState) {
resouresUsage = parseResouresUsage(neState); // resouresUsage = parseResouresUsage(neState);
} else { // } else {
item.serverState = { online: false }; // item.serverState = { online: false };
} // }
Reflect.set(item, 'resoures', resouresUsage); // Reflect.set(item, 'resoures', resouresUsage);
return item; // return item;
}); // });
//
// 转换为嵌套表格结构 // // 转换为树状表格结构
tableState.data = transformToNestedTableData(processedData); // tableState.data = transformToTreeTableData(processedData);
tableState.data = transformToTreeTableData(res.rows);
} }
tableState.loading = false; tableState.loading = false;
}) })
@@ -519,52 +548,77 @@ function fnGetList(pageNum?: number) {
} }
/**解析网元状态携带的资源利用率 */ /**解析网元状态携带的资源利用率 */
function parseResouresUsage(neState: Record<string, any>) { // function parseResouresUsage(neState: Record<string, any>) {
let sysCpuUsage = 0; // let sysCpuUsage = 0;
let nfCpuUsage = 0; // let nfCpuUsage = 0;
if (neState.cpu) { // if (neState.cpu) {
nfCpuUsage = neState.cpu.nfCpuUsage; // nfCpuUsage = neState.cpu.nfCpuUsage;
const nfCpu = +(nfCpuUsage / 100); // const nfCpu = +(nfCpuUsage / 100);
nfCpuUsage = +nfCpu.toFixed(2); // nfCpuUsage = +nfCpu.toFixed(2);
if (nfCpuUsage > 100) { // if (nfCpuUsage > 100) {
nfCpuUsage = 100; // nfCpuUsage = 100;
} // }
//
// sysCpuUsage = neState.cpu.sysCpuUsage;
// const sysCpu = +(sysCpuUsage / 100);
// sysCpuUsage = +sysCpu.toFixed(2);
// if (sysCpuUsage > 100) {
// sysCpuUsage = 100;
// }
// }
//
// let sysMemUsage = 0;
// if (neState.mem) {
// const men = neState.mem.sysMemUsage;
// sysMemUsage = +(men / 100).toFixed(2);
// if (sysMemUsage > 100) {
// sysMemUsage = 100;
// }
// }
//
// let sysDiskUsage = 0;
// if (neState.disk && Array.isArray(neState.disk.partitionInfo)) {
// let disks: any[] = neState.disk.partitionInfo;
// disks = disks.sort((a, b) => +b.used - +a.used);
// if (disks.length > 0) {
// const { total, used } = disks[0];
// sysDiskUsage = +((used / total) * 100).toFixed(2);
// }
// }
//
// return {
// sysDiskUsage,
// sysMemUsage,
// sysCpuUsage,
// nfCpuUsage,
// };
// }
sysCpuUsage = neState.cpu.sysCpuUsage; /**
const sysCpu = +(sysCpuUsage / 100); * 启动自动刷新
sysCpuUsage = +sysCpu.toFixed(2); */
if (sysCpuUsage > 100) { function startAutoRefresh() {
sysCpuUsage = 100; if (autoRefreshTimer) {
} clearInterval(autoRefreshTimer);
} }
autoRefreshTimer = window.setInterval(() => {
let sysMemUsage = 0; if (!tableState.loading) {
if (neState.mem) { fnGetList();
const men = neState.mem.sysMemUsage;
sysMemUsage = +(men / 100).toFixed(2);
if (sysMemUsage > 100) {
sysMemUsage = 100;
} }
} }, 10000); // 每10秒刷新一次
let sysDiskUsage = 0;
if (neState.disk && Array.isArray(neState.disk.partitionInfo)) {
let disks: any[] = neState.disk.partitionInfo;
disks = disks.sort((a, b) => +b.used - +a.used);
if (disks.length > 0) {
const { total, used } = disks[0];
sysDiskUsage = +((used / total) * 100).toFixed(2);
}
}
return {
sysDiskUsage,
sysMemUsage,
sysCpuUsage,
nfCpuUsage,
};
} }
/**
* 停止自动刷新
*/
function stopAutoRefresh() {
if (autoRefreshTimer) {
clearInterval(autoRefreshTimer);
autoRefreshTimer = null;
}
}
onMounted(() => { onMounted(() => {
// 初始字典数据 // 初始字典数据
Promise.allSettled([getDict('ne_info_status')]).then(resArr => { Promise.allSettled([getDict('ne_info_status')]).then(resArr => {
@@ -575,6 +629,14 @@ onMounted(() => {
// 获取列表数据 // 获取列表数据
fnGetList(); fnGetList();
// 启动自动刷新
startAutoRefresh();
});
onBeforeUnmount(() => {
// 组件销毁前清理定时器
stopAutoRefresh();
}); });
</script> </script>
@@ -627,7 +689,7 @@ onMounted(() => {
<a-button <a-button
type="default" type="default"
danger danger
:disabled="tableState.selectedRowKeys.length <= 0" :disabled="getSelectableRowKeys().length <= 0"
:loading="modalState.confirmLoading" :loading="modalState.confirmLoading"
@click.prevent="fnRecordDelete('0')" @click.prevent="fnRecordDelete('0')"
v-perms:has="['ne:neInfo:delete']" v-perms:has="['ne:neInfo:delete']"
@@ -683,223 +745,114 @@ onMounted(() => {
</a-space> </a-space>
</template> </template>
<!-- 外层表格网元类型分组 --> <!-- 树状表格 -->
<a-table <a-table
class="parent-table"
row-key="id" row-key="id"
:columns="parentTableColumns" :columns="finalTableColumns"
:loading="tableState.loading" :loading="tableState.loading"
:data-source="tableState.data" :data-source="tableState.data"
:size="tableState.size" :size="tableState.size"
:pagination="tablePagination" :pagination="tablePagination"
:scroll="{ x: parentTableColumns.length * 120 }" :scroll="{ x: finalTableColumns.length * 120 }"
:default-expand-all-rows="false" :default-expand-all-rows="false"
:expandRowByClick="false" :expandRowByClick="false"
:show-header="true" :show-header="true"
:childrenColumnName="undefined" :row-selection="{
type: 'checkbox',
columnWidth: '48px',
selectedRowKeys: tableState.selectedRowKeys,
onChange: fnTableSelectedRowKeys,
checkStrictly: false, // 启用父子节点关联选择
}"
> >
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<!-- 父表格只处理汇总 --> <!-- 状态 -->
<template v-if="column.key === 'summary'"> <template v-if="column.key === 'status'">
<span class="text-gray-600">{{ record.summary }}</span> <DictTag v-if="!record.children || record.children.length === 0" :options="dict.neInfoStatus" :value="record.status" />
</template> </template>
</template>
<!-- 父表格展开行嵌套子表格 --> <!-- 操作列 -->
<template #expandedRowRender="{ record }"> <template v-if="column.key === 'id'">
<!-- 子表格显示具体网元 --> <template v-if="!record.children || record.children.length === 0">
<a-table <a-space :size="8" align="center">
row-key="id" <a-tooltip>
:columns="childTableColumns" <template #title>{{ t('common.editText') }}</template>
:data-source="record.childrenData" <a-button
:size="tableState.size" type="link"
:pagination="false" @click.prevent="fnModalVisibleByEdit(record)"
:bordered="false" v-perms:has="['ne:neInfo:edit']"
:show-header="true" >
:scroll="{ x: childTableColumns.length * 120 }" <template #icon><FormOutlined /></template>
:row-selection="{ </a-button>
type: 'checkbox', </a-tooltip>
columnWidth: '48px', <a-tooltip>
selectedRowKeys: tableState.selectedRowKeys, <template #title>
onChange: fnTableSelectedRowKeys, {{ t('views.ne.common.restart') }}
}" </template>
> <a-button
<template #bodyCell="{ column, record: childRecord }"> type="link"
<!-- 子表格状态列 --> @click.prevent="fnRecordMore('restart', record)"
<template v-if="column.key === 'status'"> v-perms:has="['ne:neInfo:restart']"
<DictTag :options="dict.neInfoStatus" :value="childRecord.status" /> >
</template> <template #icon><UndoOutlined /></template>
</a-button>
<!-- 子表格操作列 --> </a-tooltip>
<template v-if="column.key === 'id'"> <a-tooltip placement="left">
<a-space :size="8" align="center"> <template #title>{{ t('common.moreText') }}</template>
<a-tooltip> <a-dropdown placement="bottomRight" trigger="click" v-if="hasAnyBatchPermission">
<template #title>{{ t('common.editText') }}</template> <a-button type="link">
<a-button <template #icon><EllipsisOutlined /> </template>
type="link"
@click.prevent="fnModalVisibleByEdit(childRecord)"
v-perms:has="['ne:neInfo:edit']"
>
<template #icon><FormOutlined /></template>
</a-button> </a-button>
</a-tooltip> <template #overlay>
<a-tooltip> <a-menu @click="({ key }:any) => fnRecordMore(key, record)">
<template #title> <a-menu-item key="log" v-if="hasPermissions(['ne:neInfo:logs'])">
{{ t('views.ne.common.restart') }} <FileTextOutlined />
{{ t('views.ne.common.log') }}
</a-menu-item>
<a-menu-item key="start" v-if="hasPermissions(['ne:neInfo:start'])">
<ThunderboltOutlined />
{{ t('views.ne.common.start') }}
</a-menu-item>
<a-menu-item key="stop" v-if="hasPermissions(['ne:neInfo:stop'])">
<CloseSquareOutlined />
{{ t('views.ne.common.stop') }}
</a-menu-item>
<a-menu-item
key="reload"
v-if="
!['OMC', 'PCF', 'IMS', 'MME'].includes(record.neType)
"
>
<SyncOutlined />
{{ t('views.ne.common.reload') }}
</a-menu-item>
<a-menu-item key="delete" v-if="hasPermissions(['ne:neInfo:delete'])">
<DeleteOutlined />
{{ t('common.deleteText') }}
</a-menu-item>
<a-menu-item
key="oam"
v-if="!['OMC'].includes(record.neType)"
>
<FileTextOutlined />
{{ t('views.ne.common.oam') }}
</a-menu-item>
<!-- 配置备份 -->
<a-menu-item key="backConfExport" v-if="hasPermissions(['ne:neInfo:export'])">
<ExportOutlined />
{{ t('views.ne.neInfo.backConf.export') }}
</a-menu-item>
<a-menu-item key="backConfImport" v-if="hasPermissions(['ne:neInfo:import'])">
<ImportOutlined />
{{ t('views.ne.neInfo.backConf.import') }}
</a-menu-item>
</a-menu>
</template> </template>
<a-button </a-dropdown>
type="link" </a-tooltip>
@click.prevent="fnRecordMore('restart', childRecord)" </a-space>
v-perms:has="['ne:neInfo:restart']"
>
<template #icon><UndoOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip placement="left">
<template #title>{{ t('common.moreText') }}</template>
<a-dropdown placement="bottomRight" trigger="click" v-if="hasAnyBatchPermission">
<a-button type="link">
<template #icon><EllipsisOutlined /> </template>
</a-button>
<template #overlay>
<a-menu @click="({ key }:any) => fnRecordMore(key, childRecord)">
<a-menu-item key="log" v-if="hasPermissions(['ne:neInfo:logs'])">
<FileTextOutlined />
{{ t('views.ne.common.log') }}
</a-menu-item>
<a-menu-item key="start" v-if="hasPermissions(['ne:neInfo:start'])">
<ThunderboltOutlined />
{{ t('views.ne.common.start') }}
</a-menu-item>
<a-menu-item key="stop" v-if="hasPermissions(['ne:neInfo:stop'])">
<CloseSquareOutlined />
{{ t('views.ne.common.stop') }}
</a-menu-item>
<a-menu-item
key="reload"
v-if="
!['OMC', 'PCF', 'IMS', 'MME'].includes(childRecord.neType)
"
>
<SyncOutlined />
{{ t('views.ne.common.reload') }}
</a-menu-item>
<a-menu-item key="delete" v-if="hasPermissions(['ne:neInfo:delete'])">
<DeleteOutlined />
{{ t('common.deleteText') }}
</a-menu-item>
<a-menu-item
key="oam"
v-if="!['OMC'].includes(childRecord.neType)"
>
<FileTextOutlined />
{{ t('views.ne.common.oam') }}
</a-menu-item>
<!-- 配置备份 -->
<a-menu-item key="backConfExport" v-if="hasPermissions(['ne:neInfo:export'])">
<ExportOutlined />
{{ t('views.ne.neInfo.backConf.export') }}
</a-menu-item>
<a-menu-item key="backConfImport" v-if="hasPermissions(['ne:neInfo:import'])">
<ImportOutlined />
{{ t('views.ne.neInfo.backConf.import') }}
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</a-tooltip>
</a-space>
</template>
</template> </template>
</template>
<!-- 子表格展开行:显示详细监控信息 -->
<template #expandedRowRender="{ record: childRecord }">
<a-row>
<a-col :offset="2" :lg="8" :md="8" :xs="8">
<a-divider orientation="left">
{{ t('views.ne.neInfo.info') }}
</a-divider>
<div>
<span>{{ t('views.ne.neInfo.serviceState') }}</span>
<DictTag :options="dict.neInfoStatus" :value="childRecord.status" />
</div>
<div>
<span>{{ t('views.ne.neVersion.version') }}</span>
<span>{{ childRecord.serverState?.version || '—' }}</span>
</div>
<div>
<span>{{ t('views.ne.common.serialNum') }}</span>
<span>{{ childRecord.serverState?.sn || '—' }}</span>
</div>
<div>
<span>{{ t('views.ne.common.expiryDate') }}</span>
<span>{{ childRecord.serverState?.expire || '—' }}</span>
</div>
</a-col>
<a-col :offset="2" :lg="8" :md="8" :xs="8">
<a-divider orientation="left">
{{ t('views.ne.neInfo.resourceInfo') }}
</a-divider>
<div>
<span>{{ t('views.ne.neInfo.neCpu') }}</span>
<a-progress
status="normal"
:stroke-color="
childRecord.resoures?.nfCpuUsage < 30
? '#52c41a'
: childRecord.resoures?.nfCpuUsage > 70
? '#ff4d4f'
: '#1890ff'
"
:percent="childRecord.resoures?.nfCpuUsage || 0"
/>
</div>
<div>
<span>{{ t('views.ne.neInfo.sysCpu') }}</span>
<a-progress
status="normal"
:stroke-color="
childRecord.resoures?.sysCpuUsage < 30
? '#52c41a'
: childRecord.resoures?.sysCpuUsage > 70
? '#ff4d4f'
: '#1890ff'
"
:percent="childRecord.resoures?.sysCpuUsage || 0"
/>
</div>
<div>
<span>{{ t('views.ne.neInfo.sysMem') }}</span>
<a-progress
status="normal"
:stroke-color="
childRecord.resoures?.sysMemUsage < 30
? '#52c41a'
: childRecord.resoures?.sysMemUsage > 70
? '#ff4d4f'
: '#1890ff'
"
:percent="childRecord.resoures?.sysMemUsage || 0"
/>
</div>
<div>
<span>{{ t('views.ne.neInfo.sysDisk') }}</span>
<a-progress
status="normal"
:stroke-color="
childRecord.resoures?.sysDiskUsage < 30
? '#52c41a'
: childRecord.resoures?.sysDiskUsage > 70
? '#ff4d4f'
: '#1890ff'
"
:percent="childRecord.resoures?.sysDiskUsage || 0"
/>
</div>
</a-col>
</a-row>
</template>
</a-table>
</template> </template>
</a-table> </a-table>
</a-card> </a-card>
@@ -933,14 +886,11 @@ onMounted(() => {
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.parent-table :deep(.ant-pagination) { /* 分组行样式 */
padding: 0 24px; :deep(.ant-table-tbody) {
} tr[data-row-key*="group_"] {
/* 简洁的父表格样式 */
.parent-table :deep(.ant-table-tbody) {
tr[data-row-key*="parent_"] {
font-weight: 600; font-weight: 600;
background-color: #fafafa;
} }
} }
</style> </style>