diff --git a/packages/web/projects/vgpu/views/poll/admin/index.vue b/packages/web/projects/vgpu/views/poll/admin/index.vue index 7c7dc78..9a148e7 100644 --- a/packages/web/projects/vgpu/views/poll/admin/index.vue +++ b/packages/web/projects/vgpu/views/poll/admin/index.vue @@ -5,35 +5,35 @@ round>创建资源池 - - - -
- {{ poolName }} -
- 节点数量  {{ nodeNum }} - CPU数  {{ cpuCores }}核 - 显卡数量  {{ gpuNum }}张 - 可用/总内存  {{ bytesToGB(availableMemory) }}GB / {{ bytesToGB(totalMemory) }}GB - 磁盘大小  {{ bytesToGB(diskSize) }}GB +
+ + +
+ {{ poolName }} +
+ 节点数量  {{ nodeNum }} + CPU数  {{ cpuCores }}核 + 显卡数量  {{ gpuNum }}张 + 可用/总内存  {{ bytesToGB(availableMemory) }}GB / {{ bytesToGB(totalMemory) }}GB + 磁盘大小  {{ bytesToGB(diskSize) }}GB +
-
-
- 查看详情 - - -
- - - +
+ 查看详情 + + +
+ + +
@@ -110,6 +110,7 @@ const nodeList = ref([]) const nodeSelect = ref([]) const input = ref('') const btnLoading = ref(false) +const loading = ref(true) const bytesToGB = (bytes) => { return Math.round(bytes / (1024 * 1024 * 1024)); @@ -145,10 +146,12 @@ const handleOk = async () => { nodes }) } - console.log(res, 'res') - getList(); + if (res?.code === 200) { + getList(); + dialogVisible.value = false; + } + btnLoading.value = false; - dialogVisible.value = false; } const handleCheckboxChange = (ip) => { @@ -165,17 +168,27 @@ const handleDelete = async (id) => { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', - }).then(async () => { - const res = await pollApi.delete({ pool_id: id }) - if (res.code === 1) { - ElMessage.success('删除成功'); - getList(); + beforeClose: async (action, instance, done) => { + if (action === 'confirm') { + instance.confirmButtonLoading = true; + const res = await pollApi.delete({ pool_id: id }); + if (res.code === 200) { + ElMessage.success('删除成功'); + getList(); + done(); // 关闭对话框 + } + instance.confirmButtonLoading = false; // 确保无论如何都关闭loading + } else { + done(); + } } }) } const getList = async () => { + loading.value = true const res = await pollApi.getPollList() + loading.value = false list.value = res.data }