This commit is contained in:
2025-10-21 03:26:49 +08:00
parent b5430eb8d0
commit df859762ad
19 changed files with 2750 additions and 542 deletions

View File

@@ -4,6 +4,10 @@
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
height: calc(100% - 24px); /* 距离底部保持24px的间距 */
margin-bottom: 24px; /* 底部间距 */
display: flex;
flex-direction: column;
}
/* 工具栏 */
@@ -14,6 +18,7 @@
padding: 16px;
background: #f5f5f5;
border-bottom: 1px solid #e8e8e8;
flex-shrink: 0; /* 工具栏不压缩,保持固定高度 */
}
.selected-info {
@@ -26,37 +31,83 @@
gap: 8px;
}
/* 表格主体 */
/* 表格主体 - 虚拟滚动布局 */
.table-wrapper {
overflow-x: auto;
display: flex;
flex-direction: column;
flex: 1; /* 占满剩余空间 */
height: 100%; /* 占满父容器高度 */
min-height: 200px; /* 最小高度,避免过小 */
overflow: hidden; /* 防止溢出 */
}
.data-table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
.data-table th,
.data-table td {
padding: 12px 16px;
text-align: left;
/* 固定表头容器 */
.table-header-wrapper {
flex-shrink: 0;
border-bottom: 1px solid #e8e8e8;
background: #fafafa;
overflow: hidden;
}
.data-table th {
background: #fafafa;
.table-header-row {
display: flex;
align-items: center;
}
.table-header-cell {
display: flex;
align-items: center;
padding: 12px 16px;
border-right: 1px solid #e8e8e8;
font-weight: 600;
color: #333;
position: sticky;
top: 0;
z-index: 10;
background: #fafafa;
}
.data-table tbody tr:hover {
.table-header-cell:last-child {
border-right: none;
}
.table-header-cell.sortable {
cursor: pointer;
user-select: none;
}
/* 虚拟滚动内容区域 */
.table-body-wrapper {
flex: 1;
overflow: hidden;
background: #fff;
min-height: 0; /* 重要允许flex子项收缩 */
}
/* 虚拟行样式 */
.virtual-row {
display: flex;
align-items: center;
border-bottom: 1px solid #e8e8e8;
background: #fff;
transition: background-color 0.2s;
}
.virtual-row:hover {
background: #f5f5f5;
}
.table-cell {
display: flex;
align-items: center;
padding: 12px 16px;
border-right: 1px solid #e8e8e8;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.table-cell:last-child {
border-right: none;
}
/* 表头 */
.table-header {
display: flex;
@@ -103,66 +154,220 @@
/* 操作列 */
.actions-column {
width: 200px;
width: auto;
min-width: 120px;
text-align: right;
padding: 8px 16px;
}
.action-buttons {
position: relative;
display: flex;
gap: 8px;
gap: 6px;
justify-content: flex-end;
align-items: center;
flex-wrap: wrap;
}
/* 按钮样式 */
.btn {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 4px;
padding: 6px 12px;
padding: 8px 12px;
min-width: 32px;
height: 32px;
border: 1px solid #d9d9d9;
border-radius: 4px;
border-radius: 6px;
background: #fff;
color: #333;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
text-decoration: none;
user-select: none;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
outline: none;
}
.btn:hover {
.btn:hover:not(:disabled) {
border-color: #40a9ff;
color: #40a9ff;
transform: translateY(-1px);
box-shadow: 0 4px 8px 0 rgba(64, 169, 255, 0.15);
}
.btn:focus:not(:disabled) {
border-color: #40a9ff;
box-shadow: 0 0 0 2px rgba(64, 169, 255, 0.2);
}
.btn:active:not(:disabled) {
transform: translateY(0);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none !important;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}
.btn-primary {
background: #1890ff;
background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
border-color: #1890ff;
color: #fff;
}
.btn-primary:hover:not(:disabled) {
background: #40a9ff;
background: linear-gradient(135deg, #40a9ff 0%, #1890ff 100%);
border-color: #40a9ff;
color: #fff;
box-shadow: 0 4px 12px 0 rgba(24, 144, 255, 0.3);
}
.btn-primary:focus:not(:disabled) {
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.3);
}
.btn-danger {
background: #ff4d4f;
background: linear-gradient(135deg, #ff4d4f 0%, #f5222d 100%);
border-color: #ff4d4f;
color: #fff;
}
.btn-danger:hover:not(:disabled) {
background: #ff7875;
background: linear-gradient(135deg, #ff7875 0%, #ff4d4f 100%);
border-color: #ff7875;
color: #fff;
box-shadow: 0 4px 12px 0 rgba(255, 77, 79, 0.3);
}
.btn-danger:focus:not(:disabled) {
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.3);
}
.btn-success {
background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
border-color: #52c41a;
color: #fff;
}
.btn-success:hover:not(:disabled) {
background: linear-gradient(135deg, #73d13d 0%, #52c41a 100%);
border-color: #73d13d;
color: #fff;
box-shadow: 0 4px 12px 0 rgba(82, 196, 26, 0.3);
}
.btn-success:focus:not(:disabled) {
box-shadow: 0 0 0 2px rgba(82, 196, 26, 0.3);
}
.btn-warning {
background: linear-gradient(135deg, #faad14 0%, #d48806 100%);
border-color: #faad14;
color: #fff;
}
.btn-warning:hover:not(:disabled) {
background: linear-gradient(135deg, #ffc53d 0%, #faad14 100%);
border-color: #ffc53d;
color: #fff;
box-shadow: 0 4px 12px 0 rgba(250, 173, 20, 0.3);
}
.btn-warning:focus:not(:disabled) {
box-shadow: 0 0 0 2px rgba(250, 173, 20, 0.3);
}
.btn-icon {
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
}
/* Tooltip 样式 */
.tooltip {
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
margin-bottom: 8px;
padding: 6px 10px;
background: rgba(0, 0, 0, 0.85);
color: #fff;
font-size: 12px;
font-weight: 400;
line-height: 1.4;
border-radius: 4px;
white-space: nowrap;
opacity: 0;
visibility: hidden;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
pointer-events: none;
z-index: 1000;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.tooltip::after {
content: '';
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border: 4px solid transparent;
border-top-color: rgba(0, 0, 0, 0.85);
}
.btn:hover .tooltip {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(-4px);
}
/* 确保tooltip在不同位置的按钮中都能正确显示 */
.action-buttons {
position: relative;
}
/* 按钮尺寸变体 */
.btn-small {
padding: 4px 8px;
min-width: 24px;
height: 24px;
font-size: 11px;
}
.btn-small .btn-icon {
font-size: 12px;
}
.btn-medium {
padding: 8px 12px;
min-width: 32px;
height: 32px;
font-size: 12px;
}
.btn-medium .btn-icon {
font-size: 14px;
}
.btn-large {
padding: 12px 16px;
min-width: 40px;
height: 40px;
font-size: 14px;
}
.btn-large .btn-icon {
font-size: 16px;
}
/* 空状态 */
@@ -202,73 +407,6 @@
100% { transform: rotate(360deg); }
}
/* 分页 */
.pagination-wrapper {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px;
border-top: 1px solid #e8e8e8;
background: #fafafa;
}
.pagination-info {
color: #666;
font-size: 14px;
}
.pagination-controls {
display: flex;
align-items: center;
gap: 8px;
}
.page-numbers {
display: flex;
align-items: center;
gap: 4px;
}
.page-btn {
min-width: 32px;
height: 32px;
padding: 0 8px;
border: 1px solid #d9d9d9;
background: #fff;
color: #333;
cursor: pointer;
transition: all 0.2s;
}
.page-btn:hover {
border-color: #40a9ff;
color: #40a9ff;
}
.page-btn.active {
background: #1890ff;
border-color: #1890ff;
color: #fff;
}
.page-ellipsis {
padding: 0 8px;
color: #999;
}
.page-size-selector {
margin-left: 16px;
}
.page-size-selector select {
padding: 4px 8px;
border: 1px solid #d9d9d9;
border-radius: 4px;
background: #fff;
color: #333;
font-size: 14px;
}
/* 响应式 */
@media (max-width: 768px) {
.table-toolbar {
@@ -281,32 +419,62 @@
justify-content: flex-end;
}
.pagination-wrapper {
flex-direction: column;
gap: 12px;
align-items: stretch;
}
.pagination-controls {
justify-content: center;
}
.page-size-selector {
margin-left: 0;
text-align: center;
.table-wrapper {
min-height: 300px; /* 移动端最小高度仍然使用flex: 1占满剩余空间 */
}
.action-buttons {
flex-direction: column;
flex-direction: row;
gap: 4px;
justify-content: flex-end;
}
.actions-column {
width: 120px;
min-width: 80px;
padding: 6px 12px;
}
.btn {
font-size: 11px;
padding: 6px 10px;
min-width: 28px;
height: 28px;
}
.btn-icon {
font-size: 12px;
}
/* 移动端tooltip调整 */
.tooltip {
font-size: 11px;
padding: 4px 8px;
margin-bottom: 6px;
}
.tooltip::after {
border-width: 3px;
}
/* 移动端按钮尺寸调整 */
.btn-small {
padding: 3px 6px;
min-width: 20px;
height: 20px;
font-size: 10px;
}
.btn-medium {
padding: 6px 10px;
min-width: 28px;
height: 28px;
font-size: 11px;
}
.btn-large {
padding: 8px 12px;
min-width: 32px;
height: 32px;
font-size: 12px;
}
}