fix(admin): admin管理页面优化,增加排序过滤等

This commit is contained in:
sophie committed 2026-07-10 14:10:49 +08:00
1 parent 0939aeb0d8
commit fc843905d1
31 files changed
+1090 -671

No files matched your search

@@ -1,10 +1,8 @@
/**
* shared/composables/useReportLayoutStorage.ts
* 报表页面布局偏好 localStorage 持久化。
*/
/**
* useReportLayoutStorage.ts
* 用途:为报表页面提供统一的布局偏好持久化能力(按用户 + 表名隔离)
* 用途:报表页面布局偏好 localStorage 持久化(按用户 + 表名隔离)。
* 依赖:localStorage / sessionStorage 中的 hxops_user。
* 逻辑:ReportsPage / useReportsAdmin 读写列宽、显隐与排序偏好;v3 起聊天日志默认列宽收窄。
*/
const getCurrentAuthUser = () => {
@@ -24,10 +22,20 @@ const getCurrentIdentity = () => {
return user?.id ? `id_${user.id}` : `u_${user?.username || 'guest'}`;
};
/**
* 生成报表布局偏好的 storage key。
* @param table - 报表表名(如 chat_logs)
*/
const getReportLayoutStorageKey = (table: string) => {
return `hxops_report_layout_v2_${getCurrentIdentity()}_${table}`;
// v3:聊天日志默认列宽收窄(应用名/用户/姓名/Token),旧 v2 偏好不再沿用
return `hxops_report_layout_v3_${getCurrentIdentity()}_${table}`;
};
/**
* 读取指定报表表的布局偏好。
* @param table - 报表表名
* @returns 解析后的偏好,失败或不存在时返回 null
*/
export const loadReportLayoutPref = <T = any>(table: string): T | null => {
try {
const raw = localStorage.getItem(getReportLayoutStorageKey(table));
@@ -38,6 +46,11 @@ export const loadReportLayoutPref = <T = any>(table: string): T | null => {
}
};
/**
* 写入指定报表表的布局偏好。
* @param table - 报表表名
* @param payload - 可序列化的布局对象
*/
export const saveReportLayoutPref = (table: string, payload: unknown) => {
try {
localStorage.setItem(getReportLayoutStorageKey(table), JSON.stringify(payload));
@@ -45,4 +58,3 @@ export const saveReportLayoutPref = (table: string, payload: unknown) => {
// Ignore storage write failure to avoid blocking core report flow.
}
};