refactor: 优化公共状态逻辑并修复用户列表分页

- 提取存储解析、通知已读、表格偏好和企业筛选参数逻辑
- 修复分页尺寸切换的旧页码、筛选丢失及 Semi 重复回调问题
- 补充 51 项回归测试,统一检查入口并修复格式配置和 JSON 语法
- 记录 179 项测试、生产构建和隔离浏览器交互验收结果
- 删除过期迁移与性能报告并同步开发文档

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
zhanjunhao
2026-10-21 18:47:21 +08:00
parent 89dfff96df
commit d35330d530
30 changed files with 1484 additions and 466 deletions
+11 -28
View File
@@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
import { useState, useCallback, useEffect, useRef } from 'react';
import { API } from '../../helpers/api';
import { showError } from '../../helpers';
import { buildOrgLogFilters } from '../../helpers/orgLogFilters.js';
// 获取企业X-Org-Id header
const getOrgHeaders = (orgId) => ({
@@ -239,19 +240,15 @@ export function useOrgMemberLogs(orgId) {
const [loading, setLoading] = useState(false);
const fetch = useCallback(
async (
page = 1,
pageSize = 20,
{ userId, startTimestamp, endTimestamp, modelName } = {},
) => {
async (page = 1, pageSize = 20, filters = {}) => {
if (!orgId) return;
setLoading(true);
try {
const params = { p: page, page_size: pageSize };
if (userId) params.user_id = userId;
if (startTimestamp) params.start_timestamp = startTimestamp;
if (endTimestamp) params.end_timestamp = endTimestamp;
if (modelName) params.model_name = modelName;
const params = {
p: page,
page_size: pageSize,
...buildOrgLogFilters(filters),
};
const res = await API.get('/api/org/logs', {
headers: getOrgHeaders(orgId),
@@ -292,18 +289,11 @@ export function useOrgLogsStat(orgId) {
const [loading, setLoading] = useState(false);
const fetch = useCallback(
async (
{ userId, startTimestamp, endTimestamp, modelName } = {},
noCache = false,
) => {
async (filters = {}, noCache = false) => {
if (!orgId) return;
setLoading(true);
try {
const params = {};
if (userId) params.user_id = userId;
if (startTimestamp) params.start_timestamp = startTimestamp;
if (endTimestamp) params.end_timestamp = endTimestamp;
if (modelName) params.model_name = modelName;
const params = buildOrgLogFilters(filters);
if (noCache) params.nocache = 1;
const res = await API.get('/api/org/logs/stat', {
@@ -346,18 +336,11 @@ export function useOrgMemberRanking(orgId) {
const [loading, setLoading] = useState(false);
const fetch = useCallback(
async (
{ userId, startTimestamp, endTimestamp, modelName, limit } = {},
noCache = false,
) => {
async ({ limit, ...filters } = {}, noCache = false) => {
if (!orgId) return;
setLoading(true);
try {
const params = {};
if (userId) params.user_id = userId;
if (startTimestamp) params.start_timestamp = startTimestamp;
if (endTimestamp) params.end_timestamp = endTimestamp;
if (modelName) params.model_name = modelName;
const params = buildOrgLogFilters(filters);
if (limit) params.limit = limit;
if (noCache) params.nocache = 1;