# 前后端接口联调检查报告 > 生成时间:2026-03-14 > 检查范围:前端 `src/api/*.js` ↔ 后端 `routes/api.php` --- ## 总体评估 | 模块 | 状态 | 备注 | |------|------|------| | 系统设置 | ✅ 完全匹配 | | | CRM | ✅ 完全匹配 | | | 房务 Room | ✅ 完全匹配 | | | 护理 Care | ✅ 已修复 | resolve→handle别名修复;healthMetric.delete移除 | | 月子餐 Meal | ⚠️ 部分匹配 | getDetail不存在后端路由(见下) | | 服务产康 Service | ✅ 已修复 | complete方法移除,统一用finish | | 月嫂 Nanny | ✅ 完全匹配 | | | 进销存 Inventory | ✅ 已修复 | stock/transfers/checks 3个Controller已创建,迁移已执行 | | 财务 Finance | ✅ 已修复 | paymentApi.confirm→audit | | 人事 HR | ✅ 完全匹配 | | | 办公协同 Office | ✅ 完全匹配 | 审批流引擎已升级 | | 报表 Report | ✅ 完全匹配 | | | 知识库 KB | ✅ 完全匹配 | | --- ## 已修复问题 ### ✅ care.js — careExceptionApi.resolve 路径修复 - **问题**:前端调用 `PUT /care/exceptions/{id}/resolve`,后端只有 `/handle` - **修复**:将 `resolve` 方法改为指向 `/handle` 的别名 ### ✅ care.js — healthMetricApi.delete 移除 - **问题**:前端调用 `DELETE /care/health-metrics/{id}`,后端无此路由 - **修复**:移除该方法(健康指标不支持前端删除) ### ✅ finance.js — paymentApi.confirm 改名 - **问题**:前端调用 `PUT /finance/records/{id}/confirm`,后端路由为 `/audit` - **修复**:方法改为 `audit`,路径对齐 ### ✅ service.js — serviceExecutionApi.complete 移除 - **问题**:前端有 `complete` 方法调用 `/complete`,后端无此路由(只有 `/finish`) - **修复**:移除 `complete`,使用 `finish` 统一 --- ## 已补充后端(2026-03-14 完成) ### ✅ inventory — 库存台账 (stock) - `StockController` 已创建,基于 `inventories` 表聚合,支持 `low_stock` 过滤 - 路由:`GET /inventory/stock`, `GET /inventory/stock/export` ### ✅ inventory — 调拨管理 (transfers) - `TransferOrderController` 已创建,`transfer_orders` 表已迁移 - confirm 时自动更新双仓库库存(事务保护) - 路由:GET/POST/GET{id}/confirm/cancel ### ✅ inventory — 盘点管理 (checks) - `InventoryCheckController` 已创建,`inventory_checks` 表已迁移 - complete 时按实际数量修正 inventories 表(事务保护) - 路由:GET/POST/GET{id}/complete --- ## 其他注意事项 ### meal.js — mealReviewApi.getDetail - 后端 `/meal/reviews` 只有 `GET list` 和 `POST create`,无 `GET {id}` - 前端 `getDetail` 方法存在但暂时用不到(reviews 页面未调用),低优先级 ### request.js baseURL - 配置 `baseURL: '/api/v1'` ✅ 与后端路由前缀一致 ### 认证 - 所有请求通过 `Authorization: Bearer {token}` 传递,与 Sanctum 配置一致 ✅ --- ## 全链路修复记录(2026-03-14) ### P0 — 运行时必崩(已修复) | 文件 | 问题 | 修复 | |------|------|------| | `views/finance/payments/index.vue` | `paymentApi.confirm` 不存在 | 改为 `paymentApi.audit` | | `views/service/executions/index.vue` | `serviceExecutionApi.complete` 不存在 | 改为 `serviceExecutionApi.finish` | | `views/meal/reviews/index.vue` | `mealReviewApi.getDetail` 不存在且后端无路由 | 直接用行数据 `row` 展示详情 | | `views/care/health-metrics/index.vue` | `healthMetricApi.delete` 不存在 | 改为本地 filter 移除 | ### P1 — 系统模块整体404(已修复) | 文件 | 问题 | 修复 | |------|------|------| | `api/system.js` - `dictApi` | 全部使用 `/dict-types`,后端路由是 `/dictionaries` | 重写 dictApi 路径,item 操作签名适配 | | `api/system.js` - `userApi.resetPassword` | POST `/reset-password`,后端是 PUT `/password` | 改为 `put` + 正确路径 | | `api/system.js` - `userApi.updateStatus` | PATCH,后端是 PUT | 改为 `put` | | `api/system.js` - `roleApi.assignPermissions` | POST,后端是 PUT | 改为 `put` | | `api/system.js` - `roleApi.getPermissions` | 后端无此子路由 | 删除此方法 | ### P2 — except(['show']) 导致404(已修复) | 文件 | 问题 | 修复 | |------|------|------| | `api/system.js` - `departmentApi` | `getDetail`/`getTree` 后端无路由 | 删除;页面改用行数据 + `getList`+本地buildTree | | `api/system.js` - `positionApi` | `getDetail` 后端无路由 | 删除;页面改用行数据 | | `api/system.js` - `menuApi` | `getDetail`/`getTree` 后端无路由 | 删除;页面改用行数据 + `getList`+本地buildTree | | `api/system.js` - `permissionApi` | `getDetail`/`getTree` 后端无路由 | 删除;roles页改用 `getList`+本地buildTree | | `api/system.js` - `logApi` | `getDetail` 后端无路由 | 删除此方法 | ### 页面联动修复 - `views/system/departments/index.vue`: `getTree` → `getList`+`buildTree`;`getDetail` → 用行数据 - `views/system/menus/index.vue`: `getTree` → `getList`+`buildTree`;`getDetail` → 用行数据 - `views/system/positions/index.vue`: `getDetail` → 用行数据 - `views/system/users/index.vue`: `departmentApi.getTree` → `getList`(平铺列表) - `views/system/roles/index.vue`: `permissionApi.getTree` → `getList`+`buildPermTree`;`getPermissions` → `getDetail.permissions` - `views/system/dictionaries/index.vue`: 适配新 dictApi 签名(路径/参数全部对齐) | 优先级 | 任务 | 状态 | |--------|------|------| | P1 | 执行 migration: `php artisan migrate`(审批节点字段扩展) | ✅ 已完成 | | P2 | 创建 inventory transfers/checks 后端 Controller + Migration | ✅ 已完成 | | P3 | 完善 inventory stock 聚合查询接口 | ✅ 已完成 | | P4 | 补充 meal/reviews/{id} 详情接口(低优) | ⏳ 待处理 |