fix(ui): 统一表格交互,调整企业技能与质量页面,修复浮层引用警告

This commit is contained in:
zhanjunhao
2026-11-24 13:26:07 +08:00
parent bf708039a3
commit 4e7894f144
124 changed files with 2682 additions and 1810 deletions
+2 -2
View File
@@ -104,7 +104,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
1. **改前**:读相关代码;UI 任务先按 `GLOBAL_UI_BASELINE.md` 第 6 节真实 UI 登录;通用测试指令按该节自动判断验收范围、企业 / 普通个人 / 超管账号并加载现有本地配置,无需用户重复指定登录类型。 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` 检测前台)。 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/`。 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`。 5. **证据与交付**:截图、trace、storageState、报告只写 Git 忽略目录;说明完成范围、实际验证结果与未覆盖项,未验证的不写成通过;在 `docs/CHANGELOG.md` 追加条目,改动脚本、环境变量或目录约定时同步更新 `README.md`。
6. **提交**:授权按第 0 节,格式、检查与暂存边界见开发规范第 12.2 节。 6. **提交**:授权按第 0 节,格式、检查与暂存边界见开发规范第 12.2 节。
@@ -123,7 +123,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
- 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。 - 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。
- 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。 - 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。
> 规范版本:v3.7 · 更新:2026-11-20 > 规范版本:v3.8 · 更新:2026-11-24
## 10. 工具差异(本节允许不同) ## 10. 工具差异(本节允许不同)
+2 -2
View File
@@ -104,7 +104,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
1. **改前**:读相关代码;UI 任务先按 `GLOBAL_UI_BASELINE.md` 第 6 节真实 UI 登录;通用测试指令按该节自动判断验收范围、企业 / 普通个人 / 超管账号并加载现有本地配置,无需用户重复指定登录类型。 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` 检测前台)。 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/`。 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`。 5. **证据与交付**:截图、trace、storageState、报告只写 Git 忽略目录;说明完成范围、实际验证结果与未覆盖项,未验证的不写成通过;在 `docs/CHANGELOG.md` 追加条目,改动脚本、环境变量或目录约定时同步更新 `README.md`。
6. **提交**:授权按第 0 节,格式、检查与暂存边界见开发规范第 12.2 节。 6. **提交**:授权按第 0 节,格式、检查与暂存边界见开发规范第 12.2 节。
@@ -123,7 +123,7 @@ Windows 执行命令前按开发规范第 12.3 节设置 UTF-8;使用 `npm.cmd
- 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。 - 新规则先写入对应 `docs/` 文档,再在第 6 节加索引;改动只动相关段落,更新本节版本与日期。
- 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。 - 文档的新增、调整、删除按 `docs/README.md` 的“阅读与维护”执行;删除与重命名需用户确认清单。
> 规范版本:v3.7 · 更新:2026-11-20 > 规范版本:v3.8 · 更新:2026-11-24
## 10. 工具差异(本节允许不同) ## 10. 工具差异(本节允许不同)
+1
View File
@@ -177,6 +177,7 @@ Playwright 与 weelink 共用设备环境约定,依赖精确锁定 1.64.1;
| 命令 / 参数 | 用途与默认值 | | 命令 / 参数 | 用途与默认值 |
| --- | --- | | --- | --- |
| `npm run test:e2e:headless` | 无头运行;本地默认有头离屏,CI 强制无头 | | `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:extended` | 全部 8 视口;也可设置 `PW_EXTENDED_LAYOUT=1` |
| `npm run test:e2e:dist` | 验证已有静态产物并严格启动 4176;不自动构建 | | `npm run test:e2e:dist` | 验证已有静态产物并严格启动 4176;不自动构建 |
| `npm run test:acceptance -- <参数>` | 串行单测、临时目录构建、产物校验、强制 local-dist/4176 测试 | | `npm run test:acceptance -- <参数>` | 串行单测、临时目录构建、产物校验、强制 local-dist/4176 测试 |
+186
View File
@@ -8,8 +8,194 @@
**记录规则**:每条写“范围、变更、影响、回滚、关联”五项;回滚优先 `git revert <提交>`,提交含多项改动时按文件还原(`git checkout <提交>^ -- <文件>`),不整仓 reset。本文不作为规则依据。 **记录规则**:每条写“范围、变更、影响、回滚、关联”五项;回滚优先 `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 ## 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 独立下载页原型对齐
- **范围**:`/weyai/download` 独立下载页和此路由的顶栏下载入口。 - **范围**:`/weyai/download` 独立下载页和此路由的顶栏下载入口。
+1 -1
View File
@@ -222,7 +222,7 @@ pagination={{
- 防重复:提交中按钮 `loading` 或 `confirmLoading`;hook 内 `submitting` 为真时直接返回。 - 防重复:提交中按钮 `loading` 或 `confirmLoading`;hook 内 `submitting` 为真时直接返回。
- 成功:`showSuccess` → 关闭 → 刷新当前页;失败:保留弹层与已填内容。 - 成功:`showSuccess` → 关闭 → 刷新当前页;失败:保留弹层与已填内容。
- 打开时重置:弹层加 `forceRender`,在 `useEffect([open, record])` 中先 `resetFields()` 再 `setFieldsValue(record)`。 - 打开时重置:弹层加 `forceRender`,在 `useEffect([open, record])` 中先 `resetFields()` 再 `setFieldsValue(record)`。
- 删除:`Popconfirm` 的 `onConfirm` 返回 Promise 以显示加载;批量或不可撤销操作用 `Modal.confirm`。 - 删除:确认回调返回 Promise 以显示加载;确认形态、危险按钮、失败保留与键盘交互见组件规范第 8 节。
- 日期提交前转换为后端格式(多为 Unix 秒);有未保存内容时沿用页面已有的关闭确认流程。 - 日期提交前转换为后端格式(多为 Unix 秒);有未保存内容时沿用页面已有的关闭确认流程。
## 7. 加载、空态与错误态 ## 7. 加载、空态与错误态
+12 -4
View File
@@ -125,13 +125,14 @@ html.dark .km-page {
## 4. 表格搜索栏(筛选卡) ## 4. 表格搜索栏(筛选卡)
- **筛选卡与列表卡间距**:从筛选卡底边到下方列表卡顶边统一为 18px,复用 `--uc-layout-gap`。同一对相邻区块只设置一次间距,优先由共同容器的 `gap` 控制。企业端以 `/org/logs` 为对齐基准,审计日志若在页签与筛选卡之间插入说明条,说明条上下也各留 18px。
- 背景:使用不透明的卡片纯色;浅色为白色,深色沿用主题卡片色,不使用渐变背景。 - 背景:使用不透明的卡片纯色;浅色为白色,深色沿用主题卡片色,不使用渐变背景。
- 字段竖排:标签在上(13px,次文字色,下距 8px),控件在下且宽度占满单元格。 - 字段竖排:标签在上(13px,次文字色,下距 8px),控件在下且宽度占满单元格。
- 栅格:列间距与行间距 16px;按页面宽度取 3–5 列(企业中心 3 列、控制台 4 列、用户中心 5 列,时间范围可跨 2 列);≤ 768px 单列。 - 栅格:列间距与行间距 16px;按页面宽度取 3–5 列(企业中心 3 列、控制台 4 列、用户中心 5 列,时间范围可跨 2 列);≤ 768px 单列。
- 操作:“重置”“搜索”位于右下,间距 8px;“搜索”为 primary 且 `htmlType='submit'`,回车提交。 - 操作:“重置”“搜索”位于右下,间距 8px;“搜索”为 primary 且 `htmlType='submit'`,回车提交。
- 行为:搜索与重置都回到第 1 页;重置 = 清空表单 + 以默认条件重新查询;只切换筛选的页签放在筛选卡上方。 - 行为:搜索与重置都回到第 1 页;重置 = 清空表单 + 以默认条件重新查询;只切换筛选的页签放在筛选卡上方。
- 移动端:用户中心与控制台默认收起,通过“显示 / 隐藏操作项”或“筛选”按钮展开;列设置入口不随筛选收起。 - 移动端:用户中心与控制台默认收起,通过“显示 / 隐藏操作项”或“筛选”按钮展开;列设置入口不随筛选收起。
- 控制台使用 `ConsoleSearchBar` + `ConsoleSearchActions`,企业中心使用 `OrgFilterCard`,不要另写网格。 - 控制台使用 `ConsoleSearchBar` + `ConsoleSearchActions`,企业中心常规筛选使用 `OrgFilterCard`。消耗明细及提示词记录复用个人消费记录的筛选布局和移动端折叠。
- 标准列表以 `/console/token` 为参考,覆盖控制台分佣、兑换码、会员卡和发票,企业及个人分佣,以及用户中心密钥管理(含各自子页、页签和详情列表)。使用 `ConsoleCollection`(或通过 `CardPro` 接入);独立列表可用 `ConsoleCollectionSearch` + `ConsoleFilterGrid`。筛选栅格为三列、≤ 1100px 两列、≤ 768px 单列。 - 标准列表以 `/console/token` 为参考,覆盖控制台分佣、兑换码、会员卡和发票,企业及个人分佣,以及用户中心密钥管理(含各自子页、页签和详情列表)。使用 `ConsoleCollection`(或通过 `CardPro` 接入);独立列表可用 `ConsoleCollectionSearch` + `ConsoleFilterGrid`。筛选栅格为三列、≤ 1100px 两列、≤ 768px 单列。
- 搜索操作在筛选卡右下,先默认样式“重置”(无图标),再带放大镜的主按钮“搜索”;点击和回车共用同一个提交入口。保留原有即时筛选及请求方式,移动端统一通过“显示/隐藏操作项”切换。 - 搜索操作在筛选卡右下,先默认样式“重置”(无图标),再带放大镜的主按钮“搜索”;点击和回车共用同一个提交入口。保留原有即时筛选及请求方式,移动端统一通过“显示/隐藏操作项”切换。
- 工具栏在列表卡内、表格上方:列表标题、计数或快捷筛选在左;已有的批量、导出、刷新、列设置、新建等动作在右,主操作尽量靠右,使用公共操作图标和清晰文案。窗口变窄时自然换行。只读明细若没有筛选或业务动作,不新增占位按钮。 - 工具栏在列表卡内、表格上方:列表标题、计数或快捷筛选在左;已有的批量、导出、刷新、列设置、新建等动作在右,主操作尽量靠右,使用公共操作图标和清晰文案。窗口变窄时自然换行。只读明细若没有筛选或业务动作,不新增占位按钮。
@@ -151,12 +152,14 @@ html.dark .km-page {
### 5.2 列 ### 5.2 列
- 每列显式 `width`,长文本 `ellipsis` 并配 `Tooltip`;金额与数量右对齐;时间统一格式,必要时日期与时间分两行。 - 每列显式 `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 可操作菜单。 - 操作列放在最后,标题固定为“操作”,按钮为 `type='link' size='small'`,同一行操作间距 8px;用户中心、企业中心、控制台(含系统设置)的操作列统一 `fixed: 'right'`。`/console/user` 的用户列表和 `/console/commission?view=partners` 的合作伙伴列表使用 `TableRowActions`:直出高频动作,其余放进带下箭头的文字“更多”菜单。其他列表沿用既有操作呈现方式,不批量套用此菜单。菜单点击打开、右对齐,无有效菜单项时不渲染入口;危险项置末、标记 `danger` 并保留业务确认。现有权限、状态限制、禁用项和回调不得因收纳而改变,方向键、Enter、Escape 可操作菜单。
- 三中心表格通过 `CenterActionTable` 统一处理,最后一列存在创建、查看、编辑、测试、详情、删除、添加、设置、配置、弹窗 / 抽屉或请求交互时,列头统一显示“操作”并固定右侧,宽度按按钮 / 交互数量计算。没有操作列但估算列宽超出容器时,从右侧固定末 4 列,列数不足时降为 3、2、1 列。固定列使用不透明底色并保持表头层级;横向滚动条遵循 Ant Design 官方固定列表格行为,允许鼠标、触控板、触屏和键盘滚动,不隐藏滚动条。 - 三中心表格通过 `CenterActionTable` 统一处理,最后一列存在创建、查看、编辑、测试、详情、删除、添加、设置、配置、弹窗 / 抽屉或请求交互时,列头统一显示“操作”并固定右侧,宽度按按钮 / 交互数量计算。没有操作列但估算列宽超出容器时,从右侧固定末 4 列,列数不足时降为 3、2、1 列。固定列使用不透明底色并保持表头层级;横向滚动条遵循 Ant Design 官方固定列表格行为,允许鼠标、触控板、触屏和键盘滚动,不隐藏滚动条。
- 列显隐只在已有列设置的表格中提供,统一使用 `ColumnSettings`(见 `docs/ui/TABLE_COLUMN_SETTINGS_SPEC.md`)。 - 列显隐只在已有列设置的表格中提供,统一使用 `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` 类名补丁;表头不换行,表头与正文沿用同一列宽和对齐方式。 - 三中心表头背景统一由 `center-table.css` 绘制:页面通过 `--center-table-head-bg` 提供色调,公共层在不透明的容器底色上叠加同色填充,普通列与固定列保持一致;页面不再直接覆盖表头 `background`。固定列使用 antd 6 的 `.ant-table-cell-fix` 与原生动态层级,不写死 `z-index`,不使用旧版 `fix-left` / `fix-right` 类名补丁;表头不换行,表头与正文沿用同一列宽和对齐方式。
- 操作列在异步数据或列变化后重新测量可见行的按钮宽度,取最大值;列宽不超过表格容器,按钮组在空间不足时换行。左右固定区总宽超过容器时,保留右侧操作列,其余固定列参与横向滚动;容器恢复足够宽度后恢复原固定配置,避免窄屏相互遮挡。 - 操作列在异步数据或列变化后重新测量可见行的按钮宽度,取最大值;列宽不超过表格容器,按钮组在空间不足时换行。左右固定区总宽超过容器时,保留右侧操作列,其余固定列参与横向滚动;容器恢复足够宽度后恢复原固定配置,避免窄屏相互遮挡。
- 操作列的删除入口置末并用 `danger`;点击仅打开确认,确认后的提交与刷新按第 8 节执行。无权删除或当前状态不允许删除时,沿用业务的隐藏或禁用规则。
### 5.3 状态 ### 5.3 状态
@@ -192,7 +195,11 @@ html.dark .km-page {
| 外观 | 圆角 12px;标题 16px / 600;正文与页脚使用 antd 默认间距 | | 外观 | 圆角 12px;标题 16px / 600;正文与页脚使用 antd 默认间距 |
| 页脚 | 次操作(取消)在前、主操作(确定 / 保存)在后,按钮高 34px、间距 8px;危险确认用 `okButtonProps={{ danger: true }}` | | 页脚 | 次操作(取消)在前、主操作(确定 / 保存)在后,按钮高 34px、间距 8px;危险确认用 `okButtonProps={{ danger: true }}` |
| 行为 | 提交中 `confirmLoading`;校验或请求失败不关闭;X、取消、Esc、遮罩关闭行为一致 | | 行为 | 提交中 `confirmLoading`;校验或请求失败不关闭;X、取消、Esc、遮罩关闭行为一致 |
| 确认框 | 单条删除用 `Popconfirm`;批量或不可撤销操作用 `Modal.confirm`(企业中心用 `OrgModal.confirm`) | | 表格操作列危险确认 | 删除、注销和冻结使用小尺寸危险链接,更多菜单使用危险菜单项。普通单条操作用 `TableActionPopconfirm`,注销、企业冻结等影响较大的操作用确认弹窗。取消在前,危险确认在后;优先聚焦取消 |
- 保留业务定制的标题、正文和按钮文案,并接入国际化。确认信息明确操作对象和影响。
- 只有明确确认才发送请求;取消、Esc 或关闭不修改数据。确认回调返回 Promise,提交中显示加载并防止重复请求,失败保留确认及上下文并提示原因。成功后关闭确认并刷新列表,删除当前页最后一条时按分页规范回退。
- 表格危险操作的回调在 API 明确失败时返回 `false`。确认框保持打开,业务回调保留原有错误提示。受控弹窗由业务在成功后关闭。
## 9. 抽屉 ## 9. 抽屉
@@ -222,7 +229,8 @@ html.dark .km-page {
- **状态**用语义色:成功 `success`、失败 `error`、进行中 `processing`、等待 / 警告 `warning`、中性 `default`。 - **状态**用语义色:成功 `success`、失败 `error`、进行中 `processing`、等待 / 警告 `warning`、中性 `default`。
- **分类**(分组、类型、模型标签等)用调色板色(`blue`、`green`、`purple`、`gold`、`cyan` 等 antd 预设),不用非预设色名。 - **分类**(分组、类型、模型标签等)用调色板色(`blue`、`green`、`purple`、`gold`、`cyan` 等 antd 预设),不用非预设色名。
- 全局默认描边;卡片内的分类标签与企业中心表格标签用无边框样式,新代码写 `variant='filled'`(antd 6 已弃用 `bordered={false}`,二者视觉等价;存量写法可在修改时顺带收敛)。标签间距 8px,表格内标签不留右外边距。 - 全局默认描边;卡片内的分类标签与企业中心表格标签用无边框样式,新代码写 `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. 按钮与图标 ## 12. 按钮与图标
+3 -3
View File
@@ -16,7 +16,7 @@
| 滚动条 | 全站 6px,`#8b8b8b`,悬停 `#636363`,页面不得单独设置 | | 滚动条 | 全站 6px,`#8b8b8b`,悬停 `#636363`,页面不得单独设置 |
| 装饰 | 无设计依据不加渐变、玻璃、发光、浮起与动效 | | 装饰 | 无设计依据不加渐变、玻璃、发光、浮起与动效 |
| 登录关卡 | 真实 UI 登录,企业先于个人,凭据只经环境变量(第 6 节) | | 登录关卡 | 真实 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/` **相关代码**:`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。筛选区自然换行,表格在自身容器横向滚动;不通过隐藏正文、裁剪校验信息或固定整页宽度迎合截图。 - 带侧栏页面按 4.4;控制台按 `CONSOLE_SPEC.md`;其余页面内容默认 24px 30px、移动 16px。筛选区自然换行,表格在自身容器横向滚动;不通过隐藏正文、裁剪校验信息或固定整页宽度迎合截图。
- 模型超市与技能超市的工作区居中,含内边距的最大宽度为 1760px;横向内边距为 `clamp(20px, 4vw, 80px)`,Hero 搜索区域沿用同一横向留白,600px 及以下为 20px。覆盖 3840 / 2560 / 1920 至 360px 宽度,目录按实际可用宽度减少列数,保留卡片正文和控件正常字号,不通过整体缩放压缩内容。 - 模型超市与技能超市的工作区居中,含内边距的最大宽度为 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 绘制的背景按测量值在页面作用域复现,不用生成插画替代。 - 背景图优先复用原型的原始 SVG / 图片,放入 `src/assets/prototype` 并注明来源;原型用 CSS 绘制的背景按测量值在页面作用域复现,不用生成插画替代。
- 企业工作台横幅 `.ew-hero` 的浅金 / 深棕背景与三层轮廓只用于 `.org-workbench`,不扩散到其他页面。 - 企业工作台横幅 `.ew-hero` 的浅金 / 深棕背景与三层轮廓只用于 `.org-workbench`,不扩散到其他页面。
- 原型未定义、antd 有组件:用当前版本默认样式与主题 token。antd 无对应部件:语义背景 / 文字 / 边框,无装饰背景、阴影与动画,间距 8 / 16 / 24px,窄屏堆叠且操作可达;新增此类统一规则先写入本文。 - 原型未定义、antd 有组件:用当前版本默认样式与主题 token。antd 无对应部件:语义背景 / 文字 / 边框,无装饰背景、阴影与动画,间距 8 / 16 / 24px,窄屏堆叠且操作可达;新增此类统一规则先写入本文。
@@ -176,7 +176,7 @@
### 7.3 采集与判定 ### 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 判定通过。 - 等待懒加载、骨架屏、提交中状态结束;检查错误消息、控制台、实际路由与无效数值,不能只凭无 pageerror 判定通过。
- 只读验收记录所有非 GET `/api/` 请求(应为 0);模拟响应按接口真实结构提供并标注;真实写入只用可清理的测试数据;支付未启用不得写成支付通过。 - 只读验收记录所有非 GET `/api/` 请求(应为 0);模拟响应按接口真实结构提供并标注;真实写入只用可清理的测试数据;支付未启用不得写成支付通过。
- 定位双字按钮允许 antd 默认字间距,如 `getByRole('button', { name: /^(?:loadings+)?保s*存$/ })`;虚拟 Select 用可见选项或组合框键盘操作,不点击隐藏的辅助选项。 - 定位双字按钮允许 antd 默认字间距,如 `getByRole('button', { name: /^(?:loadings+)?保s*存$/ })`;虚拟 Select 用可见选项或组合框键盘操作,不点击隐藏的辅助选项。
+2 -2
View File
@@ -38,8 +38,8 @@
| 页头 | `UserCenterPageHeader`;“新手教程 / 查看操作指引”图标按钮保留在右侧 | | 页头 | `UserCenterPageHeader`;“新手教程 / 查看操作指引”图标按钮保留在右侧 |
| 查询卡 | 保留单输入框,匹配密钥名称、Key 或分组。输入防抖,点击搜索或按回车立即提交,重置取消待提交条件并回到普通列表第 1 页 | | 查询卡 | 保留单输入框,匹配密钥名称、Key 或分组。输入防抖,点击搜索或按回车立即提交,重置取消待提交条件并回到普通列表第 1 页 |
| 列表 | `Table size='middle' tableLayout='fixed'`,列宽 150 / 300 / 150 / 100 / 180 / 100 / 100 / 130;默认每页 10 条;列设置用 `ColumnSettings`,不持久化 | | 列表 | `Table size='middle' tableLayout='fixed'`,列宽 150 / 300 / 150 / 100 / 180 / 100 / 100 / 130;默认每页 10 条;列设置用 `ColumnSettings`,不持久化 |
| 状态 | `Switch`(`onChange` 仍走原 `Modal.confirm` → `manageToken`);已过期 / 已耗尽另显示语义 `Tag` | | 状态 | `TableStatusSwitch`(`onChange` 仍走原 `Modal.confirm` → `manageToken`);已过期 / 已耗尽另显示语义 `Tag` |
| 分组 | `Tag color='blue'` 无边框 + `Tooltip`;额度为 `Tag color='success'` | | 分组 | `TableGroupTags` + `Tooltip`,颜色按组件公共规范;额度为 `Tag color='success'` |
| 密钥 | `<code>` 密钥框(底 `#f4f6f9`、描边 `#e4e9ee`,深色引用 `--surface-bg-base` / `--border-subtle`)+ 显示、隐藏、复制图标按钮 + `Tooltip`;脱敏提示 `Alert type='success'` | | 密钥 | `<code>` 密钥框(底 `#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` | | 模型抽屉 | 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 | | 编辑抽屉 | 560px(移动 100%);适配 `Form requiredMark={false}`;过期快捷 `Button` 组(间距 5px、描边 `#d9dfe6`、无按钮阴影,`aria-pressed`);仅“自定义”显示 `DatePicker showTime`;高级设置 `Collapse`(`forceRender`)+ `Switch` + `Divider`;页脚按钮间距 10px |
+5 -4
View File
@@ -50,7 +50,7 @@
- **页头**:`OrgPageHeader`(内部复用 `UserCenterPageHeader`),规格见 `GLOBAL_UI_BASELINE.md` 4.4;页头不放操作按钮,操作移入列表卡头。面包屑分组见 4.4 第 3 条。 - **页头**:`OrgPageHeader`(内部复用 `UserCenterPageHeader`),规格见 `GLOBAL_UI_BASELINE.md` 4.4;页头不放操作按钮,操作移入列表卡头。面包屑分组见 4.4 第 3 条。
- **列表卡 `OrgListCard`**:卡头与表格间距 20px;表格为紧凑变体(正文 13px,表头 12px / 500、底色 `--oc-soft`,行上下内边距 17px);分页按公共组件规范,覆盖页签及表格明细。 - **列表卡 `OrgListCard`**:卡头与表格间距 20px;表格为紧凑变体(正文 13px,表头 12px / 500、底色 `--oc-soft`,行上下内边距 17px);分页按公共组件规范,覆盖页签及表格明细。
- **筛选卡 `OrgFilterCard`**:固定 3 列;筛选取值与生效时机沿用原页面(审计日志为“选择即筛选”,“搜索”以当前条件重新查询)。 - **筛选卡 `OrgFilterCard`**:默认 3 列。提示词记录和消耗明细的筛选区沿用个人消费记录的布局。筛选取值与生效时机沿用原页面(审计日志为“选择即筛选”,“搜索”以当前条件重新查询)。
- **行操作 `OrgRowActions`**:link 按钮 13 / 24px、无内边距、间距 10px,不带图标。 - **行操作 `OrgRowActions`**:link 按钮 13 / 24px、无内边距、间距 10px,不带图标。
- **列表页签 `.oc-list-tabs`**:导航高 44px,页签内边距 12px 0,选中与悬停色为 `--oc-brand`;只切换筛选时加 `.oc-tabs-nav-only`。 - **列表页签 `.oc-list-tabs`**:导航高 44px,页签内边距 12px 0,选中与悬停色为 `--oc-brand`;只切换筛选时加 `.oc-tabs-nav-only`。
- **标签**:表格与卡片内标签统一无边框(`variant='filled'`);非 antd 预设色改用 `gold` / `purple`。 - **标签**:表格与卡片内标签统一无边框(`variant='filled'`);非 antd 预设色改用 `gold` / `purple`。
@@ -70,8 +70,8 @@
| 审批中心 | 状态页签(回调 `setStatusFilter`)+ 申请列表卡;拒绝弹窗竖排表单项 | — | | 审批中心 | 状态页签(回调 `setStatusFilter`)+ 申请列表卡;拒绝弹窗竖排表单项 | — |
| 密钥管理 | 密钥框 + 显隐 / 复制、可用模型 link、分组列、状态开关、绝对时间;列设置用共享组件;创建 / 编辑为 560px `OrgSideSheet` | 列设置只在当前页面生效;非操作列整体横向滚动,仅在可见列宽度超过容器时显示滚动条 | | 密钥管理 | 密钥框 + 显隐 / 复制、可用模型 link、分组列、状态开关、绝对时间;列设置用共享组件;创建 / 编辑为 560px `OrgSideSheet` | 列设置只在当前页面生效;非操作列整体横向滚动,仅在可见列宽度超过容器时显示滚动条 |
| 企业充值 | 企业钱包 + 充值工作区(额度卡 / 自定义 / 支付方式)+ 订单卡 + 记录;订单“立即充值”与支付方式点击同为 `handlePreTopUp` | 档位与折扣来自后台配置;无订单号搜索与发票入口 | | 企业充值 | 企业钱包 + 充值工作区(额度卡 / 自定义 / 支付方式)+ 订单卡 + 记录;订单“立即充值”与支付方式点击同为 `handlePreTopUp` | 档位与折扣来自后台配置;无订单号搜索与发票入口 |
| 消耗明细 | 统计卡 + 页签(明细日志 / 成员排行 / 绘图与视频)+ 三列筛选卡 + 列表卡;查询按钮为“搜索”(`handleSearch`) | 见第 5 节 | | 消耗明细 | 统计卡 + 页签(明细日志 / 成员排行 / 绘图与视频)+ 消费记录样式筛选卡 + 列表卡;查询按钮为“搜索”(`handleSearch`) | 见第 5 节 |
| 审计日志 | 页签 + 筛选卡(操作类型)+ 操作记录卡;“提示词记录”页签沿用原显隐 | — | | 审计日志 | 页签 + 筛选卡(操作类型)+ 操作记录卡;“提示词记录”页签沿用原显隐,筛选区参考消费记录;说明条上下与筛选卡至列表卡均间隔 18px | — |
| 个人设置 | 复用用户中心 `ui-personal-*`、`AvatarSection`、`SectionHeader`;三页签:头像设置 / 个人资料 / 通知设置;企业身份并入资料头 | 昵称在弹窗中修改 | | 个人设置 | 复用用户中心 `ui-personal-*`、`AvatarSection`、`SectionHeader`;三页签:头像设置 / 个人资料 / 通知设置;企业身份并入资料头 | 昵称在弹窗中修改 |
| 企业设置 | 设置卡内页签 + 区块头(刷新 / 保存设置);复制为 14px 无内边距图标按钮 | 保留“数据安全”“危险区域”页签 | | 企业设置 | 设置卡内页签 + 区块头(刷新 / 保存设置);复制为 14px 无内边距图标按钮 | 保留“数据安全”“危险区域”页签 |
@@ -83,7 +83,8 @@
## 5. 消耗明细(/org/logs) ## 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`。 - 任务表列宽 185 / 185 / 110 / 110 / 250 / 330 / 110 / 155 / 145 / 150;模型为行内胶囊,费用主色右对齐;分页沿用公共规范。“刷新”与“搜索”调用同一 `refresh`。
- 时间范围为本页签自有的可编辑字段(默认最近 7 天,含快捷预设),与“明细日志”筛选互不影响;起止颠倒沿用原提示。 - 时间范围为本页签自有的可编辑字段(默认最近 7 天,含快捷预设),与“明细日志”筛选互不影响;起止颠倒沿用原提示。
- 末列“操作”不固定:视频任务显示“点击预览视频”,失败任务保留失败原因查看,其余显示“-”。 - 末列“操作”不固定:视频任务显示“点击预览视频”,失败任务保留失败原因查看,其余显示“-”。
@@ -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 (
<Modal
{...props}
okType='danger'
confirmLoading={submitting}
onOk={confirm}
onCancel={(event) => {
if (!pending.current) props.onCancel(event);
}}
afterOpenChange={(visible) => {
if (visible) cancelButton.current?.focus();
}}
cancelButtonProps={{ ref: cancelButton }}
/>
);
}
@@ -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 (
<Popconfirm
{...props}
open={open}
description={content ?? props.description}
placement={position ?? props.placement}
onOpenChange={(nextOpen) => {
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}
</Popconfirm>
);
}
@@ -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 (
<Tag
color={groupColors.get(group?.trim().toLowerCase()) ?? 'default'}
variant='outlined'
onClick={onClick}
role={onClick ? 'button' : undefined}
tabIndex={onClick ? 0 : undefined}
onKeyDown={
onClick
? (event) => {
if (event.key !== 'Enter' && event.key !== ' ') return;
event.preventDefault();
event.stopPropagation();
if (!event.repeat) onClick(event);
}
: undefined
}
className='m-0'
>
{children ?? displayGroupName(group)}
</Tag>
);
}
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 (
<span className='table-group-tags'>
{names.map((name) => (
<TableGroupTag
key={name}
group={name}
onClick={
onGroupClick ? (event) => onGroupClick(name, event) : undefined
}
>
{standardGroupNames.has(name.toLowerCase())
? displayGroupName(name)
: renderLabel?.(name)}
</TableGroupTag>
))}
</span>
);
}
@@ -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 (
<Switch
{...props}
ref={ref}
size='small'
aria-label={ariaLabel ?? t('启用状态')}
checkedChildren={checkedChildren ?? t('启用')}
unCheckedChildren={unCheckedChildren ?? t('禁用')}
/>
);
});
@@ -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 && (
<Button
block
className='usage-record-mobile-toggle'
aria-expanded={expanded}
aria-controls={id}
onClick={() => setExpanded((open) => !open)}
>
{expanded ? t('隐藏操作项') : t('显示操作项')}
</Button>
)}
<div
className='usage-record-filter-content'
id={id}
hidden={isMobile && !expanded}
>
{children}
</div>
</>
);
}
export default function UsageRecordFilterCard({ children, className }) {
return (
<Card className={`usage-record-filter-card ${className}`}>
<UsageRecordFilterContent>{children}</UsageRecordFilterContent>
</Card>
);
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
}
+7 -2
View File
@@ -4,12 +4,17 @@ import { Space, Tag, Typography, Popover } from '@/components/ui';
const { Text } = Typography; const { Text } = Typography;
// 通用渲染函数:限制项目数量显示,支持popover展开 // 通用渲染函数:限制项目数量显示,支持popover展开
export function renderLimitedItems({ items, renderItem, maxDisplay = 3 }) { export function renderLimitedItems({
items,
renderItem,
maxDisplay = 3,
wrap = true,
}) {
if (!items || items.length === 0) return '-'; if (!items || items.length === 0) return '-';
const displayItems = items.slice(0, maxDisplay); const displayItems = items.slice(0, maxDisplay);
const remainingItems = items.slice(maxDisplay); const remainingItems = items.slice(maxDisplay);
return ( return (
<Space spacing={1} wrap> <Space spacing={wrap ? 1 : 4} wrap={wrap}>
{displayItems.map((item, idx) => renderItem(item, idx))} {displayItems.map((item, idx) => renderItem(item, idx))}
{remainingItems.length > 0 && ( {remainingItems.length > 0 && (
<Popover <Popover
+15 -10
View File
@@ -86,7 +86,8 @@
} }
.console-model-section, .console-model-section,
.console-channel-section { .console-channel-section,
.console-user-section {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 5px; gap: 5px;
@@ -94,12 +95,14 @@
} }
.console-model-section .ant-avatar, .console-model-section .ant-avatar,
.console-channel-section .ant-avatar { .console-channel-section .ant-avatar,
.console-user-section .ant-avatar {
flex-shrink: 0; flex-shrink: 0;
margin: 0; margin: 0;
} }
.console-channel-sections > div + div { .console-channel-sections > div + div,
.console-user-sections > .ant-card + .ant-card {
margin-top: 10px; margin-top: 10px;
} }
@@ -107,13 +110,13 @@
margin-bottom: 0; margin-bottom: 0;
} }
.console-channel-section .ant-avatar svg { .console-user-section-description {
display: block; color: var(--console-muted);
width: 16px; font-size: 12px;
height: 16px;
} }
.console-channel-footer .ant-btn { .console-channel-footer .ant-btn,
.console-user-footer .ant-btn {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@@ -133,7 +136,8 @@
} }
.console-overlay .console-model-footer, .console-overlay .console-model-footer,
.console-overlay .console-channel-footer { .console-overlay .console-channel-footer,
.console-overlay .console-user-footer {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
@@ -153,7 +157,8 @@
} }
} }
.console-model-drawer .console-model-editor-header .ant-drawer-title, .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; text-align: start;
} }
+7 -6
View File
@@ -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 { Plus as ActionPlus } from '@/components/common/icons/ActionIcons';
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
import { import {
@@ -6,7 +8,6 @@ import {
Input, Input,
InputNumber, InputNumber,
Modal, Modal,
Popconfirm,
Select, Select,
Switch, Switch,
Table, Table,
@@ -146,6 +147,7 @@ const QualityAlerts = ({ quality, t }) => {
load(); load();
} catch (e) { } catch (e) {
Toast.error(saveErrorText(e)); Toast.error(saveErrorText(e));
return false;
} }
}; };
@@ -173,8 +175,7 @@ const QualityAlerts = ({ quality, t }) => {
dataIndex: 'enabled', dataIndex: 'enabled',
width: 70, width: 70,
render: (v, rule) => ( render: (v, rule) => (
<Switch <TableStatusSwitch
size='small'
checked={v} checked={v}
onChange={(checked) => toggle(rule, checked)} onChange={(checked) => toggle(rule, checked)}
/> />
@@ -220,14 +221,14 @@ const QualityAlerts = ({ quality, t }) => {
> >
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定删除该告警规则?')} title={t('确定删除该告警规则?')}
onConfirm={() => remove(rule)} onConfirm={() => remove(rule)}
> >
<Button size='small' theme='borderless' type='danger'> <Button size='small' type='link' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</div> </div>
), ),
}, },
+2 -2
View File
@@ -196,7 +196,7 @@ const QualityBreakdown = ({ quality, t }) => {
/> />
</div> </div>
<div <div
className={`quality-card-body quality-nested-tabs${isPlatform ? ' quality-breakdown-body' : ''}`} className={`quality-card-body quality-nested-tabs ${isPlatform ? 'quality-breakdown-body' : 'quality-breakdown-org-body'}`}
> >
<Tabs type='button' size='small' activeKey={dim} onChange={setDim}> <Tabs type='button' size='small' activeKey={dim} onChange={setDim}>
{dims.map((d) => ( {dims.map((d) => (
@@ -215,7 +215,7 @@ const QualityBreakdown = ({ quality, t }) => {
className={ className={
isPlatform isPlatform
? 'quality-breakdown-result' ? 'quality-breakdown-result'
: 'overflow-x-auto app-scrollbar mt-2' : 'overflow-x-auto app-scrollbar'
} }
> >
<Table <Table
+18 -1
View File
@@ -70,7 +70,14 @@
padding-block-start: 12px; padding-block-start: 12px;
} }
.quality-breakdown-body .ant-tabs > .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; margin-bottom: 0;
} }
@@ -214,6 +221,16 @@
border-color: color-mix(in srgb, var(--ui-color-primary) 22%, transparent); 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 { .quality-grid-2 {
display: grid; display: grid;
grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
@@ -1,3 +1,6 @@
import TableGroupTags, {
TABLE_GROUP_COLUMN_WIDTH,
} from '@/components/common/table/TableGroupTags';
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js'; import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { formatIdReference } from '../../helpers/safeDisplay'; import { formatIdReference } from '../../helpers/safeDisplay';
import { TestTube2 as ActionTestTube2 } from '@/components/common/icons/ActionIcons'; import { TestTube2 as ActionTestTube2 } from '@/components/common/icons/ActionIcons';
@@ -327,7 +330,12 @@ export default function ContentGuardSetting() {
render: (v) => new Date(v).toLocaleString(), render: (v) => new Date(v).toLocaleString(),
}, },
{ title: t('用户'), dataIndex: 'user_id', width: 80 }, { title: t('用户'), dataIndex: 'user_id', width: 80 },
{ title: t('分组'), dataIndex: 'using_group' }, {
title: t('分组'),
dataIndex: 'using_group',
width: TABLE_GROUP_COLUMN_WIDTH,
render: (groups) => <TableGroupTags groups={groups} />,
},
{ title: t('模型'), dataIndex: 'model' }, { title: t('模型'), dataIndex: 'model' },
{ title: t('方向'), dataIndex: 'direction' }, { title: t('方向'), dataIndex: 'direction' },
{ title: t('类型'), dataIndex: 'content_type' }, { title: t('类型'), dataIndex: 'content_type' },
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { import {
RefreshCw as ActionRefreshCw, RefreshCw as ActionRefreshCw,
Plus as ActionPlus, Plus as ActionPlus,
@@ -13,7 +14,6 @@ import {
Select, Select,
Tag, Tag,
Avatar, Avatar,
Popconfirm,
Typography, Typography,
Space, Space,
Banner, Banner,
@@ -178,12 +178,14 @@ const CustomerServiceSetting = () => {
if (res.data.success) { if (res.data.success) {
showSuccess(t('删除成功')); showSuccess(t('删除成功'));
fetchAgents(); fetchAgents();
return true;
} else { } else {
showError(res.data.message); showError(res.data.message);
} }
} catch (err) { } catch (err) {
showError(t('删除失败')); showError(t('删除失败'));
} }
return false;
}; };
// 切换状态 // 切换状态
@@ -301,7 +303,7 @@ const CustomerServiceSetting = () => {
<Button onClick={() => openModal(record)} type='link' size='small'> <Button onClick={() => openModal(record)} type='link' size='small'>
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确认删除')} title={t('确认删除')}
content={t('确定要删除这个客服吗?')} content={t('确定要删除这个客服吗?')}
onConfirm={() => handleDelete(record.id)} onConfirm={() => handleDelete(record.id)}
@@ -309,7 +311,7 @@ const CustomerServiceSetting = () => {
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js'; import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { useEffectEvent } from '../../hooks/common/useEffectEvent'; import { useEffectEvent } from '../../hooks/common/useEffectEvent';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
@@ -317,9 +318,11 @@ export default function DataSecuritySetting() {
showSuccess(res.data?.message || t('删除成功')); showSuccess(res.data?.message || t('删除成功'));
loadOrgConfigs(); loadOrgConfigs();
loadChangeRequests(); // 开启二级审批时会进入待审批队列 loadChangeRequests(); // 开启二级审批时会进入待审批队列
return true;
} else { } else {
showError(res.data?.message || t('删除失败')); showError(res.data?.message || t('删除失败'));
} }
return false;
}; };
const toggleKillSwitch = async (action) => { const toggleKillSwitch = async (action) => {
const res = await API.post('/api/desensitize/killswitch', { const res = await API.post('/api/desensitize/killswitch', {
@@ -438,9 +441,11 @@ export default function DataSecuritySetting() {
showSuccess(res.data?.message || t('删除成功')); showSuccess(res.data?.message || t('删除成功'));
loadRules(); loadRules();
loadChangeRequests(); loadChangeRequests();
return true;
} else { } else {
showError(res.data?.message || t('删除失败')); showError(res.data?.message || t('删除失败'));
} }
return false;
}; };
// ---- 审批 ---- // ---- 审批 ----
@@ -496,14 +501,14 @@ export default function DataSecuritySetting() {
<Button onClick={() => openEditRule(rule)} type='link' size='small'> <Button onClick={() => openEditRule(rule)} type='link' size='small'>
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确认删除该规则?')} title={t('确认删除该规则?')}
onConfirm={() => deleteRule(rule)} onConfirm={() => deleteRule(rule)}
> >
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -859,7 +864,7 @@ export default function DataSecuritySetting() {
{ {
title: t('操作'), title: t('操作'),
render: (_, rule) => ( render: (_, rule) => (
<Popconfirm <TableActionPopconfirm
title={t( title={t(
'确认紧急删除该企业私有规则?将同步记入该企业的变更留痕。', '确认紧急删除该企业私有规则?将同步记入该企业的变更留痕。',
)} )}
@@ -868,7 +873,7 @@ export default function DataSecuritySetting() {
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
), ),
}, },
]} ]}
@@ -1181,14 +1186,14 @@ export default function DataSecuritySetting() {
> >
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确认删除该企业覆盖(回到继承全局)?')} title={t('确认删除该企业覆盖(回到继承全局)?')}
onConfirm={() => deleteOrgConfig(row.org_id)} onConfirm={() => deleteOrgConfig(row.org_id)}
> >
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
+16 -12
View File
@@ -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 { Trans } from 'react-i18next';
import { Eraser as ActionEraser } from '@/components/common/icons/ActionIcons'; import { Eraser as ActionEraser } from '@/components/common/icons/ActionIcons';
import { import {
@@ -25,7 +28,6 @@ import {
Tooltip, Tooltip,
Divider, Divider,
Empty, Empty,
Switch,
} from '@/components/ui'; } from '@/components/ui';
import { Search } from 'lucide-react'; import { Search } from 'lucide-react';
import { API, showError, showSuccess } from '../../helpers'; import { API, showError, showSuccess } from '../../helpers';
@@ -745,6 +747,7 @@ const LevelPolicySetting = () => {
showSuccess(t('删除成功')); showSuccess(t('删除成功'));
} }
await fetchAll(); await fetchAll();
return true;
} else { } else {
const d = res?.data?.data || {}; const d = res?.data?.data || {};
const refs = []; const refs = [];
@@ -770,6 +773,7 @@ const LevelPolicySetting = () => {
} finally { } finally {
setDeletingCode(''); setDeletingCode('');
} }
return false;
}; };
const saveDefaults = async () => { const saveDefaults = async () => {
@@ -859,9 +863,9 @@ const LevelPolicySetting = () => {
const tags = ( const tags = (
<Space> <Space>
{preview.map((g) => ( {preview.map((g) => (
<Tag key={g} color='light-blue'> <TableGroupTag key={g} group={g}>
{g} ×{d[g]} {g} ×{d[g]}
</Tag> </TableGroupTag>
))} ))}
{rest > 0 && ( {rest > 0 && (
<Tag color='light-blue' type='ghost'> <Tag color='light-blue' type='ghost'>
@@ -953,9 +957,7 @@ const LevelPolicySetting = () => {
> >
<Space> <Space>
{preview.map((g) => ( {preview.map((g) => (
<Tag key={g} color='red' type='ghost'> <TableGroupTag key={g} group={g} />
{g}
</Tag>
))} ))}
{rest > 0 && ( {rest > 0 && (
<Tag color='red' type='ghost'> <Tag color='red' type='ghost'>
@@ -988,7 +990,7 @@ const LevelPolicySetting = () => {
{t('复制')} {t('复制')}
</Button> </Button>
</Tooltip> </Tooltip>
<Popconfirm <TableActionPopconfirm
title={t('确认删除该等级?')} title={t('确认删除该等级?')}
content={t('被用户/企业/默认等级引用时会被拒绝')} content={t('被用户/企业/默认等级引用时会被拒绝')}
onConfirm={() => deleteLevel(type, r.code)} onConfirm={() => deleteLevel(type, r.code)}
@@ -1001,7 +1003,7 @@ const LevelPolicySetting = () => {
> >
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -1419,7 +1421,7 @@ const LevelPolicySetting = () => {
dataIndex: 'model', dataIndex: 'model',
render: (v, r) => ( render: (v, r) => (
<Space> <Space>
<span>{v}</span> <TableGroupTag group={v} />
{r.maybeDisabled && ( {r.maybeDisabled && (
<Tooltip <Tooltip
content={t( content={t(
@@ -1532,7 +1534,7 @@ const LevelPolicySetting = () => {
dataIndex: 'group', dataIndex: 'group',
render: (v, r) => ( render: (v, r) => (
<Space> <Space>
<span>{v}</span> <TableGroupTag group={v} />
{r.stale && ( {r.stale && (
<Tooltip <Tooltip
content={t( content={t(
@@ -1554,9 +1556,11 @@ const LevelPolicySetting = () => {
// 已废弃分组只允许关闭存量隐藏条目:后端对新增隐藏做存在性校验必拒, // 已废弃分组只允许关闭存量隐藏条目:后端对新增隐藏做存在性校验必拒,
// 放开开关会造成一次注定失败的保存。 // 放开开关会造成一次注定失败的保存。
render: (v, r) => ( render: (v, r) => (
<Switch <TableStatusSwitch
size='small'
checked={!!v} checked={!!v}
checkedChildren={t('是')}
unCheckedChildren={t('否')}
aria-label={t('对该等级隐藏')}
disabled={r.stale && !v} disabled={r.stale && !v}
onChange={(checked) => setGroupHidden(r.group, checked)} onChange={(checked) => setGroupHidden(r.group, checked)}
/> />
@@ -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 { useEffectEvent } from '../../hooks/common/useEffectEvent';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@@ -8,8 +10,6 @@ import {
Modal, Modal,
Form, Form,
Toast, Toast,
Popconfirm,
Switch,
Tag, Tag,
Progress, Progress,
Empty, Empty,
@@ -154,6 +154,7 @@ const TutorialVideoSetting = () => {
if (res.data.success) { if (res.data.success) {
Toast.success(t('删除成功')); Toast.success(t('删除成功'));
loadVideos(); loadVideos();
return true;
} else { } else {
Toast.error(res.data.message || t('删除失败')); Toast.error(res.data.message || t('删除失败'));
} }
@@ -161,6 +162,7 @@ const TutorialVideoSetting = () => {
console.error('Delete error:', error); console.error('Delete error:', error);
Toast.error(t('删除失败')); Toast.error(t('删除失败'));
} }
return false;
}; };
// 切换状态 // 切换状态
@@ -231,11 +233,9 @@ const TutorialVideoSetting = () => {
dataIndex: 'status', dataIndex: 'status',
width: 80, width: 80,
render: (status, record) => ( render: (status, record) => (
<Switch <TableStatusSwitch
checked={status === 1} checked={status === 1}
onChange={() => handleToggleStatus(record)} onChange={() => handleToggleStatus(record)}
checkedText={t('启用')}
uncheckedText={t('禁用')}
/> />
), ),
}, },
@@ -254,7 +254,7 @@ const TutorialVideoSetting = () => {
<Button onClick={() => handleEdit(record)} type='link' size='small'> <Button onClick={() => handleEdit(record)} type='link' size='small'>
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定删除这个视频吗?')} title={t('确定删除这个视频吗?')}
content={t('删除后将无法恢复')} content={t('删除后将无法恢复')}
onConfirm={() => handleDelete(record.id)} onConfirm={() => handleDelete(record.id)}
@@ -262,7 +262,7 @@ const TutorialVideoSetting = () => {
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</div> </div>
), ),
}, },
+5 -4
View File
@@ -1,6 +1,7 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next'; 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 { Table } from '@/components/ui';
import { ConsoleAlert as Alert } from '../console/ConsolePrimitives'; import { ConsoleAlert as Alert } from '../console/ConsolePrimitives';
import { Plus } from '../common/icons/ActionIcons'; import { Plus } from '../common/icons/ActionIcons';
@@ -143,10 +144,9 @@ const ProfileTable = ({ mode, orgId, canWrite = true, emptyHint }) => {
<Button type='link' size='small' onClick={() => setEditing(r)}> <Button type='link' size='small' onClick={() => setEditing(r)}>
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确认删除该集合?')} title={t('确认删除该集合?')}
description={t('使用该虚拟模型名的请求将返回"模型不存在"。')} description={t('使用该虚拟模型名的请求将返回"模型不存在"。')}
okButtonProps={{ danger: true }}
onConfirm={async () => { onConfirm={async () => {
try { try {
await deleteProfile(mode, orgId, r.id); await deleteProfile(mode, orgId, r.id);
@@ -154,13 +154,14 @@ const ProfileTable = ({ mode, orgId, canWrite = true, emptyHint }) => {
load(); load();
} catch (e) { } catch (e) {
if (e?.message) showError(e.message); if (e?.message) showError(e.message);
return false;
} }
}} }}
> >
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</> </>
)} )}
</Space> </Space>
@@ -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 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 { Tag, Typography, Popover } from '@/components/ui';
import { import {
renderGroup, renderGroup,
@@ -21,11 +23,8 @@ const renderStatus = (status, record, t, showEnableDisableModal) => {
(![1, 2].includes(status) ? { color: 'error', label: '未知状态' } : null); (![1, 2].includes(status) ? { color: 'error', label: '未知状态' } : null);
return ( return (
<div className='admin-tokens-status'> <div className='admin-tokens-status'>
<Switch <TableStatusSwitch
size='small'
checked={status === 1} checked={status === 1}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
aria-label={status === 1 ? t('禁用') : t('启用')} aria-label={status === 1 ? t('禁用') : t('启用')}
disabled={!isAdmin() || Boolean(record.DeletedAt)} disabled={!isAdmin() || Boolean(record.DeletedAt)}
onChange={() => onChange={() =>
@@ -194,7 +193,7 @@ export const getAdminTokensColumns = ({
{ {
title: t('分组'), title: t('分组'),
dataIndex: 'group', dataIndex: 'group',
width: 110, width: TABLE_GROUP_COLUMN_WIDTH,
render: (text) => <div>{renderGroup(text)}</div>, render: (text) => <div>{renderGroup(text)}</div>,
}, },
{ {
+1 -2
View File
@@ -82,8 +82,7 @@ const AdminTokensPage = () => {
const handleDeleteConfirm = async () => { const handleDeleteConfirm = async () => {
if (!modalToken) return; if (!modalToken) return;
await manageToken(modalToken.id, 'delete'); if (await manageToken(modalToken.id, 'delete')) setShowDelete(false);
setShowDelete(false);
}; };
const handleEditConfirm = async () => { const handleEditConfirm = async () => {
@@ -1,5 +1,6 @@
import TableActionModal from '@/components/common/table/TableActionModal';
import React from 'react'; import React from 'react';
import { Modal, Typography, Banner } from '@/components/ui'; import { Typography, Banner } from '@/components/ui';
const { Text } = Typography; const { Text } = Typography;
@@ -8,7 +9,7 @@ const AdminDeleteTokenModal = ({ visible, onCancel, onConfirm, token, t }) => {
const isOrgToken = token.organization_id > 0; const isOrgToken = token.organization_id > 0;
return ( return (
<Modal <TableActionModal
title={t('确定要删除此密钥吗?')} title={t('确定要删除此密钥吗?')}
visible={visible} visible={visible}
onCancel={onCancel} onCancel={onCancel}
@@ -37,7 +38,7 @@ const AdminDeleteTokenModal = ({ visible, onCancel, onConfirm, token, t }) => {
{token.user_id}) {token.user_id})
</Text> </Text>
</div> </div>
</Modal> </TableActionModal>
); );
}; };
@@ -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 { writeClipboardText } from '../../../helpers/clipboard';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Switch } from 'antd';
import { import {
Button, Button,
InputNumber, InputNumber,
@@ -34,11 +37,8 @@ const formatDisplayPercent = (value, digits = 0) => {
function ChannelStatusSwitch({ record, manageChannel, t }) { function ChannelStatusSwitch({ record, manageChannel, t }) {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
return ( return (
<Switch <TableStatusSwitch
size='small'
checked={record.status === 1} checked={record.status === 1}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
disabled={!isRoot()} disabled={!isRoot()}
loading={loading} loading={loading}
aria-label={t('状态')} aria-label={t('状态')}
@@ -405,19 +405,15 @@ export const getChannelsColumns = ({
key: COLUMN_KEYS.GROUP, key: COLUMN_KEYS.GROUP,
title: t('分组'), title: t('分组'),
dataIndex: 'group', dataIndex: 'group',
render: (text, record, index) => ( width: TABLE_GROUP_COLUMN_WIDTH,
<div> render: (groups) =>
<Space spacing={2}> renderGroup(
{text toGroupList(groups).sort((left, right) => {
?.split(',') if (left === right) return 0;
.sort((a, b) => { if (left === 'default') return -1;
if (a === 'default') return -1; if (right === 'default') return 1;
if (b === 'default') return 1; return left.localeCompare(right);
return a.localeCompare(b); }),
})
.map((item, index) => renderGroup(item))}
</Space>
</div>
), ),
}, },
{ {
@@ -723,19 +719,20 @@ export const getChannelsColumns = ({
type: 'danger', type: 'danger',
onClick: async () => { onClick: async () => {
const content = await buildDeleteConfirmContent(record.id, t); const content = await buildDeleteConfirmContent(record.id, t);
Modal.confirm({ confirmTableAction({
title: t('确定是否要删除此渠道?'), title: t('确定是否要删除此渠道?'),
content, content,
onOk: () => { okType: 'danger',
(async () => { focusable: { autoFocusButton: 'cancel' },
await manageChannel(record.id, 'delete', record); onOk: async () => {
if (!(await manageChannel(record.id, 'delete', record)))
return false;
await refresh(); await refresh();
setTimeout(() => { setTimeout(() => {
if (channels.length === 0 && activePage > 1) { if (channels.length === 0 && activePage > 1) {
refresh(activePage - 1); refresh(activePage - 1);
} }
}, 100); }, 100);
})();
}, },
}); });
}, },
@@ -1,3 +1,4 @@
import { toGroupList } from '@/helpers/groupList';
import { formatIdReference } from '../../../../helpers/safeDisplay'; import { formatIdReference } from '../../../../helpers/safeDisplay';
import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js'; 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 ChannelKeyDisplay from '../../../common/ui/ChannelKeyDisplay';
import { useSecureVerification } from '../../../../hooks/common/useSecureVerification'; import { useSecureVerification } from '../../../../hooks/common/useSecureVerification';
import { createApiCalls } from '../../../../services/secureVerification'; import { createApiCalls } from '../../../../services/secureVerification';
import { import { Code, Globe, Server, Settings, Zap } from 'lucide-react';
IconServer,
IconSetting,
IconCode,
IconGlobe,
IconBolt,
} from '@/components/ui/icons';
const { Text } = Typography; const { Text } = Typography;
@@ -573,11 +568,7 @@ const EditChannelModal = (props) => {
} else { } else {
data.models = data.models.split(','); data.models = data.models.split(',');
} }
if (data.group === '') { data.groups = toGroupList(data.group);
data.groups = [];
} else {
data.groups = data.group.split(',');
}
if (data.model_mapping !== '') { if (data.model_mapping !== '') {
data.model_mapping = JSON.stringify( data.model_mapping = JSON.stringify(
JSON.parse(data.model_mapping), JSON.parse(data.model_mapping),
@@ -1575,7 +1566,7 @@ const EditChannelModal = (props) => {
let res; let res;
localInputs.auto_ban = localInputs.auto_ban ? 1 : 0; localInputs.auto_ban = localInputs.auto_ban ? 1 : 0;
localInputs.models = localInputs.models.join(','); localInputs.models = localInputs.models.join(',');
localInputs.group = (localInputs.groups || []).join(','); localInputs.group = toGroupList(localInputs.groups).join(',');
// 日消耗限额统一使用 token(quota)单位,确保为整数 // 日消耗限额统一使用 token(quota)单位,确保为整数
if (localInputs.daily_quota_limit && localInputs.daily_quota_limit > 0) { if (localInputs.daily_quota_limit && localInputs.daily_quota_limit > 0) {
@@ -1921,7 +1912,7 @@ const EditChannelModal = (props) => {
{/* Header: Basic Info */} {/* Header: Basic Info */}
<div className='console-channel-section'> <div className='console-channel-section'>
<Avatar size='small' color='blue'> <Avatar size='small' color='blue'>
<IconServer size={16} /> <Server size={16} />
</Avatar> </Avatar>
<div> <div>
<Text className='text-lg font-medium'> <Text className='text-lg font-medium'>
@@ -2462,7 +2453,7 @@ const EditChannelModal = (props) => {
onClick={handleApiConfigSecretClick} onClick={handleApiConfigSecretClick}
> >
<Avatar size='small' color='green'> <Avatar size='small' color='green'>
<IconGlobe size={16} /> <Globe size={16} />
</Avatar> </Avatar>
<div> <div>
<Text className='text-lg font-medium'> <Text className='text-lg font-medium'>
@@ -2683,7 +2674,7 @@ const EditChannelModal = (props) => {
{/* Header: Model Config */} {/* Header: Model Config */}
<div className='console-channel-section'> <div className='console-channel-section'>
<Avatar size='small' color='purple'> <Avatar size='small' color='purple'>
<IconCode size={16} /> <Code size={16} />
</Avatar> </Avatar>
<div> <div>
<Text className='text-lg font-medium'> <Text className='text-lg font-medium'>
@@ -2888,7 +2879,7 @@ const EditChannelModal = (props) => {
{/* Header: Advanced Settings */} {/* Header: Advanced Settings */}
<div className='console-channel-section'> <div className='console-channel-section'>
<Avatar size='small' color='orange'> <Avatar size='small' color='orange'>
<IconSetting size={16} /> <Settings size={16} />
</Avatar> </Avatar>
<div> <div>
<Text className='text-lg font-medium'> <Text className='text-lg font-medium'>
@@ -3433,7 +3424,7 @@ const EditChannelModal = (props) => {
{/* Header: Channel Extra Settings */} {/* Header: Channel Extra Settings */}
<div className='console-channel-section'> <div className='console-channel-section'>
<Avatar size='small' color='violet'> <Avatar size='small' color='violet'>
<IconBolt size={16} /> <Zap size={16} />
</Avatar> </Avatar>
<div> <div>
<Text className='text-lg font-medium'> <Text className='text-lg font-medium'>
@@ -1,5 +1,8 @@
import { toGroupList } from '@/helpers/groupList';
import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js'; import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js';
import { useEffectEvent } from '../../../../hooks/common/useEffectEvent'; 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 React, { useState, useEffect, useRef } from 'react';
import { import {
API, API,
@@ -18,29 +21,43 @@ import {
Spin, Spin,
Banner, Banner,
Card, Card,
Tag,
Avatar, Avatar,
Form, Form,
Row,
Col,
} from '@/components/ui'; } from '@/components/ui';
import { import { Bookmark, Code, Settings } from 'lucide-react';
IconSave,
IconClose,
IconBookmark,
IconUser,
IconCode,
IconSetting,
} from '@/components/ui/icons';
import { getChannelModels } from '../../../../helpers'; import { getChannelModels } from '../../../../helpers';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Text, Title } = Typography; const { Text } = Typography;
const MODEL_MAPPING_EXAMPLE = { const MODEL_MAPPING_EXAMPLE = {
'gpt-3.5-turbo': 'gpt-3.5-turbo-0125', 'gpt-3.5-turbo': 'gpt-3.5-turbo-0125',
}; };
function TagEditorSection({ icon, color, title, description, children }) {
return (
<div>
<Card className='!rounded-2xl shadow-sm border-0 mb-6'>
<div className='console-channel-section'>
<Avatar size='small' color={color}>
{icon}
</Avatar>
<div>
<Text className='text-lg font-medium'>{title}</Text>
<div className='text-xs text-gray-600'>{description}</div>
</div>
</div>
{children}
</Card>
</div>
);
}
const EditTagModal = (props) => { const EditTagModal = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const isMobile = useIsMobile();
const { visible, tag, handleClose, refresh } = props; const { visible, tag, handleClose, refresh } = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [originModelOptions, setOriginModelOptions] = useState([]); const [originModelOptions, setOriginModelOptions] = useState([]);
@@ -159,6 +176,7 @@ const EditTagModal = (props) => {
}; };
const handleSave = async (values) => { const handleSave = async (values) => {
if (loading) return;
setLoading(true); setLoading(true);
const formVals = values || formApiRef.current?.getValues() || {}; const formVals = values || formApiRef.current?.getValues() || {};
let data = { tag }; let data = { tag };
@@ -170,8 +188,9 @@ const EditTagModal = (props) => {
} }
data.model_mapping = formVals.model_mapping; data.model_mapping = formVals.model_mapping;
} }
if (formVals.groups && formVals.groups.length > 0) { const groups = toGroupList(formVals.groups);
data.groups = formVals.groups.join(','); if (groups.length > 0) {
data.groups = groups.join(',');
} }
if (formVals.models && formVals.models.length > 0) { if (formVals.models && formVals.models.length > 0) {
data.models = formVals.models.join(','); data.models = formVals.models.join(',');
@@ -234,6 +253,8 @@ const EditTagModal = (props) => {
showSuccess(t('标签更新成功!')); showSuccess(t('标签更新成功!'));
refresh(); refresh();
handleClose(); handleClose();
} else if (res?.data) {
showError(res.data.message || t('操作失败'));
} }
} catch (error) { } catch (error) {
showError(error); showError(error);
@@ -254,6 +275,10 @@ const EditTagModal = (props) => {
}, [originModelOptions, inputs.models]); }, [originModelOptions, inputs.models]);
const onVisibilityChange = useEffectEvent(() => { const onVisibilityChange = useEffectEvent(() => {
if (visible) {
setCustomModel('');
formApiRef.current?.setValue('custom_model', '');
}
const fetchTagModels = async () => { const fetchTagModels = async () => {
if (!tag) return; if (!tag) return;
setLoading(true); setLoading(true);
@@ -319,6 +344,7 @@ const EditTagModal = (props) => {
setModelOptions(localModelOptions); setModelOptions(localModelOptions);
setCustomModel(''); setCustomModel('');
formApiRef.current?.setValue('custom_model', '');
handleInputChange('models', localModels); handleInputChange('models', localModels);
if (addedModels.length > 0) { if (addedModels.length > 0) {
@@ -335,44 +361,27 @@ const EditTagModal = (props) => {
return ( return (
<SideSheet <SideSheet
rootClassName='console-channel-drawer'
classNames={{ header: 'console-channel-editor-header' }}
placement='right' placement='right'
title={ title={t('编辑标签')}
<Space>
<Tag color='blue' shape='circle'>
{t('编辑')}
</Tag>
<Title heading={4} className='m-0'>
{t('编辑标签')}
</Title>
</Space>
}
bodyStyle={{ padding: '0' }} bodyStyle={{ padding: '0' }}
visible={visible} visible={visible}
width={600} width={isMobile ? '100%' : 600}
onCancel={handleClose} onCancel={handleClose}
footer={ footer={
<div className='flex justify-end'> <div className='console-channel-footer'>
<Space> <Button onClick={handleClose}>{t('取消')}</Button>
<Button <Button
theme='solid' theme='solid'
type='primary'
onClick={() => formApiRef.current?.submitForm()} onClick={() => formApiRef.current?.submitForm()}
loading={loading} loading={loading}
icon={<IconSave />}
> >
{t('保存')} {t('提交')}
</Button> </Button>
<Button
theme='light'
type='primary'
onClick={handleClose}
icon={<IconClose />}
>
{t('取消')}
</Button>
</Space>
</div> </div>
} }
closeIcon={null}
> >
<Form <Form
key={tag || 'edit'} key={tag || 'edit'}
@@ -382,56 +391,55 @@ const EditTagModal = (props) => {
> >
{() => ( {() => (
<Spin spinning={loading}> <Spin spinning={loading}>
<div className='p-2'> <div className='console-channel-sections p-2'>
<Card className='!rounded-2xl shadow-sm border-0 mb-6'> <TagEditorSection
{/* Header: Tag Info */} icon={<Bookmark size={16} />}
<div className='flex items-center mb-2'> color='blue'
<Avatar size='small' color='blue' className='mr-2 shadow-md'> title={t('标签信息')}
<IconBookmark size={16} /> description={t('标签的基本配置')}
</Avatar> >
<div>
<Text className='text-lg font-medium'>{t('标签信息')}</Text>
<div className='text-xs text-gray-600'>
{t('标签的基本配置')}
</div>
</div>
</div>
<Banner <Banner
type='warning' type='warning'
description={t('所有编辑均为覆盖操作,留空则不更改')} description={t('所有编辑均为覆盖操作,留空则不更改')}
className='!rounded-lg mb-4' className='!rounded-lg mb-4'
/> />
<div className='space-y-4'> <Row gutter={12}>
<Col xs={24} md={12}>
<Form.Input <Form.Input
field='new_tag' field='new_tag'
label={t('标签名称')} label={t('标签名称')}
placeholder={t('请输入新标签,留空则解散标签')} placeholder={t('请输入新标签,留空则解散标签')}
showClear
onChange={(value) => handleInputChange('new_tag', value)} onChange={(value) => handleInputChange('new_tag', value)}
/> />
</div> </Col>
</Card> <Col xs={24} md={12}>
<Form.Select
field='groups'
label={t('分组')}
placeholder={t(
'请选择可以使用该渠道的分组,留空则不更改',
)}
multiple
allowAdditions
additionLabel={t(
'请在系统设置页面编辑分组倍率以添加新的分组:',
)}
optionList={groupOptions}
style={{ width: '100%' }}
onChange={(value) => handleInputChange('groups', value)}
/>
</Col>
</Row>
</TagEditorSection>
<Card className='!rounded-2xl shadow-sm border-0 mb-6'> <TagEditorSection
{/* Header: Model Config */} icon={<Code size={16} />}
<div className='flex items-center mb-2'>
<Avatar
size='small'
color='purple' color='purple'
className='mr-2 shadow-md' title={t('模型配置')}
description={t('模型选择和映射设置')}
> >
<IconCode size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>{t('模型配置')}</Text>
<div className='text-xs text-gray-600'>
{t('模型选择和映射设置')}
</div>
</div>
</div>
<div className='space-y-4'>
<Banner <Banner
type='info' type='info'
description={t( description={t(
@@ -457,6 +465,7 @@ const EditTagModal = (props) => {
label={t('自定义模型名称')} label={t('自定义模型名称')}
placeholder={t('输入自定义模型名称')} placeholder={t('输入自定义模型名称')}
onChange={(value) => setCustomModel(value.trim())} onChange={(value) => setCustomModel(value.trim())}
value={customModel}
suffix={ suffix={
<Button <Button
size='small' size='small'
@@ -511,28 +520,14 @@ const EditTagModal = (props) => {
</Space> </Space>
} }
/> />
</div> </TagEditorSection>
</Card>
<Card className='!rounded-2xl shadow-sm border-0 mb-6'> <TagEditorSection
{/* Header: Advanced Settings */} icon={<Settings size={16} />}
<div className='flex items-center mb-2'>
<Avatar
size='small'
color='orange' color='orange'
className='mr-2 shadow-md' title={t('高级设置')}
description={t('渠道的高级配置选项')}
> >
<IconSetting size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>{t('高级设置')}</Text>
<div className='text-xs text-gray-600'>
{t('渠道的高级配置选项')}
</div>
</div>
</div>
<div className='space-y-4'>
<Form.TextArea <Form.TextArea
field='param_override' field='param_override'
label={t('参数覆盖')} label={t('参数覆盖')}
@@ -656,39 +651,7 @@ const EditTagModal = (props) => {
</div> </div>
} }
/> />
</div> </TagEditorSection>
</Card>
<Card className='!rounded-2xl shadow-sm border-0'>
{/* Header: Group Settings */}
<div className='flex items-center mb-2'>
<Avatar size='small' color='green' className='mr-2 shadow-md'>
<IconUser size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>{t('分组设置')}</Text>
<div className='text-xs text-gray-600'>
{t('用户分组配置')}
</div>
</div>
</div>
<div className='space-y-4'>
<Form.Select
field='groups'
label={t('分组')}
placeholder={t('请选择可以使用该渠道的分组,留空则不更改')}
multiple
allowAdditions
additionLabel={t(
'请在系统设置页面编辑分组倍率以添加新的分组:',
)}
optionList={groupOptions}
style={{ width: '100%' }}
onChange={(value) => handleInputChange('groups', value)}
/>
</div>
</Card>
</div> </div>
</Spin> </Spin>
)} )}
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { formatIdReference } from '../../../../helpers/safeDisplay'; import { formatIdReference } from '../../../../helpers/safeDisplay';
import { useEffectEvent } from '../../../../hooks/common/useEffectEvent'; import { useEffectEvent } from '../../../../hooks/common/useEffectEvent';
@@ -247,6 +248,7 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => {
showSuccess(t('密钥已删除')); showSuccess(t('密钥已删除'));
await loadKeyStatus(currentPage, pageSize); // Reload current page await loadKeyStatus(currentPage, pageSize); // Reload current page
onRefresh && onRefresh(); // Refresh parent component onRefresh && onRefresh(); // Refresh parent component
return true;
} else { } else {
showError(res.data.message); showError(res.data.message);
} }
@@ -255,6 +257,7 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => {
} finally { } finally {
setOperationLoading((prev) => ({ ...prev, [operationId]: false })); setOperationLoading((prev) => ({ ...prev, [operationId]: false }));
} }
return false;
}; };
// Handle page size change // Handle page size change
@@ -414,21 +417,21 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => {
{t('启用')} {t('启用')}
</Button> </Button>
)} )}
<Popconfirm <TableActionPopconfirm
title={t('确定要删除此密钥吗?')} title={t('确定要删除此密钥吗?')}
content={t('此操作不可撤销,将永久删除该密钥')} content={t('此操作不可撤销,将永久删除该密钥')}
onConfirm={() => handleDeleteKey(record.index)} onConfirm={() => handleDeleteKey(record.index)}
okType={'danger'}
position={'topRight'} position={'topRight'}
> >
<Button <Button
type='danger' type='link'
danger
size='small' size='small'
loading={operationLoading[`delete_${record.index}`]} loading={operationLoading[`delete_${record.index}`]}
> >
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -39,7 +39,7 @@ const PricingVendors = ({
...vendorsList.map((vendor) => ({ ...vendorsList.map((vendor) => ({
value: vendor.name, value: vendor.name,
label: vendor.name, label: vendor.name,
icon: vendor.icon ? getLobeHubIcon(vendor.icon, 18) : null, icon: vendor.icon ? getLobeHubIcon(vendor.icon, 16) : null,
})), })),
]; ];
}, [vendorsMap, availableVendorNames, t]); }, [vendorsMap, availableVendorNames, t]);
@@ -338,6 +338,9 @@ html.dark .mm-theme {
} }
.mm-filter-group .ant-btn { .mm-filter-group .ant-btn {
display: inline-flex;
align-items: center;
justify-content: center;
height: auto; height: auto;
min-height: 28px; min-height: 28px;
padding: 3px 9px; padding: 3px 9px;
@@ -348,6 +351,7 @@ html.dark .mm-theme {
max-width: 100%; max-width: 100%;
box-shadow: none; box-shadow: none;
line-height: 1.45; line-height: 1.45;
text-align: center;
} }
.mm-filter-group .ant-btn.mm-selected { .mm-filter-group .ant-btn.mm-selected {
@@ -400,6 +404,17 @@ html.dark .mm-theme {
padding: var(--mm-filter-logo-padding); 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 { html.dark .mm-filter-group .mm-logo {
color: var(--mm-filter-logo-ink); color: var(--mm-filter-logo-ink);
} }
@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import TableGroupTags from '@/components/common/table/TableGroupTags';
import { Empty, Table, Tag, Tooltip } from 'antd'; import { Empty, Table, Tag, Tooltip } from 'antd';
import { ChevronRight } from 'lucide-react'; import { ChevronRight } from 'lucide-react';
import { import {
@@ -111,7 +112,7 @@ const ModelPricingTable = ({
</span> </span>
) : ( ) : (
<span className='mm-detail-group'> <span className='mm-detail-group'>
{row.group} <TableGroupTags groups={row.group} />
{row.discountText && ( {row.discountText && (
<Tooltip <Tooltip
title={t( title={t(
@@ -1,7 +1,9 @@
import { TABLE_GROUP_COLUMN_WIDTH } from '@/components/common/table/TableGroupTags';
import { confirmTableAction } from '@/components/common/table/confirmTableAction';
import { Copy as ActionCopy } from '@/components/common/icons/ActionIcons'; import { Copy as ActionCopy } from '@/components/common/icons/ActionIcons';
import React from 'react'; import React from 'react';
import { Button as AntButton, Tooltip as AntTooltip } from 'antd'; import { Button as AntButton, Tooltip as AntTooltip } from 'antd';
import { Button, Space, Tag, Modal, Tooltip } from '@/components/ui'; import { Button, Space, Tag, Tooltip } from '@/components/ui';
import { import {
timestamp2string, timestamp2string,
getLobeHubIcon, getLobeHubIcon,
@@ -94,12 +96,17 @@ const renderCategories = (categories, t, categoryNames) => {
// Render groups (enable_groups) // Render groups (enable_groups)
const renderGroups = (groups) => { const renderGroups = (groups) => {
if (!groups || groups.length === 0) return '-'; if (!groups || groups.length === 0) return '-';
return renderLimitedItems({ return (
<span className='table-group-tags'>
{renderLimitedItems({
items: groups, items: groups,
renderItem: (g, idx) => ( renderItem: (group, index) => (
<React.Fragment key={idx}>{renderGroup(g)}</React.Fragment> <React.Fragment key={index}>{renderGroup(group)}</React.Fragment>
), ),
}); wrap: false,
})}
</span>
);
}; };
// Render tags // Render tags
@@ -261,14 +268,15 @@ const renderOperations = (
danger danger
size='small' size='small'
onClick={() => { onClick={() => {
Modal.confirm({ confirmTableAction({
title: t('确定是否要删除此模型?'), title: t('确定是否要删除此模型?'),
content: t('此修改将不可逆'), content: t('此修改将不可逆'),
onOk: () => { okType: 'danger',
(async () => { focusable: { autoFocusButton: 'cancel' },
await manageModel(record.id, 'delete', record); onOk: async () => {
if (!(await manageModel(record.id, 'delete', record)))
return false;
await refresh(); await refresh();
})();
}, },
}); });
}} }}
@@ -407,6 +415,7 @@ export const getModelsColumns = ({
{ {
title: t('可用分组'), title: t('可用分组'),
dataIndex: 'enable_groups', dataIndex: 'enable_groups',
width: TABLE_GROUP_COLUMN_WIDTH,
render: renderGroups, render: renderGroups,
}, },
{ {
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import '../../../console/module-alignment.css'; import '../../../console/module-alignment.css';
import React, { useState, useEffect, useCallback } from 'react'; import React, { useState, useEffect, useCallback } from 'react';
import { import {
@@ -6,7 +7,6 @@ import {
Typography, Typography,
Space, Space,
Tag, Tag,
Popconfirm,
Card, Card,
Avatar, Avatar,
Spin, Spin,
@@ -71,12 +71,14 @@ const PrefillGroupManagement = ({ visible, onClose }) => {
if (res.data.success) { if (res.data.success) {
showSuccess(t('删除成功')); showSuccess(t('删除成功'));
loadGroups(); loadGroups();
return true;
} else { } else {
showError(res.data.message || t('删除失败')); showError(res.data.message || t('删除失败'));
} }
} catch (error) { } catch (error) {
showError(t('删除失败')); showError(t('删除失败'));
} }
return false;
}; };
// 编辑组 // 编辑组
@@ -184,14 +186,14 @@ const PrefillGroupManagement = ({ visible, onClose }) => {
<Button type='link' size='small' onClick={() => handleEdit(record)}> <Button type='link' size='small' onClick={() => handleEdit(record)}>
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定删除此组?')} title={t('确定删除此组?')}
onConfirm={() => deleteGroup(record.id)} onConfirm={() => deleteGroup(record.id)}
> >
<Button size='small' type='link' danger> <Button size='small' type='link' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -1,5 +1,5 @@
import TableActionModal from '@/components/common/table/TableActionModal';
import React from 'react'; import React from 'react';
import { Modal } from '@/components/ui';
import { REDEMPTION_ACTIONS } from '../../../../constants/redemption.constants'; import { REDEMPTION_ACTIONS } from '../../../../constants/redemption.constants';
const DeleteRedemptionModal = ({ const DeleteRedemptionModal = ({
@@ -13,7 +13,8 @@ const DeleteRedemptionModal = ({
t, t,
}) => { }) => {
const handleConfirm = async () => { const handleConfirm = async () => {
await manageRedemption(record.id, REDEMPTION_ACTIONS.DELETE, record); if (!(await manageRedemption(record.id, REDEMPTION_ACTIONS.DELETE, record)))
return;
await refresh(); await refresh();
setTimeout(() => { setTimeout(() => {
if (redemptions.length === 0 && activePage > 1) { if (redemptions.length === 0 && activePage > 1) {
@@ -24,7 +25,7 @@ const DeleteRedemptionModal = ({
}; };
return ( return (
<Modal <TableActionModal
title={t('确定是否要删除此兑换码?')} title={t('确定是否要删除此兑换码?')}
visible={visible} visible={visible}
onCancel={onCancel} onCancel={onCancel}
@@ -32,7 +33,7 @@ const DeleteRedemptionModal = ({
type='warning' type='warning'
> >
{t('此修改将不可逆')} {t('此修改将不可逆')}
</Modal> </TableActionModal>
); );
}; };
@@ -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 // Render functions
const renderTimestamp = (timestampInSeconds) => { const renderTimestamp = (timestampInSeconds) => {
const date = new Date(timestampInSeconds * 1000); const date = new Date(timestampInSeconds * 1000);
@@ -417,11 +425,7 @@ export const getTaskLogsColumns = ({
render: (text, record, index) => { render: (text, record, index) => {
if (!isAdminUser) return null; if (!isAdminUser) return null;
const idNum = parseInt(text); const colorKey = getTaskChannelColorKey(text);
const colorIndex = Number.isFinite(idNum)
? ((idNum % colors.length) + colors.length) % colors.length
: 0;
const colorKey = colors[colorIndex];
// 若后端返回 channel_name 则在 Tooltip 中显示名称,便于管理员快速识别;否则回落为 ID // 若后端返回 channel_name 则在 Tooltip 中显示名称,便于管理员快速识别;否则回落为 ID
const tooltipContent = record.channel_name || text; const tooltipContent = record.channel_name || text;
+4 -16
View File
@@ -1,5 +1,6 @@
import { Download as ActionDownload } from '@/components/common/icons/ActionIcons'; 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 { Card, Tag as AntTag } from 'antd';
import { Clock } from 'lucide-react'; import { Clock } from 'lucide-react';
import { Button, Pagination } from '@/components/ui'; import { Button, Pagination } from '@/components/ui';
@@ -31,8 +32,6 @@ const TaskLogsPage = ({
sharedFilterRevision, sharedFilterRevision,
}); });
const isMobile = useIsMobile(); const isMobile = useIsMobile();
// 与 CardPro 一致:移动端默认收起筛选区,仅视图状态
const [showMobileFilters, setShowMobileFilters] = useState(false);
const pageStats = useTaskPageStats(taskLogsData.logs); const pageStats = useTaskPageStats(taskLogsData.logs);
if (usageRecordMode) { if (usageRecordMode) {
@@ -53,20 +52,9 @@ const TaskLogsPage = ({
<div className='usage-record-panels'> <div className='usage-record-panels'>
<TaskLogsActions {...taskLogsData} usageRecordMode /> <TaskLogsActions {...taskLogsData} usageRecordMode />
<Card className='usage-record-card usage-record-filter-card'> <UsageRecordFilterCard className='usage-record-card'>
{isMobile && (
<Button
block
className='usage-record-mobile-toggle'
onClick={() => setShowMobileFilters(!showMobileFilters)}
>
{showMobileFilters ? t('隐藏操作项') : t('显示操作项')}
</Button>
)}
<div hidden={isMobile && !showMobileFilters}>
<TaskLogsFilters {...taskLogsData} usageRecordMode /> <TaskLogsFilters {...taskLogsData} usageRecordMode />
</div> </UsageRecordFilterCard>
</Card>
<Card className='usage-record-card usage-record-table-card'> <Card className='usage-record-card usage-record-table-card'>
<div className='usage-record-table-head'> <div className='usage-record-table-head'>
@@ -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 React from 'react';
import { import {
Button, Button,
@@ -12,7 +14,6 @@ import {
Popover, Popover,
Typography, Typography,
Input, Input,
Modal,
} from '@/components/ui'; } from '@/components/ui';
import { import {
timestamp2string, timestamp2string,
@@ -387,14 +388,15 @@ const renderOperations = (
type='danger' type='danger'
size='small' size='small'
onClick={() => { onClick={() => {
Modal.confirm({ confirmTableAction({
title: t('确定是否要删除此密钥?'), title: t('确定是否要删除此密钥?'),
content: t('此修改将不可逆'), content: t('此修改将不可逆'),
onOk: () => { okType: 'danger',
(async () => { focusable: { autoFocusButton: 'cancel' },
await manageToken(record.id, 'delete', record); onOk: async () => {
if (!(await manageToken(record.id, 'delete', record)))
return false;
await refresh(); await refresh();
})();
}, },
}); });
}} }}
@@ -436,6 +438,7 @@ export const getTokensColumns = ({
title: t('分组'), title: t('分组'),
dataIndex: 'group', dataIndex: 'group',
key: 'group', key: 'group',
width: TABLE_GROUP_COLUMN_WIDTH,
render: (text) => renderGroupColumn(text, t), render: (text) => renderGroupColumn(text, t),
}, },
{ {
@@ -1,3 +1,4 @@
import { TABLE_GROUP_COLUMN_WIDTH } from '@/components/common/table/TableGroupTags';
import React from 'react'; import React from 'react';
import { Tag as AntTag } from 'antd'; import { Tag as AntTag } from 'antd';
import { import {
@@ -20,24 +21,6 @@ import {
import { IconHelpCircle } from '@/components/ui/icons'; import { IconHelpCircle } from '@/components/ui/icons';
import { Route } from 'lucide-react'; 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 = { const TYPE_CONFIG = {
1: { 1: {
@@ -256,7 +239,7 @@ const RECORD_COLUMN_WIDTHS = {
channel: 85, channel: 85,
username: 120, username: 120,
token: 120, token: 120,
group: 148, group: TABLE_GROUP_COLUMN_WIDTH,
type: 110, type: 110,
model: 225, model: 225,
use_time: 190, use_time: 190,
@@ -455,20 +438,21 @@ export const getLogsColumns = ({
return isAdminUser && return isAdminUser &&
(record.type === 0 || record.type === 2 || record.type === 5) ? ( (record.type === 0 || record.type === 2 || record.type === 5) ? (
<Space> <Space>
<Tooltip content={record.channel_name || t('未知渠道')}> <Tooltip content={record.channel_name || text}>
<span> <button
<Tag type='button'
color={colors[parseInt(text) % colors.length]} className='usage-record-copy-text'
shape='circle' onClick={(event) => copyText(event, text)}
> >
<AntTag variant='filled' className='usage-record-channel-tag'>
{text} {text}
</Tag> </AntTag>
</span> </button>
</Tooltip> </Tooltip>
{isMultiKey && ( {isMultiKey && (
<Tag color='white' shape='circle'> <AntTag variant='filled' className='usage-record-channel-tag'>
{multiKeyIndex} {multiKeyIndex}
</Tag> </AntTag>
)} )}
</Space> </Space>
) : null; ) : null;
@@ -528,6 +512,7 @@ export const getLogsColumns = ({
key: COLUMN_KEYS.GROUP, key: COLUMN_KEYS.GROUP,
title: t('分组'), title: t('分组'),
dataIndex: 'group', dataIndex: 'group',
width: TABLE_GROUP_COLUMN_WIDTH,
render: (text, record, index) => { render: (text, record, index) => {
if (record.type === 0 || record.type === 2 || record.type === 5) { if (record.type === 0 || record.type === 2 || record.type === 5) {
if (record.group) { if (record.group) {
+4 -16
View File
@@ -1,5 +1,6 @@
import { Download as ActionDownload } from '@/components/common/icons/ActionIcons'; 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 { Card } from 'antd';
import { Button, Pagination } from '@/components/ui'; import { Button, Pagination } from '@/components/ui';
import CardPro from '../../common/ui/CardPro'; import CardPro from '../../common/ui/CardPro';
@@ -18,8 +19,6 @@ import './UsageLogs.css';
const LogsPage = ({ usageRecordMode = false }) => { const LogsPage = ({ usageRecordMode = false }) => {
const logsData = useLogsData(); const logsData = useLogsData();
const isMobile = useIsMobile(); const isMobile = useIsMobile();
// 与 CardPro 一致:移动端默认收起筛选区,仅视图状态
const [showMobileFilters, setShowMobileFilters] = useState(false);
if (usageRecordMode) { if (usageRecordMode) {
const { t } = logsData; const { t } = logsData;
@@ -30,20 +29,9 @@ const LogsPage = ({ usageRecordMode = false }) => {
<UsageLogsExportModal {...logsData} usageRecordMode /> <UsageLogsExportModal {...logsData} usageRecordMode />
<div className='usage-record-panels'> <div className='usage-record-panels'>
<Card className='usage-record-card usage-record-filter-card'> <UsageRecordFilterCard className='usage-record-card'>
{isMobile && (
<Button
block
className='usage-record-mobile-toggle'
onClick={() => setShowMobileFilters(!showMobileFilters)}
>
{showMobileFilters ? t('隐藏操作项') : t('显示操作项')}
</Button>
)}
<div hidden={isMobile && !showMobileFilters}>
<LogsFilters {...logsData} usageRecordMode /> <LogsFilters {...logsData} usageRecordMode />
</div> </UsageRecordFilterCard>
</Card>
<Card className='usage-record-card usage-record-table-card usage-record-consume-card'> <Card className='usage-record-card usage-record-table-card usage-record-consume-card'>
<div className='usage-record-table-head'> <div className='usage-record-table-head'>
@@ -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 React from 'react';
import { import {
Button, Button,
@@ -8,7 +10,6 @@ import {
Popover, Popover,
Typography, Typography,
} from '@/components/ui'; } from '@/components/ui';
import { Switch } from 'antd';
import { TableRowActions } from '@/components/common/table/TableToolbar'; import { TableRowActions } from '@/components/common/table/TableToolbar';
import { import {
renderGroup, renderGroup,
@@ -106,11 +107,8 @@ const renderStatistics = (text, record, showEnableDisableModal, t) => {
const content = isDeleted ? ( const content = isDeleted ? (
<Tag color='red'>{t('已注销')}</Tag> <Tag color='red'>{t('已注销')}</Tag>
) : ( ) : (
<Switch <TableStatusSwitch
size='small'
checked={record.status === 1} checked={record.status === 1}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
aria-label={t('状态')} aria-label={t('状态')}
disabled={!canManage} disabled={!canManage}
onChange={(checked, event) => { onChange={(checked, event) => {
@@ -344,6 +342,7 @@ export const getUsersColumns = ({
{ {
title: t('分组'), title: t('分组'),
dataIndex: 'group', dataIndex: 'group',
width: TABLE_GROUP_COLUMN_WIDTH,
render: (text, record, index) => { render: (text, record, index) => {
return <div>{renderGroup(text)}</div>; return <div>{renderGroup(text)}</div>;
}, },
@@ -1,5 +1,5 @@
import TableActionModal from '@/components/common/table/TableActionModal';
import React from 'react'; import React from 'react';
import { Modal } from '@/components/ui';
const DeleteUserModal = ({ const DeleteUserModal = ({
visible, visible,
@@ -13,7 +13,7 @@ const DeleteUserModal = ({
t, t,
}) => { }) => {
const handleConfirm = async () => { const handleConfirm = async () => {
await manageUser(user.id, 'delete', user); if (!(await manageUser(user.id, 'delete', user))) return;
await refresh(); await refresh();
setTimeout(() => { setTimeout(() => {
if (users.length === 0 && activePage > 1) { if (users.length === 0 && activePage > 1) {
@@ -24,7 +24,7 @@ const DeleteUserModal = ({
}; };
return ( return (
<Modal <TableActionModal
title={t('确定是否要注销此用户?')} title={t('确定是否要注销此用户?')}
visible={visible} visible={visible}
onCancel={onCancel} onCancel={onCancel}
@@ -32,7 +32,7 @@ const DeleteUserModal = ({
type='danger' type='danger'
> >
{t('相当于删除用户,此修改将不可逆')} {t('相当于删除用户,此修改将不可逆')}
</Modal> </TableActionModal>
); );
}; };
@@ -7,7 +7,6 @@ import {
Button, Button,
Modal, Modal,
SideSheet, SideSheet,
Space,
Spin, Spin,
Typography, Typography,
Card, Card,
@@ -18,11 +17,13 @@ import {
} from '@/components/ui'; } from '@/components/ui';
import QuotaInput, { FormQuotaInput } from '../../../common/ui/QuotaInput'; import QuotaInput, { FormQuotaInput } from '../../../common/ui/QuotaInput';
import { import {
IconUser, User as ActionUser,
IconLink, Link as ActionLink,
IconUserGroup, Users as ActionUsers,
IconPlus, Plus as ActionPlus,
} from '@/components/ui/icons'; } from '@/components/common/icons/ActionIcons';
import { toGroupList } from '@/helpers/groupList';
const { Text } = Typography; const { Text } = Typography;
@@ -30,6 +31,9 @@ const EditUserModal = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const userId = props.editingUser.id; const userId = props.editingUser.id;
const [loading, setLoading] = useState(true); 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 [addQuotaModalOpen, setIsModalOpen] = useState(false);
const [addQuotaLocal, setAddQuotaLocal] = useState(''); const [addQuotaLocal, setAddQuotaLocal] = useState('');
const isMobile = useIsMobile(); const isMobile = useIsMobile();
@@ -38,6 +42,7 @@ const EditUserModal = (props) => {
const formApiRef = useRef(null); const formApiRef = useRef(null);
const isEdit = Boolean(userId); const isEdit = Boolean(userId);
const ready = loadedUserId === (userId ?? false);
const getInitValues = () => ({ const getInitValues = () => ({
username: '', username: '',
@@ -50,7 +55,7 @@ const EditUserModal = (props) => {
telegram_id: '', telegram_id: '',
email: '', email: '',
quota: 0, quota: 0,
group: 'default', group: userId ? ['default'] : 'default',
level: '', level: '',
remark: '', remark: '',
}); });
@@ -88,53 +93,83 @@ const EditUserModal = (props) => {
} }
}; };
const handleCancel = () => props.handleClose(); const handleCancel = () => {
if (pending.current) return;
const loadUser = async () => { setIsModalOpen(false);
setLoading(true); setAddQuotaLocal('');
const url = userId ? `/api/user/${userId}` : `/api/user/self`; props.handleClose();
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 onScopeChange = useEffectEvent(() => { const onScopeChange = useEffectEvent(async (isCurrent) => {
loadUser(); setLoading(true);
setLoadedUserId(null);
const url = userId ? `/api/user/${userId}` : '/api/user/self';
if (userId) { if (userId) {
fetchGroups(); fetchGroups();
fetchLevels(); 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: '',
}); });
useEffect(() => onScopeChange(), [onScopeChange, props.editingUser.id]); setLoadedUserId(userId ?? false);
} else {
showError(response.message);
}
} catch {
// The API client reports request failures.
} finally {
if (isCurrent()) setLoading(false);
}
});
useEffect(() => {
if (!props.visible) return;
let current = true;
onScopeChange(() => current);
return () => {
current = false;
};
}, [onScopeChange, props.visible, userId]);
/* ----------------------- submit ----------------------- */ /* ----------------------- submit ----------------------- */
const submit = async (values) => { const submit = async (values) => {
setLoading(true); if (!ready || pending.current) return;
let payload = { ...values }; pending.current = true;
setSubmitting(true);
try {
const payload = { ...values };
if (typeof payload.quota === 'string') if (typeof payload.quota === 'string')
payload.quota = parseInt(payload.quota) || 0; payload.quota = parseInt(payload.quota) || 0;
if (typeof payload.gift_quota === 'string') if (typeof payload.gift_quota === 'string')
payload.gift_quota = parseInt(payload.gift_quota) || 0; payload.gift_quota = parseInt(payload.gift_quota) || 0;
if (userId) { if (userId) {
payload.id = parseInt(userId); payload.id = parseInt(userId);
payload.group = toGroupList(values.group).join(',');
} }
const url = userId ? `/api/user/` : `/api/user/self`; const url = userId ? '/api/user/' : '/api/user/self';
const res = await API.put(url, payload); const { data } = await API.put(url, payload);
const { success, message } = res.data; if (data.success) {
if (success) {
showSuccess(t('用户信息更新成功!')); showSuccess(t('用户信息更新成功!'));
props.refresh(); props.refresh();
props.handleClose(); props.handleClose();
} else { } else {
showError(message); showError(data.message);
}
} catch {
// The API client reports request failures.
} finally {
pending.current = false;
setSubmitting(false);
} }
setLoading(false);
}; };
/* --------------------- quota helper -------------------- */ /* --------------------- quota helper -------------------- */
@@ -149,50 +184,49 @@ const EditUserModal = (props) => {
<> <>
<SideSheet <SideSheet
placement='right' placement='right'
classNames={{ header: 'console-detail-header' }} rootClassName='console-user-drawer'
classNames={{ header: 'console-user-editor-header' }}
title={isEdit ? t('编辑用户') : t('创建用户')} title={isEdit ? t('编辑用户') : t('创建用户')}
bodyStyle={{ padding: 0 }} bodyStyle={{ padding: 0 }}
visible={props.visible} visible={props.visible}
width={isMobile ? '100%' : 600} width={isMobile ? '100%' : 600}
footer={ footer={
<div className='flex justify-end'> <div className='console-user-footer'>
<Space> <Button onClick={handleCancel} disabled={submitting}>
<Button onClick={handleCancel}>{t('取消')}</Button> {t('取消')}
</Button>
<Button <Button
theme='solid' theme='solid'
type='primary'
disabled={!ready || loading}
loading={submitting}
onClick={() => formApiRef.current?.submitForm()} onClick={() => formApiRef.current?.submitForm()}
loading={loading}
> >
{t('确定')} {t('提交')}
</Button> </Button>
</Space>
</div> </div>
} }
onCancel={handleCancel} onCancel={handleCancel}
> >
<Spin spinning={loading}>
<Form <Form
initValues={getInitValues()} initValues={getInitValues()}
getFormApi={(api) => (formApiRef.current = api)} getFormApi={(api) => (formApiRef.current = api)}
onSubmit={submit} onSubmit={submit}
> >
{({ values }) => ( {() => (
<div className='p-2'> <Spin spinning={loading}>
<div className='console-user-sections p-2'>
{/* 基本信息 */} {/* 基本信息 */}
<Card className='!rounded-2xl shadow-sm border-0'> <Card className='rounded-2xl shadow-sm'>
<div className='flex items-center mb-2'> <div className='console-user-section'>
<Avatar <Avatar size='small' color='blue'>
size='small' <ActionUser size={16} />
color='blue'
className='mr-2 shadow-md'
>
<IconUser size={16} />
</Avatar> </Avatar>
<div> <div>
<Text className='text-lg font-medium'> <Text className='text-lg font-medium'>
{t('基本信息')} {t('基本信息')}
</Text> </Text>
<div className='text-xs text-gray-600'> <div className='console-user-section-description'>
{t('用户的基本账户信息')} {t('用户的基本账户信息')}
</div> </div>
</div> </div>
@@ -241,20 +275,16 @@ const EditUserModal = (props) => {
{/* 权限设置 */} {/* 权限设置 */}
{userId && ( {userId && (
<Card className='!rounded-2xl shadow-sm border-0'> <Card className='rounded-2xl shadow-sm'>
<div className='flex items-center mb-2'> <div className='console-user-section'>
<Avatar <Avatar size='small' color='green'>
size='small' <ActionUsers size={16} />
color='green'
className='mr-2 shadow-md'
>
<IconUserGroup size={16} />
</Avatar> </Avatar>
<div> <div>
<Text className='text-lg font-medium'> <Text className='text-lg font-medium'>
{t('权限设置')} {t('权限设置')}
</Text> </Text>
<div className='text-xs text-gray-600'> <div className='console-user-section-description'>
{t('用户分组和额度管理')} {t('用户分组和额度管理')}
</div> </div>
</div> </div>
@@ -287,7 +317,7 @@ const EditUserModal = (props) => {
/> />
</Col> </Col>
<Col span={10}> <Col xs={24} sm={12}>
<FormQuotaInput <FormQuotaInput
field='quota' field='quota'
label={t('剩余额度')} label={t('剩余额度')}
@@ -296,7 +326,7 @@ const EditUserModal = (props) => {
/> />
</Col> </Col>
<Col span={10}> <Col xs={24} sm={12}>
<FormQuotaInput <FormQuotaInput
field='gift_quota' field='gift_quota'
label={t('赠送余额')} label={t('赠送余额')}
@@ -307,10 +337,11 @@ const EditUserModal = (props) => {
/> />
</Col> </Col>
<Col span={14}> <Col span={24}>
<Form.Slot label={t('添加额度')}> <Form.Slot label={t('添加额度')}>
<Button <Button
icon={<IconPlus />} icon={<ActionPlus size={16} />}
aria-label={t('添加额度')}
onClick={() => setIsModalOpen(true)} onClick={() => setIsModalOpen(true)}
/> />
</Form.Slot> </Form.Slot>
@@ -320,20 +351,16 @@ const EditUserModal = (props) => {
)} )}
{/* 绑定信息 */} {/* 绑定信息 */}
<Card className='!rounded-2xl shadow-sm border-0'> <Card className='rounded-2xl shadow-sm'>
<div className='flex items-center mb-2'> <div className='console-user-section'>
<Avatar <Avatar size='small' color='purple'>
size='small' <ActionLink size={16} />
color='purple'
className='mr-2 shadow-md'
>
<IconLink size={16} />
</Avatar> </Avatar>
<div> <div>
<Text className='text-lg font-medium'> <Text className='text-lg font-medium'>
{t('绑定信息')} {t('绑定信息')}
</Text> </Text>
<div className='text-xs text-gray-600'> <div className='console-user-section-description'>
{t('第三方账户绑定状态(只读)')} {t('第三方账户绑定状态(只读)')}
</div> </div>
</div> </div>
@@ -364,9 +391,9 @@ const EditUserModal = (props) => {
</Row> </Row>
</Card> </Card>
</div> </div>
</Spin>
)} )}
</Form> </Form>
</Spin>
</SideSheet> </SideSheet>
{/* 添加额度模态框 */} {/* 添加额度模态框 */}
@@ -381,7 +408,7 @@ const EditUserModal = (props) => {
closable={null} closable={null}
title={ title={
<div className='flex items-center'> <div className='flex items-center'>
<IconPlus className='mr-2' /> <ActionPlus size={16} className='mr-2' />
{t('添加额度')} {t('添加额度')}
</div> </div>
} }
+8 -2
View File
@@ -603,14 +603,20 @@ export const Tooltip = ({ content, position, showArrow, ...props }) => (
export const Popover = ({ position, showArrow, ...props }) => ( export const Popover = ({ position, showArrow, ...props }) => (
<Ant.Popover {...props} placement={placement(position)} arrow={showArrow} /> <Ant.Popover {...props} placement={placement(position)} arrow={showArrow} />
); );
export const Popconfirm = ({ content, position, okType, ...props }) => ( export const Popconfirm = forwardRef(function Popconfirm(
{ content, position, okType, ...props },
ref,
) {
return (
<Ant.Popconfirm <Ant.Popconfirm
{...props} {...props}
ref={ref}
description={content} description={content}
placement={placement(position)} placement={placement(position)}
okButtonProps={{ danger: okType === 'danger' }} okButtonProps={{ danger: okType === 'danger' }}
/> />
); );
});
export const Banner = ({ export const Banner = ({
type, type,
title, title,
+13
View File
@@ -0,0 +1,13 @@
export function toGroupList(value) {
const groups = typeof value === 'string' ? value.split(',') : value;
if (!Array.isArray(groups)) return [];
return [
...new Set(
groups
.filter((group) => typeof group === 'string')
.map((group) => group.trim())
.filter(Boolean),
),
];
}
+9 -23
View File
@@ -35,6 +35,7 @@ import i18next from 'i18next';
// React 18-compatible LobeHub icons lack these brands; use generic icons. // React 18-compatible LobeHub icons lack these brands; use generic icons.
import { Lock, Bot as FastGPT, Image as Jimeng } from 'lucide-react'; import { Lock, Bot as FastGPT, Image as Jimeng } from 'lucide-react';
import { Modal, Tag, Typography } from '@/components/ui'; import { Modal, Tag, Typography } from '@/components/ui';
import TableGroupTags from '@/components/common/table/TableGroupTags';
import { copy, getCurrencySymbol, showSuccess } from './utils'; import { copy, getCurrencySymbol, showSuccess } from './utils';
import { visit } from 'unist-util-visit'; import { visit } from 'unist-util-visit';
import { toFiniteNumber } from './safeDisplay'; import { toFiniteNumber } from './safeDisplay';
@@ -595,38 +596,23 @@ export function renderGroup(group) {
); );
} }
const tagColors = { const groups = typeof group === 'string' ? group.split(',').sort() : group;
vip: 'yellow',
pro: 'yellow',
svip: 'red',
premium: 'red',
};
const groups = group.split(',').sort();
return ( return (
<span key={group}> <TableGroupTags
{groups.map((group) => ( groups={groups}
<Tag onGroupClick={async (name, event) => {
color={tagColors[group] || stringToColor(group)}
key={group}
shape='circle'
onClick={async (event) => {
event.stopPropagation(); event.stopPropagation();
if (await copy(group)) { if (await copy(name)) {
showSuccess(i18next.t('已复制:{{name}}', { name: group })); showSuccess(i18next.t('已复制:{{name}}', { name }));
} else { } else {
Modal.error({ Modal.error({
title: i18next.t('无法复制到剪贴板,请手动复制'), title: i18next.t('无法复制到剪贴板,请手动复制'),
content: group, content: name,
}); });
} }
}} }}
> />
{group}
</Tag>
))}
</span>
); );
} }
@@ -192,6 +192,7 @@ export const useAdminTokensData = () => {
showSuccess(t('操作成功')); showSuccess(t('操作成功'));
// 删除时若当前页可能变空,refresh 会自动回退页码 // 删除时若当前页可能变空,refresh 会自动回退页码
await refresh(); await refresh();
return true;
} else { } else {
showError(message); showError(message);
} }
@@ -199,6 +200,7 @@ export const useAdminTokensData = () => {
console.error('[AdminTokens] manageToken failed:', e); console.error('[AdminTokens] manageToken failed:', e);
showError(e.message || t('操作失败')); showError(e.message || t('操作失败'));
} }
return false;
}; };
// 批量管理 // 批量管理
+14 -5
View File
@@ -364,11 +364,19 @@ export const useChannelsData = () => {
return; return;
} }
const typeParam = typeKey !== 'all' ? `&type=${typeKey}` : ''; const res = await API.get('/api/channel/search', {
const statusParam = statusF !== 'all' ? `&status=${statusF}` : ''; params: {
const res = await API.get( keyword: searchKeyword,
`/api/channel/search?keyword=${searchKeyword}&group=${searchGroup}&model=${searchModel}&id_sort=${sortFlag}&tag_mode=${enableTagMode}&p=${page}&page_size=${pageSz}${typeParam}${statusParam}`, group: searchGroup,
); model: searchModel,
id_sort: sortFlag,
tag_mode: enableTagMode,
p: page,
page_size: pageSz,
type: typeKey === 'all' ? undefined : typeKey,
status: statusF === 'all' ? undefined : statusF,
},
});
const { success, message, data } = res.data; const { success, message, data } = res.data;
if (success) { if (success) {
const { items = [], total = 0, type_counts = {} } = data; const { items = [], total = 0, type_counts = {} } = data;
@@ -452,6 +460,7 @@ export const useChannelsData = () => {
} else { } else {
showError(message); showError(message);
} }
return success;
}; };
// Tag management // Tag management
+1
View File
@@ -327,6 +327,7 @@ export const useModelsData = () => {
} else { } else {
showError(message); showError(message);
} }
return success;
}; };
// Handle page change // Handle page change
+4 -1
View File
@@ -144,10 +144,13 @@ export const useRedemptionsData = () => {
} else { } else {
showError(message); showError(message);
} }
return success;
} catch (error) { } catch (error) {
showError(error.message); showError(error.message);
} return false;
} finally {
setLoading(false); setLoading(false);
}
}; };
// Refresh data // Refresh data
+4
View File
@@ -138,6 +138,7 @@ export const useTokensData = (openFluentNotification) => {
// Manage token function (delete, enable, disable) // Manage token function (delete, enable, disable)
const manageToken = async (id, action, record) => { const manageToken = async (id, action, record) => {
setLoading(true); setLoading(true);
try {
let data = { id }; let data = { id };
let res; let res;
switch (action) { switch (action) {
@@ -165,7 +166,10 @@ export const useTokensData = (openFluentNotification) => {
} else { } else {
showError(message); showError(message);
} }
return success;
} finally {
setLoading(false); setLoading(false);
}
}; };
// Search tokens function // Search tokens function
+5 -5
View File
@@ -119,7 +119,7 @@ export const useUsersData = () => {
const manageUser = async (userId, action, record) => { const manageUser = async (userId, action, record) => {
// Trigger loading state to force table re-render // Trigger loading state to force table re-render
setLoading(true); setLoading(true);
try {
const res = await API.post('/api/user/manage', { const res = await API.post('/api/user/manage', {
id: userId, id: userId,
action, action,
@@ -145,8 +145,10 @@ export const useUsersData = () => {
} else { } else {
showError(message); showError(message);
} }
return success;
} finally {
setLoading(false); setLoading(false);
}
}; };
const resetUserPasskey = async (user) => { const resetUserPasskey = async (user) => {
@@ -246,10 +248,8 @@ export const useUsersData = () => {
}; };
const closeEditUser = () => { const closeEditUser = () => {
// The drawer still renders the selected user during its exit animation.
setShowEditUser(false); setShowEditUser(false);
setEditingUser({
id: undefined,
});
}; };
// Initialize data on component mount // Initialize data on component mount
+1
View File
@@ -912,6 +912,7 @@ export const useVideoGeneration = ({ disableQuote = false } = {}) => {
showError( showError(
t('删除失败: {{message}}', { message: error.message || error }), t('删除失败: {{message}}', { message: error.message || error }),
); );
return false;
} }
}, },
[t, loadTasks, syncActiveIds], [t, loadTasks, syncActiveIds],
+3
View File
@@ -4745,9 +4745,11 @@
"确定要充值 $": "Confirm to recharge $", "确定要充值 $": "Confirm to recharge $",
"确定要更新所有已启用通道余额吗?": "Are you sure you want to update the balance of all enabled channels?", "确定要更新所有已启用通道余额吗?": "Are you sure you want to update the balance of all enabled channels?",
"确定要降级此用户吗?": "Are you sure you want to demote this user?", "确定要降级此用户吗?": "Are you sure you want to demote this user?",
"确定要禁用此预约吗?": "Are you sure you want to disable this reservation?",
"确定要禁用此密钥吗?": "Are you sure you want to disable this key?", "确定要禁用此密钥吗?": "Are you sure you want to disable this key?",
"确定要禁用此用户吗?": "Are you sure you want to disable this user?", "确定要禁用此用户吗?": "Are you sure you want to disable this user?",
"确定要禁用所有的密钥吗?": "Are you sure you want to disable all keys?", "确定要禁用所有的密钥吗?": "Are you sure you want to disable all keys?",
"确定要启用此预约吗?": "Are you sure you want to enable this reservation?",
"确定要启用此密钥吗?": "Are you sure you want to enable this key?", "确定要启用此密钥吗?": "Are you sure you want to enable this key?",
"确定要启用此用户吗?": "Are you sure you want to enable this user?", "确定要启用此用户吗?": "Are you sure you want to enable this user?",
"确定要启用所有密钥吗?": "Are you sure you want to enable all keys?", "确定要启用所有密钥吗?": "Are you sure you want to enable all keys?",
@@ -4757,6 +4759,7 @@
"确定要删除此定价配置吗?": "Are you sure you want to delete this pricing configuration?", "确定要删除此定价配置吗?": "Are you sure you want to delete this pricing configuration?",
"确定要删除此分类吗?": "Are you sure you want to delete this category?", "确定要删除此分类吗?": "Are you sure you want to delete this category?",
"确定要删除此公告吗?": "Are you sure you want to delete this notice?", "确定要删除此公告吗?": "Are you sure you want to delete this notice?",
"确定要删除此预约吗?": "Are you sure you want to delete this reservation?",
"确定要删除此密钥吗?": "Are you sure you want to delete this key?", "确定要删除此密钥吗?": "Are you sure you want to delete this key?",
"确定要删除此模型吗?": "Confirm deleting this model?", "确定要删除此模型吗?": "Confirm deleting this model?",
"确定要删除此问答吗?": "Are you sure you want to delete this FAQ?", "确定要删除此问答吗?": "Are you sure you want to delete this FAQ?",
+3
View File
@@ -4554,9 +4554,11 @@
"确定要充值 $": "Confirmer la recharge de $", "确定要充值 $": "Confirmer la recharge de $",
"确定要更新所有已启用通道余额吗?": "Êtes-vous sûr de vouloir mettre à jour le solde de tous les canaux activés ?", "确定要更新所有已启用通道余额吗?": "Êtes-vous sûr de vouloir mettre à jour le solde de tous les canaux activés ?",
"确定要降级此用户吗?": "Êtes-vous sûr de vouloir rétrograder cet utilisateur ?", "确定要降级此用户吗?": "Êtes-vous sûr de vouloir rétrograder cet utilisateur ?",
"确定要禁用此预约吗?": "Voulez-vous vraiment désactiver cette réservation ?",
"确定要禁用此密钥吗?": "Êtes-vous sûr de vouloir désactiver cette clé?", "确定要禁用此密钥吗?": "Êtes-vous sûr de vouloir désactiver cette clé?",
"确定要禁用此用户吗?": "Êtes-vous sûr de vouloir désactiver cet utilisateur ?", "确定要禁用此用户吗?": "Êtes-vous sûr de vouloir désactiver cet utilisateur ?",
"确定要禁用所有的密钥吗?": "Êtes-vous sûr de vouloir désactiver toutes les clés ?", "确定要禁用所有的密钥吗?": "Êtes-vous sûr de vouloir désactiver toutes les clés ?",
"确定要启用此预约吗?": "Voulez-vous vraiment activer cette réservation ?",
"确定要启用此密钥吗?": "Êtes-vous sûr de vouloir activer cette clé?", "确定要启用此密钥吗?": "Êtes-vous sûr de vouloir activer cette clé?",
"确定要启用此用户吗?": "Êtes-vous sûr de vouloir activer cet utilisateur ?", "确定要启用此用户吗?": "Êtes-vous sûr de vouloir activer cet utilisateur ?",
"确定要启用所有密钥吗?": "Êtes-vous sûr de vouloir activer toutes les clés ?", "确定要启用所有密钥吗?": "Êtes-vous sûr de vouloir activer toutes les clés ?",
@@ -4566,6 +4568,7 @@
"确定要删除此定价配置吗?": "Êtes-vous sûr de vouloir supprimer cette configuration de prix?", "确定要删除此定价配置吗?": "Êtes-vous sûr de vouloir supprimer cette configuration de prix?",
"确定要删除此分类吗?": "Êtes-vous sûr de vouloir supprimer cette catégorie ?", "确定要删除此分类吗?": "Êtes-vous sûr de vouloir supprimer cette catégorie ?",
"确定要删除此公告吗?": "Êtes-vous sûr de vouloir supprimer cet avis ?", "确定要删除此公告吗?": "Êtes-vous sûr de vouloir supprimer cet avis ?",
"确定要删除此预约吗?": "Voulez-vous vraiment supprimer cette réservation ?",
"确定要删除此密钥吗?": "Êtes-vous sûr de vouloir supprimer cette clé ?", "确定要删除此密钥吗?": "Êtes-vous sûr de vouloir supprimer cette clé ?",
"确定要删除此模型吗?": "Vous êtes sûr de vouloir supprimer ce modèle?", "确定要删除此模型吗?": "Vous êtes sûr de vouloir supprimer ce modèle?",
"确定要删除此问答吗?": "Êtes-vous sûr de vouloir supprimer cette FAQ ?", "确定要删除此问答吗?": "Êtes-vous sûr de vouloir supprimer cette FAQ ?",
+3
View File
@@ -4745,9 +4745,11 @@
"确定要充值 $": "チャージを確定しますか:$", "确定要充值 $": "チャージを確定しますか:$",
"确定要更新所有已启用通道余额吗?": "有効なすべてのチャネルのクォータを更新してもよろしいですか?", "确定要更新所有已启用通道余额吗?": "有効なすべてのチャネルのクォータを更新してもよろしいですか?",
"确定要降级此用户吗?": "このユーザーを降格させてもよろしいですか?", "确定要降级此用户吗?": "このユーザーを降格させてもよろしいですか?",
"确定要禁用此预约吗?": "この予約を無効にしますか?",
"确定要禁用此密钥吗?": "このキーを無効にしますか?", "确定要禁用此密钥吗?": "このキーを無効にしますか?",
"确定要禁用此用户吗?": "このユーザーを無効にしてもよろしいですか?", "确定要禁用此用户吗?": "このユーザーを無効にしてもよろしいですか?",
"确定要禁用所有的密钥吗?": "すべてのAPIキーを無効にしてもよろしいですか?", "确定要禁用所有的密钥吗?": "すべてのAPIキーを無効にしてもよろしいですか?",
"确定要启用此预约吗?": "この予約を有効にしますか?",
"确定要启用此密钥吗?": "このキーを有効にしますか?", "确定要启用此密钥吗?": "このキーを有効にしますか?",
"确定要启用此用户吗?": "このユーザーを有効にしてもよろしいですか?", "确定要启用此用户吗?": "このユーザーを有効にしてもよろしいですか?",
"确定要启用所有密钥吗?": "すべてのAPIキーを有効にしてもよろしいですか?", "确定要启用所有密钥吗?": "すべてのAPIキーを有効にしてもよろしいですか?",
@@ -4757,6 +4759,7 @@
"确定要删除此定价配置吗?": "この価格設定を削除しますか?", "确定要删除此定价配置吗?": "この価格設定を削除しますか?",
"确定要删除此分类吗?": "この分類を削除してもよろしいですか?", "确定要删除此分类吗?": "この分類を削除してもよろしいですか?",
"确定要删除此公告吗?": "このお知らせを削除してもよろしいですか?", "确定要删除此公告吗?": "このお知らせを削除してもよろしいですか?",
"确定要删除此预约吗?": "この予約を削除しますか?",
"确定要删除此密钥吗?": "このAPIキーを削除してもよろしいですか?", "确定要删除此密钥吗?": "このAPIキーを削除してもよろしいですか?",
"确定要删除此模型吗?": "このモデルを削除しますか?", "确定要删除此模型吗?": "このモデルを削除しますか?",
"确定要删除此问答吗?": "このFAQを削除してもよろしいですか?", "确定要删除此问答吗?": "このFAQを削除してもよろしいですか?",
+3
View File
@@ -4745,9 +4745,11 @@
"确定要充值 $": "충전하시겠습니까? $", "确定要充值 $": "충전하시겠습니까? $",
"确定要更新所有已启用通道余额吗?": "활성화된 모든 채널의 잔액을 갱신하시겠습니까?", "确定要更新所有已启用通道余额吗?": "활성화된 모든 채널의 잔액을 갱신하시겠습니까?",
"确定要降级此用户吗?": "이 사용자를 강등하시겠습니까?", "确定要降级此用户吗?": "이 사용자를 강등하시겠습니까?",
"确定要禁用此预约吗?": "이 예약을 비활성화하시겠습니까?",
"确定要禁用此密钥吗?": "이 키를 비활성화하시겠습니까?", "确定要禁用此密钥吗?": "이 키를 비활성화하시겠습니까?",
"确定要禁用此用户吗?": "이 사용자를 비활성화하시겠습니까?", "确定要禁用此用户吗?": "이 사용자를 비활성화하시겠습니까?",
"确定要禁用所有的密钥吗?": "모든 키를 비활성화하시겠습니까?", "确定要禁用所有的密钥吗?": "모든 키를 비활성화하시겠습니까?",
"确定要启用此预约吗?": "이 예약을 활성화하시겠습니까?",
"确定要启用此密钥吗?": "이 키를 활성화하시겠습니까?", "确定要启用此密钥吗?": "이 키를 활성화하시겠습니까?",
"确定要启用此用户吗?": "이 사용자를 활성화하시겠습니까?", "确定要启用此用户吗?": "이 사용자를 활성화하시겠습니까?",
"确定要启用所有密钥吗?": "모든 키를 활성화하시겠습니까?", "确定要启用所有密钥吗?": "모든 키를 활성화하시겠습니까?",
@@ -4757,6 +4759,7 @@
"确定要删除此定价配置吗?": "이 가격 설정을 삭제하시겠습니까?", "确定要删除此定价配置吗?": "이 가격 설정을 삭제하시겠습니까?",
"确定要删除此分类吗?": "이 분류를 삭제하시겠습니까?", "确定要删除此分类吗?": "이 분류를 삭제하시겠습니까?",
"确定要删除此公告吗?": "이 공지를 삭제하시겠습니까?", "确定要删除此公告吗?": "이 공지를 삭제하시겠습니까?",
"确定要删除此预约吗?": "이 예약을 삭제하시겠습니까?",
"确定要删除此密钥吗?": "이 키를 삭제하시겠습니까?", "确定要删除此密钥吗?": "이 키를 삭제하시겠습니까?",
"确定要删除此模型吗?": "이 모델을 삭제하시겠습니까?", "确定要删除此模型吗?": "이 모델을 삭제하시겠습니까?",
"确定要删除此问答吗?": "이 FAQ를 삭제하시겠습니까?", "确定要删除此问答吗?": "이 FAQ를 삭제하시겠습니까?",
+3
View File
@@ -4586,9 +4586,11 @@
"确定要充值 $": "Подтвердить пополнение на $", "确定要充值 $": "Подтвердить пополнение на $",
"确定要更新所有已启用通道余额吗?": "Подтвердить обновление баланса всех включенных каналов?", "确定要更新所有已启用通道余额吗?": "Подтвердить обновление баланса всех включенных каналов?",
"确定要降级此用户吗?": "Подтвердить понижение этого пользователя?", "确定要降级此用户吗?": "Подтвердить понижение этого пользователя?",
"确定要禁用此预约吗?": "Отключить эту запись на демо?",
"确定要禁用此密钥吗?": "Вы уверены, что хотите отключить этот ключ?", "确定要禁用此密钥吗?": "Вы уверены, что хотите отключить этот ключ?",
"确定要禁用此用户吗?": "Подтвердить отключение этого пользователя?", "确定要禁用此用户吗?": "Подтвердить отключение этого пользователя?",
"确定要禁用所有的密钥吗?": "Подтвердить отключение всех ключей?", "确定要禁用所有的密钥吗?": "Подтвердить отключение всех ключей?",
"确定要启用此预约吗?": "Включить эту запись на демо?",
"确定要启用此密钥吗?": "Вы уверены, что хотите включить этот ключ?", "确定要启用此密钥吗?": "Вы уверены, что хотите включить этот ключ?",
"确定要启用此用户吗?": "Подтвердить включение этого пользователя?", "确定要启用此用户吗?": "Подтвердить включение этого пользователя?",
"确定要启用所有密钥吗?": "Подтвердить включение всех ключей?", "确定要启用所有密钥吗?": "Подтвердить включение всех ключей?",
@@ -4598,6 +4600,7 @@
"确定要删除此定价配置吗?": "Вы уверены, что хотите удалить эту ценовую конфигурацию?", "确定要删除此定价配置吗?": "Вы уверены, что хотите удалить эту ценовую конфигурацию?",
"确定要删除此分类吗?": "Подтвердить удаление этой категории?", "确定要删除此分类吗?": "Подтвердить удаление этой категории?",
"确定要删除此公告吗?": "Подтвердить удаление этого объявления?", "确定要删除此公告吗?": "Подтвердить удаление этого объявления?",
"确定要删除此预约吗?": "Удалить эту запись на демо?",
"确定要删除此密钥吗?": "Подтвердить удаление этого ключа?", "确定要删除此密钥吗?": "Подтвердить удаление этого ключа?",
"确定要删除此模型吗?": "Подтвердите ли вы удаление этой модели?", "确定要删除此模型吗?": "Подтвердите ли вы удаление этой модели?",
"确定要删除此问答吗?": "Подтвердить удаление этого вопроса-ответа?", "确定要删除此问答吗?": "Подтвердить удаление этого вопроса-ответа?",
+3
View File
@@ -4745,9 +4745,11 @@
"确定要充值 $": "ยืนยันการเติมเงิน $", "确定要充值 $": "ยืนยันการเติมเงิน $",
"确定要更新所有已启用通道余额吗?": "ต้องการอัปเดตยอดคงเหลือของช่องทางที่เปิดใช้งานทั้งหมดหรือไม่?", "确定要更新所有已启用通道余额吗?": "ต้องการอัปเดตยอดคงเหลือของช่องทางที่เปิดใช้งานทั้งหมดหรือไม่?",
"确定要降级此用户吗?": "ต้องการลดระดับผู้ใช้รายนี้หรือไม่?", "确定要降级此用户吗?": "ต้องการลดระดับผู้ใช้รายนี้หรือไม่?",
"确定要禁用此预约吗?": "คุณต้องการปิดใช้งานการจองนี้หรือไม่?",
"确定要禁用此密钥吗?": "ต้องการปิดใช้งานคีย์นี้หรือไม่?", "确定要禁用此密钥吗?": "ต้องการปิดใช้งานคีย์นี้หรือไม่?",
"确定要禁用此用户吗?": "ต้องการปิดใช้งานผู้ใช้รายนี้หรือไม่?", "确定要禁用此用户吗?": "ต้องการปิดใช้งานผู้ใช้รายนี้หรือไม่?",
"确定要禁用所有的密钥吗?": "ต้องการปิดใช้งานคีย์ทั้งหมดหรือไม่?", "确定要禁用所有的密钥吗?": "ต้องการปิดใช้งานคีย์ทั้งหมดหรือไม่?",
"确定要启用此预约吗?": "คุณต้องการเปิดใช้งานการจองนี้หรือไม่?",
"确定要启用此密钥吗?": "ต้องการเปิดใช้งานคีย์นี้หรือไม่?", "确定要启用此密钥吗?": "ต้องการเปิดใช้งานคีย์นี้หรือไม่?",
"确定要启用此用户吗?": "ต้องการเปิดใช้งานผู้ใช้รายนี้หรือไม่?", "确定要启用此用户吗?": "ต้องการเปิดใช้งานผู้ใช้รายนี้หรือไม่?",
"确定要启用所有密钥吗?": "ต้องการเปิดใช้งานคีย์ทั้งหมดหรือไม่?", "确定要启用所有密钥吗?": "ต้องการเปิดใช้งานคีย์ทั้งหมดหรือไม่?",
@@ -4757,6 +4759,7 @@
"确定要删除此定价配置吗?": "ต้องการลบการตั้งค่าราคานี้หรือไม่?", "确定要删除此定价配置吗?": "ต้องการลบการตั้งค่าราคานี้หรือไม่?",
"确定要删除此分类吗?": "ต้องการลบหมวดหมู่นี้หรือไม่?", "确定要删除此分类吗?": "ต้องการลบหมวดหมู่นี้หรือไม่?",
"确定要删除此公告吗?": "ต้องการลบประกาศนี้หรือไม่?", "确定要删除此公告吗?": "ต้องการลบประกาศนี้หรือไม่?",
"确定要删除此预约吗?": "คุณต้องการลบการจองนี้หรือไม่?",
"确定要删除此密钥吗?": "ต้องการลบคีย์นี้หรือไม่?", "确定要删除此密钥吗?": "ต้องการลบคีย์นี้หรือไม่?",
"确定要删除此模型吗?": "ต้องการลบโมเดลนี้หรือไม่?", "确定要删除此模型吗?": "ต้องการลบโมเดลนี้หรือไม่?",
"确定要删除此问答吗?": "ต้องการลบคำถามที่พบบ่อยข้อนี้หรือไม่?", "确定要删除此问答吗?": "ต้องการลบคำถามที่พบบ่อยข้อนี้หรือไม่?",
+3
View File
@@ -4745,9 +4745,11 @@
"确定要充值 $": "Xác nhận nạp $", "确定要充值 $": "Xác nhận nạp $",
"确定要更新所有已启用通道余额吗?": "Bạn có chắc chắn muốn cập nhật số dư của tất cả các kênh đã bật không?", "确定要更新所有已启用通道余额吗?": "Bạn có chắc chắn muốn cập nhật số dư của tất cả các kênh đã bật không?",
"确定要降级此用户吗?": "Bạn có chắc chắn muốn hạ cấp người dùng này không?", "确定要降级此用户吗?": "Bạn có chắc chắn muốn hạ cấp người dùng này không?",
"确定要禁用此预约吗?": "Bạn có chắc muốn tắt lịch hẹn này không?",
"确定要禁用此密钥吗?": "Bạn có chắc muốn tắt khóa này?", "确定要禁用此密钥吗?": "Bạn có chắc muốn tắt khóa này?",
"确定要禁用此用户吗?": "Bạn có chắc chắn muốn vô hiệu hóa người dùng này không?", "确定要禁用此用户吗?": "Bạn có chắc chắn muốn vô hiệu hóa người dùng này không?",
"确定要禁用所有的密钥吗?": "Bạn có chắc chắn muốn vô hiệu hóa tất cả các khóa không?", "确定要禁用所有的密钥吗?": "Bạn có chắc chắn muốn vô hiệu hóa tất cả các khóa không?",
"确定要启用此预约吗?": "Bạn có chắc muốn bật lịch hẹn này không?",
"确定要启用此密钥吗?": "Bạn có chắc muốn bật khóa này?", "确定要启用此密钥吗?": "Bạn có chắc muốn bật khóa này?",
"确定要启用此用户吗?": "Bạn có chắc chắn muốn bật người dùng này không?", "确定要启用此用户吗?": "Bạn có chắc chắn muốn bật người dùng này không?",
"确定要启用所有密钥吗?": "Bạn có chắc chắn muốn bật tất cả các khóa không?", "确定要启用所有密钥吗?": "Bạn có chắc chắn muốn bật tất cả các khóa không?",
@@ -4757,6 +4759,7 @@
"确定要删除此定价配置吗?": "Xác nhận xóa cấu hình định giá này?", "确定要删除此定价配置吗?": "Xác nhận xóa cấu hình định giá này?",
"确定要删除此分类吗?": "Bạn có chắc chắn muốn xóa danh mục này không?", "确定要删除此分类吗?": "Bạn có chắc chắn muốn xóa danh mục này không?",
"确定要删除此公告吗?": "Bạn có chắc chắn muốn xóa thông báo này không?", "确定要删除此公告吗?": "Bạn có chắc chắn muốn xóa thông báo này không?",
"确定要删除此预约吗?": "Bạn có chắc muốn xóa lịch hẹn này không?",
"确定要删除此密钥吗?": "Bạn có chắc chắn muốn xóa khóa này không?", "确定要删除此密钥吗?": "Bạn có chắc chắn muốn xóa khóa này không?",
"确定要删除此模型吗?": "Xác nhận xóa mô hình này?", "确定要删除此模型吗?": "Xác nhận xóa mô hình này?",
"确定要删除此问答吗?": "Bạn có chắc chắn muốn xóa câu hỏi thường gặp này không?", "确定要删除此问答吗?": "Bạn có chắc chắn muốn xóa câu hỏi thường gặp này không?",
+3
View File
@@ -4745,9 +4745,11 @@
"确定要充值 $": "確定要儲值 $", "确定要充值 $": "確定要儲值 $",
"确定要更新所有已启用通道余额吗?": "確定要更新所有已啟用通道餘額嗎?", "确定要更新所有已启用通道余额吗?": "確定要更新所有已啟用通道餘額嗎?",
"确定要降级此用户吗?": "確定要降級此使用者嗎?", "确定要降级此用户吗?": "確定要降級此使用者嗎?",
"确定要禁用此预约吗?": "確定要停用此預約嗎?",
"确定要禁用此密钥吗?": "確定要停用此金鑰嗎?", "确定要禁用此密钥吗?": "確定要停用此金鑰嗎?",
"确定要禁用此用户吗?": "確定要停用此使用者嗎?", "确定要禁用此用户吗?": "確定要停用此使用者嗎?",
"确定要禁用所有的密钥吗?": "確定要停用所有的金鑰嗎?", "确定要禁用所有的密钥吗?": "確定要停用所有的金鑰嗎?",
"确定要启用此预约吗?": "確定要啟用此預約嗎?",
"确定要启用此密钥吗?": "確定要啟用此金鑰嗎?", "确定要启用此密钥吗?": "確定要啟用此金鑰嗎?",
"确定要启用此用户吗?": "確定要啟用此使用者嗎?", "确定要启用此用户吗?": "確定要啟用此使用者嗎?",
"确定要启用所有密钥吗?": "確定要啟用所有金鑰嗎?", "确定要启用所有密钥吗?": "確定要啟用所有金鑰嗎?",
@@ -4757,6 +4759,7 @@
"确定要删除此定价配置吗?": "確定要刪除此定價配置嗎?", "确定要删除此定价配置吗?": "確定要刪除此定價配置嗎?",
"确定要删除此分类吗?": "確定要刪除此分類嗎?", "确定要删除此分类吗?": "確定要刪除此分類嗎?",
"确定要删除此公告吗?": "確定要刪除此公告嗎?", "确定要删除此公告吗?": "確定要刪除此公告嗎?",
"确定要删除此预约吗?": "確定要刪除此預約嗎?",
"确定要删除此密钥吗?": "確定要刪除此金鑰嗎?", "确定要删除此密钥吗?": "確定要刪除此金鑰嗎?",
"确定要删除此模型吗?": "確定要刪除此模型嗎?", "确定要删除此模型吗?": "確定要刪除此模型嗎?",
"确定要删除此问答吗?": "確定要刪除此問答嗎?", "确定要删除此问答吗?": "確定要刪除此問答嗎?",
+3
View File
@@ -4694,9 +4694,11 @@
"确定要充值 $": "确定要充值 $", "确定要充值 $": "确定要充值 $",
"确定要更新所有已启用通道余额吗?": "确定要更新所有已启用通道余额吗?", "确定要更新所有已启用通道余额吗?": "确定要更新所有已启用通道余额吗?",
"确定要降级此用户吗?": "确定要降级此用户吗?", "确定要降级此用户吗?": "确定要降级此用户吗?",
"确定要禁用此预约吗?": "确定要禁用此预约吗?",
"确定要禁用此密钥吗?": "确定要禁用此密钥吗?", "确定要禁用此密钥吗?": "确定要禁用此密钥吗?",
"确定要禁用此用户吗?": "确定要禁用此用户吗?", "确定要禁用此用户吗?": "确定要禁用此用户吗?",
"确定要禁用所有的密钥吗?": "确定要禁用所有的密钥吗?", "确定要禁用所有的密钥吗?": "确定要禁用所有的密钥吗?",
"确定要启用此预约吗?": "确定要启用此预约吗?",
"确定要启用此密钥吗?": "确定要启用此密钥吗?", "确定要启用此密钥吗?": "确定要启用此密钥吗?",
"确定要启用此用户吗?": "确定要启用此用户吗?", "确定要启用此用户吗?": "确定要启用此用户吗?",
"确定要启用所有密钥吗?": "确定要启用所有密钥吗?", "确定要启用所有密钥吗?": "确定要启用所有密钥吗?",
@@ -4706,6 +4708,7 @@
"确定要删除此定价配置吗?": "确定要删除此定价配置吗?", "确定要删除此定价配置吗?": "确定要删除此定价配置吗?",
"确定要删除此分类吗?": "确定要删除此分类吗?", "确定要删除此分类吗?": "确定要删除此分类吗?",
"确定要删除此公告吗?": "确定要删除此公告吗?", "确定要删除此公告吗?": "确定要删除此公告吗?",
"确定要删除此预约吗?": "确定要删除此预约吗?",
"确定要删除此密钥吗?": "确定要删除此密钥吗?", "确定要删除此密钥吗?": "确定要删除此密钥吗?",
"确定要删除此模型吗?": "确定要删除此模型吗?", "确定要删除此模型吗?": "确定要删除此模型吗?",
"确定要删除此问答吗?": "确定要删除此问答吗?", "确定要删除此问答吗?": "确定要删除此问答吗?",
+23 -20
View File
@@ -1,3 +1,7 @@
import { confirmTableAction } from '@/components/common/table/confirmTableAction';
import TableGroupTags, {
TABLE_GROUP_COLUMN_WIDTH,
} from '@/components/common/table/TableGroupTags';
import { import {
ExternalLink as ActionExternalLink, ExternalLink as ActionExternalLink,
BarChart3 as ActionBarChart3, BarChart3 as ActionBarChart3,
@@ -408,12 +412,14 @@ const AdminOrganizations = () => {
if (res.data.success) { if (res.data.success) {
Toast.success(t('状态已更新')); Toast.success(t('状态已更新'));
fetchOrgs(); fetchOrgs();
return true;
} else { } else {
showError(res.data.message); showError(res.data.message);
} }
} catch (err) { } catch (err) {
showError(err.message); showError(err.message);
} }
return false;
}; };
const openFeatureModal = (record) => { const openFeatureModal = (record) => {
@@ -647,9 +653,11 @@ const AdminOrganizations = () => {
}; };
const handleDelete = async (orgId) => { const handleDelete = async (orgId) => {
Modal.confirm({ confirmTableAction({
title: t('确认删除'), title: t('确认删除'),
content: t('删除企业将无法恢复,确定继续?'), content: t('删除企业将无法恢复,确定继续?'),
okType: 'danger',
focusable: { autoFocusButton: 'cancel' },
onOk: async () => { onOk: async () => {
try { try {
const res = await API.delete(`/api/admin/organizations/${orgId}`); const res = await API.delete(`/api/admin/organizations/${orgId}`);
@@ -658,12 +666,14 @@ const AdminOrganizations = () => {
fetchOrgs(); fetchOrgs();
// 被删企业可能是某商务唯一跟进的企业,同步刷新筛选下拉防残留失效姓名 // 被删企业可能是某商务唯一跟进的企业,同步刷新筛选下拉防残留失效姓名
fetchSalesReps(); fetchSalesReps();
return true;
} else { } else {
showError(res.data.message); showError(res.data.message);
} }
} catch (err) { } catch (err) {
showError(err.message); showError(err.message);
} }
return false;
}, },
}); });
}; };
@@ -780,24 +790,8 @@ const AdminOrganizations = () => {
{ {
title: t('分组'), title: t('分组'),
dataIndex: 'group', dataIndex: 'group',
width: 150, width: TABLE_GROUP_COLUMN_WIDTH,
render: (_, record) => { render: (_, record) => <TableGroupTags groups={parseOrgGroups(record)} />,
const groups = parseOrgGroups(record);
if (!groups.length) return '-';
return (
<div className='flex flex-wrap gap-1'>
{groups.map((g) => (
<Tag
key={g}
size='small'
color={g === record.group ? 'blue' : 'grey'}
>
{g === record.group ? `${g} (${t('默认')})` : g}
</Tag>
))}
</div>
);
},
}, },
{ {
title: t('限额'), title: t('限额'),
@@ -877,7 +871,16 @@ const AdminOrganizations = () => {
<Button <Button
size='small' size='small'
type='link' type='link'
onClick={() => handleStatusChange(record.id, 2)} danger
onClick={() =>
confirmTableAction({
title: t('冻结'),
content: record.name,
focusable: { autoFocusButton: 'cancel' },
okType: 'danger',
onOk: () => handleStatusChange(record.id, 2),
})
}
> >
{t('冻结')} {t('冻结')}
</Button> </Button>
+40 -29
View File
@@ -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 TableEmpty from '../../components/common/table/TableEmpty';
import React, { useEffect, useMemo, useRef, useState } from 'react'; import React, { useEffect, useMemo, useRef, useState } from 'react';
import { Banner, Button, Form, Spin } from '@/components/ui'; import { Banner, Button, Form, Modal, Spin } from '@/components/ui';
import { Button as AntButton, Popconfirm, Switch } from 'antd'; import { Button as AntButton } from 'antd';
import { Download as ActionDownload } from '@/components/common/icons/ActionIcons';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import CardPro from '../../components/common/ui/CardPro'; import CardPro from '../../components/common/ui/CardPro';
import CardTable from '../../components/common/ui/CardTable'; import CardTable from '../../components/common/ui/CardTable';
@@ -18,7 +21,7 @@ import {
} from './reservationsApi'; } from './reservationsApi';
const EMPTY_FILTERS = { name: '', contact: '', companyName: '' }; const EMPTY_FILTERS = { name: '', contact: '', companyName: '' };
const RESERVATION_TABLE_MIN_WIDTH = 1280; const RESERVATION_TABLE_MIN_WIDTH = 1320;
const RESERVATION_FIELDS = [ const RESERVATION_FIELDS = [
['name', '姓名', 96], ['name', '姓名', 96],
['contact', '联系方式', 172], ['contact', '联系方式', 172],
@@ -125,7 +128,7 @@ export default function DemoReservations() {
[t], [t],
); );
const saveReservation = async (id, save) => { const saveReservation = async (id, save, keepOpenOnFailure = false) => {
if (busy) return; if (busy) return;
setSavingId(id); setSavingId(id);
try { try {
@@ -134,30 +137,42 @@ export default function DemoReservations() {
setQuery((previous) => ({ ...previous })); setQuery((previous) => ({ ...previous }));
} catch (error) { } catch (error) {
showError(t(error.message || '操作失败')); showError(t(error.message || '操作失败'));
if (keepOpenOnFailure) return false;
} finally { } finally {
setSavingId(null); 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 = [ const columns = [
...fieldColumns, ...fieldColumns,
{ {
title: t('状态'), title: t('状态'),
key: 'enabled', key: 'enabled',
width: 88, width: 128,
align: 'center',
render: (_, record) => ( render: (_, record) => (
<Switch <TableStatusSwitch
aria-label={t('状态')} aria-label={record.enabled === false ? t('启用') : t('禁用')}
checked={record.enabled !== false} checked={record.enabled !== false}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
disabled={busy} disabled={busy}
onChange={(enabled) => onChange={(enabled) => confirmStatusChange(record.id, enabled)}
saveReservation(record.id, () =>
setDemoReservationEnabled(record.id, enabled),
)
}
/> />
), ),
}, },
@@ -167,25 +182,20 @@ export default function DemoReservations() {
width: 84, width: 84,
fixed: 'right', fixed: 'right',
render: (_, record) => ( render: (_, record) => (
<Popconfirm <AntButton
title={t('确认删除')} type='link'
okText={t('删除')} size='small'
cancelText={t('取消')} danger
okButtonProps={{ danger: true }}
disabled={busy} disabled={busy}
onConfirm={() => onClick={() => confirmDelete(record.id)}
saveReservation(record.id, () => deleteDemoReservation(record.id))
}
> >
<AntButton type='link' size='small' danger disabled={busy}>
{t('删除')} {t('删除')}
</AntButton> </AntButton>
</Popconfirm>
), ),
}, },
].map((column) => ({ ].map((column) => ({
...column, ...column,
onHeaderCell: () => ({ style: { textAlign: 'center' } }), align: 'center',
})); }));
const selectedRows = result.items.filter(({ id }) => const selectedRows = result.items.filter(({ id }) =>
@@ -245,12 +255,13 @@ export default function DemoReservations() {
type='type1' type='type1'
t={t} t={t}
tableActions={ tableActions={
<AntButton <Button
icon={<ActionDownload size={14} />}
disabled={busy || selectedRows.length === 0} disabled={busy || selectedRows.length === 0}
onClick={exportSelectedRows} onClick={exportSelectedRows}
> >
{t('导出 CSV')} {t('导出')}
</AntButton> </Button>
} }
searchArea={ searchArea={
<div className='flex w-full justify-start'> <div className='flex w-full justify-start'>
@@ -1,3 +1,4 @@
import { confirmTableAction } from '@/components/common/table/confirmTableAction';
import { import {
Download as ActionDownload, Download as ActionDownload,
RefreshCw as ActionRefreshCw, RefreshCw as ActionRefreshCw,
@@ -220,7 +221,7 @@ const VideoTaskQueue = ({
danger danger
className='video-queue-link' className='video-queue-link'
onClick={() => { onClick={() => {
Modal.warning({ confirmTableAction({
title: t('确定删除此任务?'), title: t('确定删除此任务?'),
content: t('删除后将无法恢复'), content: t('删除后将无法恢复'),
icon: ( icon: (
@@ -228,9 +229,10 @@ const VideoTaskQueue = ({
), ),
okText: t('确定'), okText: t('确定'),
cancelText: t('取消'), cancelText: t('取消'),
okType: 'danger',
focusable: { autoFocusButton: 'cancel' },
onOk: () => onDelete(record.task_id), onOk: () => onDelete(record.task_id),
centered: true, centered: true,
okButtonProps: { type: 'danger' },
}); });
}} }}
> >
+17 -11
View File
@@ -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 { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
import { import {
EyeOff as ActionEyeOff, EyeOff as ActionEyeOff,
@@ -25,7 +30,6 @@ import {
Empty, Empty,
Input, Input,
Spin, Spin,
Switch,
Tag, Tag,
Tooltip, Tooltip,
} from 'antd'; } from 'antd';
@@ -63,7 +67,7 @@ const KEY_MASK = '••••••••••••••••';
const COLUMN_WIDTHS = { const COLUMN_WIDTHS = {
name: 150, name: 150,
key: 300, key: 300,
group: 150, group: TABLE_GROUP_COLUMN_WIDTH,
status: 100, status: 100,
expired_time: 180, expired_time: 180,
quota: 100, quota: 100,
@@ -162,9 +166,13 @@ const KeyTable = ({
: group : group
} }
> >
<Tag color='blue' variant='filled'> <span>
{group === 'auto' ? t('智能熔断') : group || t('默认')} <TableGroupTags
</Tag> groups={group}
empty={t('默认')}
renderLabel={(name) => (name === 'auto' ? t('智能熔断') : name)}
/>
</span>
</Tooltip> </Tooltip>
); );
}, },
@@ -176,11 +184,8 @@ const KeyTable = ({
const extra = extraStatusTag[token.status]; const extra = extraStatusTag[token.status];
return ( return (
<div className='km-status-cell'> <div className='km-status-cell'>
<Switch <TableStatusSwitch
size='small'
checked={token.status === 1} checked={token.status === 1}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
aria-label={token.status === 1 ? t('禁用') : t('启用')} aria-label={token.status === 1 ? t('禁用') : t('启用')}
onChange={() => onToggle(token)} onChange={() => onToggle(token)}
/> />
@@ -702,12 +707,13 @@ const KeyManagement = ({ embedded = false }) => {
}; };
const handleDelete = (token) => { const handleDelete = (token) => {
Modal.confirm({ confirmTableAction({
title: t('确定要删除此密钥吗?'), title: t('确定要删除此密钥吗?'),
content: t('删除后将无法恢复'), content: t('删除后将无法恢复'),
okType: 'danger', okType: 'danger',
focusable: { autoFocusButton: 'cancel' },
onOk: async () => { onOk: async () => {
await manageToken(token.id, 'delete', token); if (!(await manageToken(token.id, 'delete', token))) return false;
refreshKeyList(); refreshKeyList();
}, },
}); });
+3 -3
View File
@@ -385,7 +385,7 @@ const OrgAudit = ({ orgId }) => {
}; };
const operations = ( const operations = (
<> <div className='oc-audit-stack'>
<ConsoleCollectionSearch className='oc-audit-filter'> <ConsoleCollectionSearch className='oc-audit-filter'>
<ConsoleFilterGrid onReset={() => applyAction('')} onSearch={refresh}> <ConsoleFilterGrid onReset={() => applyAction('')} onSearch={refresh}>
<ConsoleFilterField label={t('操作类型')} id='org-audit-action-type'> <ConsoleFilterField label={t('操作类型')} id='org-audit-action-type'>
@@ -433,7 +433,7 @@ const OrgAudit = ({ orgId }) => {
empty={<TableEmpty />} empty={<TableEmpty />}
/> />
</OrgListCard> </OrgListCard>
</> </div>
); );
return ( return (
@@ -442,7 +442,7 @@ const OrgAudit = ({ orgId }) => {
{/* 原型 platform-list-tabs;“提示词记录”页签沿用原 feature flag + 权限显隐 */} {/* 原型 platform-list-tabs;“提示词记录”页签沿用原 feature flag + 权限显隐 */}
<AntTabs <AntTabs
className='oc-list-tabs' className='oc-list-tabs oc-audit-tabs'
activeKey={activeTab} activeKey={activeTab}
onChange={setActiveTab} onChange={setActiveTab}
items={[ items={[
+9 -17
View File
@@ -1,3 +1,5 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import TableStatusSwitch from '@/components/common/table/TableStatusSwitch';
import { formatIdReference } from '../../helpers/safeDisplay'; import { formatIdReference } from '../../helpers/safeDisplay';
import { import {
RefreshCw as ActionRefreshCw, RefreshCw as ActionRefreshCw,
@@ -12,16 +14,7 @@ import React, {
useState, useState,
} from 'react'; } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Switch } from 'antd'; import { Table, Button, Form, Toast, Tag, Progress } from '@/components/ui';
import {
Table,
Button,
Form,
Toast,
Tag,
Progress,
Popconfirm,
} from '@/components/ui';
import { Tabs as AntTabs } from 'antd'; import { Tabs as AntTabs } from 'antd';
import { API } from '../../helpers/api'; import { API } from '../../helpers/api';
import { showError } from '../../helpers'; import { showError } from '../../helpers';
@@ -301,12 +294,14 @@ const OrgBudgets = ({ orgId, featureFlags }) => {
if (res.data.success) { if (res.data.success) {
Toast.success(t('预算已删除')); Toast.success(t('预算已删除'));
fetchAll(); fetchAll();
return true;
} else { } else {
showError(res.data.message); showError(res.data.message);
} }
} catch (err) { } catch (err) {
showError(err.message); showError(err.message);
} }
return false;
}; };
// 列宽与渲染对齐原型 EnterpriseBudget(300/110/260/120/120/130,scroll.x 1040);取值与判定沿用原逻辑 // 列宽与渲染对齐原型 EnterpriseBudget(300/110/260/120/120/130,scroll.x 1040);取值与判定沿用原逻辑
@@ -386,11 +381,8 @@ const OrgBudgets = ({ orgId, featureFlags }) => {
dataIndex: 'status', dataIndex: 'status',
width: 120, width: 120,
render: (v, record) => ( render: (v, record) => (
<Switch <TableStatusSwitch
size='small'
checked={v === 1} checked={v === 1}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
aria-label={`${subjectOf(record).name} ${t('状态')}`} aria-label={`${subjectOf(record).name} ${t('状态')}`}
loading={updatingBudgetId === record.id} loading={updatingBudgetId === record.id}
disabled={updatingBudgetId !== null || !subjectOf(record).exists} disabled={updatingBudgetId !== null || !subjectOf(record).exists}
@@ -411,17 +403,17 @@ const OrgBudgets = ({ orgId, featureFlags }) => {
{t('编辑')} {t('编辑')}
</Button> </Button>
)} )}
<Popconfirm <TableActionPopconfirm
title={t('确认删除该预算?')} title={t('确认删除该预算?')}
content={t( content={t(
'删除后该主体不再受此额度上限约束,历史用量流水保留不受影响', '删除后该主体不再受此额度上限约束,历史用量流水保留不受影响',
)} )}
onConfirm={() => handleDelete(r)} onConfirm={() => handleDelete(r)}
> >
<Button type='link' danger> <Button size='small' type='link' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</OrgRowActions> </OrgRowActions>
); );
}, },
+105 -62
View File
@@ -1,3 +1,5 @@
import { Popconfirm } from '@/components/ui';
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { import {
formatIdReference, formatIdReference,
formatNumber, formatNumber,
@@ -5,20 +7,23 @@ import {
} from '../../helpers/safeDisplay'; } from '../../helpers/safeDisplay';
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js'; 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 React, { useCallback, useEffect, useMemo, useState } from 'react';
import { import {
Button, Button,
Input, Input,
InputNumber, InputNumber,
Modal,
Popconfirm,
Select, Select,
Table, Table,
Tag, Tag,
TextArea, TextArea,
Toast, Toast,
Typography,
} from '@/components/ui'; } from '@/components/ui';
import { Activity, FlaskConical, Gauge, ShieldAlert } from 'lucide-react'; import { Activity, FlaskConical, Gauge, ShieldAlert } from 'lucide-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@@ -29,11 +34,10 @@ import {
PageGuideDrawer, PageGuideDrawer,
PageGuideTrigger, PageGuideTrigger,
} from '../../components/common/PageGuide'; } 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 './org-effectiveness.css';
import OrgBreadcrumb from './components/OrgBreadcrumb';
const { Title, Text } = Typography;
const dimensions = [ const dimensions = [
{ value: 'organization', label: '企业总览' }, { value: 'organization', label: '企业总览' },
@@ -206,7 +210,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
); );
if (!response.data?.success) { if (!response.data?.success) {
Toast.error(response.data?.message || t('操作失败')); Toast.error(response.data?.message || t('操作失败'));
return; return false;
} }
Toast.success(t('实验已删除')); Toast.success(t('实验已删除'));
await load(); await load();
@@ -228,7 +232,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
} catch { } catch {
ids = []; ids = [];
} }
Modal.info({ OrgModal.info({
title: t('告警任务样本'), title: t('告警任务样本'),
content: ( content: (
<div className='org-effect-samples'> <div className='org-effect-samples'>
@@ -326,18 +330,17 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
], ],
}); });
return ( return (
<div className='org-effect-page'> <div className='org-effect-page oc-page'>
<header className='org-effect-hero'> <OrgPageHeader
<div> title={t('效能分析')}
<OrgBreadcrumb /> subtitle={t(
<Title heading={2}>{t('效能分析')}</Title> '回答谁在用、节省多少时间、成本是否对账、质量与安全是否改善。',
<Text type='tertiary'> )}
{t('回答谁在用、节省多少时间、成本是否对账、质量与安全是否改善。')} actions={
</Text>
</div>
<div className='org-effect-toolbar'> <div className='org-effect-toolbar'>
<PageGuideTrigger guide={guide} /> <PageGuideTrigger guide={guide} />
<Select <Select
aria-label={t('维度')}
value={dimension} value={dimension}
optionList={dimensions.map((d) => ({ optionList={dimensions.map((d) => ({
...d, ...d,
@@ -347,13 +350,14 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
/> />
{dimension !== 'organization' && ( {dimension !== 'organization' && (
<InputNumber <InputNumber
aria-label={t('维度') + ' ID'}
min={1} min={1}
value={dimensionId} value={dimensionId || null}
onChange={setDimensionId} onChange={setDimensionId}
/> />
)} )}
<Button <Button
icon={<ActionRefreshCw size={15} />} icon={<ActionRefreshCw size={16} />}
loading={loading} loading={loading}
onClick={load} onClick={load}
> >
@@ -363,38 +367,44 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
<Button onClick={aggregateToday}>{t('重算今日')}</Button> <Button onClick={aggregateToday}>{t('重算今日')}</Button>
)} )}
</div> </div>
</header> }
/>
<PageGuideDrawer guide={guide} /> <PageGuideDrawer guide={guide} />
<section className='org-effect-grid'> <section className='org-effect-grid'>
{cards.map(({ label, value: cardValue, detail, icon: Icon }) => ( {cards.map(({ label, value: cardValue, detail, icon: Icon }) => (
<article className='org-effect-card' key={label}> <Card className='org-effect-card' key={label}>
<Icon size={20} /> <div className='org-effect-card-label'>
<Text>{label}</Text> <span className='org-effect-card-icon'>
<Icon size={20} strokeWidth={1.75} aria-hidden='true' />
</span>
<span>{label}</span>
</div>
<strong>{cardValue}</strong> <strong>{cardValue}</strong>
<small>{detail}</small> <small>{detail}</small>
</article> </Card>
))} ))}
</section> </section>
<OrgPanel title={t('网关直连技能使用(近 30 天)')}> <OrgListCard title={t('网关直连技能使用(近 30 天)')}>
{directUsage.length === 0 ? ( {directUsage.length === 0 ? (
<Text type='tertiary'> <p className='org-effect-direct-note'>
{t( {t(
'暂无数据。开启密钥的「技能注入」后,用该密钥直连调用的技能使用情况会回流到这里。', '暂无数据。开启密钥的「技能注入」后,用该密钥直连调用的技能使用情况会回流到这里。',
)} )}
</Text> </p>
) : ( ) : (
<> <>
<Text type='tertiary' size='small'> <p className='org-effect-direct-note'>
{t( {t(
'统计口径:token 与额度是整条请求的量级,多技能同时命中时全额计入每个技能,不是按技能分摊的成本,勿相加。', '统计口径:token 与额度是整条请求的量级,多技能同时命中时全额计入每个技能,不是按技能分摊的成本,勿相加。',
)} )}
</Text> </p>
<Table <Table
size='small' size='small'
pagination={{ resetOnDataChange: true }} pagination={{ resetOnDataChange: true }}
dataSource={directUsage} dataSource={directUsage}
empty={<TableEmpty />}
rowKey='skill_id' rowKey='skill_id'
columns={[ columns={[
{ {
@@ -420,22 +430,27 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
/> />
</> </>
)} )}
</OrgPanel> </OrgListCard>
<div className='org-effect-columns'> <div className='org-effect-columns'>
<OrgPanel title={t('成本对账')}> <OrgListCard title={t('成本对账')}>
<div className='org-effect-reconcile'> <dl className='org-effect-reconcile'>
<span>{t('运行结算')}</span> <div>
<b>{Math.round(value('efficiency.quota')).toLocaleString()}</b> <dt>{t('运行结算')}</dt>
<span>{t('消费明细')}</span> <dd>{Math.round(value('efficiency.quota')).toLocaleString()}</dd>
<b> </div>
<div>
<dt>{t('消费明细')}</dt>
<dd>
{Math.round( {Math.round(
value('efficiency.settlement_quota') + value('efficiency.settlement_quota') +
value('efficiency.adjustment_quota'), value('efficiency.adjustment_quota'),
).toLocaleString()} ).toLocaleString()}
</b> </dd>
<span>{t('差额')}</span> </div>
<b <div>
<dt>{t('差额')}</dt>
<dd
className={ className={
value('efficiency.reconciliation_gap') ? 'is-risk' : 'is-ok' value('efficiency.reconciliation_gap') ? 'is-risk' : 'is-ok'
} }
@@ -443,12 +458,14 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
{Math.round( {Math.round(
value('efficiency.reconciliation_gap'), value('efficiency.reconciliation_gap'),
).toLocaleString()} ).toLocaleString()}
</b> </dd>
</div> </div>
</OrgPanel> </dl>
<OrgPanel title={t('质量告警')}> </OrgListCard>
<OrgListCard title={t('质量告警')}>
{isMobile ? ( {isMobile ? (
<div className='org-effect-mobile-list'> <div className='org-effect-mobile-list'>
{!data.alerts?.length && <TableEmpty />}
{(data.alerts || []).map((row) => ( {(data.alerts || []).map((row) => (
<article key={row.id}> <article key={row.id}>
<div> <div>
@@ -476,6 +493,8 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
size='small' size='small'
pagination={{ resetOnDataChange: true }} pagination={{ resetOnDataChange: true }}
dataSource={data.alerts || []} dataSource={data.alerts || []}
empty={<TableEmpty />}
rowKey='id'
columns={[ columns={[
{ title: t('Skill'), dataIndex: 'dimension_id' }, { title: t('Skill'), dataIndex: 'dimension_id' },
{ {
@@ -504,25 +523,40 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
]} ]}
/> />
)} )}
</OrgPanel> </OrgListCard>
</div> </div>
<OrgPanel <OrgListCard
title={t('灰度版本质量对比')} title={t('灰度版本质量对比')}
actions={ tools={
<div className='flex gap-2'> <form
className='org-effect-drilldown'
onSubmit={(event) => {
event.preventDefault();
void loadComparison();
}}
>
<label htmlFor='org-effect-skill-id'>Skill ID</label>
<InputNumber <InputNumber
id='org-effect-skill-id'
min={1} min={1}
placeholder='Skill ID' placeholder='Skill ID'
value={comparisonSkillId} value={comparisonSkillId || null}
onChange={setComparisonSkillId} onChange={setComparisonSkillId}
/> />
<Button onClick={loadComparison}>{t('下钻版本')}</Button> <Button
</div> htmlType='submit'
icon={<ActionSearch size={16} />}
disabled={!comparisonSkillId}
>
{t('下钻版本')}
</Button>
</form>
} }
> >
{isMobile ? ( {isMobile ? (
<div className='org-effect-mobile-list'> <div className='org-effect-mobile-list'>
{!comparison.length && <TableEmpty />}
{comparison.map((row) => ( {comparison.map((row) => (
<article key={row.version_id}> <article key={row.version_id}>
<strong> <strong>
@@ -559,6 +593,8 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
<Table <Table
pagination={{ resetOnDataChange: true }} pagination={{ resetOnDataChange: true }}
dataSource={comparison} dataSource={comparison}
empty={<TableEmpty />}
rowKey='version_id'
columns={[ columns={[
{ title: t('版本'), dataIndex: 'version_id' }, { title: t('版本'), dataIndex: 'version_id' },
{ title: t('首次交付样本'), dataIndex: 'first_delivery_count' }, { title: t('首次交付样本'), dataIndex: 'first_delivery_count' },
@@ -589,13 +625,17 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
]} ]}
/> />
)} )}
</OrgPanel> </OrgListCard>
<OrgPanel <OrgListCard
title={t('Skill A/B 实验')} title={t('Skill A/B 实验')}
actions={ tools={
canManageSkills ? ( canManageSkills ? (
<Button onClick={() => setExperimentVisible(true)}> <Button
type='primary'
icon={<ActionPlus size={16} />}
onClick={() => setExperimentVisible(true)}
>
{t('新建实验')} {t('新建实验')}
</Button> </Button>
) : null ) : null
@@ -603,6 +643,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
> >
{isMobile ? ( {isMobile ? (
<div className='org-effect-mobile-list'> <div className='org-effect-mobile-list'>
{!experiments.length && <TableEmpty />}
{experiments.map((row) => ( {experiments.map((row) => (
<article key={row.id}> <article key={row.id}>
<div> <div>
@@ -657,6 +698,8 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
<Table <Table
pagination={{ resetOnDataChange: true }} pagination={{ resetOnDataChange: true }}
dataSource={experiments} dataSource={experiments}
empty={<TableEmpty />}
rowKey='id'
columns={[ columns={[
{ title: t('实验'), dataIndex: 'name' }, { title: t('实验'), dataIndex: 'name' },
{ title: 'Skill', dataIndex: 'skill_id' }, { title: 'Skill', dataIndex: 'skill_id' },
@@ -688,7 +731,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
> >
{row.status === 'draft' ? t('开始') : t('停止并回退')} {row.status === 'draft' ? t('开始') : t('停止并回退')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确认删除该实验?')} title={t('确认删除该实验?')}
content={t( content={t(
'删除后实验配置与分桶结果一并清除,起停记录已在审计中留痕。', '删除后实验配置与分桶结果一并清除,起停记录已在审计中留痕。',
@@ -697,22 +740,22 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
> >
<Button <Button
size='small' size='small'
theme='light' type='link'
type='danger' danger
disabled={row.status === 'running'} disabled={row.status === 'running'}
> >
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</div> </div>
), ),
}, },
]} ]}
/> />
)} )}
</OrgPanel> </OrgListCard>
<Modal <OrgModal
title={t('新建 Skill A/B 实验')} title={t('新建 Skill A/B 实验')}
visible={experimentVisible} visible={experimentVisible}
onCancel={() => setExperimentVisible(false)} onCancel={() => setExperimentVisible(false)}
@@ -776,7 +819,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
} }
/> />
</div> </div>
</Modal> </OrgModal>
</div> </div>
); );
}; };
+5 -7
View File
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { import {
formatIdReference, formatIdReference,
formatPercent, formatPercent,
@@ -1093,6 +1094,7 @@ const OrgKnowledge = ({ orgId, canAuditContent = false }) => {
fetchBases(true); fetchBases(true);
} catch (error) { } catch (error) {
if (requestOrgId === orgIdentityRef.current) notifyError(error); if (requestOrgId === orgIdentityRef.current) notifyError(error);
return false;
} }
}; };
@@ -1759,7 +1761,7 @@ const OrgKnowledge = ({ orgId, canAuditContent = false }) => {
{t('重试')} {t('重试')}
</Button> </Button>
)} )}
<Popconfirm <TableActionPopconfirm
title={t( title={t(
'删除后文档会立即退出检索,历史任务仍保留来源占位。', '删除后文档会立即退出检索,历史任务仍保留来源占位。',
)} )}
@@ -1767,14 +1769,10 @@ const OrgKnowledge = ({ orgId, canAuditContent = false }) => {
deleteDocument(row.document.id) deleteDocument(row.document.id)
} }
> >
<Button <Button size='small' type='link' danger>
size='small'
type='danger'
theme='borderless'
>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</div> </div>
</article> </article>
); );
+48 -40
View File
@@ -27,7 +27,8 @@ import {
useOrgMemberRanking, useOrgMemberRanking,
} from '../../hooks/org/useOrgData'; } from '../../hooks/org/useOrgData';
import OrgPageHeader from './components/OrgPageHeader'; 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 OrgModal from './components/OrgModal';
import { fundAccountDisplay, fundDeptDisplay } from './fund/fundFormat'; import { fundAccountDisplay, fundDeptDisplay } from './fund/fundFormat';
import OrgTaskRecords from './components/OrgTaskRecords'; import OrgTaskRecords from './components/OrgTaskRecords';
@@ -839,42 +840,22 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
<OrgTaskRecords /> <OrgTaskRecords />
) : ( ) : (
<> <>
{/* 筛选栏(原型 .ee-filter-card / .eex-filter-grid) */} <UsageRecordFilterCard className='org-usage-filter-card'>
<OrgFilterCard <AntForm
className='oc-exp-filter' layout='vertical'
actions={ requiredMark={false}
<> autoComplete='off'
<Button onClick={handleReset}>{t('重置')}</Button> className='usage-record-filter-form'
<Button onFinish={() => handleSearch(false)}
type='primary'
icon={<ActionSearch size={16} />}
onClick={() => handleSearch(false)}
loading={loading}
> >
{t('搜索')} <div className='usage-record-filter-grid'>
</Button> <AntForm.Item
</> label={t('时间范围')}
} htmlFor='org-logs-start'
className='usage-record-filter-wide'
> >
<AntForm layout='vertical' requiredMark={false} component='div'>
<AntForm.Item label={t('成员')}>
{canViewTeamUsage ? (
<Select
value={selectedUserId}
onChange={setSelectedUserId}
optionList={memberOptions}
style={{ width: '100%' }}
placeholder={isAdmin ? t('全部成员') : t('全部部门成员')}
filter
/>
) : (
<div className='oc-exp-self'>{t('仅本人')}</div>
)}
</AntForm.Item>
</AntForm>
<AntForm layout='vertical' requiredMark={false} component='div'>
<AntForm.Item label={t('时间范围')}>
<DatePicker <DatePicker
id={{ start: 'org-logs-start' }}
type='dateTimeRange' type='dateTimeRange'
value={dateRange} value={dateRange}
onChange={(v) => { onChange={(v) => {
@@ -882,21 +863,48 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
setIsDefaultRange(false); setIsDefaultRange(false);
}} }}
placeholder={[t('开始时间'), t('结束时间')]} placeholder={[t('开始时间'), t('结束时间')]}
style={{ width: '100%' }}
/> />
</AntForm.Item> </AntForm.Item>
</AntForm> <AntForm.Item
<AntForm layout='vertical' requiredMark={false} component='div'> label={t('成员')}
<AntForm.Item label={t('模型名称')}> htmlFor={canViewTeamUsage ? 'org-logs-member' : undefined}
>
{canViewTeamUsage ? (
<Select
id='org-logs-member'
value={selectedUserId}
onChange={setSelectedUserId}
optionList={memberOptions}
placeholder={isAdmin ? t('全部成员') : t('全部部门成员')}
filter
/>
) : (
<div className='oc-exp-self'>{t('仅本人')}</div>
)}
</AntForm.Item>
<AntForm.Item label={t('模型名称')} htmlFor='org-logs-model'>
<Input <Input
id='org-logs-model'
placeholder={t('请输入模型名称')} placeholder={t('请输入模型名称')}
value={modelName} value={modelName}
onChange={setModelName} onChange={setModelName}
onEnterPress={() => handleSearch(false)} showClear
/> />
</AntForm.Item> </AntForm.Item>
</div>
<div className='usage-record-filter-actions'>
<Button onClick={handleReset}>{t('重置')}</Button>
<Button
type='primary'
htmlType='submit'
icon={<ActionSearch size={14} />}
loading={loading}
>
{t('搜索')}
</Button>
</div>
</AntForm> </AntForm>
</OrgFilterCard> </UsageRecordFilterCard>
<OrgListCard <OrgListCard
title={activeTab === 'ranking' ? t('成员排行') : t('明细日志')} title={activeTab === 'ranking' ? t('成员排行') : t('明细日志')}
+7 -14
View File
@@ -1,3 +1,7 @@
import TableStatusSwitch from '@/components/common/table/TableStatusSwitch';
import TableGroupTags, {
TABLE_GROUP_COLUMN_WIDTH,
} from '@/components/common/table/TableGroupTags';
import { import {
Pencil as ActionPencil, Pencil as ActionPencil,
RefreshCw as ActionRefreshCw, RefreshCw as ActionRefreshCw,
@@ -482,21 +486,13 @@ const OrgMembers = ({
{ {
title: t('分组'), title: t('分组'),
dataIndex: 'groups', dataIndex: 'groups',
width: 175, width: TABLE_GROUP_COLUMN_WIDTH,
render: (_, record) => { render: (_, record) => {
const groups = parseMemberGroups(record); const groups = parseMemberGroups(record);
if (!groups.length) { if (!groups.length) {
return <span className='oc-muted'>{t('无(继承企业)')}</span>; return <span className='oc-muted'>{t('无(继承企业)')}</span>;
} }
return ( return <TableGroupTags groups={groups} />;
<div className='oc-tags'>
{groups.map((g) => (
<Tag key={g} color='blue' bordered={false}>
{g}
</Tag>
))}
</div>
);
}, },
}, },
{ {
@@ -521,11 +517,8 @@ const OrgMembers = ({
: t('启用该成员的企业访问权限') : t('启用该成员的企业访问权限')
} }
> >
<Switch <TableStatusSwitch
size='small'
checked={status === 1} checked={status === 1}
checkedText={t('启用')}
uncheckedText={t('禁用')}
disabled={locked} disabled={locked}
aria-label={`${record.display_name || record.username || ''}${t('状态')}`} aria-label={`${record.display_name || record.username || ''}${t('状态')}`}
onChange={(checked) => onChange={(checked) =>
+47 -35
View File
@@ -28,9 +28,8 @@ import {
} from '../../components/common/PageGuide'; } from '../../components/common/PageGuide';
import OrgPanel from './components/OrgPanel'; import OrgPanel from './components/OrgPanel';
import './org-skills.css'; import './org-skills.css';
import OrgBreadcrumb from './components/OrgBreadcrumb';
const { Title, Text, Paragraph } = Typography; const { Paragraph } = Typography;
const blankSkill = { const blankSkill = {
canonical_id: '', canonical_id: '',
body: '# Method\n\nDescribe a safe, evidence-led method.', body: '# Method\n\nDescribe a safe, evidence-led method.',
@@ -57,6 +56,20 @@ const split = (value) =>
const OrgPrivateSkills = ({ orgId }) => { const OrgPrivateSkills = ({ orgId }) => {
const { t } = useTranslation(); 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 isMobile = useIsMobile();
const headers = useMemo(() => ({ 'X-Org-Id': String(orgId) }), [orgId]); const headers = useMemo(() => ({ 'X-Org-Id': String(orgId) }), [orgId]);
const [items, setItems] = useState([]); const [items, setItems] = useState([]);
@@ -199,9 +212,10 @@ const OrgPrivateSkills = ({ orgId }) => {
const isReviewer = const isReviewer =
currentUserId > 0 && Number(row.review?.reviewer_id) === currentUserId; currentUserId > 0 && Number(row.review?.reviewer_id) === currentUserId;
return ( return (
<div className='flex flex-wrap gap-2'> <div className='org-private-skill-actions'>
<Button <Button
size='small' size='small'
theme='borderless'
disabled={row.definition.emergency_stopped} disabled={row.definition.emergency_stopped}
onClick={() => { onClick={() => {
setEditingSkill(row.definition); setEditingSkill(row.definition);
@@ -214,11 +228,16 @@ const OrgPrivateSkills = ({ orgId }) => {
> >
{t('新版本')} {t('新版本')}
</Button> </Button>
<Button size='small' onClick={() => openHistory(row.definition)}> <Button
size='small'
theme='borderless'
onClick={() => openHistory(row.definition)}
>
{t('历史版本')} {t('历史版本')}
</Button> </Button>
<Button <Button
size='small' size='small'
theme='borderless'
disabled={!versionId} disabled={!versionId}
onClick={() => { onClick={() => {
// Clear residue from a previous version's test before reopening. // Clear residue from a previous version's test before reopening.
@@ -230,6 +249,7 @@ const OrgPrivateSkills = ({ orgId }) => {
</Button> </Button>
<Button <Button
size='small' size='small'
theme='borderless'
disabled={!versionId || row.review?.status !== 'pending' || isAuthor} disabled={!versionId || row.review?.status !== 'pending' || isAuthor}
onClick={() => onClick={() =>
action(`/api/org/skills/private/versions/${versionId}/review/start`) action(`/api/org/skills/private/versions/${versionId}/review/start`)
@@ -241,6 +261,7 @@ const OrgPrivateSkills = ({ orgId }) => {
</Button> </Button>
<Button <Button
size='small' size='small'
theme='borderless'
icon={<ActionFileCheck2 size={14} />} icon={<ActionFileCheck2 size={14} />}
disabled={ disabled={
!versionId || row.review?.status !== 'reviewing' || !isReviewer !versionId || row.review?.status !== 'reviewing' || !isReviewer
@@ -256,6 +277,7 @@ const OrgPrivateSkills = ({ orgId }) => {
</Button> </Button>
<Button <Button
size='small' size='small'
theme='borderless'
type='danger' type='danger'
disabled={ disabled={
!versionId || row.review?.status !== 'reviewing' || !isReviewer !versionId || row.review?.status !== 'reviewing' || !isReviewer
@@ -271,6 +293,7 @@ const OrgPrivateSkills = ({ orgId }) => {
</Button> </Button>
<Button <Button
size='small' size='small'
theme='borderless'
disabled={!versionId || row.review?.status !== 'approved'} disabled={!versionId || row.review?.status !== 'approved'}
onClick={() => onClick={() =>
action(`/api/org/skills/private/versions/${versionId}/publish`) action(`/api/org/skills/private/versions/${versionId}/publish`)
@@ -280,6 +303,7 @@ const OrgPrivateSkills = ({ orgId }) => {
</Button> </Button>
<Button <Button
size='small' size='small'
theme='borderless'
icon={<ActionRotateCcw size={14} />} icon={<ActionRotateCcw size={14} />}
disabled={!versionId} disabled={!versionId}
onClick={() => onClick={() =>
@@ -384,24 +408,17 @@ const OrgPrivateSkills = ({ orgId }) => {
closeGuide(); closeGuide();
}, [orgId, closeGuide]); }, [orgId, closeGuide]);
return ( return (
<div className='org-skills-page'> <div className='org-skill-center-content'>
<header className='org-skills-hero'> <div className='org-skill-center-actions'>
<div> <Button
<OrgBreadcrumb current={t('企业自研 Skill')} /> theme='solid'
<Title heading={3}>{t('企业自研 Skill')}</Title> icon={<ActionCode2 size={16} />}
<Text type='tertiary'> onClick={openCreateEditor}
{t( >
'版本内容不可变;兼容扫描、双人审核、发布、回滚与紧急停用均保留审计。',
)}
</Text>
</div>
<div className='org-skills-hero-actions'>
<PageGuideTrigger guide={guide} />
<Button icon={<ActionCode2 size={16} />} onClick={openCreateEditor}>
{t('创建私有 Skill')} {t('创建私有 Skill')}
</Button> </Button>
<PageGuideTrigger guide={guide} />
</div> </div>
</header>
<PageGuidePill guide={guide} /> <PageGuidePill guide={guide} />
<PageGuideDrawer guide={guide} /> <PageGuideDrawer guide={guide} />
<OrgPanel> <OrgPanel>
@@ -495,40 +512,35 @@ const OrgPrivateSkills = ({ orgId }) => {
onOk={save} onOk={save}
width={820} width={820}
> >
<div className='org-private-skill-form'> <div className='org-private-skill-form org-private-skill-editor'>
<label>
<span>{t('技能标识')}</span>
<Input <Input
disabled={!!editingSkill} disabled={!!editingSkill}
placeholder='canonical_id' placeholder='canonical_id'
value={form.canonical_id} value={form.canonical_id}
onChange={(canonical_id) => setForm({ ...form, canonical_id })} onChange={(canonical_id) => setForm({ ...form, canonical_id })}
/> />
{[ </label>
'name_zh', {Object.entries(editorLabels).map(([key, label]) => (
'name_en', <label key={key}>
'description_zh', <span>{label}</span>
'description_en',
'triggers_zh',
'triggers_en',
'scenarios_zh',
'scenarios_en',
'compact_constraint_zh',
'compact_constraint_en',
'tags',
'change_statement',
].map((key) => (
<Input <Input
key={key}
placeholder={key} placeholder={key}
value={form[key]} value={form[key]}
onChange={(value) => setForm({ ...form, [key]: value })} onChange={(value) => setForm({ ...form, [key]: value })}
/> />
</label>
))} ))}
<label className='org-private-skill-body'>
<span>{I18N_TECHNICAL_TEXT.SKILL_MARKDOWN}</span>
<TextArea <TextArea
rows={10} rows={10}
placeholder={I18N_TECHNICAL_TEXT.SKILL_MARKDOWN} placeholder={I18N_TECHNICAL_TEXT.SKILL_MARKDOWN}
value={form.body} value={form.body}
onChange={(body) => setForm({ ...form, body })} onChange={(body) => setForm({ ...form, body })}
/> />
</label>
</div> </div>
</Modal> </Modal>
<Modal <Modal
+2 -5
View File
@@ -1,3 +1,4 @@
import TableStatusSwitch from '@/components/common/table/TableStatusSwitch';
import { formatIdReference } from '../../helpers/safeDisplay'; import { formatIdReference } from '../../helpers/safeDisplay';
import { import {
RefreshCw as ActionRefreshCw, RefreshCw as ActionRefreshCw,
@@ -6,7 +7,6 @@ import {
import TableEmpty from '../../components/common/table/TableEmpty'; import TableEmpty from '../../components/common/table/TableEmpty';
import React, { useCallback, useEffect, useMemo, useState } from 'react'; import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Switch } from 'antd';
import { import {
Table, Table,
Button, Button,
@@ -311,11 +311,8 @@ const OrgProjects = ({ orgId }) => {
disabled={v !== 1 || updatingProjectId !== null} disabled={v !== 1 || updatingProjectId !== null}
onConfirm={() => handleStatusChange(record, false)} onConfirm={() => handleStatusChange(record, false)}
> >
<Switch <TableStatusSwitch
size='small'
checked={v === 1} checked={v === 1}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
aria-label={`${record.name} ${t('状态')}`} aria-label={`${record.name} ${t('状态')}`}
loading={updatingProjectId === record.id} loading={updatingProjectId === record.id}
disabled={updatingProjectId !== null} disabled={updatingProjectId !== null}
+50 -53
View File
@@ -2,12 +2,13 @@ import { formatUserReference } from '../../helpers/safeDisplay';
import { import {
Copy as ActionCopy, Copy as ActionCopy,
Search as ActionSearch, Search as ActionSearch,
RotateCcw as ActionRotateCcw,
RefreshCw as ActionRefreshCw, RefreshCw as ActionRefreshCw,
} from '@/components/common/icons/ActionIcons'; } from '@/components/common/icons/ActionIcons';
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import i18next from 'i18next'; import i18next from 'i18next';
import { Form as AntForm } from 'antd';
import { UsageRecordFilterContent } from '../../components/common/table/UsageRecordFilterCard';
import { Database, MessageSquareText, SlidersHorizontal } from 'lucide-react'; import { Database, MessageSquareText, SlidersHorizontal } from 'lucide-react';
import { import {
Table, Table,
@@ -26,6 +27,9 @@ import OrgPanel from './components/OrgPanel';
import OrgStateBlock from './components/OrgStateBlock'; import OrgStateBlock from './components/OrgStateBlock';
import { formatQuotaAsCNY } from './orgAuditFormat'; import { formatQuotaAsCNY } from './orgAuditFormat';
const recordTextClassName =
'min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-[13px] leading-5 text-gray-600 dark:text-gray-300';
const emptyFilters = { const emptyFilters = {
memberId: '', memberId: '',
modelName: '', modelName: '',
@@ -318,16 +322,9 @@ const OrgPromptRecords = ({ orgId }) => {
width: 170, width: 170,
render: (v) => ( render: (v) => (
<Tooltip content={v || '-'} position='top'> <Tooltip content={v || '-'} position='top'>
<Tag <span className={`block max-w-[154px] ${recordTextClassName}`}>
size='small'
color='violet'
type='light'
style={{ maxWidth: 154 }}
>
<span className='block overflow-hidden text-ellipsis whitespace-nowrap'>
{v || '-'} {v || '-'}
</span> </span>
</Tag>
</Tooltip> </Tooltip>
), ),
}, },
@@ -345,7 +342,7 @@ const OrgPromptRecords = ({ orgId }) => {
position='topLeft' position='topLeft'
style={{ maxWidth: 480 }} style={{ maxWidth: 480 }}
> >
<span className='min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-[13px] leading-5 text-gray-600 dark:text-gray-300'> <span className={`flex-1 ${recordTextClassName}`}>
{brief || '-'} {brief || '-'}
</span> </span>
</Tooltip> </Tooltip>
@@ -502,8 +499,8 @@ const OrgPromptRecords = ({ orgId }) => {
); );
return ( return (
<> <div className='oc-audit-stack'>
<div className='mb-4 mt-4 flex items-start gap-3 rounded-xl border border-brand/15 bg-brand/[0.045] px-4 py-3 text-xs leading-5 text-gray-600 dark:text-gray-300'> <div className='flex items-start gap-3 rounded-xl border border-brand/15 bg-brand/[0.045] px-4 py-3 text-xs leading-5 text-gray-600 dark:text-gray-300'>
<Database size={16} className='mt-0.5 flex-none text-brand' /> <Database size={16} className='mt-0.5 flex-none text-brand' />
<div> <div>
<div className='font-medium text-[var(--text-primary)]'> <div className='font-medium text-[var(--text-primary)]'>
@@ -525,74 +522,74 @@ const OrgPromptRecords = ({ orgId }) => {
? t('已应用 {{count}} 个筛选条件', { count: activeFilterCount }) ? t('已应用 {{count}} 个筛选条件', { count: activeFilterCount })
: t('可按成员、模型、关键词和时间范围组合查询') : t('可按成员、模型、关键词和时间范围组合查询')
} }
className='mb-4' className='usage-record-filter-card org-usage-filter-card'
padding='pt-4'
> >
<div className='grid grid-cols-1 items-end gap-3 sm:grid-cols-2 xl:grid-cols-[180px_180px_minmax(200px,1fr)_360px_auto]'> <UsageRecordFilterContent>
<label className='min-w-0'> <AntForm
<span className='mb-1.5 block text-xs text-gray-500 dark:text-gray-400'> layout='vertical'
{t('企业成员')} requiredMark={false}
</span> autoComplete='off'
className='usage-record-filter-form'
onFinish={applyFilter}
>
<div className='usage-record-filter-grid'>
<AntForm.Item
label={t('时间范围')}
htmlFor='org-prompts-start'
className='usage-record-filter-wide'
>
<DatePicker
id={{ start: 'org-prompts-start' }}
type='dateTimeRange'
value={timeRange}
onChange={setTimeRange}
placeholder={[t('开始时间'), t('结束时间')]}
/>
</AntForm.Item>
<AntForm.Item label={t('企业成员')} htmlFor='org-prompts-member'>
<Select <Select
id='org-prompts-member'
value={selectedMemberId} value={selectedMemberId}
onChange={setSelectedMemberId} onChange={setSelectedMemberId}
optionList={memberOptions} optionList={memberOptions}
placeholder={t('全部成员')} placeholder={t('全部成员')}
style={{ width: '100%' }}
loading={membersLoading} loading={membersLoading}
filter filter
/> />
</label> </AntForm.Item>
<label className='min-w-0'> <AntForm.Item label={t('模型')} htmlFor='org-prompts-model'>
<span className='mb-1.5 block text-xs text-gray-500 dark:text-gray-400'>
{t('模型')}
</span>
<Input <Input
id='org-prompts-model'
value={modelName} value={modelName}
onChange={setModelName} onChange={setModelName}
placeholder={t('输入模型名称')} placeholder={t('输入模型名称')}
showClear showClear
onEnterPress={applyFilter}
/> />
</label> </AntForm.Item>
<label className='min-w-0'> <AntForm.Item label={t('提示词')} htmlFor='org-prompts-keyword'>
<span className='mb-1.5 block text-xs text-gray-500 dark:text-gray-400'>
{t('提示词')}
</span>
<Input <Input
id='org-prompts-keyword'
value={keyword} value={keyword}
onChange={setKeyword} onChange={setKeyword}
placeholder={t('搜索提示词关键词')} placeholder={t('搜索提示词关键词')}
showClear showClear
onEnterPress={applyFilter}
/> />
</label> </AntForm.Item>
<label className='min-w-0 sm:col-span-2 xl:col-span-1'> </div>
<span className='mb-1.5 block text-xs text-gray-500 dark:text-gray-400'> <div className='usage-record-filter-actions'>
{t('时间范围')} <Button onClick={resetFilters}>{t('重置')}</Button>
</span>
<DatePicker
type='dateTimeRange'
density='compact'
value={timeRange}
onChange={setTimeRange}
placeholder={[t('开始时间'), t('结束时间')]}
style={{ width: '100%' }}
/>
</label>
<div className='flex flex-wrap gap-2 sm:col-span-2 xl:col-span-1 xl:flex-nowrap'>
<Button <Button
type='primary' type='primary'
htmlType='submit'
icon={<ActionSearch size={14} />} icon={<ActionSearch size={14} />}
onClick={applyFilter}
loading={loading || membersLoading} loading={loading || membersLoading}
> >
{t('查询')} {t('搜索')}
</Button>
<Button icon={<ActionRotateCcw size={14} />} onClick={resetFilters}>
{t('重置')}
</Button> </Button>
</div> </div>
</div> </AntForm>
</UsageRecordFilterContent>
</OrgPanel> </OrgPanel>
<OrgPanel <OrgPanel
@@ -652,7 +649,7 @@ const OrgPromptRecords = ({ orgId }) => {
} }
/> />
</OrgPanel> </OrgPanel>
</> </div>
); );
}; };
+12 -2
View File
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import React, { useCallback, useEffect, useMemo, useState } from 'react'; import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { import {
Button, Button,
@@ -118,7 +119,11 @@ const OrgSkillAssignments = ({ orgId, orgRole = '' }) => {
const response = await API.delete(`/api/org/skills/assignments/${id}`, { const response = await API.delete(`/api/org/skills/assignments/${id}`, {
headers, headers,
}); });
if (response.data?.success) await load(); if (!response.data?.success) {
Toast.error(response.data?.message || t('操作失败'));
return false;
}
await load();
}; };
// 指引步骤④「用预览验证」的完成态按组织持久化:preview 是会话内状态, // 指引步骤④「用预览验证」的完成态按组织持久化:preview 是会话内状态,
// 不落盘的话每次进页胶囊都会复活(与知识页 verified-key 同语义)。 // 不落盘的话每次进页胶囊都会复活(与知识页 verified-key 同语义)。
@@ -166,9 +171,14 @@ const OrgSkillAssignments = ({ orgId, orgRole = '' }) => {
{ {
title: t('操作'), title: t('操作'),
render: (_, row) => ( render: (_, row) => (
<Button type='danger' theme='borderless' onClick={() => remove(row.id)}> <TableActionPopconfirm
title={t('确认删除该分发规则?')}
onConfirm={() => remove(row.id)}
>
<Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</TableActionPopconfirm>
), ),
}, },
]; ];
+10
View File
@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import OrgPageHeader from './components/OrgPageHeader';
import OrgSubpageTabs from './components/OrgSubpageTabs'; import OrgSubpageTabs from './components/OrgSubpageTabs';
import OrgSkillLibrary from './OrgSkillLibrary'; import OrgSkillLibrary from './OrgSkillLibrary';
import OrgPrivateSkills from './OrgPrivateSkills'; import OrgPrivateSkills from './OrgPrivateSkills';
@@ -24,11 +25,16 @@ const OrgSkillCenter = ({
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<main className='uc-page oc-page org-skill-center-page'>
<OrgSubpageTabs <OrgSubpageTabs
renderHeader={({ label, subtitle }) => (
<OrgPageHeader title={label} subtitle={subtitle} />
)}
tabs={[ tabs={[
showLibrary && { showLibrary && {
key: 'library', key: 'library',
label: t('企业技能库'), label: t('企业技能库'),
subtitle: t('控制启用状态、版本锁定、紧急停用和企业展示定制。'),
// orgRole 用于识别平台超管(超市页解析不出其企业上下文,页内引入 // orgRole 用于识别平台超管(超市页解析不出其企业上下文,页内引入
// 抽屉是其唯一的"代客开通"入口);canAssignSkills 决定引入成功后的 // 抽屉是其唯一的"代客开通"入口);canAssignSkills 决定引入成功后的
// 指引指向哪里——超管的该权限位后端恒 false,不能让文案把人指向 // 指引指向哪里——超管的该权限位后端恒 false,不能让文案把人指向
@@ -44,10 +50,14 @@ const OrgSkillCenter = ({
showPrivate && { showPrivate && {
key: 'private', key: 'private',
label: t('企业自研 Skill'), label: t('企业自研 Skill'),
subtitle: t(
'版本内容不可变;兼容扫描、双人审核、发布、回滚与紧急停用均保留审计。',
),
node: <OrgPrivateSkills orgId={orgId} />, node: <OrgPrivateSkills orgId={orgId} />,
}, },
]} ]}
/> />
</main>
); );
}; };
+9 -18
View File
@@ -39,9 +39,8 @@ import OrgPanel from './components/OrgPanel';
import { StatusContext } from '../../context/Status'; import { StatusContext } from '../../context/Status';
import { normalizeSidebarModulesAdmin } from '../../constants/sidebarModules'; import { normalizeSidebarModulesAdmin } from '../../constants/sidebarModules';
import './org-skills.css'; import './org-skills.css';
import OrgBreadcrumb from './components/OrgBreadcrumb';
const { Title, Text, Paragraph } = Typography; const { Text, Paragraph } = Typography;
const jsonList = (value) => { const jsonList = (value) => {
try { try {
@@ -436,16 +435,8 @@ const OrgSkillLibrary = ({ orgId, orgRole, canAssignSkills = false }) => {
], ],
}); });
return ( return (
<main className='org-skills-page'> <div className='org-skill-center-content'>
<header className='org-skills-hero'> <div className='org-skill-center-actions'>
<div>
<OrgBreadcrumb current={t('企业技能库')} />
<Title heading={3}>{t('企业技能库')}</Title>
<Paragraph>
{t('控制启用状态、版本锁定、紧急停用和企业展示定制。')}
</Paragraph>
</div>
<div className='org-skills-hero-actions'>
{/* 页内引入:对平台超管这是唯一可用入口(超市页解析不出其企业上下文); {/* 页内引入:对平台超管这是唯一可用入口(超市页解析不出其企业上下文);
对普通管理员是就地快速添加。数据复用已加载的 catalog,不额外发请求。 */} 对普通管理员是就地快速添加。数据复用已加载的 catalog,不额外发请求。 */}
{canImport ? ( {canImport ? (
@@ -456,16 +447,12 @@ const OrgSkillLibrary = ({ orgId, orgRole, canAssignSkills = false }) => {
{/* 浏览完整平台目录(分页/搜索/分类)仍去超市页;超管在那里没有企业 {/* 浏览完整平台目录(分页/搜索/分类)仍去超市页;超管在那里没有企业
上下文,故不对其展示,避免点过去发现无法启用。 */} 上下文,故不对其展示,避免点过去发现无法启用。 */}
{selfEnableAllowed && !isPlatformSuperAdmin ? ( {selfEnableAllowed && !isPlatformSuperAdmin ? (
<Button <Button theme='borderless' onClick={() => navigate('/skill-market')}>
theme='borderless'
onClick={() => navigate('/skill-market')}
>
{t('浏览技能超市')} {t('浏览技能超市')}
</Button> </Button>
) : null} ) : null}
<PageGuideTrigger guide={guide} /> <PageGuideTrigger guide={guide} />
</div> </div>
</header>
<PageGuideDrawer guide={guide} /> <PageGuideDrawer guide={guide} />
{!loaded ? ( {!loaded ? (
<SkillEmptyGuide title={t('正在加载企业技能库')} /> <SkillEmptyGuide title={t('正在加载企业技能库')} />
@@ -513,6 +500,7 @@ const OrgSkillLibrary = ({ orgId, orgRole, canAssignSkills = false }) => {
} }
> >
<div className='org-skill-policy-row'> <div className='org-skill-policy-row'>
<div className='org-skill-policy-fields'>
<label> <label>
<Text>{t('启用')}</Text> <Text>{t('启用')}</Text>
<Switch <Switch
@@ -542,6 +530,8 @@ const OrgSkillLibrary = ({ orgId, orgRole, canAssignSkills = false }) => {
</Select.Option> </Select.Option>
</Select> </Select>
</label> </label>
</div>
<div className='org-skill-policy-actions'>
<Button <Button
type='danger' type='danger'
onClick={() => onClick={() =>
@@ -559,6 +549,7 @@ const OrgSkillLibrary = ({ orgId, orgRole, canAssignSkills = false }) => {
{t('内容派生')} {t('内容派生')}
</Button> </Button>
</div> </div>
</div>
</OrgPanel> </OrgPanel>
))} ))}
</section> </section>
@@ -816,7 +807,7 @@ const OrgSkillLibrary = ({ orgId, orgRole, canAssignSkills = false }) => {
)} )}
</div> </div>
</SideSheet> </SideSheet>
</main> </div>
); );
}; };
+18 -10
View File
@@ -1,3 +1,8 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import TableStatusSwitch from '@/components/common/table/TableStatusSwitch';
import TableGroupTags, {
TABLE_GROUP_COLUMN_WIDTH,
} from '@/components/common/table/TableGroupTags';
import { formatIdReference } from '../../helpers/safeDisplay'; import { formatIdReference } from '../../helpers/safeDisplay';
import { formatUserReference } from '../../helpers/safeDisplay'; import { formatUserReference } from '../../helpers/safeDisplay';
@@ -24,7 +29,6 @@ import {
Button, Button,
Input, Input,
Tag, Tag,
Popconfirm,
Toast, Toast,
Tooltip, Tooltip,
Spin, Spin,
@@ -192,6 +196,7 @@ const OrgTokens = ({ orgId, orgRole }) => {
fetch(page, pageSize); fetch(page, pageSize);
} }
} }
return ok;
}, },
[deleteToken, fetch, page, pageSize, t, tokens.length], [deleteToken, fetch, page, pageSize, t, tokens.length],
); );
@@ -368,13 +373,19 @@ const OrgTokens = ({ orgId, orgRole }) => {
title: t('分组'), title: t('分组'),
key: 'group', key: 'group',
dataIndex: 'group', dataIndex: 'group',
width: 150, width: TABLE_GROUP_COLUMN_WIDTH,
render: (group) => { render: (group) => {
// 空串表示未显式指定,调用时按成员/项目作用域默认分组解析(weiyuan 8d9caa881) // 空串表示未显式指定,调用时按成员/项目作用域默认分组解析(weiyuan 8d9caa881)
const label = group === 'auto' ? t('智能熔断') : group || t('默认分组'); const label = group === 'auto' ? t('智能熔断') : group || t('默认分组');
return ( return (
<Tooltip content={label}> <Tooltip content={label}>
<span className='oc-token-group'>{label}</span> <span>
<TableGroupTags
groups={group}
empty={<span className='oc-token-group'>{label}</span>}
renderLabel={(name) => (name === 'auto' ? t('智能熔断') : name)}
/>
</span>
</Tooltip> </Tooltip>
); );
}, },
@@ -413,11 +424,8 @@ const OrgTokens = ({ orgId, orgRole }) => {
}[status]; }[status];
return ( return (
<div className='oc-token-status'> <div className='oc-token-status'>
<Switch <TableStatusSwitch
size='small'
checked={rawStatus === 1} checked={rawStatus === 1}
checkedText={t('启用')}
uncheckedText={t('禁用')}
loading={togglingId === record.id} loading={togglingId === record.id}
disabled={!canOperateRow(record)} disabled={!canOperateRow(record)}
aria-label={`${record.name || ''}${t('启用状态')}`} aria-label={`${record.name || ''}${t('启用状态')}`}
@@ -513,15 +521,15 @@ const OrgTokens = ({ orgId, orgRole }) => {
<Button type='link' onClick={() => openEdit(record)}> <Button type='link' onClick={() => openEdit(record)}>
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定删除该密钥?')} title={t('确定删除该密钥?')}
content={t('删除后无法恢复')} content={t('删除后无法恢复')}
onConfirm={() => handleDelete(record.id)} onConfirm={() => handleDelete(record.id)}
> >
<Button type='link' danger> <Button size='small' type='link' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</OrgRowActions> </OrgRowActions>
); );
}, },
@@ -13,6 +13,7 @@ import { Card } from 'antd';
* @param {string} [className] 追加类名 * @param {string} [className] 追加类名
* @param {string} [padding] 内容内边距类,默认 'p-4';表格场景可传 'p-0' / 'p-2' * @param {string} [padding] 内容内边距类,默认 'p-4';表格场景可传 'p-0' / 'p-2'
* @param {string} [bodyClassName] 内容容器追加类名 * @param {string} [bodyClassName] 内容容器追加类名
* @param {boolean} [flush] 去除 Card 默认内边距,由内部 body 控制间距
*/ */
const OrgPanel = ({ const OrgPanel = ({
children, children,
@@ -23,12 +24,13 @@ const OrgPanel = ({
className = '', className = '',
padding = 'p-4', padding = 'p-4',
bodyClassName = '', bodyClassName = '',
flush = false,
}) => { }) => {
const hasHeader = title || actions; const hasHeader = title || actions;
return ( return (
<Card <Card
className={`org-panel ${className}`} className={`org-panel ${className}`}
styles={{ body: { padding: 24 } }} styles={{ body: { padding: flush ? 0 : 24 } }}
> >
{hasHeader && ( {hasHeader && (
<div className='flex items-start justify-between gap-3 flex-wrap border-b border-[var(--border-subtle)] px-5 py-3.5'> <div className='flex items-start justify-between gap-3 flex-wrap border-b border-[var(--border-subtle)] px-5 py-3.5'>
@@ -10,7 +10,7 @@ import { useSearchParams } from 'react-router-dom';
* tabs 数组允许传 falsy 项(站点级模块开关关掉的页签),会被过滤; * tabs 数组允许传 falsy 项(站点级模块开关关掉的页签),会被过滤;
* 只剩一个可见页签时不渲染页签条,直接铺内容,避免"单页签"的怪异观感。 * 只剩一个可见页签时不渲染页签条,直接铺内容,避免"单页签"的怪异观感。
*/ */
const OrgSubpageTabs = ({ tabs }) => { const OrgSubpageTabs = ({ tabs, renderHeader }) => {
const [searchParams, setSearchParams] = useSearchParams(); const [searchParams, setSearchParams] = useSearchParams();
const visible = (tabs || []).filter(Boolean); const visible = (tabs || []).filter(Boolean);
const requested = searchParams.get('tab'); const requested = searchParams.get('tab');
@@ -28,10 +28,19 @@ const OrgSubpageTabs = ({ tabs }) => {
setSearchParams(next, { replace: true }); setSearchParams(next, { replace: true });
}, [requested, activeKey, searchParams, setSearchParams]); }, [requested, activeKey, searchParams, setSearchParams]);
if (visible.length === 0) return null; if (visible.length === 0) return null;
if (visible.length === 1) return visible[0].node; const header = renderHeader?.(visible.find((item) => item.key === activeKey));
if (visible.length === 1)
return ( return (
<div className='org-subpage-tabs'> <>
{header}
{visible[0].node}
</>
);
return (
<div className={renderHeader ? undefined : 'org-subpage-tabs'}>
{header}
<Tabs <Tabs
className={renderHeader ? 'oc-list-tabs' : undefined}
type='line' type='line'
// 必须惰性渲染:Semi 默认 lazyRender=false 会把所有 TabPane 的 children // 必须惰性渲染:Semi 默认 lazyRender=false 会把所有 TabPane 的 children
// 立即挂载,于是两个子页会同时拉数、各自的 PageGuide 抽屉(SideSheet 走 // 立即挂载,于是两个子页会同时拉数、各自的 PageGuide 抽屉(SideSheet 走
@@ -4,7 +4,8 @@ import {
} from '@/components/common/icons/ActionIcons'; } from '@/components/common/icons/ActionIcons';
import TableEmpty from '../../../components/common/table/TableEmpty'; import TableEmpty from '../../../components/common/table/TableEmpty';
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { Card, Tag } from 'antd'; import { Tag } from 'antd';
import UsageRecordFilterCard from '../../../components/common/table/UsageRecordFilterCard';
import { Clock } from 'lucide-react'; import { Clock } from 'lucide-react';
import { Button, Table } from '@/components/ui'; import { Button, Table } from '@/components/ui';
import { useTaskLogsData } from '../../../hooks/task-logs/useTaskLogsData'; import { useTaskLogsData } from '../../../hooks/task-logs/useTaskLogsData';
@@ -187,10 +188,9 @@ const OrgTaskRecords = () => {
isVideo={true} isVideo={true}
/> />
{/* 原型移动端筛选卡直接展开(与“明细日志”页签一致),不设收起开关 */} <UsageRecordFilterCard className='org-usage-filter-card'>
<Card className='oc-filter-card oc-task-filter'>
<TaskLogsFilters {...taskLogsData} usageRecordMode /> <TaskLogsFilters {...taskLogsData} usageRecordMode />
</Card> </UsageRecordFilterCard>
<OrgListCard <OrgListCard
className='oc-task-list' className='oc-task-list'
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import React, { import React, {
useCallback, useCallback,
useEffect, useEffect,
@@ -10,7 +11,6 @@ import { ListChecks, ShieldPlus } from 'lucide-react';
import { import {
Button, Button,
Input, Input,
Popconfirm,
Select, Select,
Spin, Spin,
Switch, Switch,
@@ -149,12 +149,14 @@ const OrgDsRules = ({ orgId, isSuperAdmin }) => {
if (res.data.success) { if (res.data.success) {
Toast.success(t('删除成功')); Toast.success(t('删除成功'));
fetchRules(); fetchRules();
return true;
} else { } else {
showError(res.data.message || t('删除失败')); showError(res.data.message || t('删除失败'));
} }
} catch (err) { } catch (err) {
if (err?.name !== 'AxiosError') showError(err); if (err?.name !== 'AxiosError') showError(err);
} }
return false;
}; };
const platformColumns = [ const platformColumns = [
@@ -216,14 +218,14 @@ const OrgDsRules = ({ orgId, isSuperAdmin }) => {
<Button size='small' onClick={() => openEdit(rule)}> <Button size='small' onClick={() => openEdit(rule)}>
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确认删除该规则?删除后即时生效。')} title={t('确认删除该规则?删除后即时生效。')}
onConfirm={() => deleteRule(rule)} onConfirm={() => deleteRule(rule)}
> >
<Button size='small' type='danger'> <Button size='small' type='link' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</div> </div>
), ),
}, },
+152 -75
View File
@@ -1,116 +1,178 @@
/* 效能分析页样式对齐企业中心设计系统(控制台风格):
全部走主题 token,随亮/暗色主题与品牌色自适应,不再硬编码米黄/墨绿。 */
.org-effect-page { .org-effect-page {
display: grid; display: grid;
gap: 16px; grid-template-columns: minmax(0, 1fr);
padding: 16px;
color: var(--text-primary); color: var(--text-primary);
} }
@media (min-width: 640px) {
.org-effect-page {
padding: 24px;
}
}
@media (min-width: 1024px) {
.org-effect-page {
padding: 32px;
}
}
/* 控制台式页头:实底卡片 + 细边框(参考主流云厂商控制台) */ .org-effect-page > .uc-page-header {
.org-effect-hero { margin-bottom: 0;
display: flex;
align-items: end;
justify-content: space-between;
gap: 24px;
padding: 20px 24px;
border: 1px solid var(--border-subtle);
border-radius: 12px;
background: var(--surface-card);
}
/* 页头标题统一 20px/600(Semi Title 默认字号偏大) */
.org-effect-hero h1,
.org-effect-hero h2,
.org-effect-hero h3 {
font-size: 20px;
font-weight: 600;
line-height: 1.35;
} }
.org-effect-toolbar, .org-effect-toolbar,
.org-effect-form { .org-effect-drilldown {
display: flex; display: flex;
align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
gap: 10px; gap: 8px;
} }
.org-effect-form > * { .org-effect-toolbar .ant-select {
flex: 1 1 280px; min-width: 108px;
}
.org-effect-toolbar .ant-input-number,
.org-effect-drilldown .ant-input-number {
width: 110px;
}
.org-effect-drilldown label {
color: var(--text-secondary);
font-size: 13px;
}
.org-effect-grid,
.org-effect-columns {
display: grid;
gap: var(--uc-layout-gap);
} }
.org-effect-grid { .org-effect-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 14px;
} }
/* KPI 指标卡:云控制台常见的统计瓦片 */ .org-effect-card.ant-card {
.org-effect-card { min-width: 0;
border-color: var(--border-subtle);
border-radius: 10px;
background: var(--surface-card);
}
.org-effect-card > .ant-card-body {
display: grid; display: grid;
gap: 8px; gap: 8px;
min-height: 128px; padding: 20px 24px;
padding: 18px 20px;
border: 1px solid var(--border-subtle);
border-radius: 12px;
background: var(--surface-card);
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
transition:
border-color 0.2s ease,
box-shadow 0.2s ease;
} }
.org-effect-card:hover {
border-color: color-mix(in srgb, var(--ui-color-primary) 30%, transparent); .org-effect-card-label {
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08); display: flex;
align-items: center;
gap: 10px;
color: var(--text-secondary);
font-size: 14px;
overflow-wrap: anywhere;
}
.org-effect-card-icon {
display: grid;
flex: none;
width: 36px;
height: 36px;
place-items: center;
border-radius: 8px;
color: var(--ui-color-primary);
background: var(--ui-color-highlight-bg);
} }
.org-effect-card strong { .org-effect-card strong {
font-size: clamp(24px, 2.2vw, 30px); font-size: clamp(22px, 2.2vw, 28px);
font-weight: 600; font-weight: 650;
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
line-height: 1.1; line-height: 1.2;
overflow-wrap: anywhere;
}
.org-effect-card small,
.org-effect-direct-note,
.org-effect-reconcile dt {
color: var(--text-secondary);
} }
.org-effect-card small { .org-effect-card small {
color: var(--ui-color-text-2); font-size: 12px;
line-height: 18px;
}
.org-effect-direct-note {
margin: 0;
font-size: 13px;
line-height: 21px;
}
.org-effect-page .org-effect-direct-note + .ant-table-wrapper {
margin-top: 16px;
} }
.org-effect-columns { .org-effect-columns {
display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
grid-template-columns: minmax(260px, 0.75fr) minmax(420px, 1.25fr); }
gap: 16px;
.org-effect-page .oc-list-card {
min-width: 0;
align-self: start;
}
.org-effect-page .org-effect-columns > .oc-list-card {
height: 100%;
}
.org-center .org-effect-page > .oc-list-card + .oc-list-card,
.org-center
.org-effect-page
.org-effect-columns
> .oc-list-card
+ .oc-list-card {
margin-top: 0;
}
.org-effect-page .oc-list-toolbar h2 {
white-space: normal;
overflow-wrap: anywhere;
} }
.org-effect-reconcile { .org-effect-reconcile {
display: grid; display: grid;
grid-template-columns: 1fr auto; margin: 0;
gap: 14px; font-size: 13px;
font-size: 14px;
} }
.org-effect-reconcile b { .org-effect-reconcile > div {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
padding: 12px 0;
border-bottom: 1px solid var(--border-subtle);
}
.org-effect-reconcile > div:first-child {
padding-top: 0;
}
.org-effect-reconcile > div:last-child {
padding-bottom: 0;
border-bottom: 0;
}
.org-effect-reconcile dd {
margin: 0;
font-size: 16px;
font-weight: 600;
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
} }
.org-effect-reconcile .is-ok { .org-effect-reconcile .is-ok {
color: var(--ui-color-success); color: var(--ui-color-success, var(--ant-color-success));
font-weight: 600;
} }
.org-effect-reconcile .is-risk { .org-effect-reconcile .is-risk {
color: var(--ui-color-danger); color: var(--ui-color-danger, var(--ant-color-error));
font-weight: 600;
} }
.org-effect-samples { .org-effect-samples {
display: grid; display: grid;
gap: 7px; gap: 8px;
max-height: 320px; max-height: 320px;
overflow: auto; overflow: auto;
} }
@@ -125,7 +187,7 @@
gap: 8px; gap: 8px;
padding: 14px; padding: 14px;
border: 1px solid var(--border-subtle); border: 1px solid var(--border-subtle);
border-radius: 12px; border-radius: 10px;
background: var(--surface-card); background: var(--surface-card);
} }
@@ -133,25 +195,40 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
gap: 10px; gap: 8px;
}
.org-effect-form {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.org-effect-form .ant-input-number {
width: 100%;
} }
@media (max-width: 960px) { @media (max-width: 960px) {
.org-effect-grid { .org-effect-grid {
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));
} }
.org-effect-columns { .org-effect-columns {
grid-template-columns: 1fr; grid-template-columns: minmax(0, 1fr);
} }
} }
@media (max-width: 640px) { @media (max-width: 640px) {
.org-effect-hero { .org-effect-grid,
align-items: stretch; .org-effect-form {
flex-direction: column; grid-template-columns: minmax(0, 1fr);
padding: 16px 18px;
} }
.org-effect-grid {
grid-template-columns: 1fr; .org-effect-card > .ant-card-body {
padding: 16px;
}
.org-effect-page .oc-list-tools {
justify-content: flex-start;
} }
} }
+48 -2
View File
@@ -19,6 +19,52 @@
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px; gap: 12px;
} }
.org-skill-center-content {
display: grid;
grid-template-columns: minmax(0, 1fr);
min-width: 0;
gap: var(--uc-layout-gap);
}
.org-skill-center-content .page-guide-pill {
justify-self: start;
max-width: 100%;
white-space: normal;
}
.org-skill-center-actions,
.org-skill-policy-fields,
.org-skill-policy-actions,
.org-private-skill-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
}
.org-skill-center-actions,
.org-skill-policy-actions {
justify-content: flex-end;
}
.org-skill-center-content .org-skill-policy-row {
justify-content: space-between;
}
.org-skill-center-content .org-skill-policy-fields {
align-items: end;
gap: 16px;
}
.org-private-skill-editor label {
display: grid;
min-width: 0;
gap: 6px;
}
.org-private-skill-editor label > span:first-child {
color: var(--text-primary);
font-weight: 500;
}
.org-private-skill-editor > label > :is(input, textarea) {
min-width: 0;
}
.org-private-skill-body {
grid-column: 1 / -1;
}
.org-skill-mobile-list { .org-skill-mobile-list {
display: grid; display: grid;
gap: 12px; gap: 12px;
@@ -173,7 +219,7 @@
gap: 10px; gap: 10px;
padding: 12px 14px; padding: 12px 14px;
border: 1px solid var(--border-subtle); border: 1px solid var(--border-subtle);
border-radius: 12px; border-radius: 8px;
background: var(--surface-card); background: var(--surface-card);
transition: border-color 0.2s ease; transition: border-color 0.2s ease;
} }
@@ -184,7 +230,7 @@
display: grid; display: grid;
gap: 2px; gap: 2px;
min-width: 0; min-width: 0;
flex: 1 1 220px; flex: 1 1 160px;
} }
/* 技能标识可能很长,必须截断而不是把行撑破 */ /* 技能标识可能很长,必须截断而不是把行撑破 */
.org-skill-import-main > * { .org-skill-import-main > * {
+6 -4
View File
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { useEffectEvent } from '../../hooks/common/useEffectEvent'; import { useEffectEvent } from '../../hooks/common/useEffectEvent';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { import {
@@ -9,7 +10,6 @@ import {
Card, Card,
Typography, Typography,
Tag, Tag,
Popconfirm,
} from '@/components/ui'; } from '@/components/ui';
import { IconPlus } from '@/components/ui/icons'; import { IconPlus } from '@/components/ui/icons';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@@ -101,14 +101,14 @@ const AmountOptionsManager = ({
<Button onClick={() => handleEdit(record)} type='link' size='small'> <Button onClick={() => handleEdit(record)} type='link' size='small'>
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定删除该档位吗?')} title={t('确定删除该档位吗?')}
onConfirm={() => handleDelete(record.id)} onConfirm={() => handleDelete(record.id)}
> >
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
width: 150, width: 150,
@@ -121,7 +121,7 @@ const AmountOptionsManager = ({
const handleDelete = async (id) => { const handleDelete = async (id) => {
const newOptions = options.filter((opt) => opt.id !== id); const newOptions = options.filter((opt) => opt.id !== id);
await saveOptions(newOptions); return saveOptions(newOptions);
}; };
const handleAdd = () => { const handleAdd = () => {
@@ -171,12 +171,14 @@ const AmountOptionsManager = ({
if (res.data.success) { if (res.data.success) {
showSuccess(t('保存成功')); showSuccess(t('保存成功'));
loadOptions(); loadOptions();
return true;
} else { } else {
showError(res.data.message); showError(res.data.message);
} }
} catch (error) { } catch (error) {
showError(t('保存失败')); showError(t('保存失败'));
} }
return false;
}; };
return ( return (
+6 -5
View File
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { useEffectEvent } from '../../../hooks/common/useEffectEvent'; import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { Button as AntButton } from 'antd'; import { Button as AntButton } from 'antd';
@@ -300,14 +301,14 @@ export default function SettingsChats(props) {
> >
{t('编辑')} {t('编辑')}
</AntButton> </AntButton>
<AntButton <TableActionPopconfirm
type='link' title={t('确认删除')}
danger onConfirm={() => handleDeleteConfig(record.id)}
size='small'
onClick={() => handleDeleteConfig(record.id)}
> >
<AntButton type='link' danger size='small'>
{t('删除')} {t('删除')}
</AntButton> </AntButton>
</TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -1,3 +1,4 @@
import TableActionModal from '@/components/common/table/TableActionModal';
import { import {
Plus as ActionPlus, Plus as ActionPlus,
Trash2 as ActionTrash2, Trash2 as ActionTrash2,
@@ -476,7 +477,7 @@ const SettingsAPIInfo = ({ options, refresh }) => {
</Form> </Form>
</Modal> </Modal>
<Modal <TableActionModal
title={t('确认删除')} title={t('确认删除')}
visible={showDeleteModal} visible={showDeleteModal}
onOk={confirmDeleteApi} onOk={confirmDeleteApi}
@@ -487,13 +488,9 @@ const SettingsAPIInfo = ({ options, refresh }) => {
okText={t('确认删除')} okText={t('确认删除')}
cancelText={t('取消')} cancelText={t('取消')}
type='warning' type='warning'
okButtonProps={{
type: 'danger',
theme: 'solid',
}}
> >
<Text>{t('确定要删除此API信息吗?')}</Text> <Text>{t('确定要删除此API信息吗?')}</Text>
</Modal> </TableActionModal>
</> </>
); );
}; };
@@ -1,3 +1,4 @@
import TableActionModal from '@/components/common/table/TableActionModal';
import { import {
Plus as ActionPlus, Plus as ActionPlus,
Trash2 as ActionTrash2, Trash2 as ActionTrash2,
@@ -569,7 +570,7 @@ const SettingsAnnouncements = ({ options, refresh }) => {
</Form> </Form>
</Modal> </Modal>
<Modal <TableActionModal
title={t('确认删除')} title={t('确认删除')}
visible={showDeleteModal} visible={showDeleteModal}
onOk={confirmDeleteAnnouncement} onOk={confirmDeleteAnnouncement}
@@ -580,13 +581,9 @@ const SettingsAnnouncements = ({ options, refresh }) => {
okText={t('确认删除')} okText={t('确认删除')}
cancelText={t('取消')} cancelText={t('取消')}
type='warning' type='warning'
okButtonProps={{
type: 'danger',
theme: 'solid',
}}
> >
<Text>{t('确定要删除此公告吗?')}</Text> <Text>{t('确定要删除此公告吗?')}</Text>
</Modal> </TableActionModal>
{/* 公告内容放大编辑 Modal */} {/* 公告内容放大编辑 Modal */}
<Modal <Modal
+3 -6
View File
@@ -1,3 +1,4 @@
import TableActionModal from '@/components/common/table/TableActionModal';
import { import {
Plus as ActionPlus, Plus as ActionPlus,
Trash2 as ActionTrash2, Trash2 as ActionTrash2,
@@ -452,7 +453,7 @@ const SettingsFAQ = ({ options, refresh }) => {
</Form> </Form>
</Modal> </Modal>
<Modal <TableActionModal
title={t('确认删除')} title={t('确认删除')}
visible={showDeleteModal} visible={showDeleteModal}
onOk={confirmDeleteFaq} onOk={confirmDeleteFaq}
@@ -463,13 +464,9 @@ const SettingsFAQ = ({ options, refresh }) => {
okText={t('确认删除')} okText={t('确认删除')}
cancelText={t('取消')} cancelText={t('取消')}
type='warning' type='warning'
okButtonProps={{
type: 'danger',
theme: 'solid',
}}
> >
<Text>{t('确定要删除此问答吗?')}</Text> <Text>{t('确定要删除此问答吗?')}</Text>
</Modal> </TableActionModal>
</> </>
); );
}; };
@@ -1,3 +1,4 @@
import TableActionModal from '@/components/common/table/TableActionModal';
import { import {
Plus as ActionPlus, Plus as ActionPlus,
Trash2 as ActionTrash2, Trash2 as ActionTrash2,
@@ -485,7 +486,7 @@ const SettingsUptimeKuma = ({ options, refresh }) => {
</Form> </Form>
</Modal> </Modal>
<Modal <TableActionModal
title={t('确认删除')} title={t('确认删除')}
visible={showDeleteModal} visible={showDeleteModal}
onOk={confirmDeleteGroup} onOk={confirmDeleteGroup}
@@ -496,13 +497,9 @@ const SettingsUptimeKuma = ({ options, refresh }) => {
okText={t('确认删除')} okText={t('确认删除')}
cancelText={t('取消')} cancelText={t('取消')}
type='warning' type='warning'
okButtonProps={{
type: 'danger',
theme: 'solid',
}}
> >
<Text>{t('确定要删除此分类吗?')}</Text> <Text>{t('确定要删除此分类吗?')}</Text>
</Modal> </TableActionModal>
</> </>
); );
}; };
@@ -1,3 +1,5 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import TableStatusSwitch from '@/components/common/table/TableStatusSwitch';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { import {
Button, Button,
@@ -6,11 +8,9 @@ import {
Input, Input,
InputNumber, InputNumber,
Modal, Modal,
Popconfirm,
Row, Row,
Space, Space,
Spin, Spin,
Switch,
Table, Table,
Tag, Tag,
Typography, Typography,
@@ -267,7 +267,7 @@ export default function SettingImagePricing({ options, refresh }) {
const remove = async (index) => { const remove = async (index) => {
const next = configs.filter((_, configIndex) => configIndex !== index); const next = configs.filter((_, configIndex) => configIndex !== index);
await save(next); return save(next);
}; };
const toggle = async (index, enabled) => { const toggle = async (index, enabled) => {
@@ -323,7 +323,7 @@ export default function SettingImagePricing({ options, refresh }) {
dataIndex: 'enabled', dataIndex: 'enabled',
key: 'enabled', key: 'enabled',
render: (enabled, _record, index) => ( render: (enabled, _record, index) => (
<Switch <TableStatusSwitch
checked={enabled !== false} checked={enabled !== false}
onChange={(checked) => toggle(index, checked)} onChange={(checked) => toggle(index, checked)}
aria-label={t('启用图片分档计费')} aria-label={t('启用图片分档计费')}
@@ -344,14 +344,14 @@ export default function SettingImagePricing({ options, refresh }) {
> >
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定删除此图片定价配置吗?')} title={t('确定删除此图片定价配置吗?')}
onConfirm={() => remove(index)} onConfirm={() => remove(index)}
> >
<Button aria-label={t('删除')} type='link' size='small' danger> <Button aria-label={t('删除')} type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { useEffectEvent } from '../../../hooks/common/useEffectEvent'; import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { import {
@@ -178,12 +179,14 @@ const SettingModelCategory = () => {
if (success) { if (success) {
showSuccess(t('删除成功')); showSuccess(t('删除成功'));
await loadCategories(); await loadCategories();
return true;
} else { } else {
showError(message || t('删除失败')); showError(message || t('删除失败'));
} }
} catch (error) { } catch (error) {
showError(t('删除失败: {{message}}', { message: error.message })); showError(t('删除失败: {{message}}', { message: error.message }));
} }
return false;
}; };
// 重置分类 // 重置分类
@@ -236,7 +239,7 @@ const SettingModelCategory = () => {
> >
{t('修改')} {t('修改')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定要删除这个分类吗?')} title={t('确定要删除这个分类吗?')}
content={t('删除前请确保已删除其下的所有二级分类')} content={t('删除前请确保已删除其下的所有二级分类')}
onConfirm={() => handleDelete(record.id)} onConfirm={() => handleDelete(record.id)}
@@ -246,7 +249,7 @@ const SettingModelCategory = () => {
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -286,7 +289,7 @@ const SettingModelCategory = () => {
> >
{t('修改')} {t('修改')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定要删除这个分类吗?')} title={t('确定要删除这个分类吗?')}
content={t('此操作不可恢复')} content={t('此操作不可恢复')}
onConfirm={() => handleDelete(record.id)} onConfirm={() => handleDelete(record.id)}
@@ -296,7 +299,7 @@ const SettingModelCategory = () => {
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js'; import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { import {
@@ -9,7 +10,6 @@ import {
Table, Table,
Modal, Modal,
Tag, Tag,
Popconfirm,
Space, Space,
Input, Input,
InputNumber, InputNumber,
@@ -361,14 +361,14 @@ export default function SettingVideoModel(props) {
> >
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定要删除此定价配置吗?')} title={t('确定要删除此定价配置吗?')}
onConfirm={() => handleDeletePricing(index)} onConfirm={() => handleDeletePricing(index)}
> >
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },
@@ -442,14 +442,14 @@ export default function SettingVideoModel(props) {
> >
{t('编辑')} {t('编辑')}
</Button> </Button>
<Popconfirm <TableActionPopconfirm
title={t('确定要删除此模型吗?')} title={t('确定要删除此模型吗?')}
onConfirm={() => handleDeleteModel(index)} onConfirm={() => handleDeleteModel(index)}
> >
<Button type='link' size='small' danger> <Button type='link' size='small' danger>
{t('删除')} {t('删除')}
</Button> </Button>
</Popconfirm> </TableActionPopconfirm>
</Space> </Space>
), ),
}, },

Some files were not shown because too many files have changed in this diff Show More