🔨 优化页面加载逻辑.

This commit is contained in:
lijiahangmax
2025-07-03 00:01:41 +08:00
parent 0b4e42ee89
commit 6fa2d65e18
8 changed files with 41 additions and 19 deletions

View File

@@ -30,7 +30,7 @@ const checkForVersionUpdate = (serverVersion: string) => {
return; return;
} }
// 提示用户更新 // 提示用户更新
if (window.confirm('检测到新版本, 是否刷新页面以获取最新内容?')) { if (window.confirm('检测到新版本, 请强制刷新页面以获取最新内容!')) {
window.location.reload(); window.location.reload();
} }
// 更新 localStorage 记录 // 更新 localStorage 记录

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="layout-container view-container"> <div class="layout-container view-container" v-if="render">
<a-tabs v-model:active-key="activeKey" <a-tabs v-model:active-key="activeKey"
class="tabs-container simple-card" class="tabs-container simple-card"
size="large" size="large"
@@ -32,12 +32,14 @@
const route = useRoute(); const route = useRoute();
const render = ref();
const activeKey = ref(); const activeKey = ref();
// 加载字典项 // 加载字典项
onBeforeMount(async () => { onBeforeMount(async () => {
const dictStore = useDictStore(); const dictStore = useDictStore();
await dictStore.loadKeys(dictKeys); await dictStore.loadKeys(dictKeys);
render.value = true;
}); });
// 跳转到指定页 // 跳转到指定页

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="layout-container"> <div class="layout-container" v-if="render">
<!-- 列表-表格 --> <!-- 列表-表格 -->
<host-identity-table v-if="renderTable" <host-identity-table v-if="renderTable"
ref="table" ref="table"
@@ -36,6 +36,7 @@
import HostIdentityFormModal from './components/host-identity-form-modal.vue'; import HostIdentityFormModal from './components/host-identity-form-modal.vue';
import HostKeyFormDrawer from '../host-key/components/host-key-form-drawer.vue'; import HostKeyFormDrawer from '../host-key/components/host-key-form-drawer.vue';
const render = ref();
const table = ref(); const table = ref();
const card = ref(); const card = ref();
const modal = ref(); const modal = ref();
@@ -57,6 +58,7 @@
onBeforeMount(async () => { onBeforeMount(async () => {
const dictStore = useDictStore(); const dictStore = useDictStore();
await dictStore.loadKeys(dictKeys); await dictStore.loadKeys(dictKeys);
render.value = true;
}); });
</script> </script>

View File

@@ -208,6 +208,31 @@
<!-- 拓展操作 --> <!-- 拓展操作 -->
<template #extra="{ record }"> <template #extra="{ record }">
<a-space> <a-space>
<!-- 单协议连接 -->
<a-button v-if="record.types?.length === 1"
size="mini"
v-permission="['terminal:terminal:access']"
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: record.types[0] } })">
连接
</a-button>
<!-- 多协议连接 -->
<a-popover v-if="(record.types?.length || 0) > 1"
:title="undefined"
:content-style="{ padding: '8px' }">
<a-button v-permission="['terminal:terminal:access']" size="mini">
连接
</a-button>
<template #content>
<a-space>
<a-button v-for="type in record.types"
:key="type"
size="mini"
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type} })">
{{ type }}
</a-button>
</a-space>
</template>
</a-popover>
<!-- 更多操作 --> <!-- 更多操作 -->
<a-dropdown trigger="hover" :popup-max-height="false"> <a-dropdown trigger="hover" :popup-max-height="false">
<icon-more class="card-extra-icon" /> <icon-more class="card-extra-icon" />
@@ -236,18 +261,6 @@
@click="deleteRow(record.id)"> @click="deleteRow(record.id)">
<span class="more-doption error">删除</span> <span class="more-doption error">删除</span>
</a-doption> </a-doption>
<!-- SSH -->
<a-doption v-if="record.types.includes(HostType.SSH.value)"
v-permission="['terminal:terminal:access']"
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'SSH' } })">
<span class="more-doption normal">SSH</span>
</a-doption>
<!-- RDP -->
<a-doption v-if="record.types.includes(HostType.RDP.value)"
v-permission="['terminal:terminal:access']"
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type: 'RDP' } })">
<span class="more-doption normal">RDP</span>
</a-doption>
</template> </template>
</a-dropdown> </a-dropdown>
</a-space> </a-space>

View File

@@ -274,7 +274,6 @@
<a-space> <a-space>
<a-button v-for="type in record.types" <a-button v-for="type in record.types"
:key="type" :key="type"
type="text"
size="mini" size="mini"
@click="openNewRoute({ name: 'terminal', query: { connect: record.id, type} })"> @click="openNewRoute({ name: 'terminal', query: { connect: record.id, type} })">
{{ type }} {{ type }}

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="layout-container"> <div class="layout-container" v-if="render">
<!-- 列表-表格 --> <!-- 列表-表格 -->
<host-table v-if="renderTable" <host-table v-if="renderTable"
ref="table" ref="table"
@@ -36,6 +36,7 @@
import HostFormDrawer from './components/host-form-drawer.vue'; import HostFormDrawer from './components/host-form-drawer.vue';
import HostGroupDrawer from '../host-group/drawer/index.vue'; import HostGroupDrawer from '../host-group/drawer/index.vue';
const render = ref();
const table = ref(); const table = ref();
const card = ref(); const card = ref();
const drawer = ref(); const drawer = ref();
@@ -57,6 +58,7 @@
// 加载字典配置 // 加载字典配置
onBeforeMount(() => { onBeforeMount(() => {
useDictStore().loadKeys(dictKeys); useDictStore().loadKeys(dictKeys);
render.value = true;
}); });
</script> </script>

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="layout-container upload-container"> <div class="layout-container upload-container" v-if="render">
<!-- 上传面板 --> <!-- 上传面板 -->
<upload-panel ref="panel" /> <upload-panel ref="panel" />
</div> </div>
@@ -20,12 +20,14 @@
const route = useRoute(); const route = useRoute();
const render = ref();
const panel = ref(); const panel = ref();
// 加载字典值 // 加载字典值
onMounted(async () => { onMounted(async () => {
const dictStore = useDictStore(); const dictStore = useDictStore();
await dictStore.loadKeys(dictKeys); await dictStore.loadKeys(dictKeys);
render.value = true;
}); });
// 跳转日志 // 跳转日志

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="layout-container full"> <div class="layout-container full" v-if="render">
<!-- 执行面板 --> <!-- 执行面板 -->
<div v-show="!logVisible" class="panel-wrapper"> <div v-show="!logVisible" class="panel-wrapper">
<exec-command-panel @submit="openLog" /> <exec-command-panel @submit="openLog" />
@@ -34,6 +34,7 @@
const { visible: logVisible, setVisible: setLogVisible } = useVisible(); const { visible: logVisible, setVisible: setLogVisible } = useVisible();
const route = useRoute(); const route = useRoute();
const render = ref();
const log = ref(); const log = ref();
// 打开日志 // 打开日志
@@ -56,6 +57,7 @@
onMounted(async () => { onMounted(async () => {
const dictStore = useDictStore(); const dictStore = useDictStore();
await dictStore.loadKeys(dictKeys); await dictStore.loadKeys(dictKeys);
render.value = true;
}); });
// 跳转日志 // 跳转日志