From a3476596dde422cee56f8369ab871f4318869af9 Mon Sep 17 00:00:00 2001 From: lijiahangmax Date: Sun, 10 Aug 2025 19:26:33 +0800 Subject: [PATCH] =?UTF-8?q?:hammer:=20=E4=BF=AE=E6=94=B9=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=AD=97=E6=AE=B5=E5=90=8D=E7=A7=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orion-visor-ui/src/api/asset/host-extra.ts | 9 ++- .../host-list/components/host-card-list.vue | 2 +- .../host-list/components/host-form-spec.vue | 79 ++++++++++--------- .../asset/host-list/components/host-table.vue | 2 +- 4 files changed, 48 insertions(+), 44 deletions(-) diff --git a/orion-visor-ui/src/api/asset/host-extra.ts b/orion-visor-ui/src/api/asset/host-extra.ts index 62419d8d..ca235c83 100644 --- a/orion-visor-ui/src/api/asset/host-extra.ts +++ b/orion-visor-ui/src/api/asset/host-extra.ts @@ -50,20 +50,23 @@ export interface HostLabelExtraSettingModel { export interface HostSpecExtraModel { sn: string; osName: string; - cpuCore: number; + cpuCount: number; + cpuPhysicalCore: number; + cpuLogicalCore: number; cpuFrequency: number; cpuModel: string; memorySize: number; diskSize: number; inBandwidth: number; outBandwidth: number; - publicIpAddress: Array; - privateIpAddress: Array; + publicIpAddresses: Array; + privateIpAddresses: Array; chargePerson: string; createdTime: number; expiredTime: number; items: Array<{ label: string; + key?: string; value: string; }>; } diff --git a/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue b/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue index d0740b5d..90b7eee1 100644 --- a/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue +++ b/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue @@ -163,7 +163,7 @@ {{ [ - addSuffix(record.spec.cpuCore, 'C'), + addSuffix(record.spec.cpuPhysicalCore, 'C'), addSuffix(record.spec.memorySize, 'G'), addSuffix(record.spec.diskSize, 'G') ].filter(Boolean).join('/') || '-' diff --git a/orion-visor-ui/src/views/asset/host-list/components/host-form-spec.vue b/orion-visor-ui/src/views/asset/host-list/components/host-form-spec.vue index b1e5e085..e4240511 100644 --- a/orion-visor-ui/src/views/asset/host-list/components/host-form-spec.vue +++ b/orion-visor-ui/src/views/asset/host-list/components/host-form-spec.vue @@ -32,12 +32,22 @@ - {{ formModel.cpuCore }} + {{ formModel.cpuPhysicalCore }} + + + + + {{ formModel.cpuLogicalCore }} @@ -111,43 +121,19 @@ - - - - {{ addr }} - - - + - - - - {{ addr }} - - - + @@ -221,16 +207,24 @@ + @click="toggleEditing"> 编辑 - 保存 + + + 取消 + ({} as HostSpecExtraModel); // 加载配置 const fetchHostSpec = async () => { setLoading(true); + editing.value = false; try { const { data } = await getHostExtraItem({ hostId: props.hostId, item: 'SPEC' }); formModel.value = data; @@ -298,6 +292,13 @@ const saveSpec = async () => { setLoading(true); try { + // 设置额外配置的 key + if (formModel.value.items?.length) { + formModel.value.items.forEach(s => { + s.key = s.label; + }); + } + // 更新 await updateHostSpec({ hostId: props.hostId, extra: JSON.stringify(formModel.value) diff --git a/orion-visor-ui/src/views/asset/host-list/components/host-table.vue b/orion-visor-ui/src/views/asset/host-list/components/host-table.vue index 2952a165..8712ac95 100644 --- a/orion-visor-ui/src/views/asset/host-list/components/host-table.vue +++ b/orion-visor-ui/src/views/asset/host-list/components/host-table.vue @@ -191,7 +191,7 @@ {{ [ - addSuffix(record.spec.cpuCore, 'C'), + addSuffix(record.spec.cpuPhysicalCore, 'C'), addSuffix(record.spec.memorySize, 'G'), addSuffix(record.spec.diskSize, 'G') ].filter(Boolean).join(' / ') || '-'