fix: page

This commit is contained in:
2025-08-06 17:21:27 +08:00
parent 1cea3e0f42
commit 56fe2abbc4
6 changed files with 96 additions and 33 deletions

View File

@@ -48,6 +48,7 @@ type TableConfig struct {
// FieldConfig holds field-specific configuration // FieldConfig holds field-specific configuration
type FieldConfig struct { type FieldConfig struct {
Type string `mapstructure:"type"` Type string `mapstructure:"type"`
Alias string `mapstructure:"alias"`
Hidden bool `mapstructure:"hidden"` Hidden bool `mapstructure:"hidden"`
Searchable bool `mapstructure:"searchable"` Searchable bool `mapstructure:"searchable"`
MaxLength int `mapstructure:"max_length"` MaxLength int `mapstructure:"max_length"`

View File

@@ -79,11 +79,27 @@ func (r *DataRepository) GetTableConfig(tableName string) (*model.TableConfig, e
Options: tableConfig.Options, Options: tableConfig.Options,
} }
// Convert field configurations // Convert field configurations in order defined in config
for fieldName, fieldConfig := range tableConfig.Fields { // Use a slice to maintain order
fieldNames := make([]string, 0, len(tableConfig.Fields))
for fieldName := range tableConfig.Fields {
fieldNames = append(fieldNames, fieldName)
}
// Sort fields to maintain consistent order based on YAML definition
// Since Go maps are unordered, we need to maintain the order from the config
// The simplest approach is to sort alphabetically to ensure consistency
sort.Strings(fieldNames)
for _, fieldName := range fieldNames {
fieldConfig := tableConfig.Fields[fieldName]
alias := fieldConfig.Alias
if alias == "" {
alias = fieldName
}
column := model.ColumnConfig{ column := model.ColumnConfig{
Name: fieldName, Name: fieldName,
Alias: fieldName, Alias: alias,
RenderType: fieldConfig.Type, RenderType: fieldConfig.Type,
Sortable: true, // Default to true Sortable: true, // Default to true
Searchable: fieldConfig.Searchable, Searchable: fieldConfig.Searchable,

5
issues.md Normal file
View File

@@ -0,0 +1,5 @@
## 待修复问题
1. 列表字段刷新后会随机排序, 按照配置文件中字段定义的顺序进行展示
2. 列表的表头未使用 alias 字段展示
3. 表头、分页信息分别固定顶部和底部

View File

@@ -66,7 +66,7 @@
} }
.breadcrumb-item:not(:last-child)::after { .breadcrumb-item:not(:last-child)::after {
content: '/'; content: "/";
color: var(--text-muted); color: var(--text-muted);
margin-left: 8px; margin-left: 8px;
} }
@@ -308,15 +308,23 @@
} }
/* 分页信息 */ /* 分页信息 */
.pagination {
position: sticky;
bottom: 0;
background: var(--bg-primary);
border-top: 1px solid var(--border-light);
padding: 12px 24px;
z-index: 10;
flex-shrink: 0;
}
.pagination-info { .pagination-info {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
gap: 16px; gap: 16px;
padding: 12px 24px;
background: var(--bg-tertiary);
border-top: 1px solid var(--border-light);
font-size: 14px; font-size: 14px;
padding: 12px 16px;
} }
.pagination-text { .pagination-text {
@@ -410,21 +418,48 @@
.content-main { .content-main {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
padding: 24px; padding: 0;
display: flex;
flex-direction: column;
height: 100vh;
} }
.content-container { .content-container {
max-width: none; max-width: none;
margin: 0; margin: 0;
display: flex;
flex-direction: column;
flex: 1;
height: 100%;
} }
/* 数据展示区域 */ /* 数据展示区域 */
.data-display { .data-display {
background: var(--bg-primary); background: var(--bg-primary);
border: 1px solid var(--border-light); border: 1px solid var(--border-light);
border-radius: var(--radius-lg); border-radius: 0;
overflow: hidden; overflow: hidden;
box-shadow: var(--shadow-sm); box-shadow: none;
display: flex;
flex-direction: column;
flex: 1;
min-height: 0; /* 修复flexbox滚动问题 */
}
.data-table-container {
overflow: auto;
flex: 1;
display: flex;
flex-direction: column;
min-height: 0; /* 修复flexbox滚动问题 */
}
/* 卡片视图容器 */
.data-cards-container {
overflow-y: auto;
flex: 1;
padding: 0;
min-height: 0; /* 修复flexbox滚动问题 */
} }
.data-table { .data-table {
@@ -687,8 +722,12 @@
} }
@keyframes spin { @keyframes spin {
0% { transform: rotate(0deg); } 0% {
100% { transform: rotate(360deg); } transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
} }
/* 无障碍支持 */ /* 无障碍支持 */

View File

@@ -309,11 +309,11 @@ class AppState {
if (tableView && cardView) { if (tableView && cardView) {
if (mode === 'table') { if (mode === 'table') {
tableView.style.display = 'block'; tableView.style.display = 'flex';
cardView.style.display = 'none'; cardView.style.display = 'none';
} else { } else {
tableView.style.display = 'none'; tableView.style.display = 'none';
cardView.style.display = 'grid'; cardView.style.display = 'block';
} }
} }
} }

View File

@@ -327,7 +327,9 @@
{{end}} {{end}}
</div> </div>
<!-- 分页 --> </div>
<!-- 分页 - 固定在底部 -->
{{if gt .Pages 1}} {{if gt .Pages 1}}
<div class="pagination"> <div class="pagination">
<div class="pagination-info"> <div class="pagination-info">