style: 优化表格页面样式及表格纵向滚动条

This commit is contained in:
2024-05-12 19:27:27 +08:00
parent c1c5f7f632
commit 861f6203cc
14 changed files with 614 additions and 551 deletions

View File

@@ -1,5 +1,12 @@
<template> <template>
<div class="gi-table" :class="{ 'gi-table--fullscreen': isFullscreen }"> <div class="gi-table" :class="{ 'gi-table--fullscreen': isFullscreen }">
<a-row v-if="props.title" justify="space-between" align="center" class="gi-table__header">
<a-space wrap>
<slot name="custom-title">
<div class="gi-table__header-title">{{ props.title }}</div>
</slot>
</a-space>
</a-row>
<a-row justify="space-between" align="center" class="gi-table__toolbar"> <a-row justify="space-between" align="center" class="gi-table__toolbar">
<a-space wrap class="gi-table__toolbar-left" :size="[8, 8]"> <a-space wrap class="gi-table__toolbar-left" :size="[8, 8]">
<slot name="custom-left"></slot> <slot name="custom-left"></slot>
@@ -84,6 +91,7 @@ import { VueDraggable } from 'vue-draggable-plus'
defineOptions({ name: 'GiTable', inheritAttrs: false }) defineOptions({ name: 'GiTable', inheritAttrs: false })
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
title: '',
disabledTools: () => [], // 禁止显示的工具 disabledTools: () => [], // 禁止显示的工具
disabledColumnKeys: () => [] // 禁止控制显示隐藏的列 disabledColumnKeys: () => [] // 禁止控制显示隐藏的列
}) })
@@ -96,6 +104,7 @@ const attrs = useAttrs()
const slots = useSlots() const slots = useSlots()
interface Props { interface Props {
title?: string
disabledTools?: string[] disabledTools?: string[]
disabledColumnKeys?: string[] disabledColumnKeys?: string[]
} }
@@ -201,6 +210,15 @@ defineExpose({ tableRef })
max-height: 100%; max-height: 100%;
overflow: hidden; overflow: hidden;
} }
&__header {
padding: 0 0 10px;
&-title {
color: var(--color-text-1);
font-size: 18px;
font-weight: 500;
line-height: 1.5;
}
}
&__toolbar { &__toolbar {
:deep(.arco-form-item-layout-inline) { :deep(.arco-form-item-layout-inline) {
margin-right: 8px; margin-right: 8px;

View File

@@ -181,12 +181,7 @@
} }
} }
.gi_table_box { // 普通页面(使用场景,页面内容超出高度会自动滚动)
max-height: 100%;
overflow: hidden;
}
// 使用场景,页面内容超出高度会自动滚动
.gi_page { .gi_page {
flex: 1; flex: 1;
padding: $margin; padding: $margin;
@@ -194,6 +189,44 @@
overflow-y: auto; overflow-y: auto;
} }
// 表格页面
.table-page {
height: 100%;
overflow: hidden;
margin: $margin;
background: var(--color-bg-1);
padding: $padding;
padding-bottom: 0;
box-sizing: border-box;
display: flex;
flex-direction: column;
.header {
padding: 0 0 10px;
.title {
color: var(--color-text-1);
font-size: 18px;
font-weight: 500;
line-height: 1.5;
}
}
&:after {
content: '';
height: 20px;
font-size: 12px;
color: var(--color-text-3);
margin-top: 12px;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
}
}
.gi_table_box {
max-height: 100%;
overflow: hidden;
}
.gi_card_title { .gi_card_title {
.arco-card-header-title::before { .arco-card-header-title::before {
content: ''; content: '';
@@ -263,11 +296,17 @@
overflow-y: auto; overflow-y: auto;
& > .arco-card-header { & > .arco-card-header {
height: auto; height: auto;
padding: 20px; padding: $padding;
border: none; border: none;
.arco-card-header-title {
color: var(--color-text-1);
font-size: 18px;
font-weight: 500;
line-height: 1.5;
}
} }
& > .arco-card-body { & > .arco-card-body {
padding: 0 20px 20px 20px; padding: 0 $padding $padding $padding;
} }
} }

View File

@@ -1,6 +1,12 @@
<template> <template>
<div class="gi_page"> <div class="table-page">
<a-card title="系统日志" class="general-card"> <a-row justify="space-between" align="center" class="header">
<a-space wrap>
<slot name="custom-title">
<div class="title">系统日志</div>
</slot>
</a-space>
</a-row>
<a-tabs type="card-gutter" size="large" :active-key="activeKey" @change="change"> <a-tabs type="card-gutter" size="large" :active-key="activeKey" @change="change">
<a-tab-pane key="1" title="登录日志" /> <a-tab-pane key="1" title="登录日志" />
<a-tab-pane key="2" title="操作日志" /> <a-tab-pane key="2" title="操作日志" />
@@ -8,7 +14,6 @@
<keep-alive> <keep-alive>
<component :is="PaneMap[activeKey]" /> <component :is="PaneMap[activeKey]" />
</keep-alive> </keep-alive>
</a-card>
</div> </div>
</template> </template>

View File

@@ -1,8 +1,8 @@
<template> <template>
<div class="gi_page"> <div class="table-page">
<a-card title="在线用户" class="general-card">
<GiTable <GiTable
row-key="id" row-key="id"
title="在线用户"
:data="dataList" :data="dataList"
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
@@ -39,7 +39,6 @@
</a-space> </a-space>
</template> </template>
</GiTable> </GiTable>
</a-card>
</div> </div>
</template> </template>

View File

@@ -6,7 +6,7 @@
<BasicSetting /> <BasicSetting />
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" title="邮件配置(暂未开放)" disabled></a-tab-pane> <a-tab-pane key="2" title="邮件配置(暂未开放)" disabled></a-tab-pane>
<a-tab-pane key="3" title="安全置"> <a-tab-pane key="3" title="安全置">
<SecuritySetting /> <SecuritySetting />
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>

View File

@@ -1,9 +1,9 @@
<template> <template>
<div class="gi_page"> <div class="table-page">
<a-card title="部门管理" class="general-card">
<GiTable <GiTable
ref="tableRef" ref="tableRef"
row-key="id" row-key="id"
title="部门管理"
:data="dataList" :data="dataList"
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
@@ -67,7 +67,6 @@
</a-space> </a-space>
</template> </template>
</GiTable> </GiTable>
</a-card>
<DeptAddModal ref="DeptAddModalRef" @save-success="search" /> <DeptAddModal ref="DeptAddModalRef" @save-success="search" />
</div> </div>

View File

@@ -1,8 +1,8 @@
<template> <template>
<div class="gi_page"> <div class="table-page">
<a-card title="字典管理" class="general-card">
<GiTable <GiTable
row-key="id" row-key="id"
title="字典管理"
:data="dataList" :data="dataList"
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
@@ -44,7 +44,6 @@
</a-space> </a-space>
</template> </template>
</GiTable> </GiTable>
</a-card>
<DictAddModal ref="DictAddModalRef" @save-success="search" /> <DictAddModal ref="DictAddModalRef" @save-success="search" />
<DictItemModal ref="DictItemModalRef" /> <DictItemModal ref="DictItemModalRef" />

View File

@@ -55,6 +55,12 @@ const onClickItem = (item: FileTypeListItem) => {
margin: 0 16px; margin: 0 16px;
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
.arco-card-header-title {
color: var(--color-text-1);
font-size: 18px;
font-weight: 500;
line-height: 1.5;
}
} }
} }
</style> </style>

View File

@@ -1,13 +1,13 @@
<template> <template>
<div class="gi_page"> <div class="table-page">
<a-card title="菜单管理" class="general-card">
<GiTable <GiTable
ref="tableRef" ref="tableRef"
title="菜单管理"
row-key="id" row-key="id"
:data="dataList" :data="dataList"
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
:scroll="{ x: '100%', y: '100%', minWidth: 1700, maxHeight: '81vh' }" :scroll="{ x: '100%', y: '100%', minWidth: 1700 }"
:pagination="false" :pagination="false"
:disabled-column-keys="['title']" :disabled-column-keys="['title']"
@refresh="search" @refresh="search"
@@ -78,7 +78,6 @@
</a-space> </a-space>
</template> </template>
</GiTable> </GiTable>
</a-card>
<MenuAddModal ref="MenuAddModalRef" :menus="dataList" @save-success="search" /> <MenuAddModal ref="MenuAddModalRef" :menus="dataList" @save-success="search" />
</div> </div>

View File

@@ -1,9 +1,8 @@
<template> <template>
<div> <div class="table-page">
<div class="gi_page">
<a-card title="通知公告" class="general-card">
<GiTable <GiTable
row-key="id" row-key="id"
title="通知公告"
:data="dataList" :data="dataList"
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
@@ -49,8 +48,6 @@
</a-space> </a-space>
</template> </template>
</GiTable> </GiTable>
</a-card>
</div>
<NoticeAddModal ref="NoticeAddModalRef" @save-success="search" /> <NoticeAddModal ref="NoticeAddModalRef" @save-success="search" />
<NoticeDetailModal ref="NoticeDetailModalRef" /> <NoticeDetailModal ref="NoticeDetailModalRef" />

View File

@@ -1,8 +1,8 @@
<template> <template>
<div class="gi_page"> <div class="table-page">
<a-card title="角色管理" class="general-card">
<GiTable <GiTable
row-key="id" row-key="id"
title="角色管理"
:data="dataList" :data="dataList"
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
@@ -52,7 +52,6 @@
<RoleAddModal ref="RoleAddModalRef" @save-success="search" /> <RoleAddModal ref="RoleAddModalRef" @save-success="search" />
<RoleDetailDrawer ref="RoleDetailDrawerRef" /> <RoleDetailDrawer ref="RoleDetailDrawerRef" />
</a-card>
</div> </div>
</template> </template>

View File

@@ -1,8 +1,8 @@
<template> <template>
<div class="gi_page"> <div class="table-page">
<a-card title="存储管理" class="general-card">
<GiTable <GiTable
row-key="id" row-key="id"
title="存储管理"
:data="dataList" :data="dataList"
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
@@ -61,7 +61,6 @@
</a-space> </a-space>
</template> </template>
</GiTable> </GiTable>
</a-card>
<StorageAddModal ref="StorageAddModalRef" @save-success="search" /> <StorageAddModal ref="StorageAddModalRef" @save-success="search" />
</div> </div>

View File

@@ -1,6 +1,12 @@
<template> <template>
<div class="gi_page"> <div class="table-page">
<a-card title="用户管理" class="general-card"> <a-row justify="space-between" align="center" class="header">
<a-space wrap>
<slot name="custom-title">
<div class="title">用户管理</div>
</slot>
</a-space>
</a-row>
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :xs="0" :md="4" :lg="4" :xl="4" :xxl="4"> <a-col :xs="0" :md="4" :lg="4" :xl="4" :xxl="4">
<a-input v-model="deptName" placeholder="请输入部门名称" allow-clear style="margin-bottom: 10px"> <a-input v-model="deptName" placeholder="请输入部门名称" allow-clear style="margin-bottom: 10px">
@@ -97,7 +103,6 @@
</GiTable> </GiTable>
</a-col> </a-col>
</a-row> </a-row>
</a-card>
<UserAddModal ref="UserAddModalRef" @save-success="search" /> <UserAddModal ref="UserAddModalRef" @save-success="search" />
<UserDetailDrawer ref="UserDetailDrawerRef" /> <UserDetailDrawer ref="UserDetailDrawerRef" />

View File

@@ -1,8 +1,8 @@
<template> <template>
<div class="gi_page"> <div class="table-page">
<a-card title="代码生成" class="general-card">
<GiTable <GiTable
row-key="tableName" row-key="tableName"
title="代码生成"
:data="dataList" :data="dataList"
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
@@ -31,7 +31,6 @@
</a-space> </a-space>
</template> </template>
</GiTable> </GiTable>
</a-card>
<GenConfigDrawer ref="GenConfigDrawerRef" @save-success="search" /> <GenConfigDrawer ref="GenConfigDrawerRef" @save-success="search" />
<GenPreviewModal ref="GenPreviewModalRef" @generate="onGenerate" /> <GenPreviewModal ref="GenPreviewModalRef" @generate="onGenerate" />