mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-02 08:29:21 +00:00
feat: 新增配置中心功能并优化系统配置管理
refactor: 重构配置管理相关代码,包括模型、参数和CRUD操作 docs: 更新README文档中的图片引用 style: 统一前端表格样式和布局,优化暗色模式背景色 fix: 修复日志记录中用户信息泄露问题 perf: 优化前端路由和组件性能 chore: 更新依赖和脚本文件 ``` 这个提交消息涵盖了以下主要变更: 1. 新增了配置中心功能模块 2. 重构了后端配置管理相关代码 3. 更新了文档中的图片引用 4. 统一了前端表格样式 5. 修复了安全相关问题 6. 优化了前端性能 7. 更新了项目依赖 消息遵循了约定的提交格式,每个类型都准确地描述了变更的性质,并保持了简洁性。
This commit is contained in:
+1
-1
@@ -43,4 +43,4 @@ watch(() => route.path, getBreadcrumb, { immediate: true });
|
||||
.a-breadcrumb {
|
||||
margin: 12px 0;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,55 +0,0 @@
|
||||
<template>
|
||||
<div class="page-header">
|
||||
<div class="page-header-breadcrumb">
|
||||
<a-breadcrumb :routes="routes">
|
||||
<template #itemRender="{ route, routes }">
|
||||
<span v-if="routes.indexOf(route) === routes.length - 1">{{ route.breadcrumbName }}</span>
|
||||
<router-link v-else :to="route.path">{{ route.breadcrumbName }}</router-link>
|
||||
</template>
|
||||
</a-breadcrumb>
|
||||
</div>
|
||||
<div class="page-header-title">
|
||||
{{ title }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const title = ref<string | undefined>('');
|
||||
|
||||
interface Route {
|
||||
path: string,
|
||||
breadcrumbName: string | undefined
|
||||
}
|
||||
const routes = ref<Route[]>([])
|
||||
const route = useRoute();
|
||||
|
||||
const getBreadcrumb = () => {
|
||||
title.value = route.meta.title?.toString();
|
||||
routes.value.splice(0, routes.value.length);
|
||||
if (route.matched.length > 2) {
|
||||
route.matched.forEach((item, index) => {
|
||||
if (index !== 0) {
|
||||
routes.value.push({ path: item.path, breadcrumbName: item.meta.title?.toString() })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => getBreadcrumb());
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-header {
|
||||
padding: 0px 0;
|
||||
}
|
||||
|
||||
.page-header-title {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
padding: 6px 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<a-page-header
|
||||
:style="headerStyle"
|
||||
:title="getPageTitle"
|
||||
>
|
||||
<!-- 可以添加更多插槽,让组件更灵活 -->
|
||||
<template #extra>
|
||||
<slot name="extra"></slot>
|
||||
</template>
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
// 定义 props
|
||||
const props = defineProps<{
|
||||
title?: string;
|
||||
headerStyle?: string;
|
||||
}>();
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
// 计算属性获取页面标题
|
||||
const getPageTitle = computed(() => {
|
||||
return props.title || route.meta.title?.toString() || '未命名';
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -7,13 +7,19 @@
|
||||
@edit="onEdit"
|
||||
@change="onChange"
|
||||
>
|
||||
|
||||
<a-tab-pane
|
||||
v-for="pane in panes"
|
||||
:key="pane.key"
|
||||
:tab="pane.title"
|
||||
:closable="pane.closable"
|
||||
/>
|
||||
<!-- 使用 rightExtra 插槽添加关闭全部按钮 -->
|
||||
<template #rightExtra>
|
||||
<a-button type="link" @click="closeAllTabs">关闭全部</a-button>
|
||||
</template>
|
||||
</a-tabs>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@@ -71,7 +77,22 @@ const onEdit = (targetKey: string | MouseEvent, action: string) => {
|
||||
};
|
||||
|
||||
const onChange = (targetKey: string) => {
|
||||
router.push(targetKey);
|
||||
if (targetKey !== 'close-all') {
|
||||
router.push(targetKey);
|
||||
} else {
|
||||
// 防止跳转到不存在的路由
|
||||
activeKey.value = panes.value[0].key;
|
||||
}
|
||||
};
|
||||
|
||||
// 新增关闭所有标签的方法
|
||||
const closeAllTabs = () => {
|
||||
// 过滤出不可关闭的标签
|
||||
panes.value = panes.value.filter(pane => !pane.closable);
|
||||
if (panes.value.length > 0) {
|
||||
activeKey.value = panes.value[0].key;
|
||||
router.push(activeKey.value);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(getRoute);
|
||||
|
||||
Reference in New Issue
Block a user