spec.md 2.1 KB

schedule-creation Specification

Purpose

TBD - created by archiving change weapp-fixes-and-schedule-creation. Update Purpose after archive.

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