This commit is contained in:
qiuyuan 2026-02-09 17:47:58 +08:00
parent 22ea512030
commit 1601c8dc5a

View File

@ -39,7 +39,8 @@
<!-- 状态列 --> <!-- 状态列 -->
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'"> <template v-if="column.key === 'status'">
<span :style="{ color: instanceStatus.get(record.status)?.color }">{{ instanceStatus.get(record.status)?.text <span :style="{ color: instanceStatus.get(record.status)?.color }">{{
instanceStatus.get(record.status)?.text
}}</span> }}</span>
</template> </template>
@ -66,6 +67,18 @@
{{ payTypeDic.get(record.price_type) }} {{ payTypeDic.get(record.price_type) }}
</span> </span>
</template> </template>
<template v-else-if="column.key === 'ssh_link'">
<span>
{{
record.ssh_link
? JSON.parse(record.ssh_link)?.root_password|| 'N/A'
: 'N/A'
}}
</span>
</template>
<!-- 操作列 --> <!-- 操作列 -->
<template v-else-if="column.key === 'actions'"> <template v-else-if="column.key === 'actions'">
<div class="action-buttons"> <div class="action-buttons">
@ -158,7 +171,7 @@
</a-modal> </a-modal>
<!-- 释放确认模态框 --> <!-- 释放确认模态框 -->
<a-modal v-model:open="releaseModalVisible" title="确认释放" @ok="confirmRelease" @cancel="releaseModalVisible = false" > <a-modal v-model:open="releaseModalVisible" title="确认释放" @ok="confirmRelease" @cancel="releaseModalVisible = false">
<div class="modal-content"> <div class="modal-content">
<exclamation-circle-outlined class="warning-icon" <exclamation-circle-outlined class="warning-icon"
style="color: #ff4d4f; font-size: 24px; margin-right: 12px;" /> style="color: #ff4d4f; font-size: 24px; margin-right: 12px;" />
@ -177,12 +190,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted, computed } from 'vue' import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { ExclamationCircleOutlined, ReloadOutlined, EyeOutlined, DownOutlined, RedoOutlined, DeleteOutlined,CheckCircleOutlined } from '@ant-design/icons-vue' import { ExclamationCircleOutlined, ReloadOutlined, EyeOutlined, DownOutlined, RedoOutlined, DeleteOutlined, CheckCircleOutlined } from '@ant-design/icons-vue'
import type { TableColumnType } from 'ant-design-vue' import type { TableColumnType } from 'ant-design-vue'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { hostCaseList } from '@/apis/admin' import { hostCaseList } from '@/apis/admin'
import { releaseCase, reStartCase } from '@/apis/home' import { releaseCase, reStartCase } from '@/apis/home'
import { get } from 'http'
import { payTypeDic, instanceStatus } from '@/utils/dict' import { payTypeDic, instanceStatus } from '@/utils/dict'
const router = useRouter() const router = useRouter()
@ -219,7 +231,7 @@ const mockData = ref([])
// //
const columns = ref<TableColumnType[]>([ const columns = ref<TableColumnType[]>([
{ title: '实例ID', dataIndex: 'id', key: 'id', width: 100,fixed: 'left' }, { title: '实例ID', dataIndex: 'id', key: 'id', width: 100, fixed: 'left' },
{ title: '名称', dataIndex: 'name', key: 'name', width: 200 }, { title: '名称', dataIndex: 'name', key: 'name', width: 200 },
{ title: '状态', dataIndex: 'status', key: 'status', width: 200 }, { title: '状态', dataIndex: 'status', key: 'status', width: 200 },
{ title: '规格详情', dataIndex: 'spec', key: 'spec', width: 250 }, { title: '规格详情', dataIndex: 'spec', key: 'spec', width: 250 },
@ -228,7 +240,7 @@ const columns = ref<TableColumnType[]>([
{ title: '释放时间', dataIndex: 'release_at', key: 'release_at', width: 250 }, { title: '释放时间', dataIndex: 'release_at', key: 'release_at', width: 250 },
{ title: '停机时间', dataIndex: 'down_at', key: 'down_at', width: 250 }, { title: '停机时间', dataIndex: 'down_at', key: 'down_at', width: 250 },
{ title: 'SSH登录', dataIndex: 'ssh_link', key: 'ssh_link', width: 250 }, { title: 'SSH登录', dataIndex: 'ssh_link', key: 'ssh_link', width: 250 },
{ title: '操作', key: 'actions', width: 150,fixed:'right' } { title: '操作', key: 'actions', width: 150, fixed: 'right' }
]) ])
const getDataList = async () => { const getDataList = async () => {
@ -385,12 +397,12 @@ const handleRent = () => {
const handleJupyterLab = async (record: any) => { const handleJupyterLab = async (record: any) => {
try { try {
if(record.ssh_link){ if (record.ssh_link) {
const linkObj = JSON.parse(record.ssh_link) const linkObj = JSON.parse(record.ssh_link)
if(linkObj.proxy_host && linkObj.jupyter_token){ if (linkObj.proxy_host && linkObj.jupyter_token && linkObj.jupyter_port) {
const baseUrl = `http://${linkObj.proxy_host}:5784/jupyter?token=${linkObj.jupyter_token}` const baseUrl = `http://${linkObj.proxy_host}:${linkObj.jupyter_port}/jupyter/lab?token=${linkObj.jupyter_token}`
console.log("====",baseUrl) console.log("====", baseUrl)
// window.open(baseUrl, '_blank', 'noopener,noreferrer') window.open(baseUrl, '_blank', 'noopener,noreferrer')
} }
} }