From 8d22ab850add40073238a013440bed56795741b0 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 12 Mar 2025 11:13:50 +0800 Subject: [PATCH] =?UTF-8?q?style::=20=E7=BD=91=E5=85=83=E6=A6=82=E8=A7=88?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E5=86=85=E5=AD=98CPU=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/configManage/neOverview/index.vue | 96 +-------------------- 1 file changed, 3 insertions(+), 93 deletions(-) diff --git a/src/views/configManage/neOverview/index.vue b/src/views/configManage/neOverview/index.vue index b25b934a..2d0111d1 100644 --- a/src/views/configManage/neOverview/index.vue +++ b/src/views/configManage/neOverview/index.vue @@ -149,14 +149,6 @@ async function fnGetList(reload: boolean = false) { // 初始 if (!reload) { - // 选择第一个 - if (tableState.data.length > 0) { - const id = tableState.data[0].id; - fnTableSelectedRowKeys([id]); - } else { - fnTableSelectedRowKeys(tableState.selectedRowKeys); - } - if (statusBar.value) { fnDesign(statusBar.value, rightNum, errorNum); } @@ -216,44 +208,6 @@ function fnDesign(container: HTMLElement, rightNum: number, errorNum: number) { observer.observe(container); } -/**表格多选 */ -function fnTableSelectedRowKeys(keys: (string | number)[]) { - if (keys.length <= 0) return; - const id = keys[0]; - const row: any = tableState.data.find((item: any) => item.id === id); - if (!row) { - message.error(t('views.index.neStatus'), 2); - return; - } - const neState = row.serverState; - if (!neState?.online) { - message.error(t('views.index.neStatus'), 2); - return; - } - tableState.selectedRowKeys = keys; - // Mem 将KB转换为MB - const totalMemInKB = neState.mem?.totalMem; - const nfUsedMemInKB = neState.mem?.nfUsedMem; - const sysMemUsageInKB = neState.mem?.sysMemUsage; - const totalMemInMB = Math.round((totalMemInKB / 1024) * 100) / 100; - const nfUsedMemInMB = Math.round((nfUsedMemInKB / 1024) * 100) / 100; - const sysMemUsageInMB = Math.round((sysMemUsageInKB / 1024) * 100) / 100; - - // CPU - const nfCpu = neState.cpu?.nfCpuUsage; - const sysCpu = neState.cpu?.sysCpuUsage; - const nfCpuP = Math.round(nfCpu) / 100; - const sysCpuP = Math.round(sysCpu) / 100; - - serverState.value = Object.assign( - { - cpuUse: `NE:${nfCpuP}%; SYS:${sysCpuP}%`, - memoryUse: `Total: ${totalMemInMB}MB; NE: ${nfUsedMemInMB}MB; SYS: ${sysMemUsageInMB}MB`, - }, - neState - ); -} - /** * 国际化翻译转换 */ @@ -277,6 +231,7 @@ let dict: { }); let timer: any; +let timerFlag: boolean = false; onMounted(() => { // 初始字典数据 Promise.allSettled([getDict('ne_info_status'), getDict('index_status')]) @@ -292,7 +247,7 @@ onMounted(() => { fnLocale(); await fnGetList(false); timer = setInterval(() => { - if (!timer) return; + if (timerFlag) return; fnGetList(true); }, 10_000); // 每隔10秒执行一次 }); @@ -302,6 +257,7 @@ onMounted(() => { onBeforeUnmount(() => { clearInterval(timer); timer = null; + timerFlag = true; }); @@ -319,12 +275,6 @@ onBeforeUnmount(() => { :loading="tableState.loading" :pagination="false" :scroll="{ x: true }" - :row-selection="{ - type: 'radio', - columnWidth: '48px', - selectedRowKeys: tableState.selectedRowKeys, - onChange: fnTableSelectedRowKeys, - }" >