fix: 重构虚拟机内网外网参数设置选择网络
Build and Deploy Vue3 / build (push) Successful in 1m28s
Build and Deploy Vue3 / deploy (push) Successful in 1m1s

This commit is contained in:
2026-03-26 16:36:25 +08:00
parent 40a5e486a6
commit 1a4587f893
13 changed files with 1028 additions and 135 deletions
+10 -5
View File
@@ -65,7 +65,7 @@
</el-table-column>
<el-table-column label="状态" width="80">
<template #default="{ row }">
<el-tag v-if="row._isHost" :type="row.is_active ? 'success' : 'danger'" size="small">{{ row.is_active ? '启用' : '禁用' }}</el-tag>
<el-tag v-if="row._isHost" :type="row.is_active ? 'success' : 'info'" size="small">{{ row.is_active ? '在线' : '离线' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="280" fixed="right">
@@ -190,6 +190,9 @@
<el-form-item label="SSH 密码">
<el-input v-model="hostForm.password" placeholder="可选" show-password />
</el-form-item>
<el-form-item label="SSH 私钥">
<el-input v-model="hostForm.private_key" type="textarea" :rows="4" placeholder="SSH 私钥内容(可选)" />
</el-form-item>
<el-divider content-position="left">资源限制</el-divider>
<el-form-item label="最大CPU(核)">
<el-input-number v-model="hostForm.max_cpu" :min="0" controls-position="right" style="width: 240px" />
@@ -525,7 +528,7 @@ const hostDialogType = ref('add')
const hostFormRef = ref(null)
const hostForm = reactive({
id: undefined, name: '', base_url: '', ip: '', token: '',
port: 22, user: '', password: '',
port: 22, user: '', password: '', private_key: '',
max_cpu: 0, max_memory: 0, max_disk: 0,
rx_bandwidth: 0, tx_bandwidth: 0, host_group_id: 0, description: ''
})
@@ -537,13 +540,13 @@ const hostFormRules = {
const handleAddHost = () => {
hostDialogType.value = 'add'
Object.assign(hostForm, { id: undefined, name: '', base_url: '', ip: '', token: '', port: 22, user: '', password: '', max_cpu: 0, max_memory: 0, max_disk: 0, rx_bandwidth: 0, tx_bandwidth: 0, host_group_id: 0, description: '' })
Object.assign(hostForm, { id: undefined, name: '', base_url: '', ip: '', token: '', port: 22, user: '', password: '', private_key: '', max_cpu: 0, max_memory: 0, max_disk: 0, rx_bandwidth: 0, tx_bandwidth: 0, host_group_id: 0, description: '' })
hostDialogVisible.value = true
}
const handleAddHostToGroup = (group) => {
hostDialogType.value = 'add'
Object.assign(hostForm, { id: undefined, name: '', base_url: '', ip: '', token: '', port: 22, user: '', password: '', max_cpu: 0, max_memory: 0, max_disk: 0, rx_bandwidth: 0, tx_bandwidth: 0, host_group_id: group.id, description: '' })
Object.assign(hostForm, { id: undefined, name: '', base_url: '', ip: '', token: '', port: 22, user: '', password: '', private_key: '', max_cpu: 0, max_memory: 0, max_disk: 0, rx_bandwidth: 0, tx_bandwidth: 0, host_group_id: group.id, description: '' })
hostDialogVisible.value = true
}
@@ -551,7 +554,7 @@ const handleEditHost = (row) => {
hostDialogType.value = 'edit'
Object.assign(hostForm, {
id: row.id, name: row.name, base_url: row.base_url || '', ip: row.ip || '', token: row.token || '',
port: row.port || 22, user: row.user || '', password: row.password || '',
port: row.port || 22, user: row.user || '', password: row.password || '', private_key: row.private_key || '',
max_cpu: row.max_cpu || 0, max_memory: row.max_memory || 0, max_disk: row.max_disk || 0,
rx_bandwidth: row.rx_bandwidth || 0, tx_bandwidth: row.tx_bandwidth || 0,
host_group_id: row.host_group_id || 0, description: row.description || ''
@@ -561,6 +564,7 @@ const handleEditHost = (row) => {
const d = res.data.data.host ?? res.data.data.data ?? res.data.data
if (d.password) hostForm.password = d.password
if (d.token) hostForm.token = d.token
if (d.private_key) hostForm.private_key = d.private_key
}
}).catch(() => {})
hostDialogVisible.value = true
@@ -575,6 +579,7 @@ const submitHostForm = () => {
delete payload.id
if (!payload.token) delete payload.token
if (!payload.password) delete payload.password
if (!payload.private_key) delete payload.private_key
if (!payload.host_group_id) delete payload.host_group_id
if (!payload.description) delete payload.description
let res