WorkOrderQueuePage.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * 待分派(册 5,「工单与任务」菜单入口)。
  3. *
  4. * 与 `/workspace/queue` 共用 [`QueueBoard`]:团队主看本团队并可一键自动平均分派;
  5. * 总运营/区域运营看权限范围内全部团队的待分派单(多一列「团队」),
  6. * 自动分派按团队执行 ⇒ 总运营侧按钮禁用并说明原因,⛔ 让他点一下再吃服务端 `team_id` 必填。
  7. *
  8. * 运维成员(`ops`/`worker`)不在 `pending_queue` 的角色集内(服务端 `guard::gate` 直拒),
  9. * 因此不给他们这个菜单,直接敲 URL 也落回我的待办。
  10. */
  11. import { Navigate } from "react-router";
  12. import { PageIntro } from "../components/PageIntro";
  13. import { Info } from "lucide-react";
  14. import { QueueBoard } from "./TeamQueuePage";
  15. import { useDemoIdentity } from "../lib/demo-session";
  16. import "../styles/operations.css";
  17. import "../styles/work-orders.css";
  18. const QUEUE_ROLES = ["admin", "regAdmin", "teamLead"];
  19. export function WorkOrderQueuePage() {
  20. const identity = useDemoIdentity();
  21. if (identity && !QUEUE_ROLES.includes(identity.role)) return <Navigate to="/work-orders/mine" replace />;
  22. const teamLead = identity?.role === "teamLead" && identity.maintenanceTeamId ? identity : null;
  23. return <section className="work-order-page work-order-queue-page page-fill">
  24. <header className="work-order-heading">
  25. <div>
  26. <p className="work-order-eyebrow"><span /> DISPATCH / 待分派</p>
  27. <h1>待分派</h1>
  28. <PageIntro>{teamLead
  29. ? `为 ${teamLead.name} 的待分派工单找合适的接单人,候选人按工单类型、负责范围和账号状态筛选。`
  30. : "在负责范围内逐张派单。需要自动平均分派时,请切到对应的团队主账号。"}</PageIntro>
  31. </div>
  32. </header>
  33. <QueueBoard
  34. teamId={teamLead?.maintenanceTeamId}
  35. teamName={teamLead?.name}
  36. showTeamColumn={!teamLead}
  37. canAutoDispatch={Boolean(teamLead)}
  38. />
  39. {!teamLead && <p className="work-order-block-note"><Info size={13} />自动平均分派以「团队」为作用域:服务端要求 `team_id` 且团队分派方式为自动平均。总部视角请到运维团队页切换分派方式,或在此逐张指定成员。</p>}
  40. </section>;
  41. }