feat: add party-size queueing and call modes
This commit is contained in:
@@ -12,7 +12,7 @@ vi.mock("../hooks/usePollingResource", () => ({
|
||||
{ id: "super-1", username: "xqkwljtadmin", role: "ADMIN", active: true, protected: true, project_ids: [] },
|
||||
],
|
||||
} : {
|
||||
summary: { running_projects: 1, waiting_count: 1, anomaly_projects: 0, offline_devices: 0 },
|
||||
summary: { running_projects: 1, waiting_count: 1, waiting_ticket_count: 1, waiting_people_count: 3, anomaly_projects: 0, offline_devices: 0 },
|
||||
projects: [{
|
||||
id: "project-1",
|
||||
code: "EAST-RIDE",
|
||||
@@ -22,20 +22,35 @@ vi.mock("../hooks/usePollingResource", () => ({
|
||||
status: "RUNNING",
|
||||
batch_size: 5,
|
||||
call_batch_size: 5,
|
||||
call_mode: "BOTH",
|
||||
default_call_ticket_count: 5,
|
||||
max_call_ticket_count: 20,
|
||||
default_call_people_count: 8,
|
||||
max_call_people_count: 30,
|
||||
min_party_size: 1,
|
||||
max_party_size: 8,
|
||||
grace_period_minutes: 5,
|
||||
experienced_people_start: 10,
|
||||
visitor_notice: "请在入口附近等候。",
|
||||
eta: { interval_per_number_seconds: 120 },
|
||||
eta: { interval_per_person_seconds: 120 },
|
||||
waiting_count: 1,
|
||||
waiting_ticket_count: 1,
|
||||
waiting_people_count: 3,
|
||||
issued_ticket_count: 15,
|
||||
latest_ticket_number: "00015",
|
||||
current_batch: {
|
||||
id: "batch-1",
|
||||
batch_number: 4,
|
||||
status: "ACTIVE",
|
||||
tickets: [
|
||||
{ id: "ticket-2", ticket_number: "00013", phone: "13800138000", status: "CALLED" },
|
||||
{ id: "ticket-3", ticket_number: "00014", phone: "13800138001", status: "CALLED" },
|
||||
{ id: "ticket-2", ticket_number: "00013", phone: "13800138000", status: "CALLED", party_size: 2 },
|
||||
{ id: "ticket-3", ticket_number: "00014", phone: "13800138001", status: "CALLED", party_size: 3 },
|
||||
],
|
||||
ticket_count: 2,
|
||||
people_count: 5,
|
||||
},
|
||||
estimated_wait: { available: true, lower_minutes: 5, upper_minutes: 15 },
|
||||
experienced_people: 12,
|
||||
device_status: { label: "模拟设备执行成功" },
|
||||
}],
|
||||
active_tickets: [{
|
||||
@@ -46,6 +61,7 @@ vi.mock("../hooks/usePollingResource", () => ({
|
||||
phone: "13800138000",
|
||||
last_name: "张",
|
||||
honorific: "先生",
|
||||
party_size: 3,
|
||||
status: "WAITING",
|
||||
created_at: "2026-07-10T09:00:00Z",
|
||||
}],
|
||||
@@ -68,7 +84,8 @@ describe("AdminPage active tickets", () => {
|
||||
expect(screen.getByRole("list", { name: "项目队列" })).toHaveTextContent("东门观光车");
|
||||
expect(screen.getByRole("list", { name: "项目队列" })).toHaveTextContent("00013 至 00014");
|
||||
expect(screen.getByText("运行项目").parentElement).toHaveTextContent("1");
|
||||
expect(screen.getByText("总等待号码").parentElement).toHaveTextContent("1");
|
||||
expect(screen.getByText("总等待人数").parentElement).toHaveTextContent("3");
|
||||
expect(screen.getByRole("list", { name: "项目队列" })).toHaveTextContent("3人 · 1 个号码");
|
||||
expect(screen.queryByText("最近操作")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("异常与提醒")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("最新叫号")).not.toBeInTheDocument();
|
||||
@@ -106,13 +123,25 @@ describe("AdminPage active tickets", () => {
|
||||
expect(screen.getByRole("form", { name: "维护项目" })).toBeVisible();
|
||||
expect(screen.getByRole("form", { name: "维护项目" })).toHaveTextContent("项目名称");
|
||||
expect(screen.getByRole("form", { name: "维护项目" })).toHaveTextContent("项目状态");
|
||||
expect(screen.queryByText("基础信息")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("规则配置")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("region", { name: "基础信息" })).toBeVisible();
|
||||
expect(screen.getByRole("region", { name: "叫号规则" })).toBeVisible();
|
||||
expect(screen.getByRole("region", { name: "其他规则" })).toBeVisible();
|
||||
expect(screen.getByRole("group", { name: "支持方式" })).toBeVisible();
|
||||
expect(screen.getByRole("group", { name: "单号人数" })).toBeVisible();
|
||||
expect(screen.getByRole("group", { name: "批量叫号" })).toBeVisible();
|
||||
expect(screen.getByRole("group", { name: "批量叫人" })).toBeVisible();
|
||||
expect(screen.getByRole("combobox", { name: "票号格式" })).toHaveDisplayValue("00000");
|
||||
expect(screen.queryByRole("textbox", { name: "时区" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("textbox", { name: "票号前缀" })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("spinbutton", { name: "每次叫号数量" })).toHaveValue(5);
|
||||
expect(screen.getByRole("spinbutton", { name: "单个号码预计间隔时间(秒)" })).toHaveValue(120);
|
||||
expect(screen.getByRole("combobox", { name: "支持的叫号方式" })).toHaveDisplayValue("两种都支持");
|
||||
expect(screen.getByRole("spinbutton", { name: "单号最少人数" })).toHaveValue(1);
|
||||
expect(screen.getByRole("spinbutton", { name: "单号最多人数" })).toHaveValue(8);
|
||||
expect(screen.getByRole("spinbutton", { name: "批量叫号默认数量" })).toHaveValue(5);
|
||||
expect(screen.getByRole("spinbutton", { name: "批量叫号单次上限" })).toHaveValue(20);
|
||||
expect(screen.getByRole("spinbutton", { name: "批量叫人默认人数" })).toHaveValue(8);
|
||||
expect(screen.getByRole("spinbutton", { name: "批量叫人单次上限" })).toHaveValue(30);
|
||||
expect(screen.getByRole("spinbutton", { name: "已体验人数起始展示数" })).toHaveValue(10);
|
||||
expect(screen.getByRole("spinbutton", { name: "每人预计间隔时间(秒)" })).toHaveValue(120);
|
||||
expect(screen.queryByRole("combobox", { name: "预计等待时间方式" })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("textbox", { name: "游客官方提示" })).toHaveValue("请在入口附近等候。");
|
||||
expect(screen.getByRole("button", { name: "保存项目" })).toBeVisible();
|
||||
@@ -121,12 +150,22 @@ describe("AdminPage active tickets", () => {
|
||||
it("创建项目与维护项目使用相同字段", () => {
|
||||
render(<MemoryRouter initialEntries={["/admin/projects/new"]}><AdminPage /></MemoryRouter>);
|
||||
expect(screen.getByRole("form", { name: "创建项目" })).toBeVisible();
|
||||
expect(screen.getByRole("region", { name: "基础信息" })).toBeVisible();
|
||||
expect(screen.getByRole("region", { name: "叫号规则" })).toBeVisible();
|
||||
expect(screen.getByRole("region", { name: "其他规则" })).toBeVisible();
|
||||
expect(screen.getByRole("textbox", { name: "项目名称" })).toBeVisible();
|
||||
expect(screen.getByRole("textbox", { name: "项目编码" })).toBeVisible();
|
||||
expect(screen.getByRole("combobox", { name: "票号格式" })).toHaveDisplayValue("00000");
|
||||
expect(screen.getByRole("combobox", { name: "项目状态" })).toHaveDisplayValue("未开放");
|
||||
expect(screen.getByRole("spinbutton", { name: "每次叫号数量" })).toHaveValue(1);
|
||||
expect(screen.getByRole("spinbutton", { name: "单个号码预计间隔时间(秒)" })).toHaveValue(60);
|
||||
expect(screen.getByRole("combobox", { name: "支持的叫号方式" })).toHaveDisplayValue("两种都支持");
|
||||
expect(screen.getByRole("spinbutton", { name: "单号最少人数" })).toHaveValue(1);
|
||||
expect(screen.getByRole("spinbutton", { name: "单号最多人数" })).toHaveValue(10);
|
||||
expect(screen.getByRole("spinbutton", { name: "批量叫号默认数量" })).toHaveValue(1);
|
||||
expect(screen.getByRole("spinbutton", { name: "批量叫号单次上限" })).toHaveValue(100);
|
||||
expect(screen.getByRole("spinbutton", { name: "批量叫人默认人数" })).toHaveValue(1);
|
||||
expect(screen.getByRole("spinbutton", { name: "批量叫人单次上限" })).toHaveValue(100);
|
||||
expect(screen.getByRole("spinbutton", { name: "已体验人数起始展示数" })).toHaveValue(0);
|
||||
expect(screen.getByRole("spinbutton", { name: "每人预计间隔时间(秒)" })).toHaveValue(60);
|
||||
expect(screen.getByRole("textbox", { name: "游客官方提示" })).toHaveValue("请您在景区附近等候,注意听从工作人员指引。");
|
||||
expect(screen.queryByRole("textbox", { name: "时区" })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "创建项目" })).toBeVisible();
|
||||
@@ -146,8 +185,15 @@ describe("AdminPage active tickets", () => {
|
||||
expect(createProject).toHaveBeenCalledWith({ name: "新项目", code: "NEW-RIDE", timezone: "Asia/Shanghai", ticket_prefix: "A" });
|
||||
expect(updateProjectSettings).toHaveBeenCalledWith("project-2", {
|
||||
status: "NOT_OPEN",
|
||||
call_batch_size: 1,
|
||||
call_mode: "BOTH",
|
||||
default_call_ticket_count: 1,
|
||||
max_call_ticket_count: 100,
|
||||
default_call_people_count: 1,
|
||||
max_call_people_count: 100,
|
||||
min_party_size: 1,
|
||||
max_party_size: 10,
|
||||
grace_period_minutes: 5,
|
||||
experienced_people_start: 0,
|
||||
eta_interval_seconds: 60,
|
||||
visitor_notice: "请您在景区附近等候,注意听从工作人员指引。",
|
||||
});
|
||||
@@ -166,13 +212,20 @@ describe("AdminPage active tickets", () => {
|
||||
expect(screen.queryByText("13800138000")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("全项目实时监控")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("当前批次")).not.toBeInTheDocument();
|
||||
expect(screen.getByText("当前叫号")).toBeInTheDocument();
|
||||
expect(screen.queryByText("当前叫号 · 5 人")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("设备状态")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("大屏中心只展示公开票号与运行状态,不展示游客联系方式。")).not.toBeInTheDocument();
|
||||
expect(screen.getByLabelText(/当前时间/)).toBeInTheDocument();
|
||||
expect(screen.queryByText("当前项目")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("heading", { name: "东门观光车" })).toBeVisible();
|
||||
expect(screen.getByRole("heading", { name: "最新取号码:00015号" })).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("总计等待:1 个号码")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("累计取号数:15 个")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("累计等待人数:3 人")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("已体验人数:12 人")).toBeInTheDocument();
|
||||
expect(document.querySelectorAll("[data-project-screen] .screen-tile__current-metrics .screen-tile__metric")).toHaveLength(4);
|
||||
expect(document.querySelector("[data-project-screen] .screen-tile__clock .screen-tile__logo")).toBeInTheDocument();
|
||||
expect(document.querySelector("[data-project-screen] .screen-tile__project .screen-tile__logo")).toBeNull();
|
||||
expect(screen.getByText("预计等待时间")).toBeVisible();
|
||||
expect(screen.queryByText("后续号段预计")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(/\d+ \/ \d+/)).not.toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user