fix: 提交修改
Build and Deploy Vue3 / build (push) Successful in 1m31s
Build and Deploy Vue3 / deploy (push) Successful in 1m9s

This commit is contained in:
2026-04-15 16:02:36 +08:00
parent 2f06aa9f5f
commit b3ed406f84
61 changed files with 7476 additions and 7226 deletions
+21 -7
View File
@@ -467,7 +467,7 @@
<h3 class="tab-title">数据卷列表</h3>
<el-button
type="primary"
@click="showAddVolumeDialog = true"
@click="handleAddVolume"
:icon="Plus"
:disabled="vmInfo.state != 2"
>
@@ -671,8 +671,11 @@
width="500px"
>
<el-form :model="volumeForm" label-width="120px" :rules="volumeRules" ref="volumeFormRef">
<el-form-item label="大小(GB)" prop="size">
<el-input-number v-model="volumeForm.size" :min="1" :max="1000" />
<el-form-item label="大小" prop="size">
<div class="unit-input-row">
<el-input-number v-model="volumeForm.size" :min="1" :max="1000" style="flex:1" />
<el-select v-model="volumeForm._sizeUnit" class="unit-select"><el-option label="GB" value="GB" /><el-option label="TB" value="TB" /></el-select>
</div>
</el-form-item>
</el-form>
<template #footer>
@@ -693,8 +696,11 @@
>
<el-form :model="volumeForm" label-width="120px" :rules="volumeRules" ref="volumeFormRef">
<el-form-item label="大小(GB)" prop="size">
<el-input-number v-model="volumeForm.size" :min="1" :max="1000" />
<el-form-item label="大小" prop="size">
<div class="unit-input-row">
<el-input-number v-model="volumeForm.size" :min="1" :max="1000" style="flex:1" />
<el-select v-model="volumeForm._sizeUnit" class="unit-select"><el-option label="GB" value="GB" /><el-option label="TB" value="TB" /></el-select>
</div>
</el-form-item>
</el-form>
<template #footer>
@@ -1067,6 +1073,7 @@ const showMigrateVolumeDialog = ref(false);
const currentVolumeToEdit = ref(null);
const volumeForm = reactive({
size: 10,
_sizeUnit: 'GB'
});
const volumeFormRef = ref(null);
const volumeRules = {
@@ -2371,6 +2378,7 @@ const handleAddVolume = () => {
showAddVolumeDialog.value = true;
// 重置表单
volumeForm.size = 10;
volumeForm._sizeUnit = 'GB';
};
// 编辑数据卷
@@ -2378,6 +2386,7 @@ const handleEditVolume = (volume) => {
currentVolumeToEdit.value = volume;
// 填充表单
volumeForm.size = volume.size;
volumeForm._sizeUnit = 'GB';
showEditVolumeDialog.value = true;
};
@@ -2404,9 +2413,10 @@ const submitAddVolume = async () => {
if (valid) {
addingVolume.value = true;
try {
const sizeGb = volumeForm._sizeUnit === 'TB' ? volumeForm.size * 1024 : volumeForm.size
const res = await addVolume({
instance_id: route.query.instance_id,
size: String(volumeForm.size),
size: String(sizeGb),
user_id: user_id.value
});
console.log("添加数据卷112",res)
@@ -2438,9 +2448,10 @@ const submitEditVolume = async () => {
editingVolume.value = true;
try {
// 这里应该调用修改数据卷的API
const sizeGb = volumeForm._sizeUnit === 'TB' ? volumeForm.size * 1024 : volumeForm.size
const res = await updateVolume({
volume_id: currentVolumeToEdit.value.id,
size: volumeForm.size
size: sizeGb
});
console.log("编辑数据卷数据:",res)
@@ -2770,4 +2781,7 @@ const fetchServersList = async () => {
font-weight: 600;
color: #303133;
}
.unit-input-row { display: flex; align-items: center; gap: 6px; width: 100%; }
.unit-select { width: 90px; flex-shrink: 0; }
</style>