Commit Graph

36 Commits

Author SHA1 Message Date
root ab62b9839e fix: 清理旧的测试数据,添加调试日志
- 删除所有旧的测试订单(id <= 14)
- 前端添加调试日志,查看请求参数和响应数据
- 后端添加日志,记录接收到的请求参数

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 00:09:36 +08:00
root 09ccc05b83 fix: 审批详情页表单字段标签显示中文
- 添加表单字段映射表(formFieldLabelMap)
- 将英文key(如reason)翻译成中文标签(如"出差事由")

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 00:06:19 +08:00
root 71a9ec2eda fix: 修复审批详情页审批按钮不显示的问题
- 在 ApprovalRecord 接口中添加 node_id 和 approver_id 字段
- 添加调试日志帮助排查问题

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 00:05:43 +08:00
root 7ed456bac1 feat: 重写测试数据脚本,完善审批状态演示数据
- 清理旧数据逻辑(删除id > 10的测试数据)
- 用户1发起的订单:审批中、已通过、已拒绝、已撤回(4种状态)
- 待用户1审批的订单:2个(其他用户发起)
- 用户1已审批的订单:1个已通过、1个已拒绝
- 调整审批节点配置,支持不同用户的审批流程

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 00:02:04 +08:00
root 2297695ed0 docs: 更新 CLAUDE.md 项目文档
- 更新数据库配置(数据库名、容器名)
- 补充审批流程引擎的详细说明和测试数据脚本
- 更新当前开发状态(审批功能、出差申请已完成)
- 添加 Webman 官方依赖包说明
- 添加申请页面完整数据流说明
- 修正数据库连接方式说明
- 添加 User Store 和类型定义注意事项

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 23:56:09 +08:00
root 04953b22dc feat: 完善审批功能
- 新增通用审批列表页面(我发起的/待我审批/我已审批)
- 新增通用审批详情页面(支持审批通过/拒绝操作)
- 修复审批列表过滤逻辑("我已审批"只显示已完成订单)
- 修复登录页面未设置 Zustand store 的问题
- 修复 User 类型定义(id 改为 number 类型)
- 修复草稿恢复时的日期转换问题
- 创建测试数据脚本(test_data.php)
- 安装 webman 官方依赖包(database, redis, pagination 等)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 23:54:38 +08:00
root 27ad5728c9 fix: 移除 bootstrap.php 中对已删除文件的加载
- 移除对自定义 Db.php 和 Model.php 的加载
- 这些文件已删除,使用 Webman 官方 support\Db 和 support\Model

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 23:05:15 +08:00
root 358a222c24 fix: 移除导航前清除数据的逻辑,防止另一种类型人员丢失
问题:当用户没有输入内容就点击"选择审批人/抄送人"时,
会清除 sessionStorage 中所有人员数据,导致另一种类型的人员消失。

解决方案:移除导航前清除数据的逻辑,让 sessionStorage
中的数据在用户明确操作(提交、保存等)时才清除。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:44:42 +08:00
root 76ce4ba1b6 fix: 简化逻辑,确保新建申请时加载默认审批人
- 移除草稿恢复逻辑(从列表页新建时清除所有旧数据)
- 简化 useEffect 为两种情况:
  1. 从选择页面返回:恢复 sessionStorage 数据
  2. 从列表页新建:清除旧数据,加载默认配置

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:42:21 +08:00
root 67fe4bcb0e debug: 添加详细日志输出以便调试默认审批人加载问题
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:38:47 +08:00
root fa2d119099 fix: 简化 useEffect 逻辑,确保默认审批人正确加载
- 移除嵌套的异步函数,直接在 useEffect 中处理
- 只依赖 location.state?.fromSelection,避免不必要的重新执行
- 优化初始化流程:选择页面返回 > 草稿恢复 > 默认数据加载

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:37:28 +08:00
root 0ee7cb6f49 fix: 合并 useEffect 逻辑,修复默认审批人不显示的问题
问题原因:两个 useEffect 执行顺序冲突
- 第一个 useEffect 加载默认数据
- 第二个 useEffect 又清除了人员数据

解决方案:合并为一个统一的 useEffect,按优先级处理:
1. 从选择页面返回 -> 恢复 sessionStorage 数据
2. 有草稿数据 -> 恢复草稿及关联人员数据
3. 首次进入 -> 清除旧数据,加载默认配置

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:03:53 +08:00
root be2e56995e fix: 修复默认审批人和抄送人不显示的问题
- 确保在所有执行路径上都设置 defaultLoadedRef
- 将获取的默认数据保存到 sessionStorage
- 移除 useEffect 依赖,只在组件挂载时加载一次

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:59:23 +08:00
root ee931e49b7 fix: 修复选择审批人后抄送人消失的问题
- 使用 useRef 防止默认审批人/抄送人数据重复加载
- 确保从选择页面返回时,另一类型的数据不受影响

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:57:56 +08:00
root 3968e94195 feat: 实现默认审批人和抄送人功能
- 后端新增 getDefaultApprovers 接口,从审批流程配置中获取默认审批人和抄送人
- 前端申请页面加载时自动获取并显示默认审批人和抄送人
- 添加默认审批流程配置:1个审批人(闫继光) + 2个抄送人(孟启、程丽敏)
- 移除后端 support 目录下的自定义 Db 和 Model 类,使用 Webman 官方实现
- 前端选择页面优化:优先从 sessionStorage 恢复,否则加载后端默认配置

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:54:38 +08:00
root e3e2843835 fix: 修复审批功能和数据加载问题
- BusinessTripService 添加 ApprovalNode use 语句
- 修复 approve 方法中的字段引用错误(flow_id 替代 order_id)
- 修复 approve 方法中的类型引用错误(type 替代 node_type)
- getList 方法添加 approvalOrder 关联加载
- 完善审批逻辑:检查用户是否在当前节点审批人列表中
- 前后端联调测试通过

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:30:49 +08:00
root 7c933bad16 feat: 完善审批接口功能
- 修复 ApprovalController 路由参数获取方式
- 修复 BaseController 命名空间引用问题
- 添加 use 语句引入 ApprovalOrder
- 修复 ApprovalNode 类型常量与数据库 enum 一致
- 修复 ApprovalService 中的 action 常量引用
- 测试验证审批列表、详情、通过接口正常工作

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:26:22 +08:00
root eef91a6c83 feat: 添加前后端多语言支持
前端:
- 在 API 请求中添加 Accept-Language 头,传递当前语言设置

后端:
- 创建 LanguageMiddleware 中间件,自动检测并设置语言
- 为所有 API 路由添加语言中间件

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:21:05 +08:00
root 8817effc9a refactor: 使用官方support\Translation替代自定义Lang类
- 创建 config/translation.php 配置文件
- 将翻译文件从 lang/ 移动到 resource/translations/ 目录
- 按照 Symfony Translation 标准重命名文件 (messages.{locale}.php)
- 删除自定义的 app\util\Lang 类
- 使用官方的 trans() 和 locale() 函数

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:18:52 +08:00
root 2cfca3553c fix: 移除support命名空间的composer配置,使用官方默认方式
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:15:53 +08:00
root 66b61eada4 refactor: 使用官方support\Db和support\Model
- 创建 support/Db.php 和 support/Model.php
- 在 bootstrap.php 中自动初始化数据库
- 移除 app/util/Db.php
- 更新所有模型和控制器使用官方类

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:15:17 +08:00
root 81cde28aa5 fix: 添加数据库初始化到AuthController
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:10:49 +08:00
root 582f454a5a refactor: 重构后端目录结构和命名规范
- 将后端目录名从大写改为小写 (Controller->controller 等)
- 将命名空间从 App\ 改为 app\ (符合 webman 官方规范)
- 移除不必要的 bootstrap 目录
- 完善出差审批业务功能:
  - 添加删除草稿功能
  - 添加审批操作功能(同意/拒绝)
  - 完善审批详情页,显示审批人和审批记录
- 前端优化:
  - 调整列表页行高
  - 隐藏底部导航栏
  - 仪表盘只显示3个快捷入口

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:09:04 +08:00
root 09d4cb8054 fix: 修复页面间状态丢失问题并优化选择页面
- 修复选择审批人后再选择抄送人导致状态丢失的问题
- 使用独立的 sessionStorage key (selectedApprovers, selectedCc)
- 组件每次挂载时从 sessionStorage 恢复状态
- 只在提交/保存成功后清除 sessionStorage
- 优化人员选择页面布局和样式
- 更新 CLAUDE.md 文档记录问题和解决方案

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 15:22:12 +08:00
root 2d39357cc3 feat: 实现出差申请页面
- 创建出差申请表单,包含出差事由、行程明细、审批人选择
- 实现行程明细的增删改功能,支持开始/结束时间、出发地、目的地等
- 添加单程/往返类型选择和交通工具下拉选择
- 实现自动计算行程时长和总时长
- 创建审批人和抄送人选择页面
- 添加前后端API接口定义
- 更新i18n国际化翻译
- 整理开发文档和UI设计图

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 23:44:40 +08:00
root 49fa9c3f92 config: add Redis password and fix MySQL password
- Update backend/.env: REDIS_PASSWORD=redis_sSJJPb
- Update backend/.env.example: REDIS_PASSWORD=redis_sSJJPb
- Update docker-compose.yml: Add REDIS_PASSWORD and fix DB_PASSWORD to mysql_xEsdPa

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:30:45 +08:00
root 5aa7825f19 config: update all database references to xserver
- Update backend/.env: DB_DATABASE=xserver
- Update backend/.env.example: DB_DATABASE=xserver
- Update docker-compose.yml: DB_DATABASE=xserver
- Update backend/app/util/Db.php: default database=xserver

The old database name 'x_server_mobile' has been fully migrated to 'xserver'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:29:45 +08:00
root 6e61d0adc7 feat: add complete database initialization script
- Add 008_complete_init.sql with all 10 tables
- Include approval workflow tables:
  - approval_flow (审批流程配置表)
  - approval_node (审批流程节点表)
  - approval_order (审批单表)
  - approval_record (审批记录表)
- Include business trip tables:
  - business_trip (出差申请表)
  - business_trip_itinerary (出差行程明细表)
- Include user_feishu_binding (用户飞书应用绑定表)

All tables use proper UTF-8 encoding with utf8mb4_unicode_ci collation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:27:49 +08:00
root be9ae8a0d9 fix: switch to xserver database with UTF-8 data
- Change default database from x_server_mobile to xserver
- Add 007_xserver_init.sql initialization script
- Companies data now correctly encoded in UTF-8:
  - 合塑 (hesu)
  - 新友合 (xinyouhe)
  - 派卡 (paika)
  - 斯玛特 (simate)
  - magic bridge Auto (mbaf)
- Company Feishu apps properly configured

The key fix is to execute SQL directly inside the MySQL container
using heredoc to avoid charset conversion issues during transfer.

Usage:
docker exec 1Panel-mysql-409s mysql -uroot -p'mysql_xEsdPa' --default-character-set=utf8mb4 xserver < 007_xserver_init.sql

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:56:52 +08:00
root 5d989dfd86 fix: add UTF-8 encoding fix migration
- Add 006_fix_encoding_utf8.sql migration script
- Properly sets UTF-8 charset for table creation
- Recreates companies and users tables with correct Chinese comments
- Imports company data with correct UTF-8 encoding

Usage:
docker exec -i 1Panel-mysql-409s mysql -uroot -p'mysql_xEsdPa' --default-character-set=utf8mb4 x_server_mobile < 006_fix_encoding_utf8.sql

Fixes encoding issues where Chinese text appears as garbled characters
due to MySQL client using latin1 charset instead of utf8mb4.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:49:41 +08:00
root e748eba55b fix: add table structure migration with UTF-8 encoding
- Update .gitignore to allow backend database migrations
- Add 004_fix_table_structure.sql migration
- Rename tables to plural form (user->users, company->companies)
- Add missing fields to companies and users tables
- Create company_feishu_apps table for multi-app configuration
- Import company data and Feishu app configurations
- Set UTF-8 charset to fix encoding issues from MySQL 5.7 export

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:44:40 +08:00
root 8629f4a4ce refactor: fix directory structure and namespaces for webman conventions
- Rename directories to lowercase: Controller→controller, Model→model, Service→service, Util→util, Bootstrap→bootstrap
- Update all namespaces from App\Xxx to app\xxx (webman convention)
- Update all import statements across the codebase
- Update route.php to use lowercase namespaces
- Remove unused CompanyFeishuApp model
- Comment out unimplemented controller routes

Following webman 2.x framework conventions:
- Models: app\model\{ClassName}
- Controllers: app\controller\{ClassName}
- Services: app\service\{ClassName}
- Utils: app\util\{ClassName}
- Middleware: app\middleware\{ClassName}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:28:23 +08:00
root 423a04a610 refactor: remove complex migration, keep simplified approach
- Remove 002_merge_old_data.sql (complex approach with temp tables)
- Keep 003_import_feishu_config.sql (simplified data import)

Follows principle: only import needed data, not full compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:16:53 +08:00
root 348885a51c feat: add simplified Feishu configuration and workflow docs
- Update .gitignore to exclude large SQL files except migrations
- Add GIT_WORKFLOW.md documenting branch strategy
- Update Company model with Feishu app retrieval methods
- Update User model with Feishu-related scopes
- Update FeishuService to support multi-app configuration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:16:42 +08:00
root 1f6d346f6a feat: add multi-company Feishu integration and data migration
- Add companies table enhancements (abbr, tenant_key, feishu_enabled)
- Add users table enhancements (feishu fields, sn, report_to, etc.)
- Create company_feishu_apps table for multi-app per company
- Create user_sn_pool table for user number management
- Update FeishuService to support multiple Feishu apps per company
- Add data migration script (002_merge_old_data.sql)
- Add import script (scripts/import_old_data.php)
- Update User and Company models with new scopes and relationships
- Add CompanyFeishuApp model
- Add Git workflow documentation (GIT_WORKFLOW.md)

This supports:
- Multi-company architecture with Feishu integration
- Multiple Feishu apps per company (X-Server, Ticket, CRM)
- User number assignment system
- Data migration from old project

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:12:18 +08:00
root 8d78e18267 Initial commit: X-Server Mobile enterprise tool system
- Frontend: React 18 + TypeScript + Vite + Ant Design Mobile
- Backend: PHP 8.5 + Webman 2.x + MySQL + Redis
- i18n support: Chinese, English, Russian, Spanish, French
- Approval workflow engine
- Docker development environment
- Feishu integration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 17:57:25 +08:00