feat: 增加文件夹跳转

This commit is contained in:
zhengkunwang223 2022-12-27 15:36:09 +08:00 committed by zhengkunwang223
parent 68228305f8
commit aa9f6f0f2b
6 changed files with 40 additions and 18 deletions

View file

@ -13,6 +13,7 @@ const hostRouter = {
{
path: '/hosts/files',
name: 'File',
props: true,
component: () => import('@/views/host/file-management/index.vue'),
meta: {
title: 'menu.files',

View file

@ -117,7 +117,7 @@ const handleParams = () => {
} else {
rules[p.envKey] = [Rules.requiredInput];
if (p.envKey === 'PANEL_DB_NAME') {
rules[p.envKey].push(Rules.linuxName);
rules[p.envKey].push(Rules.dbName);
}
}
}

View file

@ -209,7 +209,9 @@ import Download from './download/index.vue';
import { Mimetypes } from '@/global/mimetype';
import Process from './process/index.vue';
import Detail from './detail/index.vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const data = ref();
let selects = ref<any>([]);
let req = reactive({ path: '/', expand: true, showHidden: false, page: 1, pageSize: 100 });
@ -454,7 +456,6 @@ const openWget = () => {
};
const closeWget = (submit: any) => {
console.log(submit);
wgetPage.open = false;
search();
if (submit) {
@ -568,6 +569,9 @@ const buttons = [
];
onMounted(() => {
if (router.currentRoute.value.query.path) {
req.path = String(router.currentRoute.value.query.path);
}
search();
});
</script>

View file

@ -1,22 +1,22 @@
<template>
<el-tabs tab-position="left" type="border-card" v-model="index">
<el-tabs tab-position="left" type="border-card" v-model="tabIndex">
<el-tab-pane :label="$t('website.domainConfig')">
<Doamin :id="id" v-if="index == '0'"></Doamin>
<Doamin :id="id" v-if="tabIndex == '0'"></Doamin>
</el-tab-pane>
<el-tab-pane :label="$t('website.sitePath')">
<SitePath :id="id" v-if="index == '1'"></SitePath>
<SitePath :id="id" v-if="tabIndex == '1'"></SitePath>
</el-tab-pane>
<el-tab-pane :label="$t('website.defaultDoc')">
<Default :id="id" v-if="index == '2'"></Default>
<Default :id="id" v-if="tabIndex == '2'"></Default>
</el-tab-pane>
<el-tab-pane :label="$t('website.rate')">
<LimitConn :id="id" v-if="index == '3'"></LimitConn>
<LimitConn :id="id" v-if="tabIndex == '3'"></LimitConn>
</el-tab-pane>
<el-tab-pane :label="'HTTPS'">
<HTTPS :id="id" v-if="index == '4'"></HTTPS>
<HTTPS :id="id" v-if="tabIndex == '4'"></HTTPS>
</el-tab-pane>
<el-tab-pane :label="$t('website.other')">
<Other :id="id" v-if="index == '5'"></Other>
<Other :id="id" v-if="tabIndex == '5'"></Other>
</el-tab-pane>
</el-tabs>
</template>
@ -42,5 +42,5 @@ const id = computed(() => {
return props.id;
});
let index = ref('0');
let tabIndex = ref('0');
</script>

View file

@ -4,7 +4,12 @@
<br />
<el-descriptions :column="1" border v-loading="loading">
<el-descriptions-item :label="$t('website.siteAlias')">{{ website.alias }}</el-descriptions-item>
<el-descriptions-item :label="$t('website.primaryPath')">{{ website.sitePath }}</el-descriptions-item>
<el-descriptions-item :label="$t('website.primaryPath')">
{{ website.sitePath }}
<el-button type="primary" link @click="toFolder(website.sitePath)">
<el-icon><CopyDocument /></el-icon>
</el-button>
</el-descriptions-item>
</el-descriptions>
<br />
@ -20,6 +25,8 @@
<script lang="ts" setup>
import { GetWebsite } from '@/api/modules/website';
import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const props = defineProps({
id: {
@ -44,6 +51,10 @@ const search = () => {
});
};
const toFolder = (folder: string) => {
router.push({ path: '/hosts/files', query: { path: folder } });
};
onMounted(() => {
search();
});

View file

@ -1,18 +1,18 @@
<template>
<el-card>
<LayoutContent :header="$t('website.websiteConfig')" :back-name="'Website'">
<el-tabs v-model="index" @click="changeTab(index)">
<el-tabs v-model="index">
<el-tab-pane :label="$t('website.basic')" name="basic">
<Basic :key="id" :id="id" v-if="index === 'basic'"></Basic>
<Basic :id="id" v-if="index === 'basic'"></Basic>
</el-tab-pane>
<el-tab-pane :label="$t('website.security')" name="safety">
<Safety :key="id" :id="id" v-if="index === 'safety'"></Safety>
<Safety :id="id" v-if="index === 'safety'"></Safety>
</el-tab-pane>
<el-tab-pane :label="$t('website.log')" name="log">
<Log :key="id" :id="id" v-if="index === 'log'"></Log>
<Log :id="id" v-if="index === 'log'"></Log>
</el-tab-pane>
<el-tab-pane :label="$t('website.source')" name="resource">
<Resource :key="id" :id="id" v-if="index === 'resource'"></Resource>
<Resource :id="id" v-if="index === 'resource'"></Resource>
</el-tab-pane>
</el-tabs>
</LayoutContent>
@ -21,7 +21,7 @@
<script setup lang="ts">
import LayoutContent from '@/layout/layout-content.vue';
import { onMounted, ref } from 'vue';
import { onMounted, ref, watch } from 'vue';
import Basic from './basic/index.vue';
import Safety from './safety/index.vue';
import Resource from './resource/index.vue';
@ -42,8 +42,14 @@ const props = defineProps({
let id = ref(0);
let index = ref('basic');
watch(index, (curr, old) => {
if (curr != old) {
changeTab(curr);
}
});
const changeTab = (index: string) => {
router.replace({ name: 'WebsiteConfig', params: { id: id.value, tab: index } });
router.push({ name: 'WebsiteConfig', params: { id: id.value, tab: index } });
};
onMounted(() => {