Commit Graph

337 Commits

Author SHA1 Message Date
LiangShiyong d88cfc818b feat: 1. 实现一键替换。
2. 优化追加附件和模板上传的样式。
2025-12-03 12:07:56 +08:00
LiangShiyong 2897423404 feat: 大模型对话适配移动端的样式 2025-12-02 11:41:21 +08:00
LiangShiyong 88466b7a8b feat: 1. 完善交叉评查上传创建任务,改成动态加载文档类型。
2. 重新对齐交叉评查的接口。
2025-12-02 10:10:03 +08:00
LiangShiyong c9e0d5abba Merge branch 'PingChuan' into shiy-login 2025-12-01 12:40:22 +08:00
LiangShiyong c43485ec27 fix: 添加交叉评查的案卷类型的查询,动态选择文档类型 2025-12-01 12:36:38 +08:00
PingChuan 0c1b81cfb2 temp:临时备份,完成一半知识库管理模块 2025-12-01 12:33:53 +08:00
PingChuan 754ec2c7b5 feat:完成dify知识库文档基础CRUD模块 2025-11-30 21:28:49 +08:00
PingChuan d85010bada feat:完善知识库管理路由权限配置 2025-11-30 20:14:51 +08:00
LiangShiyong af258fe669 Merge branch 'PingChuan' into shiy-login 2025-11-30 19:33:46 +08:00
LiangShiyong 4fcc92a381 feat: 1. 接入CollaboraViewer选中的高亮效果,清除高亮功能,页面销毁自动清除高亮。
2. 合同模板对比接入monaco editor的效果。
3. 添加交叉评查的案卷类型的数据查询。

fix: 1. 修复文档列表的打开模态框蒙板层显示效果。
2025-11-30 19:33:05 +08:00
PingChuan c94cc00138 feat:前端新增初版知识库管理页面 2025-11-30 19:27:01 +08:00
PingChuan 9614899171 feat:重构dify前端组件以及转发逻辑 2025-11-30 16:24:35 +08:00
LiangShiyong fb67f138dc fix: 1. 全局axios添加formData文件上传的检测,删除Content-Type让axios自动检测。
2. 完善入口模块管理的接口的对接。
3. 完善角色权限管理的接口对接和测试。
4. 完善主页的入口模块的图标的显示和图片的显示。
2025-11-29 19:37:29 +08:00
LiangShiyong 875ce19bb8 Merge branch 'PingChuan' into shiy-login
# Conflicts:
#	app/routes/files.upload.tsx
2025-11-29 10:59:50 +08:00
LiangShiyong e3d09aafb3 fix: 修复文档上传的页面bug 2025-11-29 10:57:05 +08:00
PingChuan 2865970f01 fix: 修复从react 引入 useRevalidator的问题,改为从remix引入 2025-11-29 10:54:56 +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