From 6528027d6d0e454f9785cbae7321393da9d40947 Mon Sep 17 00:00:00 2001 From: zhanjunhao <642307404@qq.com> Date: Tue, 24 Nov 2026 13:26:07 +0800 Subject: [PATCH] fix(ui): unify table controls and organization layouts --- AGENTS.md | 4 +- CLAUDE.md | 4 +- README.md | 1 + docs/CHANGELOG.md | 186 ++++++ docs/standards/DEV_STANDARDS.md | 2 +- docs/standards/UI_COMPONENT_STANDARDS.md | 16 +- docs/ui/GLOBAL_UI_BASELINE.md | 6 +- docs/ui/KEY_MANAGEMENT_SPEC.md | 4 +- docs/ui/ORG_CENTER_SPEC.md | 9 +- .../common/table/TableActionModal.jsx | 38 ++ .../common/table/TableActionPopconfirm.jsx | 76 +++ .../common/table/TableGroupTags.jsx | 80 +++ .../common/table/TableStatusSwitch.jsx | 20 + .../common/table/UsageRecordFilterCard.jsx | 44 ++ .../common/table/confirmTableAction.js | 30 + .../common/table/table-group-tags.css | 27 + .../common/table/usage-record-filter.css | 82 +++ src/components/common/ui/RenderUtils.jsx | 9 +- src/components/console/module-alignment.css | 25 +- src/components/quality/QualityAlerts.jsx | 13 +- src/components/quality/QualityBreakdown.jsx | 4 +- src/components/quality/quality.css | 19 +- .../settings/ContentGuardSetting.jsx | 10 +- .../settings/CustomerServiceSetting.jsx | 8 +- .../settings/DataSecuritySetting.jsx | 17 +- .../settings/LevelPolicySetting.jsx | 28 +- .../settings/TutorialVideoSetting.jsx | 14 +- src/components/smart-router/ProfileTable.jsx | 9 +- .../admin-tokens/AdminTokensColumnDefs.jsx | 11 +- src/components/table/admin-tokens/index.jsx | 3 +- .../modals/AdminDeleteTokenModal.jsx | 7 +- .../table/channels/ChannelsColumnDefs.jsx | 57 +- .../channels/modals/EditChannelModal.jsx | 27 +- .../table/channels/modals/EditTagModal.jsx | 599 ++++++++---------- .../channels/modals/MultiKeyManageModal.jsx | 11 +- .../model-pricing/filter/PricingVendors.jsx | 2 +- .../table/model-pricing/market/market.css | 15 + .../modal/components/ModelPricingTable.jsx | 3 +- .../table/models/ModelsColumnDefs.jsx | 35 +- .../models/modals/PrefillGroupManagement.jsx | 8 +- .../modals/DeleteRedemptionModal.jsx | 9 +- .../table/task-logs/TaskLogsColumnDefs.jsx | 14 +- src/components/table/task-logs/index.jsx | 22 +- .../table/tokens/TokensColumnDefs.jsx | 17 +- .../table/usage-logs/UsageLogsColumnDefs.jsx | 43 +- src/components/table/usage-logs/index.jsx | 22 +- .../table/users/UsersColumnDefs.jsx | 9 +- .../table/users/modals/DeleteUserModal.jsx | 8 +- .../table/users/modals/EditUserModal.jsx | 223 ++++--- src/components/ui/index.jsx | 22 +- src/helpers/groupList.js | 13 + src/helpers/render.jsx | 46 +- src/hooks/admin-tokens/useAdminTokensData.jsx | 2 + src/hooks/channels/useChannelsData.jsx | 19 +- src/hooks/models/useModelsData.jsx | 1 + src/hooks/redemptions/useRedemptionsData.jsx | 5 +- src/hooks/tokens/useTokensData.jsx | 56 +- src/hooks/users/useUsersData.jsx | 56 +- src/hooks/video/useVideoGeneration.js | 1 + src/i18n/locales/en.json | 3 + src/i18n/locales/fr.json | 3 + src/i18n/locales/ja.json | 3 + src/i18n/locales/ko.json | 3 + src/i18n/locales/ru.json | 3 + src/i18n/locales/th.json | 3 + src/i18n/locales/vi.json | 3 + src/i18n/locales/zh-TW.json | 3 + src/i18n/locales/zh.json | 3 + src/pages/AdminOrganizations/index.jsx | 43 +- src/pages/DemoReservations/index.jsx | 73 ++- .../AICreation/Video/VideoTaskQueue.jsx | 6 +- src/pages/KeyManagement/index.jsx | 28 +- src/pages/Organization/OrgAudit.jsx | 6 +- src/pages/Organization/OrgBudgets.jsx | 26 +- src/pages/Organization/OrgEffectiveness.jsx | 241 ++++--- src/pages/Organization/OrgKnowledge.jsx | 12 +- src/pages/Organization/OrgLogs.jsx | 110 ++-- src/pages/Organization/OrgMembers.jsx | 21 +- src/pages/Organization/OrgPrivateSkills.jsx | 118 ++-- src/pages/Organization/OrgProjects.jsx | 7 +- src/pages/Organization/OrgPromptRecords.jsx | 161 +++-- .../Organization/OrgSkillAssignments.jsx | 18 +- src/pages/Organization/OrgSkillCenter.jsx | 58 +- src/pages/Organization/OrgSkillLibrary.jsx | 135 ++-- src/pages/Organization/OrgTokens.jsx | 28 +- .../Organization/components/OrgPanel.jsx | 4 +- .../components/OrgSubpageTabs.jsx | 15 +- .../components/OrgTaskRecords.jsx | 8 +- .../Organization/datasecurity/OrgDsRules.jsx | 10 +- src/pages/Organization/org-effectiveness.css | 227 ++++--- src/pages/Organization/org-skills.css | 50 +- src/pages/Setting/AmountOptionsManager.jsx | 10 +- src/pages/Setting/Chat/SettingsChats.jsx | 15 +- .../Setting/Dashboard/SettingsAPIInfo.jsx | 9 +- .../Dashboard/SettingsAnnouncements.jsx | 9 +- src/pages/Setting/Dashboard/SettingsFAQ.jsx | 9 +- .../Setting/Dashboard/SettingsUptimeKuma.jsx | 9 +- .../Setting/Model/SettingImagePricing.jsx | 12 +- .../Setting/Model/SettingModelCategory.jsx | 11 +- src/pages/Setting/Model/SettingVideoModel.jsx | 10 +- .../Operation/SettingsAdminDelegation.jsx | 27 +- .../Setting/Operation/SettingsCreditLimit.jsx | 8 +- .../Setting/Operation/SettingsFallback.jsx | 6 +- .../Setting/Operation/SettingsGeneral.jsx | 18 +- .../Setting/Operation/SettingsLanguage.jsx | 93 +-- src/pages/Setting/Operation/SettingsLog.jsx | 4 +- .../Setting/Operation/SettingsMarquee.jsx | 4 +- .../Setting/Operation/SettingsMonitoring.jsx | 4 +- .../Operation/SettingsSensitiveWords.jsx | 4 +- .../Setting/Operation/SettingsSkillInject.jsx | 8 +- .../Setting/Payment/SettingsMembership.jsx | 7 +- .../Payment/SettingsPaymentGatewayCreem.jsx | 15 +- src/pages/Setting/Ratio/ModelCostSettings.jsx | 8 +- .../Ratio/ModelSettingsVisualEditor.jsx | 15 +- src/pages/Setting/Setting.css | 38 ++ .../Setting/WeyAi/SettingsWeyAiContent.jsx | 11 +- .../WeyAi/SettingsWeyAiReleaseNotes.jsx | 9 +- src/pages/UserCenter/UsageRecord.css | 59 +- src/pages/UserCenter/index.jsx | 5 +- src/pages/WebsiteSettings/InsightsPanel.jsx | 2 + src/pages/WeyAiDownload/index.jsx | 80 +-- src/pages/WeyAiDownload/weyai-download.css | 200 +++--- src/styles/org-center.css | 118 ++-- test/unit/table-status-and-groups.test.js | 72 +++ 124 files changed, 2682 insertions(+), 1810 deletions(-) create mode 100644 src/components/common/table/TableActionModal.jsx create mode 100644 src/components/common/table/TableActionPopconfirm.jsx create mode 100644 src/components/common/table/TableGroupTags.jsx create mode 100644 src/components/common/table/TableStatusSwitch.jsx create mode 100644 src/components/common/table/UsageRecordFilterCard.jsx create mode 100644 src/components/common/table/confirmTableAction.js create mode 100644 src/components/common/table/table-group-tags.css create mode 100644 src/components/common/table/usage-record-filter.css create mode 100644 src/helpers/groupList.js create mode 100644 test/unit/table-status-and-groups.test.js diff --git a/AGENTS.md b/AGENTS.md index 26a2d4fe..2258d57d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -104,7 +104,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd 1. **改前**:读相关代码;UI 任务先按 `GLOBAL_UI_BASELINE.md` 第 6 节真实 UI 登录;通用测试指令按该节自动判断验收范围、企业 / 普通个人 / 超管账号并加载现有本地配置,无需用户重复指定登录类型。 2. **服务与浏览器**:优先通过项目目录、启动日志和监听进程查找并验证用户已运行的开发服务;仅确认不存在时才启动新服务,细节见全局基线第 7.1 节;Playwright + 本机 Chrome(`channel: 'chrome'`),无人值守设 `UI_VISUAL_OFFSCREEN=1`,单 Context 串行;有头运行遵守 `GLOBAL_UI_BASELINE.md` 7.1.1 焦点约束(唯一页面,不新建 / 切换标签页、不 `bringToFront`,用 `scripts/playwright-focus-guard.mjs` 检测前台)。 -3. **覆盖**:UI 规范验收为浅深主题 × 桌面 1920×1000 / 移动 393×851;正常、空数据、失败、校验、重复提交;只读验收的非 GET `/api/` 请求为 0;模拟与真实分开记录。配置默认值、服务复用与规范矩阵的差异见基线第 7.1 节,不能用默认 runner 结果替代完整验收。 +3. **覆盖**:UI 规范验收为浅深主题 × 桌面 1920×1000 / 移动 393×851 与 360×800(最小必测视口);正常、空数据、失败、校验、重复提交;只读验收的非 GET `/api/` 请求为 0;模拟与真实分开记录。配置默认值、服务复用与规范矩阵的差异见基线第 7.1 节,不能用默认 runner 结果替代完整验收。 4. **检查**:`npm run eslint`、`npm run lint`、`npm test -- --test-concurrency=1`、`git diff --check`,涉及依赖或图标时加 `npm run check:ui`;纯文档改动只需 `npx prettier --check <文件>` 与 `git diff --check`。构建须先经用户同意,输出到系统临时目录(如 `npx vite build --outDir <临时目录> --emptyOutDir`),不覆盖 `dist/`。 5. **证据与交付**:截图、trace、storageState、报告只写 Git 忽略目录;说明完成范围、实际验证结果与未覆盖项,未验证的不写成通过;在 `docs/CHANGELOG.md` 追加条目,改动脚本、环境变量或目录约定时同步更新 `README.md`。 6. **提交**:授权按第 0 节,格式、检查与暂存边界见开发规范第 12.2 节。 @@ -123,7 +123,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd - 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。 - 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。 -> 规范版本:v3.7 · 更新:2026-11-20 +> 规范版本:v3.8 · 更新:2026-11-24 ## 10. 工具差异(本节允许不同) diff --git a/CLAUDE.md b/CLAUDE.md index d61bf9b4..3c38e567 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -104,7 +104,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd 1. **改前**:读相关代码;UI 任务先按 `GLOBAL_UI_BASELINE.md` 第 6 节真实 UI 登录;通用测试指令按该节自动判断验收范围、企业 / 普通个人 / 超管账号并加载现有本地配置,无需用户重复指定登录类型。 2. **服务与浏览器**:优先通过项目目录、启动日志和监听进程查找并验证用户已运行的开发服务;仅确认不存在时才启动新服务,细节见全局基线第 7.1 节;Playwright + 本机 Chrome(`channel: 'chrome'`),无人值守设 `UI_VISUAL_OFFSCREEN=1`,单 Context 串行;有头运行遵守 `GLOBAL_UI_BASELINE.md` 7.1.1 焦点约束(唯一页面,不新建 / 切换标签页、不 `bringToFront`,用 `scripts/playwright-focus-guard.mjs` 检测前台)。 -3. **覆盖**:UI 规范验收为浅深主题 × 桌面 1920×1000 / 移动 393×851;正常、空数据、失败、校验、重复提交;只读验收的非 GET `/api/` 请求为 0;模拟与真实分开记录。配置默认值、服务复用与规范矩阵的差异见基线第 7.1 节,不能用默认 runner 结果替代完整验收。 +3. **覆盖**:UI 规范验收为浅深主题 × 桌面 1920×1000 / 移动 393×851 与 360×800(最小必测视口);正常、空数据、失败、校验、重复提交;只读验收的非 GET `/api/` 请求为 0;模拟与真实分开记录。配置默认值、服务复用与规范矩阵的差异见基线第 7.1 节,不能用默认 runner 结果替代完整验收。 4. **检查**:`npm run eslint`、`npm run lint`、`npm test -- --test-concurrency=1`、`git diff --check`,涉及依赖或图标时加 `npm run check:ui`;纯文档改动只需 `npx prettier --check <文件>` 与 `git diff --check`。构建须先经用户同意,输出到系统临时目录(如 `npx vite build --outDir <临时目录> --emptyOutDir`),不覆盖 `dist/`。 5. **证据与交付**:截图、trace、storageState、报告只写 Git 忽略目录;说明完成范围、实际验证结果与未覆盖项,未验证的不写成通过;在 `docs/CHANGELOG.md` 追加条目,改动脚本、环境变量或目录约定时同步更新 `README.md`。 6. **提交**:授权按第 0 节,格式、检查与暂存边界见开发规范第 12.2 节。 @@ -123,7 +123,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd - 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。 - 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。 -> 规范版本:v3.7 · 更新:2026-11-20 +> 规范版本:v3.8 · 更新:2026-11-24 ## 10. 工具差异(本节允许不同) diff --git a/README.md b/README.md index 91aa8683..60baefdf 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ Playwright 与 weelink 共用设备环境约定,依赖精确锁定 1.64.1; | 命令 / 参数 | 用途与默认值 | | --- | --- | | `npm run test:e2e:headless` | 无头运行;本地默认有头离屏,CI 强制无头 | +| `npm run test:e2e -- --project=chrome-mobile` | 运行默认配置中的 360×800 手机项目。专项 UI 验收也须覆盖此最小视口 | | `npm run test:e2e:extended` | 全部 8 视口;也可设置 `PW_EXTENDED_LAYOUT=1` | | `npm run test:e2e:dist` | 验证已有静态产物并严格启动 4176;不自动构建 | | `npm run test:acceptance -- <参数>` | 串行单测、临时目录构建、产物校验、强制 local-dist/4176 测试 | diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c790e638..e55e3b0a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,8 +8,194 @@ **记录规则**:每条写“范围、变更、影响、回滚、关联”五项;回滚优先 `git revert <提交>`,提交含多项改动时按文件还原(`git checkout <提交>^ -- <文件>`),不整仓 reset。本文不作为规则依据。 +## 2026-11-24 + +### 调整 · 企业技能中心布局 + +- **范围**:企业中心技能库与自研 Skill。 +- **变更**:统一页头与页签顺序,整理技能操作区、引入目录与自研技能表单标签。 +- **影响**:两种页签继续使用原有路由参数、权限及技能治理操作。 +- **回滚**:还原技能中心、两个子页与共用页签容器的对应布局改动。 +- **关联**:`src/pages/Organization/OrgSkillCenter.jsx`、`src/pages/Organization/org-skills.css`。 + +### 修复 · 企业质量维度分布提示栏对齐 + +- **范围**:企业中心质量监控「维度分布」的六个页签。 +- **变更**:提示图标与文案整体水平居中,两者垂直居中对齐,窄屏文案换行时保持居中。 +- **影响**:仅调整企业端维度分布提示栏的布局,覆盖警告和信息提示。 +- **回滚**:移除企业端维度分布提示栏的居中样式。 +- **关联**:`src/components/quality/quality.css`。 + +### 修复 · 表格分组布局与渠道分组参数 + +- **范围**:用户、企业、渠道、模型、密钥等调用分组表格,以及渠道筛选和编辑表单。 +- **变更**:分组标签统一单行紧凑显示。渠道筛选按查询参数编码,分组表单统一处理字符串和数组回填。 +- **影响**:分组显示、复制和模型更多分组入口沿用原有行为。用户、渠道、企业及密钥接口各自沿用已有字段类型。 +- **回滚**:还原分组布局、列宽配置及渠道分组转换与查询参数改动。 +- **关联**:`src/components/common/table/TableGroupTags.jsx`、`src/helpers/groupList.js`、`src/hooks/channels/useChannelsData.jsx`。 + +### 调整 · 企业效能分析页面 + +- **范围**:企业中心效能分析。 +- **变更**:统一页头、指标卡、列表卡、成本对账和移动端空态,版本下钻支持回车提交。 +- **影响**:保留各区块的排列和数据逻辑,指标图标及主操作随系统主题色。 +- **回滚**:还原效能分析页组件与页面样式。 +- **关联**:`src/pages/Organization/OrgEffectiveness.jsx`、`src/pages/Organization/org-effectiveness.css`。 + +### 修复 · 编辑用户分组提交格式 + +- **范围**:`/console/user` 编辑用户的分组字段。 +- **变更**:单个字符串、逗号分隔字符串和数组均可回填,保存时统一提交逗号分隔字符串。 +- **影响**:保留已有分组选择及请求地址。 +- **回滚**:还原编辑用户表单的分组转换。 +- **关联**:`src/components/table/users/modals/EditUserModal.jsx`。 + +### 调整 · 明确最小移动验收视口 + +- **范围**:Playwright 与专项 UI 验收。 +- **变更**:明确 360×800 是必测的最小移动视口,保留 393×851 专项覆盖。 +- **影响**:默认 `chrome-mobile` 项目已使用 360×800。 +- **回滚**:还原本条对应的验收规范与 README 说明。 +- **关联**:`docs/ui/GLOBAL_UI_BASELINE.md`、`scripts/ui-review/config.json`。 + +### 修复 · 编辑用户抽屉关闭时标题闪动 + +- **范围**:`/console/user` 的编辑用户抽屉。 +- **变更**:关闭时保留当前用户,退出动画期间维持编辑标题和分区。 +- **影响**:下次打开时按选中的行重新加载用户信息。 +- **回滚**:恢复关闭抽屉时的选中用户清理逻辑。 +- **关联**:`src/hooks/users/useUsersData.jsx`。 + +### 修复 · 企业调用质量维度分布提示栏间距 + +- **范围**:`/org/quality` 的维度分布卡片。 +- **变更**:复用 18px 区块间距,统一提示栏与页签、结果区之间的留白。 +- **影响**:有提示、无提示和查询失败时均沿用同一组间距。 +- **回滚**:还原企业端维度分布的容器样式和表格上边距。 +- **关联**:`src/components/quality/QualityBreakdown.jsx`、`src/components/quality/quality.css`。 + +### 修复 · 补齐运营设置保存按钮对齐 + +- **范围**:`/console/setting?tab=operation` 的额度、邀请消费返佣、监控、兜底渠道、日志、屏蔽词过滤、跑马灯、技能超市与技能注入。 +- **变更**:9 个保存按钮复用运营设置操作区,与对应表单左边缘对齐。 +- **影响**:覆盖桌面和移动端,沿用各区块的保存处理。 +- **回滚**:还原本条涉及的保存按钮容器。 +- **关联**:`src/pages/Setting/Operation/`、`src/pages/Setting/Setting.css`。 + +### 调整 · 用户编辑抽屉对齐渠道编辑 + +- **范围**:`/console/user` 表格操作列的编辑用户抽屉。 +- **变更**:统一抽屉标题、分区标题、图标、面板间距和固定页脚,余额控件按视口切换单双列。 +- **影响**:保留原有用户字段、校验、额度调整和更新接口,提交期间防止重复保存。 +- **回滚**:还原用户编辑抽屉及对应的样式规则。 +- **关联**:`src/components/table/users/modals/EditUserModal.jsx`、`src/components/console/module-alignment.css`。 + +### 修复 · 统一表格分组标签文字 + +- **范围**:企业列表及共用分组标签的表格。 +- **变更**:分组列的 `default`、`vip`、`svip` 显示标准名称,移除企业列表追加的默认分组标记。 +- **影响**:默认分组配置、访问权限和计费规则沿用原逻辑。 +- **回滚**:还原分组列渲染与对应公共规范。 +- **关联**:`src/components/common/table/TableGroupTags.jsx`、`docs/standards/UI_COMPONENT_STANDARDS.md`。 + +### 修复 · 运营设置操作区对齐 + +- **范围**:`/console/setting?tab=operation` 的通用、COS、提示词采集、语言与地区及管理员权限下放设置。 +- **变更**:将操作按钮与表单内容左边缘对齐,统一按钮组及语言规则校验提示的间距,权限选项沿用横向排列并统一行列间距。 +- **影响**:语言规则正常和校验失败时均保留操作区间距。 +- **回滚**:还原运营设置操作区的布局与样式。 +- **关联**:`src/pages/Setting/Operation/SettingsGeneral.jsx`、`src/pages/Setting/Operation/SettingsLanguage.jsx`、`src/pages/Setting/Setting.css`。 + +### 调整 · 企业日志筛选栏对齐消费记录 + +- **范围**:审计日志的提示词记录与操作审计卡片间距,消耗明细的明细日志、成员排行和绘图与视频筛选栏。 +- **变更**:复用个人消费记录的筛选卡布局、操作区和移动端折叠,统一搜索提交入口。审计日志的说明条上下及筛选卡至列表卡采用 18px 公共间距。 +- **影响**:沿用各页签的筛选条件、默认时间和请求逻辑。 +- **回滚**:还原本条对应的页面筛选区、公共样式和组件。 +- **关联**:`src/components/common/table/UsageRecordFilterCard.jsx`、`docs/standards/UI_COMPONENT_STANDARDS.md`、`docs/ui/ORG_CENTER_SPEC.md`。 + +### 修复 · 企业成员页浮层触发节点引用 + +- **范围**:企业成员列表的状态开关和移除确认。 +- **变更**:表格状态开关和兼容层确认框将 `ref` 转发给 Ant Design 组件。 +- **影响**:消除 React 18 的 `Trigger` 引用告警,提示框可定位到对应的开关和按钮。 +- **回滚**:还原本条对应的组件引用转发及单测修改。 +- **关联**:`src/components/common/table/TableStatusSwitch.jsx`、`src/components/ui/index.jsx`。 + +### 修复 · 表格危险操作失败后可重试 + +- **范围**:表格操作列的删除、注销和冻结。 +- **变更**:业务回调回传提交结果。确认框在失败时保留当前记录,提交期间拦截重复确认。 +- **影响**:继续使用原接口、提示文案、权限判断及成功后的列表更新逻辑。 +- **回滚**:还原本条涉及的提交结果传递和确认框改动。 +- **关联**:`src/components/common/table/confirmTableAction.js`、`docs/standards/UI_COMPONENT_STANDARDS.md`。 + +### 修复 · 模型超市筛选按钮对齐 + +- **范围**:`/market` 顶部筛选按钮。 +- **变更**:统一按钮内容的对齐方式,厂商图标调整为 16px,图标右侧文字下移 1px 以改善视觉对齐。 +- **影响**:带图标和纯文字的选项采用相同的对齐方式。 +- **回滚**:还原筛选按钮及其图标的对齐样式。 +- **关联**:`src/components/table/model-pricing/market/market.css`、`src/components/table/model-pricing/filter/PricingVendors.jsx`。 + +### 调整 · 统一 WeyAi 下载页 + +- **范围**:公开下载页与用户中心下载页。 +- **变更**:共用下载页布局和样式,用户中心保留面包屑,下载背景延伸至导航区域。 +- **影响**:两个入口使用相同的推荐卡、安装包列表与下载交互,布局按各自的可用宽度排列。 +- **回滚**:还原本条对应的下载组件、样式和布局规范。 +- **关联**:`src/pages/WeyAiDownload/`、`docs/ui/GLOBAL_UI_BASELINE.md`。 + +### 修复 · 表格危险操作确认交互 + +- **范围**:表格操作列的删除、注销和冻结。 +- **变更**:统一危险操作入口和确认按钮,补齐直接执行入口的确认步骤;取消优先聚焦。 +- **影响**:保留已有业务提示文案和提交逻辑。 +- **回滚**:还原本条对应的行操作入口和公共确认组件。 +- **关联**:`src/components/common/table/TableActionPopconfirm.jsx`、`src/components/common/table/TableActionModal.jsx`。 + ## 2026-11-23 +### 修复 · 表格启停开关与分组样式统一 + +- **范围**:已有启停开关、调用或计费分组的表格,以及操作列删除确认规范。 +- **变更**:复用密钥管理的小尺寸状态开关和企业列表的分组标签;规范删除确认、提交防重及失败处理,文案可自定义。 +- **影响**:保持原接口、权限、确认及删除流程;单组与多组使用同一颜色映射。 +- **回滚**:分别还原共享组件接入和对应规范差异。 +- **关联**:`src/components/common/table/TableStatusSwitch.jsx`、`src/components/common/table/TableGroupTags.jsx`、`docs/standards/UI_COMPONENT_STANDARDS.md`。 + +### 调整 · 渠道聚合标签编辑抽屉 + +- **范围**:`/console/channel` 标签聚合模式下的编辑标签抽屉。 +- **变更**:标签抽屉沿用编辑渠道的标题、面板和页脚,将标签名称与分组放入响应式栅格。创建渠道、编辑渠道和编辑标签的圆形图标均对齐模型编辑抽屉。 +- **影响**:可通过关闭按钮或取消退出,提交继续使用标签批量覆盖接口及校验规则。 +- **回滚**:还原标签编辑抽屉的布局、控件和页脚改动。 +- **关联**:`src/components/table/channels/modals/EditTagModal.jsx`、`src/components/table/channels/modals/EditChannelModal.jsx`、`src/components/console/module-alignment.css`。 + +### 调整 · 预约列表导出和操作确认 + +- **范围**:`/console/demo-reservations` 预约列表。 +- **变更**:复用日志页的导出按钮,水平居中表格列,加宽操作列左侧的状态列,启用、禁用与删除操作采用密钥管理页的确认弹窗样式。 +- **影响**:启停和删除在确认后提交;导出继续下载当前选中预约的 CSV。 +- **回滚**:还原预约列表的工具栏、列定义、确认弹窗与对应语言条目。 +- **关联**:`src/pages/DemoReservations/index.jsx`、`src/i18n/locales/`。 + +### 修复 · 审计提示词记录模型列样式 + +- **范围**:`/org/audit` 提示词调用记录的模型列。 +- **变更**:移除紫色标签,复用相邻提示词列的文字样式,保留长名称省略和悬浮提示。 +- **影响**:文字随浅深主题切换,不受品牌色覆盖;查询、权限和调用明细不变。 +- **回滚**:还原模型列渲染及共享文字类名提取。 +- **关联**:`src/pages/Organization/OrgPromptRecords.jsx`。 + +### 修复 · 消费记录渠道标签可读性 + +- **范围**:`/user-center/usage-record` 消费记录和绘图与视频任务记录表格的渠道列。 +- **变更**:调用明细采用与任务记录相同的默认填充标签,移除按渠道 ID 配色及井号图标,并修正点击复制的参数。 +- **影响**:两张表的渠道标签随亮暗主题使用中性底色,保留渠道名称提示和调用明细的多密钥序号。 +- **回滚**:按关联文件还原本条对应的标签渲染与样式。 +- **关联**:`src/components/table/usage-logs/UsageLogsColumnDefs.jsx`、`src/components/table/task-logs/TaskLogsColumnDefs.jsx`、`src/pages/UserCenter/UsageRecord.css`。 + ### 优化 · WeyAi 独立下载页原型对齐 - **范围**:`/weyai/download` 独立下载页和此路由的顶栏下载入口。 diff --git a/docs/standards/DEV_STANDARDS.md b/docs/standards/DEV_STANDARDS.md index 23b17e4e..9fff3f9e 100644 --- a/docs/standards/DEV_STANDARDS.md +++ b/docs/standards/DEV_STANDARDS.md @@ -222,7 +222,7 @@ pagination={{ - 防重复:提交中按钮 `loading` 或 `confirmLoading`;hook 内 `submitting` 为真时直接返回。 - 成功:`showSuccess` → 关闭 → 刷新当前页;失败:保留弹层与已填内容。 - 打开时重置:弹层加 `forceRender`,在 `useEffect([open, record])` 中先 `resetFields()` 再 `setFieldsValue(record)`。 -- 删除:`Popconfirm` 的 `onConfirm` 返回 Promise 以显示加载;批量或不可撤销操作用 `Modal.confirm`。 +- 删除:确认回调返回 Promise 以显示加载;确认形态、危险按钮、失败保留与键盘交互见组件规范第 8 节。 - 日期提交前转换为后端格式(多为 Unix 秒);有未保存内容时沿用页面已有的关闭确认流程。 ## 7. 加载、空态与错误态 diff --git a/docs/standards/UI_COMPONENT_STANDARDS.md b/docs/standards/UI_COMPONENT_STANDARDS.md index b337f1c9..fc2a7330 100644 --- a/docs/standards/UI_COMPONENT_STANDARDS.md +++ b/docs/standards/UI_COMPONENT_STANDARDS.md @@ -125,13 +125,14 @@ html.dark .km-page { ## 4. 表格搜索栏(筛选卡) +- **筛选卡与列表卡间距**:从筛选卡底边到下方列表卡顶边统一为 18px,复用 `--uc-layout-gap`。同一对相邻区块只设置一次间距,优先由共同容器的 `gap` 控制。企业端以 `/org/logs` 为对齐基准,审计日志若在页签与筛选卡之间插入说明条,说明条上下也各留 18px。 - 背景:使用不透明的卡片纯色;浅色为白色,深色沿用主题卡片色,不使用渐变背景。 - 字段竖排:标签在上(13px,次文字色,下距 8px),控件在下且宽度占满单元格。 - 栅格:列间距与行间距 16px;按页面宽度取 3–5 列(企业中心 3 列、控制台 4 列、用户中心 5 列,时间范围可跨 2 列);≤ 768px 单列。 - 操作:“重置”“搜索”位于右下,间距 8px;“搜索”为 primary 且 `htmlType='submit'`,回车提交。 - 行为:搜索与重置都回到第 1 页;重置 = 清空表单 + 以默认条件重新查询;只切换筛选的页签放在筛选卡上方。 - 移动端:用户中心与控制台默认收起,通过“显示 / 隐藏操作项”或“筛选”按钮展开;列设置入口不随筛选收起。 -- 控制台使用 `ConsoleSearchBar` + `ConsoleSearchActions`,企业中心使用 `OrgFilterCard`,不要另写网格。 +- 控制台使用 `ConsoleSearchBar` + `ConsoleSearchActions`,企业中心常规筛选使用 `OrgFilterCard`。消耗明细及提示词记录复用个人消费记录的筛选布局和移动端折叠。 - 标准列表以 `/console/token` 为参考,覆盖控制台分佣、兑换码、会员卡和发票,企业及个人分佣,以及用户中心密钥管理(含各自子页、页签和详情列表)。使用 `ConsoleCollection`(或通过 `CardPro` 接入);独立列表可用 `ConsoleCollectionSearch` + `ConsoleFilterGrid`。筛选栅格为三列、≤ 1100px 两列、≤ 768px 单列。 - 搜索操作在筛选卡右下,先默认样式“重置”(无图标),再带放大镜的主按钮“搜索”;点击和回车共用同一个提交入口。保留原有即时筛选及请求方式,移动端统一通过“显示/隐藏操作项”切换。 - 工具栏在列表卡内、表格上方:列表标题、计数或快捷筛选在左;已有的批量、导出、刷新、列设置、新建等动作在右,主操作尽量靠右,使用公共操作图标和清晰文案。窗口变窄时自然换行。只读明细若没有筛选或业务动作,不新增占位按钮。 @@ -151,12 +152,14 @@ html.dark .km-page { ### 5.2 列 - 每列显式 `width`,长文本 `ellipsis` 并配 `Tooltip`;金额与数量右对齐;时间统一格式,必要时日期与时间分两行。 -- 状态列用 `Tag` 或 `Switch`(见第 11 节);启停开关请求中禁用,失败恢复原状态。 +- 状态列用只读 `Tag` 或 `TableStatusSwitch`(见第 11 节);启停开关请求中禁用,失败恢复原状态。 +- 调用、计费和访问权限分组列使用 `TableGroupTags`,单组与多组按同一套颜色渲染(见第 11 节)。 - 操作列放在最后,标题固定为“操作”,按钮为 `type='link' size='small'`,同一行操作间距 8px;用户中心、企业中心、控制台(含系统设置)的操作列统一 `fixed: 'right'`。`/console/user` 的用户列表和 `/console/commission?view=partners` 的合作伙伴列表使用 `TableRowActions`:直出高频动作,其余放进带下箭头的文字“更多”菜单。其他列表沿用既有操作呈现方式,不批量套用此菜单。菜单点击打开、右对齐,无有效菜单项时不渲染入口;危险项置末、标记 `danger` 并保留业务确认。现有权限、状态限制、禁用项和回调不得因收纳而改变,方向键、Enter、Escape 可操作菜单。 - 三中心表格通过 `CenterActionTable` 统一处理,最后一列存在创建、查看、编辑、测试、详情、删除、添加、设置、配置、弹窗 / 抽屉或请求交互时,列头统一显示“操作”并固定右侧,宽度按按钮 / 交互数量计算。没有操作列但估算列宽超出容器时,从右侧固定末 4 列,列数不足时降为 3、2、1 列。固定列使用不透明底色并保持表头层级;横向滚动条遵循 Ant Design 官方固定列表格行为,允许鼠标、触控板、触屏和键盘滚动,不隐藏滚动条。 - 列显隐只在已有列设置的表格中提供,统一使用 `ColumnSettings`(见 `docs/ui/TABLE_COLUMN_SETTINGS_SPEC.md`)。 - 三中心表头背景统一由 `center-table.css` 绘制:页面通过 `--center-table-head-bg` 提供色调,公共层在不透明的容器底色上叠加同色填充,普通列与固定列保持一致;页面不再直接覆盖表头 `background`。固定列使用 antd 6 的 `.ant-table-cell-fix` 与原生动态层级,不写死 `z-index`,不使用旧版 `fix-left` / `fix-right` 类名补丁;表头不换行,表头与正文沿用同一列宽和对齐方式。 - 操作列在异步数据或列变化后重新测量可见行的按钮宽度,取最大值;列宽不超过表格容器,按钮组在空间不足时换行。左右固定区总宽超过容器时,保留右侧操作列,其余固定列参与横向滚动;容器恢复足够宽度后恢复原固定配置,避免窄屏相互遮挡。 +- 操作列的删除入口置末并用 `danger`;点击仅打开确认,确认后的提交与刷新按第 8 节执行。无权删除或当前状态不允许删除时,沿用业务的隐藏或禁用规则。 ### 5.3 状态 @@ -192,7 +195,11 @@ html.dark .km-page { | 外观 | 圆角 12px;标题 16px / 600;正文与页脚使用 antd 默认间距 | | 页脚 | 次操作(取消)在前、主操作(确定 / 保存)在后,按钮高 34px、间距 8px;危险确认用 `okButtonProps={{ danger: true }}` | | 行为 | 提交中 `confirmLoading`;校验或请求失败不关闭;X、取消、Esc、遮罩关闭行为一致 | -| 确认框 | 单条删除用 `Popconfirm`;批量或不可撤销操作用 `Modal.confirm`(企业中心用 `OrgModal.confirm`) | +| 表格操作列危险确认 | 删除、注销和冻结使用小尺寸危险链接,更多菜单使用危险菜单项。普通单条操作用 `TableActionPopconfirm`,注销、企业冻结等影响较大的操作用确认弹窗。取消在前,危险确认在后;优先聚焦取消 | + +- 保留业务定制的标题、正文和按钮文案,并接入国际化。确认信息明确操作对象和影响。 +- 只有明确确认才发送请求;取消、Esc 或关闭不修改数据。确认回调返回 Promise,提交中显示加载并防止重复请求,失败保留确认及上下文并提示原因。成功后关闭确认并刷新列表,删除当前页最后一条时按分页规范回退。 +- 表格危险操作的回调在 API 明确失败时返回 `false`。确认框保持打开,业务回调保留原有错误提示。受控弹窗由业务在成功后关闭。 ## 9. 抽屉 @@ -222,7 +229,8 @@ html.dark .km-page { - **状态**用语义色:成功 `success`、失败 `error`、进行中 `processing`、等待 / 警告 `warning`、中性 `default`。 - **分类**(分组、类型、模型标签等)用调色板色(`blue`、`green`、`purple`、`gold`、`cyan` 等 antd 预设),不用非预设色名。 - 全局默认描边;卡片内的分类标签与企业中心表格标签用无边框样式,新代码写 `variant='filled'`(antd 6 已弃用 `bordered={false}`,二者视觉等价;存量写法可在修改时顺带收敛)。标签间距 8px,表格内标签不留右外边距。 -- 可启停的记录用 `Switch size='small'`,`onChange` 调原处理函数;无启停接口的列表保留只读 `Tag`。 +- **表格启停开关**以 `/user-center/key-management` 为准,复用 `TableStatusSwitch`:小尺寸、开启显示「启用」并使用系统主题主色,关闭显示「禁用」并使用组件中性色。其他既有布尔含义可自定义两态文字。保留键盘焦点、可访问名称、原有确认和权限;关闭状态不等于控件不可操作。只读状态仍用 `Tag`,过期、耗尽等非二元状态的说明保留,表单与筛选区开关不套用本规则。 +- **表格分组颜色与布局**以 `/console/organizations` 分组列为准,复用 `TableGroupTags`(单个标签也可用 `TableGroupTag`)。三种分组的标签文字固定为 `default`、`vip`、`svip`,颜色分别为蓝、黄、红。分组列禁止追加「(默认)」等说明,默认分组设置继续在表单中体现。`premium`、`pro` 沿用原名及红、黄配色,自定义分组用中性色。使用 antd 浅底描边标签并适配明暗主题。标签逐个着色、去重,按 4px 间距单行排列。纯分组列复用 `TABLE_GROUP_COLUMN_WIDTH`(148px),以完整容纳三枚标准标签为准。超出单元格的分组可横向滚动,已有的「+N」展开仍可使用。空值继承、智能熔断和非调用分组沿用各自的业务展示。 ## 12. 按钮与图标 diff --git a/docs/ui/GLOBAL_UI_BASELINE.md b/docs/ui/GLOBAL_UI_BASELINE.md index cfec0706..dad15e68 100644 --- a/docs/ui/GLOBAL_UI_BASELINE.md +++ b/docs/ui/GLOBAL_UI_BASELINE.md @@ -16,7 +16,7 @@ | 滚动条 | 全站 6px,`#8b8b8b`,悬停 `#636363`,页面不得单独设置 | | 装饰 | 无设计依据不加渐变、玻璃、发光、浮起与动效 | | 登录关卡 | 真实 UI 登录,企业先于个人,凭据只经环境变量(第 6 节) | -| 验收 | 浅深主题 × 1920×1000 / 393×851,有头离屏串行,唯一页面不抢焦点,模拟与真实分开记录(第 7 节) | +| 验收 | 浅深主题 × 1920×1000 / 393×851 / 360×800,有头离屏串行,唯一页面不抢焦点,模拟与真实分开记录(第 7 节) | **相关代码**:`src/styles/{user-center,center-layout,org-page,prototype}.css`、`src/index.css`、`src/components/layout/` @@ -94,7 +94,7 @@ - 带侧栏页面按 4.4;控制台按 `CONSOLE_SPEC.md`;其余页面内容默认 24px 30px、移动 16px。筛选区自然换行,表格在自身容器横向滚动;不通过隐藏正文、裁剪校验信息或固定整页宽度迎合截图。 - 模型超市与技能超市的工作区居中,含内边距的最大宽度为 1760px;横向内边距为 `clamp(20px, 4vw, 80px)`,Hero 搜索区域沿用同一横向留白,600px 及以下为 20px。覆盖 3840 / 2560 / 1920 至 360px 宽度,目录按实际可用宽度减少列数,保留卡片正文和控件正常字号,不通过整体缩放压缩内容。 -- WeyAi 独立下载页的居中容器含内边距最大宽度为 1464px。页头、安装卡和工作台示意组成首屏,960px 及以下上下排列。随后依次展示平台安装包、功能和使用步骤。安装包分组在 1024px 及以上显示三列,在 768–1023px 显示两列,其余宽度显示一列,文件名可换行。用户中心内嵌页沿用第 4.4 节的页头与内容边距。 +- WeyAi 两个下载路由共用页头、安装卡、工作台示意、平台安装包、功能和使用步骤。公开页的居中容器含内边距最大宽度为 1464px。首屏在页面可用宽度 960px 及以下上下排列,安装包分组在 1024px 及以上显示三列,在 768–1023px 显示两列,其余宽度显示一列,文件名可换行。用户中心内嵌页沿用第 4.4 节的面包屑和内容边距,下载页背景从面包屑区域开始覆盖内容区,面包屑与首屏标题区间隔 24px。 - 背景图优先复用原型的原始 SVG / 图片,放入 `src/assets/prototype` 并注明来源;原型用 CSS 绘制的背景按测量值在页面作用域复现,不用生成插画替代。 - 企业工作台横幅 `.ew-hero` 的浅金 / 深棕背景与三层轮廓只用于 `.org-workbench`,不扩散到其他页面。 - 原型未定义、antd 有组件:用当前版本默认样式与主题 token。antd 无对应部件:语义背景 / 文字 / 边框,无装饰背景、阴影与动画,间距 8 / 16 / 24px,窄屏堆叠且操作可达;新增此类统一规则先写入本文。 @@ -176,7 +176,7 @@ ### 7.3 采集与判定 -- 固定视口(桌面 1920×1000 / 移动 393×851,专项另有规定从其规定)、DPR 1、`zh-CN`、`Asia/Shanghai`、`reducedMotion: reduce`、相同数据与状态;用角色、标签、测试标识定位,用条件等待,不依赖固定延时与坐标。 +- 固定视口(桌面 1920×1000,移动 393×851 和 360×800。360×800 是必测的最小移动视口,专项可增加其他尺寸)、DPR 1、`zh-CN`、`Asia/Shanghai`、`reducedMotion: reduce`、相同数据与状态;用角色、标签、测试标识定位,用条件等待,不依赖固定延时与坐标。 - 等待懒加载、骨架屏、提交中状态结束;检查错误消息、控制台、实际路由与无效数值,不能只凭无 pageerror 判定通过。 - 只读验收记录所有非 GET `/api/` 请求(应为 0);模拟响应按接口真实结构提供并标注;真实写入只用可清理的测试数据;支付未启用不得写成支付通过。 - 定位双字按钮允许 antd 默认字间距,如 `getByRole('button', { name: /^(?:loadings+)?保s*存$/ })`;虚拟 Select 用可见选项或组合框键盘操作,不点击隐藏的辅助选项。 diff --git a/docs/ui/KEY_MANAGEMENT_SPEC.md b/docs/ui/KEY_MANAGEMENT_SPEC.md index 694aaa4f..0a1758ec 100644 --- a/docs/ui/KEY_MANAGEMENT_SPEC.md +++ b/docs/ui/KEY_MANAGEMENT_SPEC.md @@ -38,8 +38,8 @@ | 页头 | `UserCenterPageHeader`;“新手教程 / 查看操作指引”图标按钮保留在右侧 | | 查询卡 | 保留单输入框,匹配密钥名称、Key 或分组。输入防抖,点击搜索或按回车立即提交,重置取消待提交条件并回到普通列表第 1 页 | | 列表 | `Table size='middle' tableLayout='fixed'`,列宽 150 / 300 / 150 / 100 / 180 / 100 / 100 / 130;默认每页 10 条;列设置用 `ColumnSettings`,不持久化 | -| 状态 | `Switch`(`onChange` 仍走原 `Modal.confirm` → `manageToken`);已过期 / 已耗尽另显示语义 `Tag` | -| 分组 | `Tag color='blue'` 无边框 + `Tooltip`;额度为 `Tag color='success'` | +| 状态 | `TableStatusSwitch`(`onChange` 仍走原 `Modal.confirm` → `manageToken`);已过期 / 已耗尽另显示语义 `Tag` | +| 分组 | `TableGroupTags` + `Tooltip`,颜色按组件公共规范;额度为 `Tag color='success'` | | 密钥 | `` 密钥框(底 `#f4f6f9`、描边 `#e4e9ee`,深色引用 `--surface-bg-base` / `--border-subtle`)+ 显示、隐藏、复制图标按钮 + `Tooltip`;脱敏提示 `Alert type='success'` | | 模型抽屉 | 440px;正文 20px;卡片间 18px;信息卡 16px(标签 12 / 18px);分类头 45px(底 `#f6f8fa`);模型名高 28px(等宽 12px、底 `#fafafa`);行距 9.5px、列距 8px;面板描边 `#e4e9ef` | | 编辑抽屉 | 560px(移动 100%);适配 `Form requiredMark={false}`;过期快捷 `Button` 组(间距 5px、描边 `#d9dfe6`、无按钮阴影,`aria-pressed`);仅“自定义”显示 `DatePicker showTime`;高级设置 `Collapse`(`forceRender`)+ `Switch` + `Divider`;页脚按钮间距 10px | diff --git a/docs/ui/ORG_CENTER_SPEC.md b/docs/ui/ORG_CENTER_SPEC.md index 1a46da08..c043a06d 100644 --- a/docs/ui/ORG_CENTER_SPEC.md +++ b/docs/ui/ORG_CENTER_SPEC.md @@ -50,7 +50,7 @@ - **页头**:`OrgPageHeader`(内部复用 `UserCenterPageHeader`),规格见 `GLOBAL_UI_BASELINE.md` 4.4;页头不放操作按钮,操作移入列表卡头。面包屑分组见 4.4 第 3 条。 - **列表卡 `OrgListCard`**:卡头与表格间距 20px;表格为紧凑变体(正文 13px,表头 12px / 500、底色 `--oc-soft`,行上下内边距 17px);分页按公共组件规范,覆盖页签及表格明细。 -- **筛选卡 `OrgFilterCard`**:固定 3 列;筛选取值与生效时机沿用原页面(审计日志为“选择即筛选”,“搜索”以当前条件重新查询)。 +- **筛选卡 `OrgFilterCard`**:默认 3 列。提示词记录和消耗明细的筛选区沿用个人消费记录的布局。筛选取值与生效时机沿用原页面(审计日志为“选择即筛选”,“搜索”以当前条件重新查询)。 - **行操作 `OrgRowActions`**:link 按钮 13 / 24px、无内边距、间距 10px,不带图标。 - **列表页签 `.oc-list-tabs`**:导航高 44px,页签内边距 12px 0,选中与悬停色为 `--oc-brand`;只切换筛选时加 `.oc-tabs-nav-only`。 - **标签**:表格与卡片内标签统一无边框(`variant='filled'`);非 antd 预设色改用 `gold` / `purple`。 @@ -70,8 +70,8 @@ | 审批中心 | 状态页签(回调 `setStatusFilter`)+ 申请列表卡;拒绝弹窗竖排表单项 | — | | 密钥管理 | 密钥框 + 显隐 / 复制、可用模型 link、分组列、状态开关、绝对时间;列设置用共享组件;创建 / 编辑为 560px `OrgSideSheet` | 列设置只在当前页面生效;非操作列整体横向滚动,仅在可见列宽度超过容器时显示滚动条 | | 企业充值 | 企业钱包 + 充值工作区(额度卡 / 自定义 / 支付方式)+ 订单卡 + 记录;订单“立即充值”与支付方式点击同为 `handlePreTopUp` | 档位与折扣来自后台配置;无订单号搜索与发票入口 | -| 消耗明细 | 统计卡 + 页签(明细日志 / 成员排行 / 绘图与视频)+ 三列筛选卡 + 列表卡;查询按钮为“搜索”(`handleSearch`) | 见第 5 节 | -| 审计日志 | 页签 + 筛选卡(操作类型)+ 操作记录卡;“提示词记录”页签沿用原显隐 | — | +| 消耗明细 | 统计卡 + 页签(明细日志 / 成员排行 / 绘图与视频)+ 消费记录样式筛选卡 + 列表卡;查询按钮为“搜索”(`handleSearch`) | 见第 5 节 | +| 审计日志 | 页签 + 筛选卡(操作类型)+ 操作记录卡;“提示词记录”页签沿用原显隐,筛选区参考消费记录;说明条上下与筛选卡至列表卡均间隔 18px | — | | 个人设置 | 复用用户中心 `ui-personal-*`、`AvatarSection`、`SectionHeader`;三页签:头像设置 / 个人资料 / 通知设置;企业身份并入资料头 | 昵称在弹窗中修改 | | 企业设置 | 设置卡内页签 + 区块头(刷新 / 保存设置);复制为 14px 无内边距图标按钮 | 保留“数据安全”“危险区域”页签 | @@ -83,7 +83,8 @@ ## 5. 消耗明细(/org/logs) -- 绘图与视频由 `components/OrgTaskRecords.jsx` 呈现,复用 `useTaskLogsData({ organizationMode: true })`、`TaskLogsFilters`、`getTaskLogsColumns`、`exportTaskLogsPageCsv`、`ColumnSelectorModal`、`ContentModal`;结构为筛选卡 + “任务记录”列表卡(导出本页 / 刷新 / 列设置),不渲染“本页统计”区块,移动端筛选直接展开。 +- 三个页签和审计日志下的提示词记录共用个人消费记录的筛选布局:桌面五列,时间范围跨两列;窄屏三列,移动端单列并默认收起。操作区位于右下,“重置”在前,“搜索”在后,点击和回车共用提交入口。 +- 绘图与视频由 `components/OrgTaskRecords.jsx` 呈现,复用 `useTaskLogsData({ organizationMode: true })`、`TaskLogsFilters`、`getTaskLogsColumns`、`exportTaskLogsPageCsv`、`ColumnSelectorModal`、`ContentModal`;结构为筛选卡 + “任务记录”列表卡(导出本页 / 刷新 / 列设置),不渲染“本页统计”区块。 - 任务表列宽 185 / 185 / 110 / 110 / 250 / 330 / 110 / 155 / 145 / 150;模型为行内胶囊,费用主色右对齐;分页沿用公共规范。“刷新”与“搜索”调用同一 `refresh`。 - 时间范围为本页签自有的可编辑字段(默认最近 7 天,含快捷预设),与“明细日志”筛选互不影响;起止颠倒沿用原提示。 - 末列“操作”不固定:视频任务显示“点击预览视频”,失败任务保留失败原因查看,其余显示“-”。 diff --git a/src/components/common/table/TableActionModal.jsx b/src/components/common/table/TableActionModal.jsx new file mode 100644 index 00000000..f1e8f348 --- /dev/null +++ b/src/components/common/table/TableActionModal.jsx @@ -0,0 +1,38 @@ +import React, { useRef, useState } from 'react'; +import { Modal } from '@/components/ui'; + +export default function TableActionModal({ onOk, ...props }) { + const [submitting, setSubmitting] = useState(false); + const cancelButton = useRef(null); + const pending = useRef(false); + + const confirm = async () => { + if (pending.current) return; + pending.current = true; + setSubmitting(true); + try { + await onOk(); + } catch { + // The request or page already reports the error. + } finally { + pending.current = false; + setSubmitting(false); + } + }; + + return ( + { + if (!pending.current) props.onCancel(event); + }} + afterOpenChange={(visible) => { + if (visible) cancelButton.current?.focus(); + }} + cancelButtonProps={{ ref: cancelButton }} + /> + ); +} diff --git a/src/components/common/table/TableActionPopconfirm.jsx b/src/components/common/table/TableActionPopconfirm.jsx new file mode 100644 index 00000000..391c2a31 --- /dev/null +++ b/src/components/common/table/TableActionPopconfirm.jsx @@ -0,0 +1,76 @@ +import React, { useRef, useState } from 'react'; +import { Popconfirm } from 'antd'; + +export default function TableActionPopconfirm({ + children, + content, + position, + onConfirm, + ...props +}) { + const [open, setOpen] = useState(false); + const cancelButton = useRef(null); + const trigger = useRef(null); + const pending = useRef(false); + const [submitting, setSubmitting] = useState(false); + + const confirm = (event) => { + if (pending.current) return; + pending.current = true; + setSubmitting(true); + void (async () => { + try { + if ((await onConfirm(event)) !== false) setOpen(false); + } catch { + // The request or page already reports the error. + } finally { + pending.current = false; + setSubmitting(false); + } + })(); + }; + + const cancel = () => { + if (pending.current) return; + setOpen(false); + trigger.current?.focus(); + }; + + const handleKeyDown = (event) => { + if (event.key === 'Escape') { + event.stopPropagation(); + cancel(); + } + }; + + return ( + { + if (pending.current) return; + if (nextOpen) trigger.current = document.activeElement; + setOpen(nextOpen); + }} + afterOpenChange={(visible) => { + if (visible) cancelButton.current?.focus(); + }} + onConfirm={confirm} + onCancel={cancel} + cancelButtonProps={{ + ref: cancelButton, + disabled: submitting, + onKeyDown: handleKeyDown, + }} + okButtonProps={{ + danger: true, + loading: submitting, + onKeyDown: handleKeyDown, + }} + > + {children} + + ); +} diff --git a/src/components/common/table/TableGroupTags.jsx b/src/components/common/table/TableGroupTags.jsx new file mode 100644 index 00000000..f3c4840d --- /dev/null +++ b/src/components/common/table/TableGroupTags.jsx @@ -0,0 +1,80 @@ +import React from 'react'; +import { Tag } from 'antd'; +import './table-group-tags.css'; + +export const TABLE_GROUP_COLUMN_WIDTH = 148; + +const groupColors = new Map([ + ['default', 'blue'], + ['svip', 'red'], + ['vip', 'yellow'], + ['premium', 'red'], + ['pro', 'yellow'], +]); + +const standardGroupNames = new Set(['default', 'vip', 'svip']); + +function displayGroupName(group) { + const name = group?.trim().toLowerCase(); + return standardGroupNames.has(name) ? name : group; +} + +export function TableGroupTag({ group, children, onClick }) { + return ( + { + if (event.key !== 'Enter' && event.key !== ' ') return; + event.preventDefault(); + event.stopPropagation(); + if (!event.repeat) onClick(event); + } + : undefined + } + className='m-0' + > + {children ?? displayGroupName(group)} + + ); +} + +export default function TableGroupTags({ + groups, + empty = '-', + renderLabel, + onGroupClick, +}) { + const names = [ + ...new Set( + (Array.isArray(groups) ? groups : [groups]) + .flatMap((value) => (typeof value === 'string' ? value.split(',') : [])) + .map((name) => name.trim()) + .filter(Boolean), + ), + ]; + if (!names.length) return empty; + + return ( + + {names.map((name) => ( + onGroupClick(name, event) : undefined + } + > + {standardGroupNames.has(name.toLowerCase()) + ? displayGroupName(name) + : renderLabel?.(name)} + + ))} + + ); +} diff --git a/src/components/common/table/TableStatusSwitch.jsx b/src/components/common/table/TableStatusSwitch.jsx new file mode 100644 index 00000000..5a02baad --- /dev/null +++ b/src/components/common/table/TableStatusSwitch.jsx @@ -0,0 +1,20 @@ +import React, { forwardRef } from 'react'; +import { Switch } from 'antd'; +import { useTranslation } from 'react-i18next'; + +export default forwardRef(function TableStatusSwitch( + { checkedChildren, unCheckedChildren, 'aria-label': ariaLabel, ...props }, + ref, +) { + const { t } = useTranslation(); + return ( + + ); +}); diff --git a/src/components/common/table/UsageRecordFilterCard.jsx b/src/components/common/table/UsageRecordFilterCard.jsx new file mode 100644 index 00000000..5eafd22a --- /dev/null +++ b/src/components/common/table/UsageRecordFilterCard.jsx @@ -0,0 +1,44 @@ +import React, { useId, useState } from 'react'; +import { Card } from 'antd'; +import { useTranslation } from 'react-i18next'; +import { Button } from '@/components/ui'; +import { useIsMobile } from '../../../hooks/common/useIsMobile'; +import './usage-record-filter.css'; + +export function UsageRecordFilterContent({ children }) { + const { t } = useTranslation(); + const isMobile = useIsMobile(); + const [expanded, setExpanded] = useState(false); + const id = useId(); + + return ( + <> + {isMobile && ( + + )} + + + ); +} + +export default function UsageRecordFilterCard({ children, className }) { + return ( + + {children} + + ); +} diff --git a/src/components/common/table/confirmTableAction.js b/src/components/common/table/confirmTableAction.js new file mode 100644 index 00000000..cff77942 --- /dev/null +++ b/src/components/common/table/confirmTableAction.js @@ -0,0 +1,30 @@ +import { Modal } from '@/components/ui'; + +export function confirmTableAction({ onOk, ...config }) { + let submitting = false; + const okButtonProps = { danger: true, ...config.okButtonProps }; + const dialog = Modal.confirm({ + ...config, + okButtonProps, + onOk: (close) => { + if (submitting) return; + submitting = true; + dialog.update({ + okButtonProps: { ...okButtonProps, loading: true }, + }); + void (async () => { + try { + if ((await onOk()) !== false) close(); + } catch { + // The request or page already reports the error. + } finally { + submitting = false; + dialog.update({ + okButtonProps: { ...okButtonProps, loading: false }, + }); + } + })(); + }, + }); + return dialog; +} diff --git a/src/components/common/table/table-group-tags.css b/src/components/common/table/table-group-tags.css new file mode 100644 index 00000000..75de4a69 --- /dev/null +++ b/src/components/common/table/table-group-tags.css @@ -0,0 +1,27 @@ +.table-group-tags { + display: inline-flex; + align-items: center; + gap: 4px; + inline-size: 132px; + max-inline-size: 100%; + overflow-x: auto; + vertical-align: middle; + white-space: nowrap; +} + +.table-group-tags > * { + flex: none; +} + +.table-group-tags .table-group-tags { + inline-size: auto; + overflow: visible; +} + +.table-group-tags > .ant-tag { + margin-inline-end: 0; +} + +.table-group-tags > .ant-tag:focus-visible { + outline-offset: -2px; +} diff --git a/src/components/common/table/usage-record-filter.css b/src/components/common/table/usage-record-filter.css new file mode 100644 index 00000000..e8322faf --- /dev/null +++ b/src/components/common/table/usage-record-filter.css @@ -0,0 +1,82 @@ +.usage-record-filter-card { + --usage-record-filter-label: #6b7789; +} +html.dark .usage-record-filter-card { + --usage-record-filter-label: var(--text-secondary); +} +.usage-record-filter-card.ant-card { + background: var(--surface-card); +} +.usage-record-mobile-toggle { + margin-bottom: 0; +} +.usage-record-mobile-toggle[aria-expanded='true'] { + margin-bottom: 12px; +} + +/* 筛选:五列竖排标签表单,日期跨两列;重置/搜索右下 */ +:where(.usage-record-filter-card) .usage-record-filter-grid { + display: grid; + grid-template-columns: repeat(5, minmax(0, 1fr)); + column-gap: 16px; + row-gap: 16px; +} +:where(.usage-record-filter-card) + .usage-record-filter-grid + .usage-record-filter-wide { + grid-column: span 2; +} +:where(.usage-record-filter-card) .usage-record-filter-form .ant-form-item { + margin-bottom: 0; +} +:where(.usage-record-filter-card) + .usage-record-filter-form + .ant-form-item-label { + padding-bottom: 8px; +} +:where(.usage-record-filter-card) + .usage-record-filter-form + .ant-form-item-label + > label { + height: 21px; + color: var(--usage-record-filter-label); + font-size: 13px; +} +:where(.usage-record-filter-card) .usage-record-filter-form .ant-picker, +:where(.usage-record-filter-card) .usage-record-filter-form .ant-select { + width: 100%; +} +:where(.usage-record-filter-card) .usage-record-filter-actions { + display: flex; + justify-content: flex-end; + gap: 10px; + margin-top: 16px; +} + +@media (max-width: 1200px) { + :where(.usage-record-filter-card) .usage-record-filter-grid { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } +} +@media (max-width: 768px) { + :where(.usage-record-filter-card) .usage-record-filter-grid { + grid-template-columns: minmax(0, 1fr); + } + :where(.usage-record-filter-card) + .usage-record-filter-grid + .usage-record-filter-wide { + grid-column: auto; + } + :where(.usage-record-filter-card) .ant-picker-range { + padding-inline: 8px; + } + :where(.usage-record-filter-card) .ant-picker-range-separator { + padding-inline: 4px; + } + :where(.usage-record-filter-card) + .ant-picker-range + .ant-picker-input + > input { + font-size: 12px; + } +} diff --git a/src/components/common/ui/RenderUtils.jsx b/src/components/common/ui/RenderUtils.jsx index 54b1ef27..155a7c9c 100644 --- a/src/components/common/ui/RenderUtils.jsx +++ b/src/components/common/ui/RenderUtils.jsx @@ -4,12 +4,17 @@ import { Space, Tag, Typography, Popover } from '@/components/ui'; const { Text } = Typography; // 通用渲染函数:限制项目数量显示,支持popover展开 -export function renderLimitedItems({ items, renderItem, maxDisplay = 3 }) { +export function renderLimitedItems({ + items, + renderItem, + maxDisplay = 3, + wrap = true, +}) { if (!items || items.length === 0) return '-'; const displayItems = items.slice(0, maxDisplay); const remainingItems = items.slice(maxDisplay); return ( - + {displayItems.map((item, idx) => renderItem(item, idx))} {remainingItems.length > 0 && ( div + div { +.console-channel-sections > div + div, +.console-user-sections > .ant-card + .ant-card { margin-top: 10px; } @@ -107,13 +110,13 @@ margin-bottom: 0; } -.console-channel-section .ant-avatar svg { - display: block; - width: 16px; - height: 16px; +.console-user-section-description { + color: var(--console-muted); + font-size: 12px; } -.console-channel-footer .ant-btn { +.console-channel-footer .ant-btn, +.console-user-footer .ant-btn { display: inline-flex; align-items: center; justify-content: center; @@ -133,7 +136,8 @@ } .console-overlay .console-model-footer, -.console-overlay .console-channel-footer { +.console-overlay .console-channel-footer, +.console-overlay .console-user-footer { display: flex; align-items: center; justify-content: flex-end; @@ -153,7 +157,8 @@ } } .console-model-drawer .console-model-editor-header .ant-drawer-title, -.console-channel-drawer .console-channel-editor-header .ant-drawer-title { +.console-channel-drawer .console-channel-editor-header .ant-drawer-title, +.console-user-drawer .console-user-editor-header .ant-drawer-title { text-align: start; } diff --git a/src/components/quality/QualityAlerts.jsx b/src/components/quality/QualityAlerts.jsx index 7f87a41c..419a58d6 100644 --- a/src/components/quality/QualityAlerts.jsx +++ b/src/components/quality/QualityAlerts.jsx @@ -1,3 +1,5 @@ +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; +import TableStatusSwitch from '@/components/common/table/TableStatusSwitch'; import { Plus as ActionPlus } from '@/components/common/icons/ActionIcons'; import React, { useCallback, useEffect, useState } from 'react'; import { @@ -6,7 +8,6 @@ import { Input, InputNumber, Modal, - Popconfirm, Select, Switch, Table, @@ -146,6 +147,7 @@ const QualityAlerts = ({ quality, t }) => { load(); } catch (e) { Toast.error(saveErrorText(e)); + return false; } }; @@ -173,8 +175,7 @@ const QualityAlerts = ({ quality, t }) => { dataIndex: 'enabled', width: 70, render: (v, rule) => ( - toggle(rule, checked)} /> @@ -220,14 +221,14 @@ const QualityAlerts = ({ quality, t }) => { > {t('编辑')} - remove(rule)} > - - + ), }, diff --git a/src/components/quality/QualityBreakdown.jsx b/src/components/quality/QualityBreakdown.jsx index 0aa565d3..34fd0ef0 100644 --- a/src/components/quality/QualityBreakdown.jsx +++ b/src/components/quality/QualityBreakdown.jsx @@ -196,7 +196,7 @@ const QualityBreakdown = ({ quality, t }) => { />
{dims.map((d) => ( @@ -215,7 +215,7 @@ const QualityBreakdown = ({ quality, t }) => { className={ isPlatform ? 'quality-breakdown-result' - : 'overflow-x-auto app-scrollbar mt-2' + : 'overflow-x-auto app-scrollbar' } > .ant-tabs-nav { +.quality-breakdown-org-body { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: var(--uc-layout-gap); +} + +.quality-breakdown-body .ant-tabs > .ant-tabs-nav, +.quality-breakdown-org-body .ant-tabs > .ant-tabs-nav { margin-bottom: 0; } @@ -214,6 +221,16 @@ border-color: color-mix(in srgb, var(--ui-color-primary) 22%, transparent); } +.quality-breakdown-org-body .quality-notice { + align-items: center; + justify-content: center; + text-align: center; +} + +.quality-breakdown-org-body .quality-notice > svg { + margin-top: 0; +} + .quality-grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); diff --git a/src/components/settings/ContentGuardSetting.jsx b/src/components/settings/ContentGuardSetting.jsx index dbea3b9f..9e188609 100644 --- a/src/components/settings/ContentGuardSetting.jsx +++ b/src/components/settings/ContentGuardSetting.jsx @@ -1,3 +1,6 @@ +import TableGroupTags, { + TABLE_GROUP_COLUMN_WIDTH, +} from '@/components/common/table/TableGroupTags'; import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js'; import { formatIdReference } from '../../helpers/safeDisplay'; import { TestTube2 as ActionTestTube2 } from '@/components/common/icons/ActionIcons'; @@ -327,7 +330,12 @@ export default function ContentGuardSetting() { render: (v) => new Date(v).toLocaleString(), }, { title: t('用户'), dataIndex: 'user_id', width: 80 }, - { title: t('分组'), dataIndex: 'using_group' }, + { + title: t('分组'), + dataIndex: 'using_group', + width: TABLE_GROUP_COLUMN_WIDTH, + render: (groups) => , + }, { title: t('模型'), dataIndex: 'model' }, { title: t('方向'), dataIndex: 'direction' }, { title: t('类型'), dataIndex: 'content_type' }, diff --git a/src/components/settings/CustomerServiceSetting.jsx b/src/components/settings/CustomerServiceSetting.jsx index 30ee91fc..010c7ff2 100644 --- a/src/components/settings/CustomerServiceSetting.jsx +++ b/src/components/settings/CustomerServiceSetting.jsx @@ -1,3 +1,4 @@ +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; import { RefreshCw as ActionRefreshCw, Plus as ActionPlus, @@ -13,7 +14,6 @@ import { Select, Tag, Avatar, - Popconfirm, Typography, Space, Banner, @@ -178,12 +178,14 @@ const CustomerServiceSetting = () => { if (res.data.success) { showSuccess(t('删除成功')); fetchAgents(); + return true; } else { showError(res.data.message); } } catch (err) { showError(t('删除失败')); } + return false; }; // 切换状态 @@ -301,7 +303,7 @@ const CustomerServiceSetting = () => { - handleDelete(record.id)} @@ -309,7 +311,7 @@ const CustomerServiceSetting = () => { - + ), }, diff --git a/src/components/settings/DataSecuritySetting.jsx b/src/components/settings/DataSecuritySetting.jsx index 92bdc44a..e7a85a01 100644 --- a/src/components/settings/DataSecuritySetting.jsx +++ b/src/components/settings/DataSecuritySetting.jsx @@ -1,3 +1,4 @@ +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js'; import { useEffectEvent } from '../../hooks/common/useEffectEvent'; import React, { useEffect, useRef, useState } from 'react'; @@ -317,9 +318,11 @@ export default function DataSecuritySetting() { showSuccess(res.data?.message || t('删除成功')); loadOrgConfigs(); loadChangeRequests(); // 开启二级审批时会进入待审批队列 + return true; } else { showError(res.data?.message || t('删除失败')); } + return false; }; const toggleKillSwitch = async (action) => { const res = await API.post('/api/desensitize/killswitch', { @@ -438,9 +441,11 @@ export default function DataSecuritySetting() { showSuccess(res.data?.message || t('删除成功')); loadRules(); loadChangeRequests(); + return true; } else { showError(res.data?.message || t('删除失败')); } + return false; }; // ---- 审批 ---- @@ -496,14 +501,14 @@ export default function DataSecuritySetting() { - deleteRule(rule)} > - + ), }, @@ -859,7 +864,7 @@ export default function DataSecuritySetting() { { title: t('操作'), render: (_, rule) => ( - {t('删除')} - + ), }, ]} @@ -1181,14 +1186,14 @@ export default function DataSecuritySetting() { > {t('编辑')} - deleteOrgConfig(row.org_id)} > - + ), }, diff --git a/src/components/settings/LevelPolicySetting.jsx b/src/components/settings/LevelPolicySetting.jsx index 4efcd31b..7e2c349f 100644 --- a/src/components/settings/LevelPolicySetting.jsx +++ b/src/components/settings/LevelPolicySetting.jsx @@ -1,3 +1,6 @@ +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; +import TableStatusSwitch from '@/components/common/table/TableStatusSwitch'; +import { TableGroupTag } from '@/components/common/table/TableGroupTags'; import { Trans } from 'react-i18next'; import { Eraser as ActionEraser } from '@/components/common/icons/ActionIcons'; import { @@ -25,7 +28,6 @@ import { Tooltip, Divider, Empty, - Switch, } from '@/components/ui'; import { Search } from 'lucide-react'; import { API, showError, showSuccess } from '../../helpers'; @@ -745,6 +747,7 @@ const LevelPolicySetting = () => { showSuccess(t('删除成功')); } await fetchAll(); + return true; } else { const d = res?.data?.data || {}; const refs = []; @@ -770,6 +773,7 @@ const LevelPolicySetting = () => { } finally { setDeletingCode(''); } + return false; }; const saveDefaults = async () => { @@ -859,9 +863,9 @@ const LevelPolicySetting = () => { const tags = ( {preview.map((g) => ( - + {g} ×{d[g]} - + ))} {rest > 0 && ( @@ -953,9 +957,7 @@ const LevelPolicySetting = () => { > {preview.map((g) => ( - - {g} - + ))} {rest > 0 && ( @@ -988,7 +990,7 @@ const LevelPolicySetting = () => { {t('复制')} - deleteLevel(type, r.code)} @@ -1001,7 +1003,7 @@ const LevelPolicySetting = () => { > {t('删除')} - + ), }, @@ -1419,7 +1421,7 @@ const LevelPolicySetting = () => { dataIndex: 'model', render: (v, r) => ( - {v} + {r.maybeDisabled && ( { dataIndex: 'group', render: (v, r) => ( - {v} + {r.stale && ( { // 已废弃分组只允许关闭存量隐藏条目:后端对新增隐藏做存在性校验必拒, // 放开开关会造成一次注定失败的保存。 render: (v, r) => ( - setGroupHidden(r.group, checked)} /> diff --git a/src/components/settings/TutorialVideoSetting.jsx b/src/components/settings/TutorialVideoSetting.jsx index 032f79aa..230e3f0e 100644 --- a/src/components/settings/TutorialVideoSetting.jsx +++ b/src/components/settings/TutorialVideoSetting.jsx @@ -1,3 +1,5 @@ +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; +import TableStatusSwitch from '@/components/common/table/TableStatusSwitch'; import { useEffectEvent } from '../../hooks/common/useEffectEvent'; import React, { useState, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; @@ -8,8 +10,6 @@ import { Modal, Form, Toast, - Popconfirm, - Switch, Tag, Progress, Empty, @@ -154,6 +154,7 @@ const TutorialVideoSetting = () => { if (res.data.success) { Toast.success(t('删除成功')); loadVideos(); + return true; } else { Toast.error(res.data.message || t('删除失败')); } @@ -161,6 +162,7 @@ const TutorialVideoSetting = () => { console.error('Delete error:', error); Toast.error(t('删除失败')); } + return false; }; // 切换状态 @@ -231,11 +233,9 @@ const TutorialVideoSetting = () => { dataIndex: 'status', width: 80, render: (status, record) => ( - handleToggleStatus(record)} - checkedText={t('启用')} - uncheckedText={t('禁用')} /> ), }, @@ -254,7 +254,7 @@ const TutorialVideoSetting = () => { - handleDelete(record.id)} @@ -262,7 +262,7 @@ const TutorialVideoSetting = () => { - + ), }, diff --git a/src/components/smart-router/ProfileTable.jsx b/src/components/smart-router/ProfileTable.jsx index 410fca08..492adf1e 100644 --- a/src/components/smart-router/ProfileTable.jsx +++ b/src/components/smart-router/ProfileTable.jsx @@ -1,6 +1,7 @@ +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; import React, { useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { Button, Empty, Popconfirm, Space, Tag, Typography } from 'antd'; +import { Button, Empty, Space, Tag, Typography } from 'antd'; import { Table } from '@/components/ui'; import { ConsoleAlert as Alert } from '../console/ConsolePrimitives'; import { Plus } from '../common/icons/ActionIcons'; @@ -143,10 +144,9 @@ const ProfileTable = ({ mode, orgId, canWrite = true, emptyHint }) => { - { try { await deleteProfile(mode, orgId, r.id); @@ -154,13 +154,14 @@ const ProfileTable = ({ mode, orgId, canWrite = true, emptyHint }) => { load(); } catch (e) { if (e?.message) showError(e.message); + return false; } }} > - + )} diff --git a/src/components/table/admin-tokens/AdminTokensColumnDefs.jsx b/src/components/table/admin-tokens/AdminTokensColumnDefs.jsx index 36c414f8..8a449c9f 100644 --- a/src/components/table/admin-tokens/AdminTokensColumnDefs.jsx +++ b/src/components/table/admin-tokens/AdminTokensColumnDefs.jsx @@ -1,5 +1,7 @@ +import { TABLE_GROUP_COLUMN_WIDTH } from '@/components/common/table/TableGroupTags'; +import TableStatusSwitch from '@/components/common/table/TableStatusSwitch'; import React from 'react'; -import { Button, Switch, Tag as AntTag } from 'antd'; +import { Button, Tag as AntTag } from 'antd'; import { Tag, Typography, Popover } from '@/components/ui'; import { renderGroup, @@ -21,11 +23,8 @@ const renderStatus = (status, record, t, showEnableDisableModal) => { (![1, 2].includes(status) ? { color: 'error', label: '未知状态' } : null); return (
- @@ -194,7 +193,7 @@ export const getAdminTokensColumns = ({ { title: t('分组'), dataIndex: 'group', - width: 110, + width: TABLE_GROUP_COLUMN_WIDTH, render: (text) =>
{renderGroup(text)}
, }, { diff --git a/src/components/table/admin-tokens/index.jsx b/src/components/table/admin-tokens/index.jsx index ad505037..58744d82 100644 --- a/src/components/table/admin-tokens/index.jsx +++ b/src/components/table/admin-tokens/index.jsx @@ -82,8 +82,7 @@ const AdminTokensPage = () => { const handleDeleteConfirm = async () => { if (!modalToken) return; - await manageToken(modalToken.id, 'delete'); - setShowDelete(false); + if (await manageToken(modalToken.id, 'delete')) setShowDelete(false); }; const handleEditConfirm = async () => { diff --git a/src/components/table/admin-tokens/modals/AdminDeleteTokenModal.jsx b/src/components/table/admin-tokens/modals/AdminDeleteTokenModal.jsx index 570e3c9f..20bc2a20 100644 --- a/src/components/table/admin-tokens/modals/AdminDeleteTokenModal.jsx +++ b/src/components/table/admin-tokens/modals/AdminDeleteTokenModal.jsx @@ -1,5 +1,6 @@ +import TableActionModal from '@/components/common/table/TableActionModal'; import React from 'react'; -import { Modal, Typography, Banner } from '@/components/ui'; +import { Typography, Banner } from '@/components/ui'; const { Text } = Typography; @@ -8,7 +9,7 @@ const AdminDeleteTokenModal = ({ visible, onCancel, onConfirm, token, t }) => { const isOrgToken = token.organization_id > 0; return ( - { {token.user_id})
- + ); }; diff --git a/src/components/table/channels/ChannelsColumnDefs.jsx b/src/components/table/channels/ChannelsColumnDefs.jsx index 8d79f2c2..1d490fc6 100644 --- a/src/components/table/channels/ChannelsColumnDefs.jsx +++ b/src/components/table/channels/ChannelsColumnDefs.jsx @@ -1,6 +1,9 @@ +import { TABLE_GROUP_COLUMN_WIDTH } from '@/components/common/table/TableGroupTags'; +import { toGroupList } from '@/helpers/groupList'; +import { confirmTableAction } from '@/components/common/table/confirmTableAction'; +import TableStatusSwitch from '@/components/common/table/TableStatusSwitch'; import { writeClipboardText } from '../../../helpers/clipboard'; import React, { useState } from 'react'; -import { Switch } from 'antd'; import { Button, InputNumber, @@ -34,11 +37,8 @@ const formatDisplayPercent = (value, digits = 0) => { function ChannelStatusSwitch({ record, manageChannel, t }) { const [loading, setLoading] = useState(false); return ( - ( -
- - {text - ?.split(',') - .sort((a, b) => { - if (a === 'default') return -1; - if (b === 'default') return 1; - return a.localeCompare(b); - }) - .map((item, index) => renderGroup(item))} - -
- ), + width: TABLE_GROUP_COLUMN_WIDTH, + render: (groups) => + renderGroup( + toGroupList(groups).sort((left, right) => { + if (left === right) return 0; + if (left === 'default') return -1; + if (right === 'default') return 1; + return left.localeCompare(right); + }), + ), }, { key: COLUMN_KEYS.TYPE, @@ -723,19 +719,20 @@ export const getChannelsColumns = ({ type: 'danger', onClick: async () => { const content = await buildDeleteConfirmContent(record.id, t); - Modal.confirm({ + confirmTableAction({ title: t('确定是否要删除此渠道?'), content, - onOk: () => { - (async () => { - await manageChannel(record.id, 'delete', record); - await refresh(); - setTimeout(() => { - if (channels.length === 0 && activePage > 1) { - refresh(activePage - 1); - } - }, 100); - })(); + okType: 'danger', + focusable: { autoFocusButton: 'cancel' }, + onOk: async () => { + if (!(await manageChannel(record.id, 'delete', record))) + return false; + await refresh(); + setTimeout(() => { + if (channels.length === 0 && activePage > 1) { + refresh(activePage - 1); + } + }, 100); }, }); }, diff --git a/src/components/table/channels/modals/EditChannelModal.jsx b/src/components/table/channels/modals/EditChannelModal.jsx index 66b8e255..0817eb26 100644 --- a/src/components/table/channels/modals/EditChannelModal.jsx +++ b/src/components/table/channels/modals/EditChannelModal.jsx @@ -1,3 +1,4 @@ +import { toGroupList } from '@/helpers/groupList'; import { formatIdReference } from '../../../../helpers/safeDisplay'; import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js'; @@ -46,13 +47,7 @@ import SecureVerificationModal from '../../../common/modals/SecureVerificationMo import ChannelKeyDisplay from '../../../common/ui/ChannelKeyDisplay'; import { useSecureVerification } from '../../../../hooks/common/useSecureVerification'; import { createApiCalls } from '../../../../services/secureVerification'; -import { - IconServer, - IconSetting, - IconCode, - IconGlobe, - IconBolt, -} from '@/components/ui/icons'; +import { Code, Globe, Server, Settings, Zap } from 'lucide-react'; const { Text } = Typography; @@ -573,11 +568,7 @@ const EditChannelModal = (props) => { } else { data.models = data.models.split(','); } - if (data.group === '') { - data.groups = []; - } else { - data.groups = data.group.split(','); - } + data.groups = toGroupList(data.group); if (data.model_mapping !== '') { data.model_mapping = JSON.stringify( JSON.parse(data.model_mapping), @@ -1575,7 +1566,7 @@ const EditChannelModal = (props) => { let res; localInputs.auto_ban = localInputs.auto_ban ? 1 : 0; localInputs.models = localInputs.models.join(','); - localInputs.group = (localInputs.groups || []).join(','); + localInputs.group = toGroupList(localInputs.groups).join(','); // 日消耗限额统一使用 token(quota)单位,确保为整数 if (localInputs.daily_quota_limit && localInputs.daily_quota_limit > 0) { @@ -1921,7 +1912,7 @@ const EditChannelModal = (props) => { {/* Header: Basic Info */}
- +
@@ -2462,7 +2453,7 @@ const EditChannelModal = (props) => { onClick={handleApiConfigSecretClick} > - +
@@ -2683,7 +2674,7 @@ const EditChannelModal = (props) => { {/* Header: Model Config */}
- +
@@ -2888,7 +2879,7 @@ const EditChannelModal = (props) => { {/* Header: Advanced Settings */}
- +
@@ -3433,7 +3424,7 @@ const EditChannelModal = (props) => { {/* Header: Channel Extra Settings */}
- +
diff --git a/src/components/table/channels/modals/EditTagModal.jsx b/src/components/table/channels/modals/EditTagModal.jsx index edf5c437..de7ac897 100644 --- a/src/components/table/channels/modals/EditTagModal.jsx +++ b/src/components/table/channels/modals/EditTagModal.jsx @@ -1,5 +1,8 @@ +import { toGroupList } from '@/helpers/groupList'; import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js'; import { useEffectEvent } from '../../../../hooks/common/useEffectEvent'; +import { useIsMobile } from '../../../../hooks/common/useIsMobile'; +import '../../../console/module-alignment.css'; import React, { useState, useEffect, useRef } from 'react'; import { API, @@ -18,29 +21,43 @@ import { Spin, Banner, Card, - Tag, Avatar, Form, + Row, + Col, } from '@/components/ui'; -import { - IconSave, - IconClose, - IconBookmark, - IconUser, - IconCode, - IconSetting, -} from '@/components/ui/icons'; +import { Bookmark, Code, Settings } from 'lucide-react'; import { getChannelModels } from '../../../../helpers'; import { useTranslation } from 'react-i18next'; -const { Text, Title } = Typography; +const { Text } = Typography; const MODEL_MAPPING_EXAMPLE = { 'gpt-3.5-turbo': 'gpt-3.5-turbo-0125', }; +function TagEditorSection({ icon, color, title, description, children }) { + return ( +
+ +
+ + {icon} + +
+ {title} +
{description}
+
+
+ {children} +
+
+ ); +} + const EditTagModal = (props) => { const { t } = useTranslation(); + const isMobile = useIsMobile(); const { visible, tag, handleClose, refresh } = props; const [loading, setLoading] = useState(false); const [originModelOptions, setOriginModelOptions] = useState([]); @@ -159,6 +176,7 @@ const EditTagModal = (props) => { }; const handleSave = async (values) => { + if (loading) return; setLoading(true); const formVals = values || formApiRef.current?.getValues() || {}; let data = { tag }; @@ -170,8 +188,9 @@ const EditTagModal = (props) => { } data.model_mapping = formVals.model_mapping; } - if (formVals.groups && formVals.groups.length > 0) { - data.groups = formVals.groups.join(','); + const groups = toGroupList(formVals.groups); + if (groups.length > 0) { + data.groups = groups.join(','); } if (formVals.models && formVals.models.length > 0) { data.models = formVals.models.join(','); @@ -234,6 +253,8 @@ const EditTagModal = (props) => { showSuccess(t('标签更新成功!')); refresh(); handleClose(); + } else if (res?.data) { + showError(res.data.message || t('操作失败')); } } catch (error) { showError(error); @@ -254,6 +275,10 @@ const EditTagModal = (props) => { }, [originModelOptions, inputs.models]); const onVisibilityChange = useEffectEvent(() => { + if (visible) { + setCustomModel(''); + formApiRef.current?.setValue('custom_model', ''); + } const fetchTagModels = async () => { if (!tag) return; setLoading(true); @@ -319,6 +344,7 @@ const EditTagModal = (props) => { setModelOptions(localModelOptions); setCustomModel(''); + formApiRef.current?.setValue('custom_model', ''); handleInputChange('models', localModels); if (addedModels.length > 0) { @@ -335,44 +361,27 @@ const EditTagModal = (props) => { return ( - - {t('编辑')} - - - {t('编辑标签')} - - - } + title={t('编辑标签')} bodyStyle={{ padding: '0' }} visible={visible} - width={600} + width={isMobile ? '100%' : 600} onCancel={handleClose} footer={ -
- - - - +
+ +
} - closeIcon={null} >
{ > {() => ( -
- - {/* Header: Tag Info */} -
- - - -
- {t('标签信息')} -
- {t('标签的基本配置')} -
-
-
- +
+ } + color='blue' + title={t('标签信息')} + description={t('标签的基本配置')} + > -
- handleInputChange('new_tag', value)} - /> -
- + +
+ handleInputChange('new_tag', value)} + /> + + + handleInputChange('groups', value)} + /> + + + - - {/* Header: Model Config */} -
- - - -
- {t('模型配置')} -
- {t('模型选择和映射设置')} -
-
-
+ } + color='purple' + title={t('模型配置')} + description={t('模型选择和映射设置')} + > + + handleInputChange('models', value)} + /> -
- - handleInputChange('models', value)} - /> + setCustomModel(value.trim())} + value={customModel} + suffix={ + + } + /> - setCustomModel(value.trim())} - suffix={ - - } - /> + {t('填入模板')} + + + handleInputChange( + 'model_mapping', + JSON.stringify({}, null, 2), + ) + } + > + {t('清空重定向')} + + handleInputChange('model_mapping', '')} + > + {t('不更改')} + + + } + /> + - - handleInputChange('model_mapping', value) - } - extraText={ - + } + color='orange' + title={t('高级设置')} + description={t('渠道的高级配置选项')} + > + + handleInputChange('param_override', value) + } + extraText={ +
+ + handleInputChange( + 'param_override', + JSON.stringify({ temperature: 0 }, null, 2), + ) + } + > + {t('旧格式模板')} + + + handleInputChange( + 'param_override', + JSON.stringify( + { + operations: [ + { + path: 'temperature', + mode: 'set', + value: 0.7, + conditions: [ + { + path: 'model', + mode: 'prefix', + value: 'gpt', + }, + ], + logic: 'AND', + }, + ], + }, + null, + 2, + ), + ) + } + > + {t('新格式模板')} + + + handleInputChange('param_override', null) + } + > + {t('不更改')} + +
+ } + /> + + + handleInputChange('header_override', value) + } + extraText={ +
+
handleInputChange( - 'model_mapping', - JSON.stringify(MODEL_MAPPING_EXAMPLE, null, 2), + 'header_override', + JSON.stringify( + { + 'User-Agent': + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0', + Authorization: 'Bearer {api_key}', + }, + null, + 2, + ), ) } > @@ -494,201 +631,27 @@ const EditTagModal = (props) => { - handleInputChange( - 'model_mapping', - JSON.stringify({}, null, 2), - ) - } - > - {t('清空重定向')} - - handleInputChange('model_mapping', '')} - > - {t('不更改')} - - - } - /> -
- - - - {/* Header: Advanced Settings */} -
- - - -
- {t('高级设置')} -
- {t('渠道的高级配置选项')} -
-
-
- -
- - handleInputChange('param_override', value) - } - extraText={ -
- - handleInputChange( - 'param_override', - JSON.stringify({ temperature: 0 }, null, 2), - ) - } - > - {t('旧格式模板')} - - - handleInputChange( - 'param_override', - JSON.stringify( - { - operations: [ - { - path: 'temperature', - mode: 'set', - value: 0.7, - conditions: [ - { - path: 'model', - mode: 'prefix', - value: 'gpt', - }, - ], - logic: 'AND', - }, - ], - }, - null, - 2, - ), - ) - } - > - {t('新格式模板')} - - - handleInputChange('param_override', null) + handleInputChange('header_override', null) } > {t('不更改')}
- } - /> - - - handleInputChange('header_override', value) - } - extraText={ -
-
- - handleInputChange( - 'header_override', - JSON.stringify( - { - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0', - Authorization: 'Bearer {api_key}', - }, - null, - 2, - ), - ) - } - > - {t('填入模板')} - - - handleInputChange('header_override', null) - } - > - {t('不更改')} - -
-
- - {t('支持变量:')} - -
-
- {t('渠道密钥')}:{' '} - {I18N_TECHNICAL_TEXT.API_KEY_PLACEHOLDER} -
+
+ + {t('支持变量:')} + +
+
+ {t('渠道密钥')}:{' '} + {I18N_TECHNICAL_TEXT.API_KEY_PLACEHOLDER}
- } - /> -
- - - - {/* Header: Group Settings */} -
- - - -
- {t('分组设置')} -
- {t('用户分组配置')}
-
-
- -
- handleInputChange('groups', value)} - /> -
-
+ } + /> +
)} diff --git a/src/components/table/channels/modals/MultiKeyManageModal.jsx b/src/components/table/channels/modals/MultiKeyManageModal.jsx index b3520497..f9ea9ac5 100644 --- a/src/components/table/channels/modals/MultiKeyManageModal.jsx +++ b/src/components/table/channels/modals/MultiKeyManageModal.jsx @@ -1,3 +1,4 @@ +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; import { formatIdReference } from '../../../../helpers/safeDisplay'; import { useEffectEvent } from '../../../../hooks/common/useEffectEvent'; @@ -247,6 +248,7 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => { showSuccess(t('密钥已删除')); await loadKeyStatus(currentPage, pageSize); // Reload current page onRefresh && onRefresh(); // Refresh parent component + return true; } else { showError(res.data.message); } @@ -255,6 +257,7 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => { } finally { setOperationLoading((prev) => ({ ...prev, [operationId]: false })); } + return false; }; // Handle page size change @@ -414,21 +417,21 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => { {t('启用')} )} - handleDeleteKey(record.index)} - okType={'danger'} position={'topRight'} > - + ), }, diff --git a/src/components/table/model-pricing/filter/PricingVendors.jsx b/src/components/table/model-pricing/filter/PricingVendors.jsx index bb3242ff..dce1dc6d 100644 --- a/src/components/table/model-pricing/filter/PricingVendors.jsx +++ b/src/components/table/model-pricing/filter/PricingVendors.jsx @@ -39,7 +39,7 @@ const PricingVendors = ({ ...vendorsList.map((vendor) => ({ value: vendor.name, label: vendor.name, - icon: vendor.icon ? getLobeHubIcon(vendor.icon, 18) : null, + icon: vendor.icon ? getLobeHubIcon(vendor.icon, 16) : null, })), ]; }, [vendorsMap, availableVendorNames, t]); diff --git a/src/components/table/model-pricing/market/market.css b/src/components/table/model-pricing/market/market.css index 96ea2f3a..c5588c17 100644 --- a/src/components/table/model-pricing/market/market.css +++ b/src/components/table/model-pricing/market/market.css @@ -338,6 +338,9 @@ html.dark .mm-theme { } .mm-filter-group .ant-btn { + display: inline-flex; + align-items: center; + justify-content: center; height: auto; min-height: 28px; padding: 3px 9px; @@ -348,6 +351,7 @@ html.dark .mm-theme { max-width: 100%; box-shadow: none; line-height: 1.45; + text-align: center; } .mm-filter-group .ant-btn.mm-selected { @@ -400,6 +404,17 @@ html.dark .mm-theme { padding: var(--mm-filter-logo-padding); } +.mm-filter-group .mm-logo :is(svg, img) { + display: block; + max-width: 16px; + max-height: 16px; +} + +.mm-filter-group .mm-logo + span { + position: relative; + top: 1px; +} + html.dark .mm-filter-group .mm-logo { color: var(--mm-filter-logo-ink); } diff --git a/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx b/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx index 6eb4e162..0c7bd602 100644 --- a/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx +++ b/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import TableGroupTags from '@/components/common/table/TableGroupTags'; import { Empty, Table, Tag, Tooltip } from 'antd'; import { ChevronRight } from 'lucide-react'; import { @@ -111,7 +112,7 @@ const ModelPricingTable = ({ ) : ( - {row.group} + {row.discountText && ( { // Render groups (enable_groups) const renderGroups = (groups) => { if (!groups || groups.length === 0) return '-'; - return renderLimitedItems({ - items: groups, - renderItem: (g, idx) => ( - {renderGroup(g)} - ), - }); + return ( + + {renderLimitedItems({ + items: groups, + renderItem: (group, index) => ( + {renderGroup(group)} + ), + wrap: false, + })} + + ); }; // Render tags @@ -261,14 +268,15 @@ const renderOperations = ( danger size='small' onClick={() => { - Modal.confirm({ + confirmTableAction({ title: t('确定是否要删除此模型?'), content: t('此修改将不可逆'), - onOk: () => { - (async () => { - await manageModel(record.id, 'delete', record); - await refresh(); - })(); + okType: 'danger', + focusable: { autoFocusButton: 'cancel' }, + onOk: async () => { + if (!(await manageModel(record.id, 'delete', record))) + return false; + await refresh(); }, }); }} @@ -407,6 +415,7 @@ export const getModelsColumns = ({ { title: t('可用分组'), dataIndex: 'enable_groups', + width: TABLE_GROUP_COLUMN_WIDTH, render: renderGroups, }, { diff --git a/src/components/table/models/modals/PrefillGroupManagement.jsx b/src/components/table/models/modals/PrefillGroupManagement.jsx index a0cf8eb7..1caa1ac1 100644 --- a/src/components/table/models/modals/PrefillGroupManagement.jsx +++ b/src/components/table/models/modals/PrefillGroupManagement.jsx @@ -1,3 +1,4 @@ +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; import '../../../console/module-alignment.css'; import React, { useState, useEffect, useCallback } from 'react'; import { @@ -6,7 +7,6 @@ import { Typography, Space, Tag, - Popconfirm, Card, Avatar, Spin, @@ -71,12 +71,14 @@ const PrefillGroupManagement = ({ visible, onClose }) => { if (res.data.success) { showSuccess(t('删除成功')); loadGroups(); + return true; } else { showError(res.data.message || t('删除失败')); } } catch (error) { showError(t('删除失败')); } + return false; }; // 编辑组 @@ -184,14 +186,14 @@ const PrefillGroupManagement = ({ visible, onClose }) => { - deleteGroup(record.id)} > - + ), }, diff --git a/src/components/table/redemptions/modals/DeleteRedemptionModal.jsx b/src/components/table/redemptions/modals/DeleteRedemptionModal.jsx index ae36fb63..08d38b43 100644 --- a/src/components/table/redemptions/modals/DeleteRedemptionModal.jsx +++ b/src/components/table/redemptions/modals/DeleteRedemptionModal.jsx @@ -1,5 +1,5 @@ +import TableActionModal from '@/components/common/table/TableActionModal'; import React from 'react'; -import { Modal } from '@/components/ui'; import { REDEMPTION_ACTIONS } from '../../../../constants/redemption.constants'; const DeleteRedemptionModal = ({ @@ -13,7 +13,8 @@ const DeleteRedemptionModal = ({ t, }) => { const handleConfirm = async () => { - await manageRedemption(record.id, REDEMPTION_ACTIONS.DELETE, record); + if (!(await manageRedemption(record.id, REDEMPTION_ACTIONS.DELETE, record))) + return; await refresh(); setTimeout(() => { if (redemptions.length === 0 && activePage > 1) { @@ -24,7 +25,7 @@ const DeleteRedemptionModal = ({ }; return ( - {t('此修改将不可逆')} - + ); }; diff --git a/src/components/table/task-logs/TaskLogsColumnDefs.jsx b/src/components/table/task-logs/TaskLogsColumnDefs.jsx index b8d6d8d1..b64224b3 100644 --- a/src/components/table/task-logs/TaskLogsColumnDefs.jsx +++ b/src/components/table/task-logs/TaskLogsColumnDefs.jsx @@ -132,6 +132,14 @@ const CustomTag = ({ ); }; +const getTaskChannelColorKey = (value) => { + const idNum = parseInt(value); + const colorIndex = Number.isFinite(idNum) + ? ((idNum % colors.length) + colors.length) % colors.length + : 0; + return colors[colorIndex]; +}; + // Render functions const renderTimestamp = (timestampInSeconds) => { const date = new Date(timestampInSeconds * 1000); @@ -417,11 +425,7 @@ export const getTaskLogsColumns = ({ render: (text, record, index) => { if (!isAdminUser) return null; - const idNum = parseInt(text); - const colorIndex = Number.isFinite(idNum) - ? ((idNum % colors.length) + colors.length) % colors.length - : 0; - const colorKey = colors[colorIndex]; + const colorKey = getTaskChannelColorKey(text); // 若后端返回 channel_name 则在 Tooltip 中显示名称,便于管理员快速识别;否则回落为 ID const tooltipContent = record.channel_name || text; diff --git a/src/components/table/task-logs/index.jsx b/src/components/table/task-logs/index.jsx index 3f37cddd..19c3ac26 100644 --- a/src/components/table/task-logs/index.jsx +++ b/src/components/table/task-logs/index.jsx @@ -1,5 +1,6 @@ import { Download as ActionDownload } from '@/components/common/icons/ActionIcons'; -import React, { useState } from 'react'; +import React from 'react'; +import UsageRecordFilterCard from '../../common/table/UsageRecordFilterCard'; import { Card, Tag as AntTag } from 'antd'; import { Clock } from 'lucide-react'; import { Button, Pagination } from '@/components/ui'; @@ -31,8 +32,6 @@ const TaskLogsPage = ({ sharedFilterRevision, }); const isMobile = useIsMobile(); - // 与 CardPro 一致:移动端默认收起筛选区,仅视图状态 - const [showMobileFilters, setShowMobileFilters] = useState(false); const pageStats = useTaskPageStats(taskLogsData.logs); if (usageRecordMode) { @@ -53,20 +52,9 @@ const TaskLogsPage = ({
- - {isMobile && ( - - )} - - + + +
diff --git a/src/components/table/tokens/TokensColumnDefs.jsx b/src/components/table/tokens/TokensColumnDefs.jsx index 50e81549..e1e5392e 100644 --- a/src/components/table/tokens/TokensColumnDefs.jsx +++ b/src/components/table/tokens/TokensColumnDefs.jsx @@ -1,3 +1,5 @@ +import { TABLE_GROUP_COLUMN_WIDTH } from '@/components/common/table/TableGroupTags'; +import { confirmTableAction } from '@/components/common/table/confirmTableAction'; import React from 'react'; import { Button, @@ -12,7 +14,6 @@ import { Popover, Typography, Input, - Modal, } from '@/components/ui'; import { timestamp2string, @@ -387,14 +388,15 @@ const renderOperations = ( type='danger' size='small' onClick={() => { - Modal.confirm({ + confirmTableAction({ title: t('确定是否要删除此密钥?'), content: t('此修改将不可逆'), - onOk: () => { - (async () => { - await manageToken(record.id, 'delete', record); - await refresh(); - })(); + okType: 'danger', + focusable: { autoFocusButton: 'cancel' }, + onOk: async () => { + if (!(await manageToken(record.id, 'delete', record))) + return false; + await refresh(); }, }); }} @@ -436,6 +438,7 @@ export const getTokensColumns = ({ title: t('分组'), dataIndex: 'group', key: 'group', + width: TABLE_GROUP_COLUMN_WIDTH, render: (text) => renderGroupColumn(text, t), }, { diff --git a/src/components/table/usage-logs/UsageLogsColumnDefs.jsx b/src/components/table/usage-logs/UsageLogsColumnDefs.jsx index 5f689c34..4632acaa 100644 --- a/src/components/table/usage-logs/UsageLogsColumnDefs.jsx +++ b/src/components/table/usage-logs/UsageLogsColumnDefs.jsx @@ -1,3 +1,4 @@ +import { TABLE_GROUP_COLUMN_WIDTH } from '@/components/common/table/TableGroupTags'; import React from 'react'; import { Tag as AntTag } from 'antd'; import { @@ -20,24 +21,6 @@ import { import { IconHelpCircle } from '@/components/ui/icons'; import { Route } from 'lucide-react'; -const colors = [ - 'amber', - 'blue', - 'cyan', - 'green', - 'grey', - 'indigo', - 'light-blue', - 'lime', - 'orange', - 'pink', - 'purple', - 'red', - 'teal', - 'violet', - 'yellow', -]; - // 类型配置映射 const TYPE_CONFIG = { 1: { @@ -256,7 +239,7 @@ const RECORD_COLUMN_WIDTHS = { channel: 85, username: 120, token: 120, - group: 148, + group: TABLE_GROUP_COLUMN_WIDTH, type: 110, model: 225, use_time: 190, @@ -455,20 +438,21 @@ export const getLogsColumns = ({ return isAdminUser && (record.type === 0 || record.type === 2 || record.type === 5) ? ( - - - + + {isMultiKey && ( - + {multiKeyIndex} - + )} ) : null; @@ -528,6 +512,7 @@ export const getLogsColumns = ({ key: COLUMN_KEYS.GROUP, title: t('分组'), dataIndex: 'group', + width: TABLE_GROUP_COLUMN_WIDTH, render: (text, record, index) => { if (record.type === 0 || record.type === 2 || record.type === 5) { if (record.group) { diff --git a/src/components/table/usage-logs/index.jsx b/src/components/table/usage-logs/index.jsx index 29c33596..84ebc853 100644 --- a/src/components/table/usage-logs/index.jsx +++ b/src/components/table/usage-logs/index.jsx @@ -1,5 +1,6 @@ import { Download as ActionDownload } from '@/components/common/icons/ActionIcons'; -import React, { useState } from 'react'; +import React from 'react'; +import UsageRecordFilterCard from '../../common/table/UsageRecordFilterCard'; import { Card } from 'antd'; import { Button, Pagination } from '@/components/ui'; import CardPro from '../../common/ui/CardPro'; @@ -18,8 +19,6 @@ import './UsageLogs.css'; const LogsPage = ({ usageRecordMode = false }) => { const logsData = useLogsData(); const isMobile = useIsMobile(); - // 与 CardPro 一致:移动端默认收起筛选区,仅视图状态 - const [showMobileFilters, setShowMobileFilters] = useState(false); if (usageRecordMode) { const { t } = logsData; @@ -30,20 +29,9 @@ const LogsPage = ({ usageRecordMode = false }) => {
- - {isMobile && ( - - )} - - + + +
diff --git a/src/components/table/users/UsersColumnDefs.jsx b/src/components/table/users/UsersColumnDefs.jsx index 22b41545..85834dfe 100644 --- a/src/components/table/users/UsersColumnDefs.jsx +++ b/src/components/table/users/UsersColumnDefs.jsx @@ -1,3 +1,5 @@ +import { TABLE_GROUP_COLUMN_WIDTH } from '@/components/common/table/TableGroupTags'; +import TableStatusSwitch from '@/components/common/table/TableStatusSwitch'; import React from 'react'; import { Button, @@ -8,7 +10,6 @@ import { Popover, Typography, } from '@/components/ui'; -import { Switch } from 'antd'; import { TableRowActions } from '@/components/common/table/TableToolbar'; import { renderGroup, @@ -106,11 +107,8 @@ const renderStatistics = (text, record, showEnableDisableModal, t) => { const content = isDeleted ? ( {t('已注销')} ) : ( - { @@ -344,6 +342,7 @@ export const getUsersColumns = ({ { title: t('分组'), dataIndex: 'group', + width: TABLE_GROUP_COLUMN_WIDTH, render: (text, record, index) => { return
{renderGroup(text)}
; }, diff --git a/src/components/table/users/modals/DeleteUserModal.jsx b/src/components/table/users/modals/DeleteUserModal.jsx index c04496d4..4445630a 100644 --- a/src/components/table/users/modals/DeleteUserModal.jsx +++ b/src/components/table/users/modals/DeleteUserModal.jsx @@ -1,5 +1,5 @@ +import TableActionModal from '@/components/common/table/TableActionModal'; import React from 'react'; -import { Modal } from '@/components/ui'; const DeleteUserModal = ({ visible, @@ -13,7 +13,7 @@ const DeleteUserModal = ({ t, }) => { const handleConfirm = async () => { - await manageUser(user.id, 'delete', user); + if (!(await manageUser(user.id, 'delete', user))) return; await refresh(); setTimeout(() => { if (users.length === 0 && activePage > 1) { @@ -24,7 +24,7 @@ const DeleteUserModal = ({ }; return ( - {t('相当于删除用户,此修改将不可逆')} - + ); }; diff --git a/src/components/table/users/modals/EditUserModal.jsx b/src/components/table/users/modals/EditUserModal.jsx index 44c31415..4cb5aa06 100644 --- a/src/components/table/users/modals/EditUserModal.jsx +++ b/src/components/table/users/modals/EditUserModal.jsx @@ -7,7 +7,6 @@ import { Button, Modal, SideSheet, - Space, Spin, Typography, Card, @@ -18,11 +17,13 @@ import { } from '@/components/ui'; import QuotaInput, { FormQuotaInput } from '../../../common/ui/QuotaInput'; import { - IconUser, - IconLink, - IconUserGroup, - IconPlus, -} from '@/components/ui/icons'; + User as ActionUser, + Link as ActionLink, + Users as ActionUsers, + Plus as ActionPlus, +} from '@/components/common/icons/ActionIcons'; + +import { toGroupList } from '@/helpers/groupList'; const { Text } = Typography; @@ -30,6 +31,9 @@ const EditUserModal = (props) => { const { t } = useTranslation(); const userId = props.editingUser.id; const [loading, setLoading] = useState(true); + const [loadedUserId, setLoadedUserId] = useState(null); + const [submitting, setSubmitting] = useState(false); + const pending = useRef(false); const [addQuotaModalOpen, setIsModalOpen] = useState(false); const [addQuotaLocal, setAddQuotaLocal] = useState(''); const isMobile = useIsMobile(); @@ -38,6 +42,7 @@ const EditUserModal = (props) => { const formApiRef = useRef(null); const isEdit = Boolean(userId); + const ready = loadedUserId === (userId ?? false); const getInitValues = () => ({ username: '', @@ -50,7 +55,7 @@ const EditUserModal = (props) => { telegram_id: '', email: '', quota: 0, - group: 'default', + group: userId ? ['default'] : 'default', level: '', remark: '', }); @@ -88,53 +93,83 @@ const EditUserModal = (props) => { } }; - const handleCancel = () => props.handleClose(); - - const loadUser = async () => { - setLoading(true); - const url = userId ? `/api/user/${userId}` : `/api/user/self`; - const res = await API.get(url); - const { success, message, data } = res.data; - if (success) { - data.password = ''; - formApiRef.current?.setValues({ ...getInitValues(), ...data }); - } else { - showError(message); - } - setLoading(false); + const handleCancel = () => { + if (pending.current) return; + setIsModalOpen(false); + setAddQuotaLocal(''); + props.handleClose(); }; - const onScopeChange = useEffectEvent(() => { - loadUser(); + const onScopeChange = useEffectEvent(async (isCurrent) => { + setLoading(true); + setLoadedUserId(null); + const url = userId ? `/api/user/${userId}` : '/api/user/self'; if (userId) { fetchGroups(); fetchLevels(); } + try { + const { data: response } = await API.get(url); + if (!isCurrent()) return; + if (response.success) { + formApiRef.current?.setValues({ + ...getInitValues(), + ...response.data, + ...(userId && { + group: toGroupList(response.data.group ?? 'default'), + }), + password: '', + }); + setLoadedUserId(userId ?? false); + } else { + showError(response.message); + } + } catch { + // The API client reports request failures. + } finally { + if (isCurrent()) setLoading(false); + } }); - useEffect(() => onScopeChange(), [onScopeChange, props.editingUser.id]); + + useEffect(() => { + if (!props.visible) return; + let current = true; + onScopeChange(() => current); + return () => { + current = false; + }; + }, [onScopeChange, props.visible, userId]); /* ----------------------- submit ----------------------- */ const submit = async (values) => { - setLoading(true); - let payload = { ...values }; - if (typeof payload.quota === 'string') - payload.quota = parseInt(payload.quota) || 0; - if (typeof payload.gift_quota === 'string') - payload.gift_quota = parseInt(payload.gift_quota) || 0; - if (userId) { - payload.id = parseInt(userId); + if (!ready || pending.current) return; + pending.current = true; + setSubmitting(true); + try { + const payload = { ...values }; + if (typeof payload.quota === 'string') + payload.quota = parseInt(payload.quota) || 0; + if (typeof payload.gift_quota === 'string') + payload.gift_quota = parseInt(payload.gift_quota) || 0; + if (userId) { + payload.id = parseInt(userId); + payload.group = toGroupList(values.group).join(','); + } + const url = userId ? '/api/user/' : '/api/user/self'; + const { data } = await API.put(url, payload); + if (data.success) { + showSuccess(t('用户信息更新成功!')); + props.refresh(); + props.handleClose(); + } else { + showError(data.message); + } + } catch { + // The API client reports request failures. + } finally { + pending.current = false; + setSubmitting(false); } - const url = userId ? `/api/user/` : `/api/user/self`; - const res = await API.put(url, payload); - const { success, message } = res.data; - if (success) { - showSuccess(t('用户信息更新成功!')); - props.refresh(); - props.handleClose(); - } else { - showError(message); - } - setLoading(false); }; /* --------------------- quota helper -------------------- */ @@ -149,50 +184,49 @@ const EditUserModal = (props) => { <> - - - - +
+ +
} onCancel={handleCancel} > - - (formApiRef.current = api)} - onSubmit={submit} - > - {({ values }) => ( -
+ (formApiRef.current = api)} + onSubmit={submit} + > + {() => ( + +
{/* 基本信息 */} - -
- - + +
+ +
{t('基本信息')} -
+
{t('用户的基本账户信息')}
@@ -241,20 +275,16 @@ const EditUserModal = (props) => { {/* 权限设置 */} {userId && ( - -
- - + +
+ +
{t('权限设置')} -
+
{t('用户分组和额度管理')}
@@ -287,7 +317,7 @@ const EditUserModal = (props) => { /> -
+ { /> - + { /> - + diff --git a/src/pages/DemoReservations/index.jsx b/src/pages/DemoReservations/index.jsx index bf48920a..35a076b9 100644 --- a/src/pages/DemoReservations/index.jsx +++ b/src/pages/DemoReservations/index.jsx @@ -1,7 +1,10 @@ +import { confirmTableAction } from '@/components/common/table/confirmTableAction'; +import TableStatusSwitch from '@/components/common/table/TableStatusSwitch'; import TableEmpty from '../../components/common/table/TableEmpty'; import React, { useEffect, useMemo, useRef, useState } from 'react'; -import { Banner, Button, Form, Spin } from '@/components/ui'; -import { Button as AntButton, Popconfirm, Switch } from 'antd'; +import { Banner, Button, Form, Modal, Spin } from '@/components/ui'; +import { Button as AntButton } from 'antd'; +import { Download as ActionDownload } from '@/components/common/icons/ActionIcons'; import { useTranslation } from 'react-i18next'; import CardPro from '../../components/common/ui/CardPro'; import CardTable from '../../components/common/ui/CardTable'; @@ -18,7 +21,7 @@ import { } from './reservationsApi'; const EMPTY_FILTERS = { name: '', contact: '', companyName: '' }; -const RESERVATION_TABLE_MIN_WIDTH = 1280; +const RESERVATION_TABLE_MIN_WIDTH = 1320; const RESERVATION_FIELDS = [ ['name', '姓名', 96], ['contact', '联系方式', 172], @@ -125,7 +128,7 @@ export default function DemoReservations() { [t], ); - const saveReservation = async (id, save) => { + const saveReservation = async (id, save, keepOpenOnFailure = false) => { if (busy) return; setSavingId(id); try { @@ -134,30 +137,42 @@ export default function DemoReservations() { setQuery((previous) => ({ ...previous })); } catch (error) { showError(t(error.message || '操作失败')); + if (keepOpenOnFailure) return false; } finally { setSavingId(null); } }; + const confirmStatusChange = (id, enabled) => { + Modal.confirm({ + title: enabled ? t('确定要启用此预约吗?') : t('确定要禁用此预约吗?'), + onOk: () => + saveReservation(id, () => setDemoReservationEnabled(id, enabled)), + }); + }; + + const confirmDelete = (id) => { + confirmTableAction({ + title: t('确定要删除此预约吗?'), + content: t('删除后将无法恢复'), + okType: 'danger', + focusable: { autoFocusButton: 'cancel' }, + onOk: () => saveReservation(id, () => deleteDemoReservation(id), true), + }); + }; + const columns = [ ...fieldColumns, { title: t('状态'), key: 'enabled', - width: 88, - align: 'center', + width: 128, render: (_, record) => ( - - saveReservation(record.id, () => - setDemoReservationEnabled(record.id, enabled), - ) - } + onChange={(enabled) => confirmStatusChange(record.id, enabled)} /> ), }, @@ -167,25 +182,20 @@ export default function DemoReservations() { width: 84, fixed: 'right', render: (_, record) => ( - - saveReservation(record.id, () => deleteDemoReservation(record.id)) - } + onClick={() => confirmDelete(record.id)} > - - {t('删除')} - - + {t('删除')} + ), }, ].map((column) => ({ ...column, - onHeaderCell: () => ({ style: { textAlign: 'center' } }), + align: 'center', })); const selectedRows = result.items.filter(({ id }) => @@ -245,12 +255,13 @@ export default function DemoReservations() { type='type1' t={t} tableActions={ - } disabled={busy || selectedRows.length === 0} onClick={exportSelectedRows} > - {t('导出 CSV')} - + {t('导出')} + } searchArea={
diff --git a/src/pages/ExperienceCenter/components/AICreation/Video/VideoTaskQueue.jsx b/src/pages/ExperienceCenter/components/AICreation/Video/VideoTaskQueue.jsx index 131fc0f2..6bbc30da 100644 --- a/src/pages/ExperienceCenter/components/AICreation/Video/VideoTaskQueue.jsx +++ b/src/pages/ExperienceCenter/components/AICreation/Video/VideoTaskQueue.jsx @@ -1,3 +1,4 @@ +import { confirmTableAction } from '@/components/common/table/confirmTableAction'; import { Download as ActionDownload, RefreshCw as ActionRefreshCw, @@ -220,7 +221,7 @@ const VideoTaskQueue = ({ danger className='video-queue-link' onClick={() => { - Modal.warning({ + confirmTableAction({ title: t('确定删除此任务?'), content: t('删除后将无法恢复'), icon: ( @@ -228,9 +229,10 @@ const VideoTaskQueue = ({ ), okText: t('确定'), cancelText: t('取消'), + okType: 'danger', + focusable: { autoFocusButton: 'cancel' }, onOk: () => onDelete(record.task_id), centered: true, - okButtonProps: { type: 'danger' }, }); }} > diff --git a/src/pages/KeyManagement/index.jsx b/src/pages/KeyManagement/index.jsx index 0c3d211d..4972e928 100644 --- a/src/pages/KeyManagement/index.jsx +++ b/src/pages/KeyManagement/index.jsx @@ -1,3 +1,8 @@ +import { confirmTableAction } from '@/components/common/table/confirmTableAction'; +import TableStatusSwitch from '@/components/common/table/TableStatusSwitch'; +import TableGroupTags, { + TABLE_GROUP_COLUMN_WIDTH, +} from '@/components/common/table/TableGroupTags'; import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js'; import { EyeOff as ActionEyeOff, @@ -25,7 +30,6 @@ import { Empty, Input, Spin, - Switch, Tag, Tooltip, } from 'antd'; @@ -63,7 +67,7 @@ const KEY_MASK = '••••••••••••••••'; const COLUMN_WIDTHS = { name: 150, key: 300, - group: 150, + group: TABLE_GROUP_COLUMN_WIDTH, status: 100, expired_time: 180, quota: 100, @@ -162,9 +166,13 @@ const KeyTable = ({ : group } > - - {group === 'auto' ? t('智能熔断') : group || t('默认')} - + + (name === 'auto' ? t('智能熔断') : name)} + /> + ); }, @@ -176,11 +184,8 @@ const KeyTable = ({ const extra = extraStatusTag[token.status]; return (
- onToggle(token)} /> @@ -702,12 +707,13 @@ const KeyManagement = ({ embedded = false }) => { }; const handleDelete = (token) => { - Modal.confirm({ + confirmTableAction({ title: t('确定要删除此密钥吗?'), content: t('删除后将无法恢复'), okType: 'danger', + focusable: { autoFocusButton: 'cancel' }, onOk: async () => { - await manageToken(token.id, 'delete', token); + if (!(await manageToken(token.id, 'delete', token))) return false; refreshKeyList(); }, }); diff --git a/src/pages/Organization/OrgAudit.jsx b/src/pages/Organization/OrgAudit.jsx index 1db43086..5ed661af 100644 --- a/src/pages/Organization/OrgAudit.jsx +++ b/src/pages/Organization/OrgAudit.jsx @@ -385,7 +385,7 @@ const OrgAudit = ({ orgId }) => { }; const operations = ( - <> +
applyAction('')} onSearch={refresh}> @@ -433,7 +433,7 @@ const OrgAudit = ({ orgId }) => { empty={} /> - +
); return ( @@ -442,7 +442,7 @@ const OrgAudit = ({ orgId }) => { {/* 原型 platform-list-tabs;“提示词记录”页签沿用原 feature flag + 权限显隐 */} { if (res.data.success) { Toast.success(t('预算已删除')); fetchAll(); + return true; } else { showError(res.data.message); } } catch (err) { showError(err.message); } + return false; }; // 列宽与渲染对齐原型 EnterpriseBudget(300/110/260/120/120/130,scroll.x 1040);取值与判定沿用原逻辑 @@ -386,11 +381,8 @@ const OrgBudgets = ({ orgId, featureFlags }) => { dataIndex: 'status', width: 120, render: (v, record) => ( - { {t('编辑')} )} - handleDelete(r)} > - - + ); }, diff --git a/src/pages/Organization/OrgEffectiveness.jsx b/src/pages/Organization/OrgEffectiveness.jsx index c107af09..679e91d9 100644 --- a/src/pages/Organization/OrgEffectiveness.jsx +++ b/src/pages/Organization/OrgEffectiveness.jsx @@ -1,3 +1,5 @@ +import { Popconfirm } from '@/components/ui'; +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; import { formatIdReference, formatNumber, @@ -5,20 +7,23 @@ import { } from '../../helpers/safeDisplay'; import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js'; -import { RefreshCw as ActionRefreshCw } from '@/components/common/icons/ActionIcons'; +import { + Plus as ActionPlus, + RefreshCw as ActionRefreshCw, + Search as ActionSearch, +} from '@/components/common/icons/ActionIcons'; +import { Card } from 'antd'; +import TableEmpty from '../../components/common/table/TableEmpty'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { Button, Input, InputNumber, - Modal, - Popconfirm, Select, Table, Tag, TextArea, Toast, - Typography, } from '@/components/ui'; import { Activity, FlaskConical, Gauge, ShieldAlert } from 'lucide-react'; import { useTranslation } from 'react-i18next'; @@ -29,11 +34,10 @@ import { PageGuideDrawer, PageGuideTrigger, } from '../../components/common/PageGuide'; -import OrgPanel from './components/OrgPanel'; +import { OrgListCard } from './components/OrgListCard'; +import OrgModal from './components/OrgModal'; +import OrgPageHeader from './components/OrgPageHeader'; import './org-effectiveness.css'; -import OrgBreadcrumb from './components/OrgBreadcrumb'; - -const { Title, Text } = Typography; const dimensions = [ { value: 'organization', label: '企业总览' }, @@ -206,7 +210,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { ); if (!response.data?.success) { Toast.error(response.data?.message || t('操作失败')); - return; + return false; } Toast.success(t('实验已删除')); await load(); @@ -228,7 +232,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { } catch { ids = []; } - Modal.info({ + OrgModal.info({ title: t('告警任务样本'), content: (
@@ -326,75 +330,81 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { ], }); return ( -
-
-
- - {t('效能分析')} - - {t('回答谁在用、节省多少时间、成本是否对账、质量与安全是否改善。')} - -
-
- - ({ + ...d, + label: t(d.label), + }))} + onChange={setDimension} /> - )} - - {canManagePolicy && ( - - )} -
-
+ {dimension !== 'organization' && ( + + )} + + {canManagePolicy && ( + + )} +
+ } + />
{cards.map(({ label, value: cardValue, detail, icon: Icon }) => ( -
- - {label} + +
+ + + {label} +
{cardValue} {detail} -
+ ))}
- + {directUsage.length === 0 ? ( - +

{t( '暂无数据。开启密钥的「技能注入」后,用该密钥直连调用的技能使用情况会回流到这里。', )} - +

) : ( <> - +

{t( '统计口径:token 与额度是整条请求的量级,多技能同时命中时全额计入每个技能,不是按技能分摊的成本,勿相加。', )} - +

} rowKey='skill_id' columns={[ { @@ -420,35 +430,42 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { /> )} - +
- -
- {t('运行结算')} - {Math.round(value('efficiency.quota')).toLocaleString()} - {t('消费明细')} - - {Math.round( - value('efficiency.settlement_quota') + - value('efficiency.adjustment_quota'), - ).toLocaleString()} - - {t('差额')} - - {Math.round( - value('efficiency.reconciliation_gap'), - ).toLocaleString()} - -
-
- + +
+
+
{t('运行结算')}
+
{Math.round(value('efficiency.quota')).toLocaleString()}
+
+
+
{t('消费明细')}
+
+ {Math.round( + value('efficiency.settlement_quota') + + value('efficiency.adjustment_quota'), + ).toLocaleString()} +
+
+
+
{t('差额')}
+
+ {Math.round( + value('efficiency.reconciliation_gap'), + ).toLocaleString()} +
+
+
+
+ {isMobile ? (
+ {!data.alerts?.length && } {(data.alerts || []).map((row) => (
@@ -476,6 +493,8 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { size='small' pagination={{ resetOnDataChange: true }} dataSource={data.alerts || []} + empty={} + rowKey='id' columns={[ { title: t('Skill'), dataIndex: 'dimension_id' }, { @@ -504,25 +523,40 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { ]} /> )} - +
- + tools={ +
{ + event.preventDefault(); + void loadComparison(); + }} + > + - -
+ + } > {isMobile ? (
+ {!comparison.length && } {comparison.map((row) => (
@@ -559,6 +593,8 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
} + rowKey='version_id' columns={[ { title: t('版本'), dataIndex: 'version_id' }, { title: t('首次交付样本'), dataIndex: 'first_delivery_count' }, @@ -589,13 +625,17 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { ]} /> )} - + - setExperimentVisible(true)}> + ) : null @@ -603,6 +643,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { > {isMobile ? (
+ {!experiments.length && } {experiments.map((row) => (
@@ -657,6 +698,8 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
} + rowKey='id' columns={[ { title: t('实验'), dataIndex: 'name' }, { title: 'Skill', dataIndex: 'skill_id' }, @@ -688,7 +731,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { > {row.status === 'draft' ? t('开始') : t('停止并回退')} - { > - + ), }, ]} /> )} - + - setExperimentVisible(false)} @@ -776,7 +819,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => { } /> - + ); }; diff --git a/src/pages/Organization/OrgKnowledge.jsx b/src/pages/Organization/OrgKnowledge.jsx index 18ad9434..bd3d8d1c 100644 --- a/src/pages/Organization/OrgKnowledge.jsx +++ b/src/pages/Organization/OrgKnowledge.jsx @@ -1,3 +1,4 @@ +import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm'; import { formatIdReference, formatPercent, @@ -1093,6 +1094,7 @@ const OrgKnowledge = ({ orgId, canAuditContent = false }) => { fetchBases(true); } catch (error) { if (requestOrgId === orgIdentityRef.current) notifyError(error); + return false; } }; @@ -1759,7 +1761,7 @@ const OrgKnowledge = ({ orgId, canAuditContent = false }) => { {t('重试')} )} - { deleteDocument(row.document.id) } > - - + ); diff --git a/src/pages/Organization/OrgLogs.jsx b/src/pages/Organization/OrgLogs.jsx index 6e2d41ec..cecc6b98 100644 --- a/src/pages/Organization/OrgLogs.jsx +++ b/src/pages/Organization/OrgLogs.jsx @@ -27,7 +27,8 @@ import { useOrgMemberRanking, } from '../../hooks/org/useOrgData'; import OrgPageHeader from './components/OrgPageHeader'; -import { OrgFilterCard, OrgListCard } from './components/OrgListCard'; +import UsageRecordFilterCard from '../../components/common/table/UsageRecordFilterCard'; +import { OrgListCard } from './components/OrgListCard'; import OrgModal from './components/OrgModal'; import { fundAccountDisplay, fundDeptDisplay } from './fund/fundFormat'; import OrgTaskRecords from './components/OrgTaskRecords'; @@ -839,64 +840,71 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => { ) : ( <> - {/* 筛选栏(原型 .ee-filter-card / .eex-filter-grid) */} - + + handleSearch(false)} + > +
+ + { + setDateRange(v); + setIsDefaultRange(false); + }} + placeholder={[t('开始时间'), t('结束时间')]} + /> + + + {canViewTeamUsage ? ( + + +
+
- - } - > - - - {canViewTeamUsage ? ( - handleSearch(false)} - /> - - - + { const groups = parseMemberGroups(record); if (!groups.length) { return {t('无(继承企业)')}; } - return ( -
- {groups.map((g) => ( - - {g} - - ))} -
- ); + return ; }, }, { @@ -521,11 +517,8 @@ const OrgMembers = ({ : t('启用该成员的企业访问权限') } > - diff --git a/src/pages/Organization/OrgPrivateSkills.jsx b/src/pages/Organization/OrgPrivateSkills.jsx index cc59a50e..d5a4feae 100644 --- a/src/pages/Organization/OrgPrivateSkills.jsx +++ b/src/pages/Organization/OrgPrivateSkills.jsx @@ -28,9 +28,8 @@ import { } from '../../components/common/PageGuide'; import OrgPanel from './components/OrgPanel'; import './org-skills.css'; -import OrgBreadcrumb from './components/OrgBreadcrumb'; -const { Title, Text, Paragraph } = Typography; +const { Paragraph } = Typography; const blankSkill = { canonical_id: '', body: '# Method\n\nDescribe a safe, evidence-led method.', @@ -57,6 +56,20 @@ const split = (value) => const OrgPrivateSkills = ({ orgId }) => { const { t } = useTranslation(); + const editorLabels = { + name_zh: t('中文名称'), + name_en: t('英文名称'), + description_zh: t('中文说明'), + description_en: t('说明') + ' (EN)', + triggers_zh: t('触发词') + ' (ZH)', + triggers_en: t('触发词') + ' (EN)', + scenarios_zh: t('适用场景') + ' (ZH)', + scenarios_en: t('适用场景') + ' (EN)', + compact_constraint_zh: t('限制') + ' (ZH)', + compact_constraint_en: t('限制') + ' (EN)', + tags: t('标签'), + change_statement: t('版本说明'), + }; const isMobile = useIsMobile(); const headers = useMemo(() => ({ 'X-Org-Id': String(orgId) }), [orgId]); const [items, setItems] = useState([]); @@ -199,9 +212,10 @@ const OrgPrivateSkills = ({ orgId }) => { const isReviewer = currentUserId > 0 && Number(row.review?.reviewer_id) === currentUserId; return ( -
+
- -
- +
+
+ + +
@@ -495,40 +512,35 @@ const OrgPrivateSkills = ({ orgId }) => { onOk={save} width={820} > -
- setForm({ ...form, canonical_id })} - /> - {[ - 'name_zh', - 'name_en', - 'description_zh', - 'description_en', - 'triggers_zh', - 'triggers_en', - 'scenarios_zh', - 'scenarios_en', - 'compact_constraint_zh', - 'compact_constraint_en', - 'tags', - 'change_statement', - ].map((key) => ( +
+ + {Object.entries(editorLabels).map(([key, label]) => ( + ))} -