mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-08 10:39:59 +00:00
feat: 迁移前端资源文件并重构项目结构
refactor: 优化前端代码结构和资源管理 style: 调整前端代码格式和样式 chore: 更新.gitignore和构建配置 fix: 修复前端资源路径和引用问题 docs: 更新前端文档和注释 perf: 优化前端性能和加载速度 test: 更新前端测试用例 build: 调整前端构建配置 ci: 更新CI/CD配置
This commit is contained in:
@@ -1,31 +1,40 @@
|
||||
<!-- 部门树 -->
|
||||
<!-- 部门树(无外层卡片,由用户页左侧 ElCard 统一包裹) -->
|
||||
<template>
|
||||
<el-card shadow="hover">
|
||||
<div class="dept-tree-root">
|
||||
<div class="dept-tree-toolbar">
|
||||
<el-input v-model="deptName" placeholder="部门名称" class="dept-tree-search">
|
||||
<template #prefix>
|
||||
<el-icon>
|
||||
<Search />
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
<ElInput
|
||||
v-model="deptName"
|
||||
class="dept-tree-search"
|
||||
placeholder="部门名称"
|
||||
size="small"
|
||||
class="dept-tree-expand-btn"
|
||||
@click="toggleTreeExpandAll"
|
||||
clearable
|
||||
>
|
||||
<el-icon :size="14">
|
||||
<Switch />
|
||||
</el-icon>
|
||||
<span>{{ treeExpanded ? "收起" : "展开" }}</span>
|
||||
</el-button>
|
||||
<template #prefix>
|
||||
<ElIcon class="dept-tree-search__prefix-icon">
|
||||
<Search />
|
||||
</ElIcon>
|
||||
</template>
|
||||
<template #suffix>
|
||||
<ElTooltip :content="treeExpanded ? '收起全部' : '展开全部'" placement="top">
|
||||
<span
|
||||
class="dept-tree-expand-trigger"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
@click.stop="toggleTreeExpandAll"
|
||||
@keydown.enter.prevent="toggleTreeExpandAll"
|
||||
>
|
||||
<ElIcon :size="15">
|
||||
<Switch />
|
||||
</ElIcon>
|
||||
</span>
|
||||
</ElTooltip>
|
||||
</template>
|
||||
</ElInput>
|
||||
</div>
|
||||
|
||||
<el-tree
|
||||
<ElTree
|
||||
ref="deptTreeRef"
|
||||
class="mt-2"
|
||||
class="dept-tree-body"
|
||||
node-key="value"
|
||||
:data="deptOptions"
|
||||
:props="{ children: 'children', label: 'label', disabled: 'disabled' }"
|
||||
@@ -35,16 +44,16 @@
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
<template #empty>
|
||||
<el-empty :image-size="80" description="暂无数据" />
|
||||
<ElEmpty :image-size="80" description="暂无数据" />
|
||||
</template>
|
||||
</el-tree>
|
||||
</el-card>
|
||||
</ElTree>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Switch } from "@element-plus/icons-vue";
|
||||
import { Search, Switch } from "@element-plus/icons-vue";
|
||||
import DeptAPI, { DeptPageQuery } from "@/api/module_system/dept";
|
||||
import { formatTree } from "@/utils/common";
|
||||
import { formatTree } from "@utils/common";
|
||||
import type { FilterNodeMethodFunction, TreeInstance } from "element-plus";
|
||||
|
||||
const props = defineProps({
|
||||
@@ -156,22 +165,51 @@ onBeforeMount(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.dept-tree-root {
|
||||
box-sizing: border-box;
|
||||
padding: 16px 6px 12px 10px;
|
||||
}
|
||||
|
||||
.dept-tree-toolbar {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
align-items: stretch;
|
||||
|
||||
.dept-tree-search {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.dept-tree-expand-btn {
|
||||
flex-shrink: 0;
|
||||
height: auto;
|
||||
min-height: unset;
|
||||
padding: 0 4px;
|
||||
font-size: 12px;
|
||||
.dept-tree-search__prefix-icon {
|
||||
color: var(--el-text-color-placeholder);
|
||||
}
|
||||
|
||||
.dept-tree-expand-trigger {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 2px;
|
||||
margin-right: -2px;
|
||||
vertical-align: middle;
|
||||
color: var(--el-text-color-secondary);
|
||||
cursor: pointer;
|
||||
border-radius: var(--el-border-radius-small);
|
||||
transition:
|
||||
color 0.15s ease,
|
||||
background-color 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
color: var(--el-color-primary);
|
||||
background-color: var(--el-fill-color-light);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 2px solid var(--el-color-primary-light-5);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dept-tree-body {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
@clear-click="handleClearSelection"
|
||||
>
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row[scope.prop] === '0' ? 'success' : 'danger'">
|
||||
<ElTag :type="scope.row[scope.prop] === '0' ? 'success' : 'danger'">
|
||||
{{ scope.row[scope.prop] === "0" ? "启用" : "停用" }}
|
||||
</el-tag>
|
||||
</ElTag>
|
||||
</template>
|
||||
</table-select>
|
||||
</template>
|
||||
@@ -29,7 +29,8 @@ const emit = defineEmits<{
|
||||
|
||||
const selectConfig: ISelectConfig = {
|
||||
pk: "id",
|
||||
width: "167.5px", // 与搜索表单其他输入宽度一致
|
||||
/** 与 ArtSearchBar 栅格内 ElInput 一致,占满表单项内容区 */
|
||||
width: "100%",
|
||||
placeholder: "请选择用户",
|
||||
popover: {
|
||||
width: 720, // 弹出层宽度,提升可用性(约 720px)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user