/* 表格容器 */ .table-container { background: #fff; 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; } /* 工具栏 */ .table-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 16px; background: #f5f5f5; border-bottom: 1px solid #e8e8e8; flex-shrink: 0; /* 工具栏不压缩,保持固定高度 */ } .selected-info { color: #666; font-size: 14px; } .bulk-actions { display: flex; gap: 8px; } /* 表格主体 - 虚拟滚动布局 */ .table-wrapper { display: flex; flex-direction: column; flex: 1; /* 占满剩余空间 */ height: 100%; /* 占满父容器高度 */ min-height: 200px; /* 最小高度,避免过小 */ overflow: hidden; /* 防止溢出 */ } /* 固定表头容器 */ .table-header-wrapper { flex-shrink: 0; border-bottom: 1px solid #e8e8e8; background: #fafafa; overflow: hidden; } .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; background: #fafafa; } .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; align-items: center; justify-content: space-between; } .sortable { cursor: pointer; user-select: none; } .sort-indicators { display: flex; flex-direction: column; margin-left: 8px; } .sort-arrow { font-size: 10px; line-height: 1; color: #ccc; cursor: pointer; transition: color 0.2s; } .sort-arrow.active { color: #1890ff; } .sort-up { margin-bottom: 2px; } /* 选择列 */ .selection-column { width: 48px; text-align: center; } .selection-column input[type="checkbox"] { cursor: pointer; } /* 操作列 */ .actions-column { width: auto; min-width: 120px; text-align: right; padding: 8px 16px; } .action-buttons { position: relative; display: flex; 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: 8px 12px; min-width: 32px; height: 32px; border: 1px solid #d9d9d9; border-radius: 6px; background: #fff; color: #333; font-size: 12px; font-weight: 500; cursor: pointer; 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: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: linear-gradient(135deg, #1890ff 0%, #096dd9 100%); border-color: #1890ff; color: #fff; } .btn-primary:hover:not(:disabled) { 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: linear-gradient(135deg, #ff4d4f 0%, #f5222d 100%); border-color: #ff4d4f; color: #fff; } .btn-danger:hover:not(:disabled) { 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; } /* 空状态 */ .empty-state { text-align: center; padding: 64px 16px; color: #999; } .empty-icon { font-size: 48px; margin-bottom: 16px; } /* 加载状态 */ .table-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 16px; color: #666; } .loading-spinner { width: 32px; height: 32px; border: 3px solid #f0f0f0; border-top: 3px solid #1890ff; border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 16px; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } /* 响应式 */ @media (max-width: 768px) { .table-toolbar { flex-direction: column; gap: 12px; align-items: stretch; } .bulk-actions { justify-content: flex-end; } .table-wrapper { min-height: 300px; /* 移动端最小高度,仍然使用flex: 1占满剩余空间 */ } .action-buttons { flex-direction: row; gap: 4px; justify-content: flex-end; } .actions-column { 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; } }