|
|
@@ -0,0 +1,237 @@
|
|
|
+# Comet Design Handoff
|
|
|
+
|
|
|
+- Change: weapp-fixes-and-schedule-creation
|
|
|
+- Phase: design
|
|
|
+- Mode: compact
|
|
|
+- Context hash: fbd4d371098581149798d176bc0180b6b9eee40b29afc5b01cb7fcbb66ad0352
|
|
|
+
|
|
|
+Generated-by: comet-handoff.sh
|
|
|
+
|
|
|
+OpenSpec remains the canonical capability spec. This handoff is a deterministic, source-traceable context pack, not an agent-authored summary.
|
|
|
+
|
|
|
+## openspec/changes/weapp-fixes-and-schedule-creation/proposal.md
|
|
|
+
|
|
|
+- Source: openspec/changes/weapp-fixes-and-schedule-creation/proposal.md
|
|
|
+- Lines: 1-25
|
|
|
+- SHA256: 7d44bf59909b1d8861860c6107dd35fc17c1a9247584cbb05abe113535a9f823
|
|
|
+
|
|
|
+```md
|
|
|
+## Why
|
|
|
+
|
|
|
+清道夫 App 在 V21-SOP 原型验证过程中暴露出 5 个影响体验的 UI/交互问题:tab 页面 TopBar 出现多余的返回按钮、任务页发布按钮仍被微信胶囊遮挡、排班页无法新增排班、自定义 tabBar 高亮切换滞后、退出登录无动画且卡顿。本次变更一次性修复这 5 个问题,并严格以后端现有接口为准,缺失接口则在后端补全。
|
|
|
+
|
|
|
+## What Changes
|
|
|
+
|
|
|
+- **移除 tab 页 TopBar 返回按钮**:`TopBar` 默认 `showBack` 改为 `false`;仅非 tab 页面显式开启返回按钮。
|
|
|
+- **修复任务页发布/新增按钮被胶囊遮挡**:重新调整 `TaskListView` 在 `TopBar` 右侧插槽的按钮布局,确保胶囊安全区计算生效。
|
|
|
+- **实现排班页新增排班**:按 V21-SOP 原型交互,在 `ScheduleView` 中新增排班表单弹窗/页面,调用 `/schedule` POST 接口;前端车辆下拉调用后端接口,缺失 `/vehicle/simple-list` 时后端补全该接口。
|
|
|
+- **修复自定义 tabBar 高亮不同步**:在 tab 页面 `onShow` 中显式调用 `setData({ selected })` 刷新自定义 tabBar 高亮状态。
|
|
|
+- **修复退出登录卡顿无动画**:调整 `ProfileView` 登出顺序,先 `uni.reLaunch` 跳转登录页,再处理清理与提示,避免阻塞主线程。
|
|
|
+
|
|
|
+## Capabilities
|
|
|
+
|
|
|
+### New Capabilities
|
|
|
+- `schedule-creation`: 排班页新增排班功能,包含表单、后端接口调用、原型交互映射。
|
|
|
+
|
|
|
+### Modified Capabilities
|
|
|
+<!-- 本次其余 4 项均为既有能力的实现缺陷修复,不涉及规格级需求变更;排班新增为全新能力。 -->
|
|
|
+
|
|
|
+## Impact
|
|
|
+
|
|
|
+- 前端:`src/components/common/TopBar.vue`、`src/components/task/TaskListView.vue`、`src/components/dispatch/ScheduleView.vue`、`src/custom-tab-bar/index.js`、`src/components/my/ProfileView.vue`、`src/api/schedule.ts`、`src/api/vehicle.ts`。
|
|
|
+- 后端:`VehicleController.java`、`VehicleService.java`(新增 `/vehicle/simple-list`)。
|
|
|
+- 构建:需保持 `npm run build:mp-weixin` 与 `npm run type-check` 通过。
|
|
|
+```
|
|
|
+
|
|
|
+## openspec/changes/weapp-fixes-and-schedule-creation/design.md
|
|
|
+
|
|
|
+- Source: openspec/changes/weapp-fixes-and-schedule-creation/design.md
|
|
|
+- Lines: 1-74
|
|
|
+- SHA256: f1fc2bd669651006f9a686a48639964aabcc26e146a74b428e09a6a0989d838f
|
|
|
+
|
|
|
+```md
|
|
|
+## Context
|
|
|
+
|
|
|
+清道夫 App 采用 uni-app Vue 3 + TypeScript 开发,页面使用 `navigationStyle: custom` 自定义导航栏。`TopBar` 组件为通用导航头,`CapsuleSafeArea` 负责计算微信胶囊安全区。自定义 tabBar 使用微信小程序 `custom-tab-bar` 组件。后端为 Java Spring Boot + MyBatis-Plus。
|
|
|
+
|
|
|
+当前问题:
|
|
|
+- `TopBar` 默认 `showBack: true`,导致 tab 页面(首页、任务、排班、我的)出现多余返回按钮。
|
|
|
+- 任务页发布/新增按钮虽放入 `TopBar` 右侧插槽,但仍被胶囊遮挡,需要进一步调整。
|
|
|
+- 排班页 `addSchedule()` 仅提示“排班功能开发中”,未实现 V21-SOP 原型的新增排班流程。
|
|
|
+- 自定义 tabBar 在页面切换后高亮状态未同步更新。
|
|
|
+- 退出登录时先执行 `authStore.doLogout()` 和 `uni.showToast`,再 `uni.reLaunch`,导致页面切换无动画、卡顿。
|
|
|
+
|
|
|
+## Goals / Non-Goals
|
|
|
+
|
|
|
+**Goals:**
|
|
|
+- tab 页面 TopBar 不显示返回按钮,非 tab 页面保留返回能力。
|
|
|
+- 任务页新增/发布按钮完全避开微信胶囊,可正常点击。
|
|
|
+- 排班页可按原型新增排班并保存到后端。
|
|
|
+- tabBar 高亮与当前页面实时同步。
|
|
|
+- 退出登录动画流畅、无卡顿。
|
|
|
+- 后端缺失 `/vehicle/simple-list` 时补全该接口,保证前端下拉数据可用。
|
|
|
+
|
|
|
+**Non-Goals:**
|
|
|
+- 不重构整个导航或 tabBar 架构。
|
|
|
+- 不改变任务/排班核心业务状态机。
|
|
|
+- 不新增排班以外的调度功能。
|
|
|
+
|
|
|
+## Decisions
|
|
|
+
|
|
|
+1. **TopBar 默认不显示返回按钮**
|
|
|
+ - 将 `showBack` 默认值改为 `false`;需要返回的页面显式传入 `:showBack="true"`。
|
|
|
+ - 理由:tab 页面是入口页,绝大多数场景不需要返回;显式开启更安全,避免遗漏。
|
|
|
+
|
|
|
+2. **任务页按钮胶囊安全区二次确认**
|
|
|
+ - 检查 `TaskListView` 是否正确将按钮放入 `TopBar` 的 right slot,并确认 `CapsuleSafeArea` 已包裹 right slot。
|
|
|
+ - 如仍被遮挡,调整按钮容器为 `CapsuleSafeArea` 内部元素,确保 `margin-left` 生效。
|
|
|
+
|
|
|
+3. **排班新增采用弹窗表单**
|
|
|
+ - 在 `ScheduleView` 内实现 `uni-popup` 或同项目弹窗组件,表单字段:班组(下拉 `/team/simple-list`)、工作日期(日期选择器)、班次类型(月计划/应急,映射 `month_plan/emergency`)、车辆(多选,调用 `/vehicle/simple-list`)、人员(多选,调用 `/staff/simple-list`)、备注(文本)。
|
|
|
+ - 提交调用 `POST /schedule`,成功后刷新当前日期班表列表。
|
|
|
+ - 理由:与原型一致,保持在当前页面完成新增,避免全页跳转。
|
|
|
+
|
|
|
+4. **后端车辆下拉接口补全 `/vehicle/simple-list`**
|
|
|
+ - 在 `VehicleController` 新增该接口,返回 `{ value: vehicleId, label: plateNo }`。
|
|
|
+ - 理由:前端现有 `getAvailableVehicles()` 调用不存在的 `/vehicle/available`;用户要求以后端接口为准,缺失则补全。
|
|
|
+
|
|
|
+5. **tabBar 高亮同步**
|
|
|
+ - 在每个 tab 页面的 `onShow` 中调用 `uni.setTabBarItem` 不够,因为项目使用自定义 tabBar;需通过 `getTabBar().setData({ selected: index })` 显式同步。
|
|
|
+
|
|
|
+6. **退出登录顺序调整**
|
|
|
+ - 先调用 `uni.reLaunch({ url: '/pages/login/login' })`,再执行 `authStore.doLogout()` 清理 token/state;toast 可在跳转后可选显示或省略。
|
|
|
+ - 理由:`reLaunch` 是同步触发页面切换的 API,放在前面可立即释放当前页面;清理逻辑在后台完成不影响动画。
|
|
|
+
|
|
|
+## Risks / Trade-offs
|
|
|
+
|
|
|
+- [Risk] `TopBar` 默认 `showBack=false` 可能导致已有非 tab 页面依赖默认返回而失效。
|
|
|
+ → Mitigation:全局搜索 `TopBar` 使用处,为非 tab 页面补充 `:showBack="true"`。
|
|
|
+- [Risk] 排班表单字段与后端 `DispatchSchedule` 不完全对齐。
|
|
|
+ → Mitigation:严格参考后端 entity 字段命名,提交前做一次字段映射。
|
|
|
+- [Risk] 自定义 tabBar `getTabBar()` 在页面未完全挂载时可能为 `null`。
|
|
|
+ → Mitigation:使用 `this.getTabBar()?.setData` 并加空值保护。
|
|
|
+- [Risk] 后端新增接口需要重新部署才能生效。
|
|
|
+ → Mitigation:前端同时保留降级方案(如使用 `/vehicle/list?pageSize=100`),但本次按用户要求优先补全后端接口。
|
|
|
+
|
|
|
+## Migration Plan
|
|
|
+
|
|
|
+1. 后端:新增 `/vehicle/simple-list`,重启服务。
|
|
|
+2. 前端:修改 `TopBar`、`TaskListView`、`ScheduleView`、`custom-tab-bar/index.js`、`ProfileView` 及相关 API 文件。
|
|
|
+3. 构建:`npm run type-check` 与 `npm run build:mp-weixin` 验证。
|
|
|
+4. 真机验证:微信开发者工具 + 真机预览,检查胶囊遮挡、tabBar 高亮、退出动画。
|
|
|
+
|
|
|
+## Open Questions
|
|
|
+
|
|
|
+- 任务页发布按钮在当前角色化首页改造后,是否仍命名为“发布”或已改为“新增”?以当前代码为准。
|
|
|
+- V21-SOP 原型文件路径需读取确认排班弹窗具体字段顺序与校验规则。
|
|
|
+```
|
|
|
+
|
|
|
+## openspec/changes/weapp-fixes-and-schedule-creation/tasks.md
|
|
|
+
|
|
|
+- Source: openspec/changes/weapp-fixes-and-schedule-creation/tasks.md
|
|
|
+- Lines: 1-43
|
|
|
+- SHA256: fdc5606154bc3a4b6b24b60de0eb92db8ce016d0b8d3a42a1096c209e2bbd46c
|
|
|
+
|
|
|
+```md
|
|
|
+## 1. 后端接口补全
|
|
|
+
|
|
|
+- [ ] 1.1 在 `VehicleController` 新增 `GET /vehicle/simple-list`,返回 `{ value, label }` 列表
|
|
|
+- [ ] 1.2 在 `VehicleService` 添加 `simpleList()` 查询方法
|
|
|
+- [ ] 1.3 后端编译验证(`mvn compile` 或 IDE 构建)
|
|
|
+
|
|
|
+## 2. TopBar 返回按钮修复
|
|
|
+
|
|
|
+- [ ] 2.1 将 `TopBar` 默认 `showBack` 改为 `false`
|
|
|
+- [ ] 2.2 全局检查 `TopBar` 使用处,为非 tab 页面补充 `:showBack="true"`(如需要)
|
|
|
+- [ ] 2.3 确认 tab 页面(home/task/schedule/my)不再显示返回按钮
|
|
|
+
|
|
|
+## 3. 任务页发布/新增按钮胶囊遮挡修复
|
|
|
+
|
|
|
+- [ ] 3.1 检查 `TaskListView` 中发布/新增按钮是否正确置于 `TopBar` right slot
|
|
|
+- [ ] 3.2 确认 `CapsuleSafeArea` 包裹 right slot 且安全间距生效
|
|
|
+- [ ] 3.3 如仍被遮挡,调整按钮容器使其落在安全区内
|
|
|
+
|
|
|
+## 4. 排班页新增排班功能实现
|
|
|
+
|
|
|
+- [ ] 4.1 更新 `src/api/schedule.ts` 中 `createSchedule` 参数以匹配后端 `DispatchSchedule`
|
|
|
+- [ ] 4.2 更新 `src/api/vehicle.ts`,使用 `/vehicle/simple-list` 获取车辆下拉
|
|
|
+- [ ] 4.3 在 `ScheduleView` 中实现新增排班弹窗/表单(班组、日期、班次类型、车辆、人员、备注)
|
|
|
+- [ ] 4.4 实现班次类型映射:月计划/应急 ↔ `month_plan`/`emergency`
|
|
|
+- [ ] 4.5 实现表单校验与提交,调用 `POST /schedule`
|
|
|
+- [ ] 4.6 提交成功后刷新当前日期班表列表
|
|
|
+
|
|
|
+## 5. 自定义 tabBar 高亮同步修复
|
|
|
+
|
|
|
+- [ ] 5.1 在 tab 页面 `onShow` 中显式调用 `getTabBar().setData({ selected })`
|
|
|
+- [ ] 5.2 确保 `custom-tab-bar/index.js` 中 `selected` 响应式更新
|
|
|
+- [ ] 5.3 验证切换 tab 后高亮即时同步
|
|
|
+
|
|
|
+## 6. 退出登录卡顿修复
|
|
|
+
|
|
|
+- [ ] 6.1 调整 `ProfileView` 登出顺序:先 `uni.reLaunch` 到登录页,再执行清理逻辑
|
|
|
+- [ ] 6.2 移除或延后阻塞式 `uni.showToast`,确保页面切换动画流畅
|
|
|
+
|
|
|
+## 7. 构建与验证
|
|
|
+
|
|
|
+- [ ] 7.1 运行 `npm run type-check` 无错误
|
|
|
+- [ ] 7.2 运行 `npm run build:mp-weixin` 无错误
|
|
|
+- [ ] 7.3 微信开发者工具/真机预览验证 5 个问题均已修复
|
|
|
+```
|
|
|
+
|
|
|
+## openspec/changes/weapp-fixes-and-schedule-creation/specs/schedule-creation/spec.md
|
|
|
+
|
|
|
+- Source: openspec/changes/weapp-fixes-and-schedule-creation/specs/schedule-creation/spec.md
|
|
|
+- Lines: 1-48
|
|
|
+- SHA256: 2006b8ae40885ef27c038a56c31103f83180d292b62feb8cfb3f48f1c510201e
|
|
|
+
|
|
|
+```md
|
|
|
+## ADDED Requirements
|
|
|
+
|
|
|
+### Requirement: Schedule page can create a new schedule
|
|
|
+The system SHALL provide a schedule creation entry on the schedule page that opens a form, collects required fields, and saves a new `DispatchSchedule` via the backend `POST /schedule` endpoint.
|
|
|
+
|
|
|
+#### Scenario: Open create schedule form
|
|
|
+- **WHEN** the user taps the "新增排班" button on `pages/schedule/schedule`
|
|
|
+- **THEN** a form popup opens with fields for team, work date, shift type, vehicles, staff, and remark
|
|
|
+
|
|
|
+#### Scenario: Select team
|
|
|
+- **WHEN** the user opens the team dropdown
|
|
|
+- **THEN** the system calls `GET /team/simple-list` and displays `{ value, label }` options
|
|
|
+
|
|
|
+#### Scenario: Select vehicles
|
|
|
+- **WHEN** the user opens the vehicle selector
|
|
|
+- **THEN** the system calls `GET /vehicle/simple-list` and displays vehicles by plate number
|
|
|
+
|
|
|
+#### Scenario: Select staff
|
|
|
+- **WHEN** the user opens the staff selector
|
|
|
+- **THEN** the system calls `GET /staff/simple-list` and displays staff by name
|
|
|
+
|
|
|
+#### Scenario: Save new schedule
|
|
|
+- **WHEN** the user fills the form and taps save
|
|
|
+- **THEN** the system calls `POST /schedule` with `teamId`, `teamName`, `workDate`, `shiftType` (`month_plan`/`emergency`), `vehicleIds`, `staffIds`, `status`, and `remark`
|
|
|
+- **AND** the popup closes and the schedule list for the selected date refreshes
|
|
|
+
|
|
|
+#### Scenario: Cancel create schedule
|
|
|
+- **WHEN** the user taps cancel or the mask area
|
|
|
+- **THEN** the popup closes without saving
|
|
|
+
|
|
|
+### Requirement: Schedule creation follows V21-SOP prototype interaction
|
|
|
+The system SHALL align the schedule creation flow, field labels, and value mapping with the V21-SOP prototype.
|
|
|
+
|
|
|
+#### Scenario: Shift type mapping
|
|
|
+- **WHEN** the user selects "月计划" or "应急"
|
|
|
+- **THEN** the system stores the value as `month_plan` or `emergency` respectively before submitting to the backend
|
|
|
+
|
|
|
+#### Scenario: Form validation
|
|
|
+- **WHEN** the user attempts to save with missing required fields
|
|
|
+- **THEN** the system shows a validation message and does not call the backend
|
|
|
+
|
|
|
+## MODIFIED Requirements
|
|
|
+
|
|
|
+*No existing spec-level requirements are changed; other fixes in this change are implementation-level corrections to existing behavior.*
|
|
|
+
|
|
|
+## REMOVED Requirements
|
|
|
+
|
|
|
+*None.*
|
|
|
+```
|
|
|
+
|