✨ 支持批量连接终端
This commit is contained in:
parent
5f8c3aabe7
commit
be0ee9e86e
@ -7,6 +7,7 @@
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="handleBatchSSH">连接终端</el-dropdown-item>
|
||||
<el-dropdown-item @click="handleBatchModify">批量修改</el-dropdown-item>
|
||||
<el-dropdown-item @click="handleBatchRemove">批量删除</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
@ -78,7 +79,7 @@ import HostForm from './components/host-form.vue'
|
||||
import ImportHost from './components/import-host.vue'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
|
||||
const { proxy: { $api, $store, $message, $messageBox } } = getCurrentInstance()
|
||||
const { proxy: { $api, $store, $router, $message, $messageBox } } = getCurrentInstance()
|
||||
|
||||
let updateHostData = ref(null)
|
||||
let hostFormVisible = ref(false)
|
||||
@ -103,6 +104,11 @@ let handleSelectChange = (val) => {
|
||||
selectHosts.value = val
|
||||
}
|
||||
|
||||
let handleBatchSSH = () => {
|
||||
let ips = selectHosts.value.map(item => item.host)
|
||||
$router.push({ path: '/terminal', query: { host: ips.join(',') } })
|
||||
}
|
||||
|
||||
let handleBatchModify = async () => {
|
||||
if (!selectHosts.value.length) return $message.warning('请选择要批量操作的实例')
|
||||
isBatchModify.value = true
|
||||
|
@ -59,7 +59,7 @@ import HostForm from '../server/components/host-form.vue'
|
||||
|
||||
const { proxy: { $store, $message } } = getCurrentInstance()
|
||||
|
||||
const emit = defineEmits(['add-host',])
|
||||
// const emit = defineEmits(['add-host',])
|
||||
|
||||
let terminalTabs = reactive([])
|
||||
let hostFormVisible = ref(false)
|
||||
@ -104,9 +104,9 @@ onActivated(async () => {
|
||||
await nextTick()
|
||||
const { host } = route.query
|
||||
if (!host) return
|
||||
let targetHost = hostList.value.find(item => item.host === host)
|
||||
if (!targetHost) return
|
||||
terminalTabs.push(targetHost)
|
||||
let targetHosts = hostList.value.filter(item => host.includes(item.host))
|
||||
if (!targetHosts || !targetHosts.length) return
|
||||
terminalTabs.push(...targetHosts)
|
||||
})
|
||||
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user