feat(web): 数据字典浏览器动态分页(滚动加载 + 筛选重读 + 隐藏全选)
状态机重构:
- 删 tableSummary / dataDict 全量 ref + 4 个前端过滤 computed
- 新增 tableList/fieldList + page/hasMore/total/loading 共 10 个 ref
- 新增 fetchTablesPage/fetchFieldsPage(防 stale 响应 + nextTick 后重挂 scroll)
- 新增 onTablesScroll/onFieldsScroll:EP 2.14.3 + height 时 scroll 不冒泡到 el-table 根,
改在 .el-scrollbar__wrap 上挂原生 addEventListener('scroll', { passive: true })
- 新增 rebindDictScroll:每次 fetch + nextTick 后重挂兜底(el-table 重建 wrap 时失效)
- 筛选 commit 时从后端重读第 1 页(applyTableSearch/applyFieldSearch)
- watch(form.tables) 触发 fetchFieldsPage(1, true)(勾选表变化自动更新字段表)
跨页勾选同步:
- onTableSelectionChange 改为 set 合并(visible 名 + 新选中 → add;visible - 未选中 → delete;
不在 visible 的保留)—— 旧实现会丢跨页勾选
- 新增 restoreTableSelection:数据刷新后把 el-table 可见勾选与 form.tables 对齐
(reserve-selection 在 :data 整体替换时失效,必须手动同步)
按钮重写:
- 全选 / 反选:调 /api/dict/all-table-names 拿全量匹配名字 → 设 form.tables
→ fetchTablesPage(1, true) 把所有匹配表拉回首屏
- 清空:form.tables = [] + clearSelection()
CSS:web/static/style.css
- .dict-tables-table thead .el-checkbox, .dict-fields-table thead .el-checkbox
{ visibility: hidden; pointer-events: none; }
(display:none 会算错表头高度)
addCustomRule:去除 tableSummary 兜底(后端 /api/dict/fields 每行附 table_comment)
踩坑:
- EP 2.14.3 + height → <el-scrollbar> 包裹 body → @scroll 不触发,必须原生监听
- selection-change 只返 visible 选中行,直接赋值丢跨页勾选 → set 合并
- reserve-selection 在 :data 整体替换时失效 → 自写 restoreTableSelection
Showing
Please register or sign in to comment