PingChuan
|
2865970f01
|
fix: 修复从react 引入 useRevalidator的问题,改为从remix引入
|
2025-11-29 10:54:56 +08:00 |
|
PingChuan
|
3162573128
|
fix:修复文件上传从react导入useRevalidator错误,改为从remix导入
|
2025-11-29 10:48:20 +08:00 |
|
LiangShiyong
|
30e100ef3e
|
feat: 1. 本地化思源黑体的字体包并优先使用。
2. 添加权限映射表和全局查看权限的hook,便于路由控制不同权限按钮显示/隐藏。
3. 删除评查点分组的部分旧api方法。
4. 对接评查点分组接口,文档类型接口, 提示词管理接口, 入口模块管理的接口。
5. 优化角色权限管理的接口,完善不用地区的访问权限认证。
6. 优化主页交叉评查和设置的入口样式和布局。
7. 优化评查点分组,评查规则的功能权限校验。
|
2025-11-29 10:37:35 +08:00 |
|
PingChuan
|
61facf5d71
|
feat:组装UNO命令实现特定页面搜索替换功能
|
2025-11-28 15:44:05 +08:00 |
|
PingChuan
|
4b53e214ab
|
feat:完善Collabora组件实现高亮特定文本并跳转页面逻辑
|
2025-11-27 19:10:00 +08:00 |
|
PingChuan
|
f2714360d3
|
feat:完成清除高亮脚本封装
|
2025-11-27 16:13:51 +08:00 |
|
LiangShiyong
|
d5827a2146
|
fix: 1. 接入入口模块的管理接口,优化样式。
2. 将查看文档评查结果详情对接接口,采用接口的方式进行查询。
|
2025-11-26 23:37:14 +08:00 |
|
LiangShiyong
|
ae24b82384
|
Merge branch 'Wren' into shiy-login
|
2025-11-26 19:11:57 +08:00 |
|
LiangShiyong
|
9a1a78d578
|
fix: 删除冗余文件
|
2025-11-26 19:11:45 +08:00 |
|
TanWenyan
|
e4e1757977
|
fix: 修复首页统计数据字段映射错误
修正后端API字段名称:
- pass_rate_growth → monthly_pass_rate_growth
- issues_detected → monthly_detected_issues
- issues_growth → monthly_issues_growth
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-26 18:55:46 +08:00 |
|
LiangShiyong
|
e9e2934c4e
|
Merge branch 'Wren' into shiy-login
|
2025-11-26 18:05:24 +08:00 |
|
LiangShiyong
|
1b0108e518
|
fix: 1. 系统设置入口进来只会跳转到拥有权限访问的页面。
2. 优化登录样式
|
2025-11-26 18:05:15 +08:00 |
|
TanWenyan
|
c491ad228c
|
chore: 删除RBAC Mock API路由和数据
删除以下Mock文件(已迁移到真实后端API):
- api.v3.rbac.roles._index.tsx
- api.v3.rbac.roles.$roleId.tsx
- api.v3.rbac.roles.$roleId.users.tsx
- api.v3.rbac.users.$userId.roles.tsx
- api.v3.rbac.users.$userId.roles.$roleId.tsx
- rbac-mock-data.server.ts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-26 17:08:11 +08:00 |
|
TanWenyan
|
1e9e0044ba
|
feat: 角色权限管理v3.0及错误处理优化
1. 角色权限管理升级:
- 添加路由下展开式API权限管理功能
- 新增 getRoleRoutesWithPermissions 和 saveRoleApiPermissions API
- 支持按路由展开/收起查看和勾选权限
- 过滤"所有权限"选项,只显示具体权限
2. 错误处理优化:
- 403 无权限错误显示为"无权限访问该资源"
- 修复评查点分组批量删除显示"成功删除 undefined 个分组"的问题
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-26 17:04:18 +08:00 |
|
TanWenyan
|
5073090bcb
|
feat: 添加 403 无权限弹窗提示
## 修改内容
在 axios 响应拦截器中添加 403 Forbidden 错误处理:
- 检测到 403 状态码时,显示 toast 警告提示
- 提示信息:"无权限访问该资源"
- 只在客户端环境显示,服务端不显示 toast
## 代码位置
- app/api/axios-client.ts:177-185
## 实现
```typescript
// 🔒 403 无权限错误处理
if (isAxiosError(error) && error.response?.status === 403) {
console.warn('⚠️ [403 Forbidden] 无权限访问:', error.config?.url);
// 只在客户端显示 toast 提示
if (typeof window !== 'undefined') {
toastService.warning('无权限访问该资源');
}
}
```
## 用户体验
- 用户访问无权限资源时,右上角显示黄色警告 toast
- toast 自动消失,不阻塞用户操作
- 控制台同时输出警告日志便于调试
|
2025-11-26 12:13:44 +08:00 |
|
LiangShiyong
|
efbf78246f
|
Merge branch 'Wren' into shiy-login
|
2025-11-26 10:49:26 +08:00 |
|
LiangShiyong
|
fe75b4fabd
|
feat: 1. 将交叉评查转移在入口页。
2. 交叉评查渲染的pdf预览组件复用评查点详情的,同时在评查结果中的数据也添加坐标信息。
|
2025-11-26 10:49:15 +08:00 |
|
TanWenyan
|
da7e565bbb
|
fix(evaluation-groups): 修复 Authorization 头缺失问题
## 问题
GET 和 DELETE 请求在 token 为 undefined 时,传递空对象 `{}` 作为 headers,导致 axios-client 拦截器无法自动添加 Authorization 头。
## 根本原因
```typescript
// ❌ 错误写法
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
```
当 token 为 undefined 时,传递的是空对象 `{}`,axios-client 认为已经提供了 headers,就跳过拦截器。
## 修复方案
```typescript
// ✅ 正确写法
...(token ? { headers: { 'Authorization': `Bearer ${token}` } } : {})
```
当 token 为 undefined 时,完全不传 headers 参数,让 axios-client 拦截器自动添加。
## 修复的函数
1. ✅ getEvaluationPointGroups (GET)
2. ✅ getAllEvaluationPointGroups (GET)
3. ✅ getEvaluationPointGroup (GET)
4. ✅ getEvaluationPointGroupChildren (GET)
5. ✅ deleteEvaluationPointGroup (DELETE)
## 未修复的函数(无需修复)
- createEvaluationPointGroup (POST) - headers 总是包含 Content-Type
- updateEvaluationPointGroup (PUT) - headers 总是包含 Content-Type
- batchUpdateEvaluationPointGroupStatus (PATCH) - headers 总是包含 Content-Type
- batchDeleteEvaluationPointGroups (DELETE) - headers 总是包含 Content-Type
POST/PUT/PATCH 请求因为总是需要设置 Content-Type,所以 headers 对象总是存在,拦截器会正常工作。
## 影响
修复后,即使 token 参数为 undefined,axios-client 拦截器也能正常添加 Authorization 头。
## 文件
- app/api/evaluation_points/rule-groups.ts
## 相关日志
解决了控制台警告:
⚠️ [apiRequest] 请求缺少 Authorization 头!headers:
|
2025-11-26 10:37:36 +08:00 |
|
TanWenyan
|
bd3b6de9cd
|
debug(evaluation-groups): 添加 getEvaluationPointGroups 调试日志
## 修改内容
在 getEvaluationPointGroups 函数中添加详细的调试日志,用于排查数据获取问题:
### 新增调试日志
- 📦 打印完整 API 响应
- 📊 打印 response.data 和 response.data.data
- ❌ 错误日志增强
- ✅ 转换成功后打印结果
### 日志输出点
1. API 响应完整数据
2. response.data 检查
3. response.data.data 存在性验证
4. 数据转换后的 ruleGroups
5. 错误捕获和详细错误信息
### 目的
帮助诊断以下问题:
- 后端返回数据格式是否正确
- response.data.data 是否存在
- 数据转换是否成功
- 前端为什么没有显示数据
### 文件
- app/api/evaluation_points/rule-groups.ts:1207-1225
⚠️ 注意:这是临时调试日志,问题解决后应该移除或注释掉
|
2025-11-26 10:23:01 +08:00 |
|
TanWenyan
|
e7646d17a6
|
fix(evaluation-groups): 修复一级分组显示错误和 React key 警告
## 修复内容
### 1. 修复一级分组过滤问题
- **问题**: getEvaluationPointGroups 函数忽略了 pid 参数,导致返回所有分组(包括二级分组)
- **修复**: 添加 pid 参数处理逻辑,支持传递 "null" 字符串来查询一级分组
- **文件**: app/api/evaluation_points/rule-groups.ts:1186-1198
### 2. 修复 React key 重复警告
- **问题**: 父分组和子分组可能有相同的 ID,导致 "Encountered two children with the same key" 警告
- **修复**: 将 rowKey 从简单的 "id" 改为根据 isParent 生成唯一 key
- **文件**: app/routes/rule-groups._index.tsx:817
### 3. 新增后端 API 规范文档
- **文件**: docs/evaluation/evaluation_point_groups_backend_api_spec.md
- **内容**:
- 完整的 9 个 FastAPI v3 接口规范
- Python Pydantic 模型定义
- TypeScript 接口定义
- pid 参数处理说明(字符串 "null" 转换为 None)
- 10 个完整测试用例
- 数据库表结构建议
## 技术细节
**pid 参数处理**:
```typescript
// 前端发送
GET /api/v3/evaluation-point-groups?pid=null&page=1
// 后端需要识别字符串 "null" 并转换为 None/NULL
if (pid == "null") {
query = query.filter(EvaluationPointGroup.pid.is_(None))
}
```
**唯一 key 生成**:
```typescript
rowKey={(record) => record.isParent ? `parent-${record.id}` : `child-${record.id}`}
```
🔗 相关文档: docs/evaluation/evaluation_point_groups_backend_api_spec.md
|
2025-11-26 10:05:39 +08:00 |
|
TanWenyan
|
d1f764028c
|
Merge branch 'shiy-login' into Wren
|
2025-11-25 20:59:59 +08:00 |
|
LiangShiyong
|
63857b3431
|
fix: 1.提交pdf预览的组件
|
2025-11-25 20:52:43 +08:00 |
|
LiangShiyong
|
83f8d80e12
|
合并代码
|
2025-11-25 20:50:34 +08:00 |
|
LiangShiyong
|
e01d8be5fa
|
Merge branch 'PingChuan' into shiy-login
|
2025-11-25 20:45:49 +08:00 |
|
PingChuan
|
a5cf3bc948
|
temp:备份代码
|
2025-11-25 20:45:41 +08:00 |
|
TanWenyan
|
0e812ba181
|
fix(rule-groups): 修复 getChildGroups 函数使用 FastAPI v3 接口
问题:
- getChildGroups 函数内部仍在调用已重命名的 getRuleGroups 函数
- 导致运行时错误:"getRuleGroups is not defined"
- 影响子分组加载功能
修复:
- 更新 getChildGroups 使用 FastAPI v3 的 getEvaluationPointGroupChildren
- 删除手动统计评查点数量的代码(FastAPI v3 接口已返回 rule_count)
- 简化函数逻辑,直接返回接口数据
影响范围:
- app/api/evaluation_points/rule-groups.ts (getChildGroups 函数)
功能:
- 获取子分组列表及评查点数量
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 20:39:11 +08:00 |
|
TanWenyan
|
02658b77b2
|
fix(document-types): 修复构建错误 - 替换为 FastAPI v3 接口
问题:
- document-types.new.tsx 仍在使用已重命名的 getAllRuleGroups 函数
- 导致构建失败:"getAllRuleGroups" is not exported
修复:
- getAllRuleGroups → getAllEvaluationPointGroups
- 传递正确的参数:includeDisabled=false, withRuleCount=true
影响范围:
- app/routes/document-types.new.tsx (文档类型创建/编辑页面)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 20:24:24 +08:00 |
|
TanWenyan
|
dbc9512c8b
|
refactor(rule-groups): 替换创建/编辑页面为 FastAPI v3 接口
变更内容:
1. 补充重命名 getRuleGroup → getRuleGroup_legacy (rule-groups.ts)
2. 更新导入语句,使用新的 FastAPI v3 函数 (rule-groups.new.tsx)
3. 替换所有函数调用:
- getRuleGroups → getEvaluationPointGroups (2处)
- getRuleGroup → getEvaluationPointGroup
- createRuleGroup → createEvaluationPointGroup
- updateRuleGroup → updateEvaluationPointGroup
影响范围:
- app/api/evaluation_points/rule-groups.ts (补充遗漏的重命名)
- app/routes/rule-groups.new.tsx (创建/编辑页面)
功能:
- 分组创建、编辑、编码唯一性验证
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 20:20:52 +08:00 |
|
TanWenyan
|
ef8b843dc5
|
refactor(rule-groups): 替换列表页面为 FastAPI v3 接口
变更内容:
- 更新导入语句,使用新的 FastAPI v3 函数
- getRuleGroups → getEvaluationPointGroups
- deleteRuleGroup → deleteEvaluationPointGroup
- batchUpdateRuleGroupStatus → batchUpdateEvaluationPointGroupStatus
- batchDeleteRuleGroups → batchDeleteEvaluationPointGroups
影响范围:
- app/routes/rule-groups._index.tsx(评查点分组列表页面)
功能:
- 列表查询、删除、批量启用/禁用、批量删除
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 20:17:39 +08:00 |
|
TanWenyan
|
ccb33e9b11
|
refactor(rule-groups): 重命名旧 PostgREST 函数为 _legacy 后缀
重命名函数(保留作为备份):
1. getRuleGroups → getRuleGroups_legacy
2. getAllRuleGroups → getAllRuleGroups_legacy
3. createRuleGroup → createRuleGroup_legacy
4. updateRuleGroup → updateRuleGroup_legacy
5. deleteRuleGroup → deleteRuleGroup_legacy
6. batchUpdateRuleGroupStatus → batchUpdateRuleGroupStatus_legacy
7. batchDeleteRuleGroups → batchDeleteRuleGroups_legacy
变更:
- 所有旧函数添加 _legacy 后缀
- 添加 @deprecated 注释指向新的 FastAPI v3 函数
- 保留旧函数作为备份,不删除
目的:
- 为过渡到 FastAPI v3 接口做准备
- 保留旧代码以便回滚
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 20:14:53 +08:00 |
|
TanWenyan
|
d5a7674a9a
|
feat(rule-groups): 添加 FastAPI v3 评查点分组接口函数
新增功能:
- 添加 9 个 FastAPI v3 接口函数到 rule-groups.ts
- 导入 apiRequest 用于调用后端 API
接口列表:
1. getEvaluationPointGroups - 获取一级分组列表 (GET /api/v3/evaluation-point-groups)
2. getAllEvaluationPointGroups - 获取树形结构 (GET /api/v3/evaluation-point-groups/all)
3. getEvaluationPointGroup - 获取单个分组详情 (GET /api/v3/evaluation-point-groups/{id})
4. getEvaluationPointGroupChildren - 获取子分组列表 (GET /api/v3/evaluation-point-groups/{parent_id}/children)
5. createEvaluationPointGroup - 创建分组 (POST /api/v3/evaluation-point-groups)
6. updateEvaluationPointGroup - 更新分组 (PUT /api/v3/evaluation-point-groups/{id})
7. deleteEvaluationPointGroup - 删除分组 (DELETE /api/v3/evaluation-point-groups/{id})
8. batchUpdateEvaluationPointGroupStatus - 批量更新状态 (PATCH /api/v3/evaluation-point-groups/batch/status)
9. batchDeleteEvaluationPointGroups - 批量删除 (DELETE /api/v3/evaluation-point-groups/batch)
技术细节:
- 新增 EvaluationPointGroupResponse 接口定义响应格式
- 新增 convertApiGroupToRuleGroup 转换函数
- 所有函数支持 JWT token 认证
- 统一的错误处理和日志输出
- 保留旧的 PostgREST 函数作为备份
相关文档:
- docs/evaluation/evaluation_point_groups.md
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 20:10:30 +08:00 |
|
LiangShiyong
|
b4034cc0e8
|
Merge branch 'PingChuan' into shiy-login
|
2025-11-25 19:26:49 +08:00 |
|
PingChuan
|
ba83796a44
|
feat:移除无用的UNO封装代码
|
2025-11-25 18:58:58 +08:00 |
|
LiangShiyong
|
fbf741bca9
|
Merge branch 'Wren' into shiy-login
|
2025-11-25 18:47:46 +08:00 |
|
TanWenyan
|
87a1bf87e5
|
fix(axios-client): 修复 code 字段类型判断导致的误报错误
问题:
- axios-client 检查 API 响应中的 code 字段时,没有区分数字类型和字符串类型
- 当后端返回包含业务编码字段 code: "05PZSYTZSNRYZX" 的数据时,被误判为错误响应
- 导致 GET /api/v3/evaluation-points/:id 等接口报"API请求失败: 未知错误"
解决方案:
- 添加 typeof data.code === 'number' 类型检查
- 只有数字类型的 code 才被视为 API 状态码(0 或 200)
- 字符串类型的 code 被视为业务数据字段,不触发错误检查
影响范围:
- 所有返回包含字符串 code 字段的 API 响应
- 特别是评查点相关接口(code 是评查点编码)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 18:36:15 +08:00 |
|
PingChuan
|
08ebcf1935
|
feat:集成uno命令,封装高亮特定文本方法
|
2025-11-25 18:31:50 +08:00 |
|
LiangShiyong
|
ff0a99cbb4
|
Merge branch 'Wren' into shiy-login
|
2025-11-25 18:24:28 +08:00 |
|
LiangShiyong
|
f76b3a8a92
|
feat: 接入pdf文件的显示高亮效果
|
2025-11-25 18:23:35 +08:00 |
|
TanWenyan
|
368b89fba0
|
chore: 添加 typecheck_result.txt 到 .gitignore
|
2025-11-25 18:19:39 +08:00 |
|
TanWenyan
|
f938ca6c00
|
feat(rbac): 添加 RBAC 角色管理 API 代理和模拟数据
添加角色基于访问控制(RBAC)相关接口:
1. API 代理路由
- api.v3.rbac.roles._index.tsx: 角色列表和创建
- api.v3.rbac.roles.$roleId.tsx: 角色详情、更新和删除
- api.v3.rbac.roles.$roleId.users.tsx: 角色用户关联管理
- api.v3.rbac.users.$userId.roles.tsx: 用户角色列表
- api.v3.rbac.users.$userId.roles.$roleId.tsx: 用户角色分配
2. 模拟数据服务
- rbac-mock-data.server.ts: 提供模拟角色和用户角色数据
- 支持 CRUD 操作
- 包含预置的系统管理员、开发者等角色
接口功能:
- ✅ 获取角色列表(支持分页和搜索)
- ✅ 获取角色详情
- ✅ 创建、更新、删除角色
- ✅ 获取角色的用户列表
- ✅ 为用户分配/移除角色
注:当前使用模拟数据,待后端接口完善后切换到真实 API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 18:19:05 +08:00 |
|
TanWenyan
|
3d6305376b
|
docs: 添加 PostgREST 使用情况分析和删除确认功能文档
1. PostgREST 使用情况分析文档
- PostgREST使用情况-后端API替代建议.md: 完整的迁移建议和优先级分析
- PostgREST实际使用清单.md: 当前使用的 PostgREST 接口清单
- PostgREST未使用函数清单.md: 已封装但未使用的函数列表
- PostgREST请求模块清单.md: 所有请求模块的使用情况
2. 删除操作延迟确认功能实施文档
- 功能设计和实现细节
- 使用示例和最佳实践
- 技术实现说明
这些文档用于:
- 追踪 PostgREST 到 FastAPI 的迁移进度
- 指导后续的接口迁移工作
- 记录 UI 改进的实施细节
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 18:18:20 +08:00 |
|
TanWenyan
|
7c47b11ec7
|
feat(ui): 添加删除操作延迟确认功能
增强用户体验,防止误删除操作:
1. MessageModal 组件增强
- 添加 confirmDelay 属性(秒)
- 确认按钮倒计时功能
- 倒计时期间禁用确认按钮
- 按钮显示剩余秒数 (例如: "删除 (4s)")
2. 删除操作应用延迟确认(4秒)
- ✅ 文档类型删除 (document-types._index.tsx)
- ✅ 文档删除和批量删除 (documents.list.tsx)
- ✅ 入口模块删除 (entry-modules._index.tsx)
- ✅ 提示词删除 (prompts._index.tsx)
- ✅ 规则组删除 (rule-groups._index.tsx)
技术实现:
- 使用 useEffect + setInterval 实现倒计时
- 倒计时结束自动清理定时器
- 按钮禁用状态控制(disabled + opacity + cursor)
用户体验提升:
- 防止误操作:4秒思考时间
- 视觉反馈:倒计时提示
- 操作可逆:倒计时期间可取消
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 18:17:52 +08:00 |
|
TanWenyan
|
be529d2f2a
|
Revert "fix(evaluation): 修复选择全部评查点类型时的筛选查询"
This reverts commit 948e652201.
|
2025-11-25 18:07:07 +08:00 |
|
TanWenyan
|
948e652201
|
fix(evaluation): 修复选择全部评查点类型时的筛选查询
问题:
- 前端选择"全部"时,将多个类型 ID 拼接成 "1,2,3" 传给后端
- 后端 evaluation_point_groups_pid 参数类型是 int,不支持逗号分隔的字符串
- 导致查询失败或返回错误结果
解决方案:
- 选择"全部"时,不传递 ruleType 参数(即 evaluation_point_groups_pid)
- 让后端根据用户权限返回所有有权限查看的评查点类型数据
- 只有选择具体类型时,才传递单个类型 ID
技术细节:
- 移除了 loadedRuleTypes.map(type => type.id).join(',') 逻辑
- 将 finalRuleType 设置为 undefined 而不是拼接的 ID 字符串
- getRulesList 函数已有判断,只在 ruleType 存在时添加查询参数
测试场景:
✅ 选择"全部" → 不传 evaluation_point_groups_pid → 返回所有类型
✅ 选择具体类型 → 传 evaluation_point_groups_pid=1 → 返回该类型
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 18:04:34 +08:00 |
|
TanWenyan
|
02a76a0916
|
feat(evaluation): 优化前端映射逻辑并修复 documentTypeIds 筛选
主要变更:
1. ✅ 修复 getRuleTypes 函数的 documentTypeIds 筛选逻辑
- 添加参数验证:如果未提供 documentTypeIds,返回空数组
- 添加 PostgREST 过滤条件:id in (documentTypeIds)
- 确保评查点类型下拉框只显示会话存储中的文档类型关联的评查点类型
2. ✅ 简化 getRulesList 的数据映射逻辑
- 后端已返回 ruleType、groupName、groupId 字段
- 移除中间 ApiRule 转换步骤,直接映射 EvaluationPointData
- 代码行数从 35 行减少到 30 行
3. ✅ 更新 EvaluationPointData 接口
- 添加后端新增的 3 个字段:ruleType、groupName、groupId
- 与后端 Schema 保持一致
技术细节:
- 保留评查点编码清洗逻辑(移除最后的 '--' 后缀)
- 保留风险等级到优先级的映射
- 保留日期格式化处理
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 17:56:19 +08:00 |
|
TanWenyan
|
4b9d9868c2
|
feat(evaluation): 将评查点 CRUD 操作从 PostgREST 迁移到 FastAPI
完成评查点管理的完整 API 迁移:
- ✅ createEvaluationPoint: POST /api/v3/evaluation-points
- ✅ updateEvaluationPoint: PUT /api/v3/evaluation-points/{id}
- ✅ getEvaluationPoint: GET /api/v3/evaluation-points/{id}
- ✅ deleteRule: DELETE /api/v3/evaluation-points/{id}
- ✅ getRulesList: GET /api/v3/evaluation-points (带查询参数)
主要变更:
1. 将所有 postgrest* 函数调用替换为 apiRequest (axios-client)
2. 从 PostgREST 查询参数格式迁移到 REST API 路径格式
3. 简化响应处理逻辑 (FastAPI 返回清晰的 JSON)
4. 修复类型定义 (ApiRule 接口字段可选化)
5. 移除复杂的 PostgREST 嵌套查询逻辑
技术细节:
- 删除函数返回类型改为 {success: boolean, message: string}
- getRulesList 从 226 行简化到 122 行
- 所有接口统一使用 JWT Bearer 认证
- 响应格式:{data: T[], total: number, page: number, page_size: number}
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-25 17:39:02 +08:00 |
|
TanWenyan
|
a0611a3a13
|
fix(evaluation): 修复 PostgREST endpoint 格式错误导致 404
## 问题描述
更新或获取评查点时出现 404 错误:
- GET http://172.16.0.55:8073/evaluation_points/736 (404 Not Found)
- 用户报告"删除失败"
## 根本原因
`getRule` 和 `updateRule` 函数使用了错误的 PostgREST endpoint 格式:
- ❌ 错误:`evaluation_points/${id}` (REST风格路径)
- ✅ 正确:`evaluation_points?id=eq.${id}` (PostgREST查询参数)
PostgREST **不支持** `/resource/{id}` 风格的路径参数,
必须使用查询参数格式:`/resource?id=eq.{id}`
## 修复内容
### getRule 函数 (line 416-470)
- 更新endpoint从 `evaluation_points/${id}` 为 `'evaluation_points'`
- 添加 `filter: { 'id': \`eq.${id}\` }` 到 PostgrestParams
- 更新响应数据处理逻辑,支持数组和包装对象两种格式
- 改进错误处理,返回404而不是500
### updateRule 函数 (line 728-754)
- 更新endpoint从 `evaluation_points/${id}` 为 `'evaluation_points'`
- 添加filter参数:`{ id: parseInt(id) }` 到 `postgrestPut` 第三个参数
- 更新响应数据处理逻辑,支持数组和包装对象两种格式
- 修复数据映射,使用 `updatedRule` 而不是 `response.data.data`
## 技术说明
PostgREST 标准查询语法:
- 单条记录查询:`GET /table?id=eq.123`
- 更新操作:`PATCH /table?id=eq.123` + body
- 不支持:`GET /table/123` 或 `PATCH /table/123`
## 测试建议
1. 刷新浏览器页面(Ctrl+F5)
2. 尝试编辑评查点并保存
3. 检查控制台不再出现404错误
4. 验证更新成功并正确返回数据
|
2025-11-25 16:38:07 +08:00 |
|
TanWenyan
|
0499a3f0e5
|
fix(evaluation): 修复 updateEvaluationPoint 返回数据格式判断问题
## 问题描述
更新评查点时出现"更新评查点失败:返回数据格式不正确"错误
## 根本原因
- updateEvaluationPoint 和 createEvaluationPoint 对返回数据的格式判断过于严格
- 当 PostgREST 返回空数组时,代码没有正确处理
## 解决方案
### updateEvaluationPoint
- 添加详细的调试日志,记录返回数据的类型和格式
- 当返回空数组时,尝试重新获取数据(因为更新可能已成功)
- 改进错误消息,提供更明确的错误提示
### createEvaluationPoint
- 添加相同的调试日志
- 当返回空数组时,提供明确的错误消息并建议刷新页面
- 改进数据格式判断逻辑
## 技术改进
- 分层处理数组格式:有数据、空数组、非数组
- 空数组情况下的降级处理(update 重新获取,create 提示刷新)
- 保留所有调试日志便于问题诊断
## 测试建议
请在控制台查看日志输出,确认 PostgREST 返回的实际数据格式
|
2025-11-25 16:15:27 +08:00 |
|
LiangShiyong
|
87a6cae1d5
|
Merge branch 'PingChuan' into shiy-login
# Conflicts:
# app/components/reviews/ReviewTabs.tsx
|
2025-11-25 15:05:48 +08:00 |
|
LiangShiyong
|
ecc8aa6efc
|
fix: ReviewTabs的导入
|
2025-11-25 15:04:53 +08:00 |
|