fix: 解决数据权限

fix: 优化页面显示
This commit is contained in:
zhangtao
2025-01-13 04:36:14 +08:00
parent 395abc3652
commit cec448c2ef
20 changed files with 155 additions and 97 deletions
+4 -3
View File
@@ -14,7 +14,7 @@
</a-col>
<a-col flex="0 1 450px">
<a-form-item name="user_name" label="用户名" style="max-width: 300px;">
<a-input v-model:value="queryState.user_name" placeholder="请输入登陆用户名称" allowClear></a-input>
<a-input v-model:value="queryState.name" placeholder="请输入登陆用户名称" allowClear></a-input>
</a-form-item>
</a-col>
<a-col flex="0 1 450px">
@@ -43,8 +43,9 @@
:columns="columns"
:data-source="tableData"
:loading="loading"
:scroll="{ x: 500 }"
:pagination="pagination">
:scroll="{ x: 400 }"
:pagination="pagination"
:style="{ minHeight: '420px' }">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'index'">
<span>{{ (pagination.current - 1) * pagination.pageSize + index + 1 }}</span>
+1
View File
@@ -180,6 +180,7 @@ const contentStyle: CSSProperties = {
const footerStyle: CSSProperties = {
textAlign: "center",
background: "none",
flex: "0 0 60px",
};
// 统一的弹窗控制
+48 -28
View File
@@ -7,14 +7,23 @@
<div class="config-edit-wrapper">
<a-card title="系统配置" :bordered="false">
<!-- 动态生成配置项 -->
<a-row :gutter="16">
<a-row :gutter="[16, 24]">
<!-- 网站标题 -->
<a-col :span="12">
<!-- 网站标题 -->
<a-form-item label="网站标题">
<a-input v-model:value="configData.title" placeholder="请输入网站标题" allowClear />
</a-form-item>
</a-col>
<!-- 网站图标 -->
<!-- 网站描述 -->
<a-col :span="12">
<a-form-item label="网站描述">
<a-input v-model:value="configData.description" placeholder="请输入网站描述" allowClear />
</a-form-item>
</a-col>
<!-- 网站图标 -->
<a-col :span="8">
<a-form-item label="网站图标">
<a-upload
v-model:file-list="faviconFileList"
@@ -28,8 +37,10 @@
</div>
</a-upload>
</a-form-item>
</a-col>
<!-- 登录页Logo -->
<!-- 登录页Logo -->
<a-col :span="8">
<a-form-item label="登录页Logo">
<a-upload
v-model:file-list="logoFileList"
@@ -43,8 +54,10 @@
</div>
</a-upload>
</a-form-item>
</a-col>
<!-- 登录页背景图 -->
<!-- 登录页背景图 -->
<a-col :span="8">
<a-form-item label="登录页背景图">
<a-upload
v-model:file-list="backgroundFileList"
@@ -58,38 +71,45 @@
</div>
</a-upload>
</a-form-item>
</a-col>
<!-- 版权信息 -->
<a-form-item label="网站描述">
<a-input v-model:value="configData.description" placeholder="请输入版权信息" allowClear />
</a-form-item>
<!-- 版权信息 -->
<!-- 版权信息 -->
<a-col :span="12">
<a-form-item label="版权信息">
<a-input v-model:value="configData.copyright" placeholder="请输入版权信息" allowClear />
</a-form-item>
</a-col>
<!-- 备案号 -->
<!-- 备案号 -->
<a-col :span="12">
<a-form-item label="备案号">
<a-input v-model:value="configData.keep_record" placeholder="请输入备案号" allowClear />
</a-form-item>
</a-col>
<!-- 帮助链接 -->
<!-- 帮助链接 -->
<a-col :span="12">
<a-form-item label="帮助链接">
<a-input v-model:value="configData.help_url" placeholder="请输入帮助链接" allowClear />
</a-form-item>
</a-col>
<!-- 隐私条款链接 -->
<!-- 隐私条款链接 -->
<a-col :span="12">
<a-form-item label="隐私条款链接">
<a-input v-model:value="configData.privacy_url" placeholder="请输入隐私条款链接" allowClear />
</a-form-item>
</a-col>
<!-- 服务条款链接 -->
<!-- 服务条款链接 -->
<a-col :span="12">
<a-form-item label="服务条款链接">
<a-input v-model:value="configData.clause_url" placeholder="请输入服务条款链接" allowClear />
</a-form-item>
</a-col>
<!-- 代码仓库链接 -->
<!-- 代码仓库链接 -->
<a-col :span="12">
<a-form-item label="代码仓库链接">
<a-input v-model:value="configData.code_url" placeholder="请输入代码仓库链接" allowClear />
</a-form-item>
@@ -115,18 +135,18 @@ import type { tableDataType } from './types';
// 配置数据
const configData = reactive<tableDataType>({
id: 1,
title: 'FastAPI Vue Admin',
favicon: 'http://example.com/favicon.png',
logo: 'http://example.com/logo.png',
background: 'http://example.com/background.png',
description: 'FastAPI Vue Admin 是完全开源的权限管理系统',
copyright: 'Copyright © 2021-2025 fastapi-vue-admin.com',
keep_record: '晋ICP备18005113号-3',
help_url: 'https://django-vue-admin.com',
privacy_url: '/api/system/clause/privacy.html',
clause_url: '/api/system/clause/terms_service.html',
code_url: 'https://gitee.com/tao__tao/fastapi_vue_admin.git',
id: 1,
title: '',
favicon: '',
logo: '',
background: '',
description: '',
copyright: '',
keep_record: '',
help_url: '',
privacy_url: '',
clause_url: '',
code_url: '',
});
// 文件上传列表
+3 -2
View File
@@ -57,7 +57,7 @@
</a-space>
</template>
<a-table v-if="dataSource.length"
<a-table v-if="dataSource"
:defaultExpandAllRows="true"
:rowKey="record => record.id"
:columns="columns"
@@ -66,7 +66,7 @@
:scroll="{ x: 500, y: 'calc(100vh - 300px)' }"
:row-selection="rowSelection"
:pagination="false"
:style="{ minHeight: '300px' }"
:style="{ minHeight: '420px' }"
>
<template #bodyCell="{ column, record }">
@@ -116,6 +116,7 @@
<a-badge :status="detailState.available ? 'processing': 'error'" :text="detailState.available ? '启用' : '停用'" />
</a-descriptions-item>
<a-descriptions-item label="上级部门" :span="2">{{ detailState.parent_name }}</a-descriptions-item>
<a-descriptions-item label="创建人">{{ detailState.creator ? detailState.creator.name : '-' }}</a-descriptions-item>
<a-descriptions-item label="创建时间">{{ detailState.created_at }}</a-descriptions-item>
<a-descriptions-item label="修改时间">{{ detailState.updated_at }}</a-descriptions-item>
<a-descriptions-item label="备注" :span="2">{{ detailState.description }}</a-descriptions-item>
+7
View File
@@ -15,4 +15,11 @@ export interface tableDataType {
children?: tableDataType[];
created_at?: string;
updated_at?: string;
creator?: creatorType;
}
interface creatorType {
id?: number;
name?: string;
username?: string;
}
+5 -3
View File
@@ -41,7 +41,9 @@
<!-- 表格区域 -->
<div class="table-wrapper">
<a-card title="日志列表" :bordered="false" :headStyle="{ borderBottom: 'none', padding: '20px 24px' }"
<a-card title="日志列表"
:bordered="false"
:headStyle="{ borderBottom: 'none', padding: '20px 24px' }"
:bodyStyle="{ padding: '0 24px', minHeight: 'calc(100vh - 400px)' }">
<template #extra>
<a-button type="primary" :icon="h(DownOutlined)" @click="handleExport"
@@ -55,9 +57,9 @@
:data-source="dataSource"
:loading="tableLoading"
@change="handleTableChange"
:scroll="{ x: 500 }"
:scroll="{ x: 400 }"
:pagination="pagination"
:style="{ minHeight: '300px'}"
:style="{ minHeight: '420px'}"
>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'index'">
+2 -2
View File
@@ -57,7 +57,7 @@
</a-button>
</a-dropdown>
</template>
<a-table v-if="dataSource.length"
<a-table v-if="dataSource"
:defaultExpandAllRows="true"
:rowKey="record => record.id"
:columns="columns"
@@ -66,7 +66,7 @@
:scroll="{ x: 500, y: 'calc(100vh - 300px)' }"
:row-selection="rowSelection"
:pagination="false"
:style="{ minHeight: '300px' }"
:style="{ minHeight: '420px' }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'type'">
+5 -3
View File
@@ -35,7 +35,9 @@
<!-- 表格区域 -->
<div class="table-wrapper">
<a-card title="公告通知列表" :bordered="false" :headStyle="{ borderBottom: 'none', padding: '20px 24px' }"
<a-card title="公告通知列表"
:bordered="false"
:headStyle="{ borderBottom: 'none', padding: '20px 24px' }"
:bodyStyle="{ padding: '0 24px', minHeight: 'calc(100vh - 400px)' }">
<template #extra>
<a-button type="primary" :icon="h(PlusOutlined)" @click="modalHandle('create')"
@@ -66,9 +68,9 @@
:row-selection="rowSelection"
:loading="tableLoading"
@change="handleTableChange"
:scroll="{ x: 500 }"
:scroll="{ x: 400 }"
:pagination="pagination"
:style="{ minHeight: '300px' }"
:style="{ minHeight: '420px' }"
>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'index'">
+2 -2
View File
@@ -71,9 +71,9 @@
:row-selection="rowSelection"
:loading="tableLoading"
@change="handleTableChange"
:scroll="{ x: 500 }"
:scroll="{ x: 400 }"
:pagination="pagination"
:style="{ minHeight: '300px' }"
:style="{ minHeight: '420px' }"
>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'index'">
@@ -33,7 +33,7 @@
:checkedKeys="permissionState.dept_ids"
:rowKey="record => record.id"
:tree-data="deptTreeData"
defaultExpandAll=true
defaultExpandAll="true"
:scroll="{ y: 1000 }"
:field-names="{ children: 'children', title: 'name', key: 'id' }"
@check="deptTreeCheck" checkable checkStrictly style="margin-top: 15px;" />
@@ -56,7 +56,7 @@
</div>
<div style="margin-top: 15px;">
<a-table v-if="menuTreeData.length"
<a-table v-if="menuTreeData"
:rowKey="record => record.id"
:defaultExpandAllRows="true"
:columns="menuColumns"
+1 -1
View File
@@ -69,7 +69,7 @@
:row-selection="rowSelection"
:loading="tableLoading"
@change="handleTableChange"
:scroll="{ x: 500 }"
:scroll="{ x: 400 }"
:pagination="pagination"
:style="{ minHeight: '420px' }"
>
+14 -16
View File
@@ -40,9 +40,9 @@
<!-- 表格区域 -->
<div class="table-wrapper">
<a-card title="用户管理"
:bordered="false"
:bordered="false"
:headStyle="{ borderBottom: 'none', padding: '20px 24px' }"
:bodyStyle="{ padding: '10px 24px', minHeight: 'calc(100vh - 400px)' }">
:bodyStyle="{ padding: '0px 24px', minHeight: 'calc(100vh - 400px)' }">
<template #extra>
<a-button type="primary" :icon="h(PlusOutlined)" @click="modalHandle('create')" style="margin-right: 10px;">
新建
@@ -74,28 +74,27 @@
<a-row :gutter="16">
<!-- 左侧部门树 -->
<a-col :span="4">
<a-tree ref="deptTree" v-if="deptTreeData.length"
:tree-data="deptTreeData"
:show-line="true"
:defaultExpandAll="true"
:field-names="{ children: 'children', title: 'name', key: 'id' }"
:selected-keys="selectedKeys"
@select="onSelectDept">
</a-tree>
<a-tree ref="deptTree" v-if="deptTreeData.length"
:tree-data="deptTreeData"
:show-line="true"
:defaultExpandAll="true"
:field-names="{ children: 'children', title: 'name', key: 'id' }"
:selected-keys="selectedKeys"
@select="onSelectDept">
</a-tree>
</a-col>
<!-- 右侧用户列表 -->
<a-col :span="20">
<a-card title="用户列表" >
<a-table :rowKey="record => record.id"
:columns="columns"
:data-source="dataSource"
:row-selection="rowSelection"
:loading="tableLoading"
@change="handleTableChange"
:scroll="{ x: 300 }"
:scroll="{ x: 400 }"
:pagination="pagination"
:style="{ minHeight: '310px' }">
:style="{ minHeight: '420px' }">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'index'">
<span>{{ (pagination.current - 1) * pagination.pageSize + index + 1 }}</span>
@@ -135,7 +134,6 @@
</template>
</template>
</a-table>
</a-card>
</a-col>
</a-row>
</a-card>
@@ -522,7 +520,7 @@ const rowSelection = computed(() => {
}
});
const selectedKeys = ref<string[]>([]);
const selectedKeys = ref<number[]>([]);
// 生命周期钩子
onMounted(() => loadingData());
@@ -790,7 +788,7 @@ const handleSelectorModalEvent = (
}
// 部门选择器事件
const onSelectDept = (selectedKeys: string[], info: any) => {
const onSelectDept = (selectedKeys: number[], info: any) => {
if (selectedKeys.length > 0) {
queryState.dept_id = selectedKeys[0]; // 获取选中的部门 ID
} else {