From 3f214226b59737d71d6291cdd07d7c2a97125686 Mon Sep 17 00:00:00 2001 From: zwt13703 Date: Mon, 23 Mar 2026 19:17:13 +0800 Subject: [PATCH] updates --- docs/tasks/task_detail_2026_03_22.md | 49 ++++ src/hooks/common/table.ts | 39 +++ src/views/client/platform-user/index.vue | 261 ++++++++++++------ .../modules/platform-user-operate-drawer.vue | 165 +++++++---- src/views/client/user/index.vue | 65 ++++- .../user/modules/user-operate-drawer.vue | 14 +- 6 files changed, 446 insertions(+), 147 deletions(-) diff --git a/docs/tasks/task_detail_2026_03_22.md b/docs/tasks/task_detail_2026_03_22.md index 90113c2..19d6187 100644 --- a/docs/tasks/task_detail_2026_03_22.md +++ b/docs/tasks/task_detail_2026_03_22.md @@ -15,3 +15,52 @@ 1. 提取并扁平化嵌套路由中标记为 `constant` 的页面。 2. 动态模式初始化常量路由时合并上述嵌套常量路由并去重。 - **执行结果**: 动态模式下 `system_oss-config` 已注册到路由表,跳转不再报错。 + +## 会话 ID: 2026-03-22-03 +- [2026-03-22 15:00:30] +- **执行原因**: 客户用户列表增加平台关联跳转,并提供操作列固定的通用能力 +- **执行过程**: + 1. 在表格 hook 中新增操作列固定配置,并在用户列表启用固定到右侧。 + 2. 用户列表操作栏新增“平台”按钮并携带用户 ID 跳转到平台用户页。 + 3. 平台用户页读取路由 query.userId 并联动筛选。 +- **执行结果**: 用户列表可直接跳转平台用户关联页,操作列可固定显示,平台页支持按用户 ID 过滤。 + +## 会话 ID: 2026-03-22-04 +- [2026-03-22 15:04:47] +- **执行原因**: 用户列表“平台”改为弹窗关联显示,避免页面跳转 +- **执行过程**: + 1. 用户列表引入平台用户列表组件并通过弹窗展示。 + 2. 平台用户列表支持接收预设用户 ID,并自动联动筛选。 +- **执行结果**: 点击“平台”在弹窗中展示对应平台用户关联信息。 + +## 会话 ID: 2026-03-22-05 +- [2026-03-22 17:10:25] +- **执行原因**: 弹窗内列表被遮挡,需优化可视区域与滚动 +- **执行过程**: + 1. 平台用户列表增加嵌入式布局样式,放开滚动并限制高度。 + 2. 弹窗内容外层增加最大高度与滚动容器。 +- **执行结果**: 弹窗内列表显示完整且可滚动查看。 + +## 会话 ID: 2026-03-22-06 +- [2026-03-22 17:14:33] +- **执行原因**: 弹窗内仅显示表头与分页,表格内容被折叠 +- **执行过程**: + 1. 嵌入式场景关闭表格 flex 高度以避免容器高度为 0。 + 2. 嵌入式场景调整表格容器 class 以保证自适应高度展示。 +- **执行结果**: 弹窗内表格内容正常显示。 + +## 会话 ID: 2026-03-22-07 +- [2026-03-22 17:20:06] +- **执行原因**: 操作列 fixed 未生效,需确保横向滚动触发 +- **执行过程**: + 1. 平台用户列表设置最小 `scroll-x`,保证横向滚动容器存在。 + 2. 表格使用新的 `scroll-x` 以触发固定列效果。 +- **执行结果**: 固定列在横向滚动时生效。 + +## 会话 ID: 2026-03-22-08 +- [2026-03-22 17:25:37] +- **执行原因**: 弹窗内固定列仍无效果,需强化表格布局与滚动 +- **执行过程**: + 1. 弹窗嵌入场景提高最小 `scroll-x` 以确保横向滚动。 + 2. 弹窗嵌入场景强制表格 `table-layout` 为 `fixed`。 +- **执行结果**: 弹窗内固定列可随横向滚动保持固定。 diff --git a/src/hooks/common/table.ts b/src/hooks/common/table.ts index 096fcf5..bfa180f 100644 --- a/src/hooks/common/table.ts +++ b/src/hooks/common/table.ts @@ -23,6 +23,18 @@ export type UseNaiveTableOptions) => boolean; + /** + * fixed the operate column + * + * @default undefined + */ + operateColumnFixed?: 'left' | 'right'; + /** + * the key of operate column + * + * @default 'operate' + */ + operateColumnKey?: string; }; const SELECTION_KEY = '__selection__'; @@ -33,8 +45,12 @@ export function useNaiveTable(options: UseNaiveTableOptio const scope = effectScope(); const appStore = useAppStore(); + const columns = () => + applyOperateColumnFixed(options.columns(), options.operateColumnFixed, options.operateColumnKey); + const result = useTable, false>({ ...options, + columns, getColumnChecks: cols => getColumnChecks(cols, options.getColumnVisible), getColumns }); @@ -125,9 +141,13 @@ export function useNaivePaginatedTable( }; }); + const columns = () => + applyOperateColumnFixed(options.columns(), options.operateColumnFixed, options.operateColumnKey); + const result = useTable, true>({ ...options, pagination: true, + columns, getColumnChecks: cols => getColumnChecks(cols, options.getColumnVisible), getColumns, onFetched: data => { @@ -180,6 +200,25 @@ export function useNaivePaginatedTable( }; } +function applyOperateColumnFixed>( + columns: Column[], + fixed?: 'left' | 'right', + key: string = 'operate' +) { + if (!fixed) return columns; + + return columns.map(column => { + if (isTableColumnHasKey(column) && column.key === key && !column.fixed) { + return { + ...column, + fixed + }; + } + + return column; + }); +} + export function useTableOperate( data: Ref, idKey: keyof TableData, diff --git a/src/views/client/platform-user/index.vue b/src/views/client/platform-user/index.vue index 0be6140..2b6ff42 100644 --- a/src/views/client/platform-user/index.vue +++ b/src/views/client/platform-user/index.vue @@ -1,122 +1,170 @@