前端业务拆分.

This commit is contained in:
lijiahang
2024-01-04 17:58:20 +08:00
parent 685e68a47f
commit 50f2c8cc6a
30 changed files with 73 additions and 51 deletions

View File

@@ -22,10 +22,6 @@ const ASSET: AppRouteRecordRaw = {
name: 'assetGrant',
path: '/asset/grant',
component: () => import('@/views/asset/grant/index.vue'),
}, {
name: 'assetHostConnectLog',
path: '/asset/host-connect-log',
component: () => import('@/views/asset/host-connect-log/index.vue'),
},
],
};

View File

@@ -0,0 +1,18 @@
import type { AppRouteRecordRaw } from '../types';
import { DEFAULT_LAYOUT } from '../base';
const HOST_REVIEW: AppRouteRecordRaw =
{
name: 'hostReview',
path: '/host-review',
component: DEFAULT_LAYOUT,
children: [
{
name: 'hostReviewConnectLog',
path: '/host-review/connect-log',
component: () => import('@/views/host-review/connect-log/index.vue'),
},
],
};
export default HOST_REVIEW;

View File

@@ -1,15 +1,15 @@
import type { AppRouteRecordRaw } from '../types';
import { FULL_LAYOUT } from '../base';
const HOST_OPS: AppRouteRecordRaw = {
name: 'hostOps',
const HOST: AppRouteRecordRaw = {
name: 'host',
path: '/host',
component: FULL_LAYOUT,
children: [
{
name: 'hostTerminal',
path: '/host/terminal',
component: () => import('@/views/host-ops/terminal/index.vue'),
component: () => import('@/views/host/terminal/index.vue'),
meta: {
noAffix: true
}
@@ -17,4 +17,4 @@ const HOST_OPS: AppRouteRecordRaw = {
],
};
export default HOST_OPS;
export default HOST;

View File

@@ -4,8 +4,9 @@ import { defineStore } from 'pinia';
import { getPreference, updatePreference } from '@/api/user/preference';
import { Message } from '@arco-design/web-vue';
import { useDark } from '@vueuse/core';
import { DEFAULT_SCHEMA } from '@/views/host-ops/terminal/types/terminal.theme';
import { InnerTabs } from '@/views/host-ops/terminal/types/terminal.const';
import { DEFAULT_SCHEMA } from '@/views/host/terminal/types/terminal.theme';
import { InnerTabs } from '@/views/host/terminal/types/terminal.const';
import { getHostTerminalAccessToken } from '@/api/asset/host-terminal';
// 暗色主题
export const DarkTheme = {
@@ -33,7 +34,8 @@ export default defineStore('terminal', {
tabs: {
active: InnerTabs.NEW_CONNECTION.key,
items: [InnerTabs.NEW_CONNECTION, InnerTabs.VIEW_SETTING]
}
},
access: undefined
}),
actions: {
@@ -139,7 +141,13 @@ export default defineStore('terminal', {
},
// 打开终端
openTerminal(record: HostQueryResponse) {
async openTerminal(record: HostQueryResponse) {
// 获取 access
if (!this.access) {
const { data } = await getHostTerminalAccessToken();
this.access = data;
}
console.log(this.access);
console.log(record);
}

View File

@@ -1,9 +1,11 @@
import type { Ref } from 'vue';
import type { HostTerminalAccessResponse } from '@/api/asset/host-terminal';
export interface TerminalState {
isDarkTheme: Ref<boolean>;
preference: TerminalPreference;
tabs: TerminalTabs;
access?: HostTerminalAccessResponse;
}
// 终端配置

View File

@@ -97,7 +97,7 @@
<script lang="ts">
export default {
name: 'asset-host-connect-log-table'
name: 'hostReviewConnectLogTable'
};
</script>

View File

@@ -1,18 +1,18 @@
<template>
<div class="layout-container" v-if="render">
<!-- 列表-表格 -->
<host-connect-log-table />
<connect-log-table />
</div>
</template>
<script lang="ts">
export default {
name: 'assetHostConnectLog'
name: 'hostReviewConnectLog'
};
</script>
<script lang="ts" setup>
import HostConnectLogTable from './components/host-connect-log-table.vue';
import ConnectLogTable from './components/connect-log-table.vue';
import { ref, onBeforeMount, onUnmounted } from 'vue';
import { useCacheStore, useDictStore } from '@/store';
import { dictKeys } from './types/const';

View File

@@ -11,10 +11,6 @@
<new-connection-view v-if="tab.key === InnerTabs.NEW_CONNECTION.key" />
<!-- 显示设置 -->
<terminal-view-setting v-else-if="tab.key === InnerTabs.VIEW_SETTING.key" />
<span v-else>
{{ tab.key }}
{{ tab.title }}
</span>
</template>
<!-- 终端 -->
<template v-else-if="tab.type === TabType.TERMINAL">

View File

@@ -14,37 +14,39 @@
:cancel-button-props="{ disabled: loading }"
:on-before-ok="handlerOk"
@close="handleClose">
<a-spin :loading="loading" class="role-menu-wrapper">
<a-alert class="usn mb8">
<span>{{ roleRecord.name }} {{ roleRecord.code }}</span>
<span class="mx8">-</span>
<span>菜单分配后需要用户手动刷新页面才会生效</span>
</a-alert>
<div class="usn mb8">
<a-space>
<a-tag color="arcoblue">全选操作</a-tag>
<!-- 全选操作 -->
<template v-for="opt of quickGrantMenuOperator" :key="opt.name">
<a-button size="mini" type="text" @click="() => { table.checkOrUncheckByFilter(opt.filter, true) }">
{{ opt.name }}
</a-button>
</template>
</a-space>
</div>
<div class="usn mb8">
<a-space>
<a-tag color="arcoblue">反选操作</a-tag>
<!-- 反选操作 -->
<template v-for="opt of quickGrantMenuOperator" :key="opt.name">
<a-button size="mini" type="text" @click="() => { table.checkOrUncheckByFilter(opt.filter, false) }">
{{ opt.name }}
</a-button>
</template>
</a-space>
</div>
<!-- 菜单 -->
<menu-grant-table ref="table" />
</a-spin>
<div class="role-menu-wrapper">
<a-spin :loading="loading">
<a-alert class="usn mb8">
<span>{{ roleRecord.name }} {{ roleRecord.code }}</span>
<span class="mx8">-</span>
<span>菜单分配后需要用户手动刷新页面才会生效</span>
</a-alert>
<div class="usn mb8">
<a-space>
<a-tag color="arcoblue">全选操作</a-tag>
<!-- 全选操作 -->
<template v-for="opt of quickGrantMenuOperator" :key="opt.name">
<a-button size="mini" type="text" @click="() => { table.checkOrUncheckByFilter(opt.filter, true) }">
{{ opt.name }}
</a-button>
</template>
</a-space>
</div>
<div class="usn mb8">
<a-space>
<a-tag color="arcoblue">反选操作</a-tag>
<!-- 反选操作 -->
<template v-for="opt of quickGrantMenuOperator" :key="opt.name">
<a-button size="mini" type="text" @click="() => { table.checkOrUncheckByFilter(opt.filter, false) }">
{{ opt.name }}
</a-button>
</template>
</a-space>
</div>
<!-- 菜单 -->
<menu-grant-table ref="table" />
</a-spin>
</div>
</a-modal>
</template>