接口调试

main
陈博文 2 weeks ago
parent 0749208a0d
commit a2c556a404

@ -5,7 +5,7 @@
round>创建资源池</el-button> round>创建资源池</el-button>
</template> </template>
</list-header> </list-header>
<div v-loading="loading" style="min-height: 200px;">
<block-box <block-box
v-for="{ poolId, poolName, nodeNum, cpuCores, gpuNum, availableMemory, totalMemory, diskSize, nodeList }, index in list" v-for="{ poolId, poolName, nodeNum, cpuCores, gpuNum, availableMemory, totalMemory, diskSize, nodeList }, index in list"
:key="poolId"> :key="poolId">
@ -33,7 +33,7 @@
</div> </div>
</el-row> </el-row>
</block-box> </block-box>
</div>
<el-dialog @close="editId = null; input = ''; nodeSelect = []" v-model="dialogVisible" <el-dialog @close="editId = null; input = ''; nodeSelect = []" v-model="dialogVisible"
:title="editId ? '编辑资源池' : '创建资源池'" width="1180" :before-close="handleClose"> :title="editId ? '编辑资源池' : '创建资源池'" width="1180" :before-close="handleClose">
<el-row :wrap="false" style="align-items: center;"> <el-row :wrap="false" style="align-items: center;">
@ -110,6 +110,7 @@ const nodeList = ref([])
const nodeSelect = ref([]) const nodeSelect = ref([])
const input = ref('') const input = ref('')
const btnLoading = ref(false) const btnLoading = ref(false)
const loading = ref(true)
const bytesToGB = (bytes) => { const bytesToGB = (bytes) => {
return Math.round(bytes / (1024 * 1024 * 1024)); return Math.round(bytes / (1024 * 1024 * 1024));
@ -145,12 +146,14 @@ const handleOk = async () => {
nodes nodes
}) })
} }
console.log(res, 'res') if (res?.code === 200) {
getList(); getList();
btnLoading.value = false;
dialogVisible.value = false; dialogVisible.value = false;
} }
btnLoading.value = false;
}
const handleCheckboxChange = (ip) => { const handleCheckboxChange = (ip) => {
const index = nodeSelect.value.indexOf(ip); const index = nodeSelect.value.indexOf(ip);
if (index > -1) { if (index > -1) {
@ -165,17 +168,27 @@ const handleDelete = async (id) => {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}).then(async () => { beforeClose: async (action, instance, done) => {
const res = await pollApi.delete({ pool_id: id }) if (action === 'confirm') {
if (res.code === 1) { instance.confirmButtonLoading = true;
const res = await pollApi.delete({ pool_id: id });
if (res.code === 200) {
ElMessage.success('删除成功'); ElMessage.success('删除成功');
getList(); getList();
done(); //
}
instance.confirmButtonLoading = false; // loading
} else {
done();
}
} }
}) })
} }
const getList = async () => { const getList = async () => {
loading.value = true
const res = await pollApi.getPollList() const res = await pollApi.getPollList()
loading.value = false
list.value = res.data list.value = res.data
} }

Loading…
Cancel
Save