|
@@ -6,7 +6,7 @@ import { SearchInput } from "../components/ui/search-input";
|
|
|
import { MemberEditDialog } from "../components/OrganizationTeamAccounts";
|
|
import { MemberEditDialog } from "../components/OrganizationTeamAccounts";
|
|
|
import { ListPager } from "../components/ListPager";
|
|
import { ListPager } from "../components/ListPager";
|
|
|
import { TeamTicketTypes } from "../components/TeamTicketTypes";
|
|
import { TeamTicketTypes } from "../components/TeamTicketTypes";
|
|
|
-import { OpsDrawer, OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty, OpsTag } from "../components/OperationsKit";
|
|
|
|
|
|
|
+import { OpsDialog, OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty, OpsTag } from "../components/OperationsKit";
|
|
|
import { PageIntro } from "../components/PageIntro";
|
|
import { PageIntro } from "../components/PageIntro";
|
|
|
import { WorkspaceEmpty, WorkspaceHeading, WorkspacePanel } from "../components/RoleWorkspaceKit";
|
|
import { WorkspaceEmpty, WorkspaceHeading, WorkspacePanel } from "../components/RoleWorkspaceKit";
|
|
|
import { Tri } from "../components/triState";
|
|
import { Tri } from "../components/triState";
|
|
@@ -204,7 +204,23 @@ export function TeamDispatchModePage() {
|
|
|
return <section className="role-workspace"><WorkspaceHeading title="分派方式" description={`为 ${team.team_name} 选择手工派单或自动平均分派,设置只对尚未分派的未完成工单生效。`} />
|
|
return <section className="role-workspace"><WorkspaceHeading title="分派方式" description={`为 ${team.team_name} 选择手工派单或自动平均分派,设置只对尚未分派的未完成工单生效。`} />
|
|
|
<WorkspacePanel title="选择团队分派方式" description="每个团队使用一种方式;切换为自动平均时会立即尝试分派存量待派单。" aside={<OpsStatus tone="success">当前:{currentLabel === "手工" ? "手工分派" : "自动平均"}</OpsStatus>}><div className="workspace-choice-grid">{([{ value: "手工" as const, title: "手工分派", Icon: Hand, text: "由团队主账号逐张指定接单成员。适合需要结合现场安排、技能与交付时间选择责任人的团队。" }, { value: "自动平均" as const, title: "自动平均分派", Icon: Shuffle, text: "在类型匹配、客户属于负责范围的可接单成员中,优先分给未完成工单最少的成员。" }]).map(({ value, title, Icon, text }) => <label key={value} className={`workspace-choice ${selected === value ? "selected" : ""}`}><input type="radio" name="dispatch-mode" value={value} checked={selected === value} onChange={() => setDraft(value)} /><Icon size={26} /><h3>{title}</h3><p>{text}</p></label>)}</div><div className="workspace-form !pt-0"><footer><Button variant="outline" disabled={selected === currentLabel || saving} onClick={() => setDraft(null)}>取消更改</Button><Button disabled={selected === currentLabel || saving} onClick={() => { if (selected === "自动平均" && currentLabel === "手工") setConfirming(true); else void saveMode(); }}><Check size={16} />保存分派方式</Button></footer></div></WorkspacePanel>
|
|
<WorkspacePanel title="选择团队分派方式" description="每个团队使用一种方式;切换为自动平均时会立即尝试分派存量待派单。" aside={<OpsStatus tone="success">当前:{currentLabel === "手工" ? "手工分派" : "自动平均"}</OpsStatus>}><div className="workspace-choice-grid">{([{ value: "手工" as const, title: "手工分派", Icon: Hand, text: "由团队主账号逐张指定接单成员。适合需要结合现场安排、技能与交付时间选择责任人的团队。" }, { value: "自动平均" as const, title: "自动平均分派", Icon: Shuffle, text: "在类型匹配、客户属于负责范围的可接单成员中,优先分给未完成工单最少的成员。" }]).map(({ value, title, Icon, text }) => <label key={value} className={`workspace-choice ${selected === value ? "selected" : ""}`}><input type="radio" name="dispatch-mode" value={value} checked={selected === value} onChange={() => setDraft(value)} /><Icon size={26} /><h3>{title}</h3><p>{text}</p></label>)}</div><div className="workspace-form !pt-0"><footer><Button variant="outline" disabled={selected === currentLabel || saving} onClick={() => setDraft(null)}>取消更改</Button><Button disabled={selected === currentLabel || saving} onClick={() => { if (selected === "自动平均" && currentLabel === "手工") setConfirming(true); else void saveMode(); }}><Check size={16} />保存分派方式</Button></footer></div></WorkspacePanel>
|
|
|
<WorkspacePanel title="分派规则" description="两种方式遵循同一套成员资格和工单边界。"><div className="workspace-member-grid">{[{ Icon: UsersRound, title: "本团队、同类型", text: "团队须承接此类型,成员可处理类型须包含此类型,账号须在用。" }, { Icon: ClipboardIcon, title: "按客户负责范围", text: "工单客户须在成员负责范围内。没有符合条件的成员时,工单保留在团队队列。" }, { Icon: Shuffle, title: "动态计算负荷", text: "未完成数包含待处理与处理中;每分派一张后重新计算。数量相同按成员固定顺序选择。" }].map(({ Icon, title, text }) => <article className="workspace-member-card" key={title}><Icon size={22} className="text-primary" /><h3 className="mt-3">{title}</h3><p>{text}</p></article>)}</div><p className="workspace-note"><Info size={15} />自动模式下仍未派出的工单可到 <Link className="workspace-link" to="/workspace/queue">待分派工单 <ArrowRight size={13} /></Link> 重试。</p></WorkspacePanel>
|
|
<WorkspacePanel title="分派规则" description="两种方式遵循同一套成员资格和工单边界。"><div className="workspace-member-grid">{[{ Icon: UsersRound, title: "本团队、同类型", text: "团队须承接此类型,成员可处理类型须包含此类型,账号须在用。" }, { Icon: ClipboardIcon, title: "按客户负责范围", text: "工单客户须在成员负责范围内。没有符合条件的成员时,工单保留在团队队列。" }, { Icon: Shuffle, title: "动态计算负荷", text: "未完成数包含待处理与处理中;每分派一张后重新计算。数量相同按成员固定顺序选择。" }].map(({ Icon, title, text }) => <article className="workspace-member-card" key={title}><Icon size={22} className="text-primary" /><h3 className="mt-3">{title}</h3><p>{text}</p></article>)}</div><p className="workspace-note"><Info size={15} />自动模式下仍未派出的工单可到 <Link className="workspace-link" to="/workspace/queue">待分派工单 <ArrowRight size={13} /></Link> 重试。</p></WorkspacePanel>
|
|
|
- {confirming && <OpsDrawer title="确认切换为自动平均" subtitle={team.team_name} onClose={() => setConfirming(false)}><div className="workspace-form"><p>本团队当前有 <strong>{waiting ?? "—"}</strong> 张待分派工单。确认后立即按未完成数量逐张分派;无符合条件成员的工单仍留在团队队列。</p>{error && <p role="alert" className="workspace-error">{error}</p>}<footer><Button variant="outline" disabled={saving} onClick={() => setConfirming(false)}>取消</Button><Button disabled={saving} onClick={() => void saveMode()}>{saving ? "提交中…" : "确认切换并分派"}</Button></footer></div></OpsDrawer>}
|
|
|
|
|
|
|
+ {confirming && (
|
|
|
|
|
+ <OpsDialog title="确认切换为自动平均" subtitle={team.team_name} onClose={() => { if (!saving) setConfirming(false); }}>
|
|
|
|
|
+ <div className="workspace-form">
|
|
|
|
|
+ <div className="rounded-lg border border-border bg-muted/40 px-4 py-3">
|
|
|
|
|
+ <h3>待分派工单 <strong className="ml-2 text-primary tabular-nums">{waiting ?? "—"}</strong> 张</h3>
|
|
|
|
|
+ <p className="mt-1 text-sm leading-relaxed text-muted-foreground">
|
|
|
|
|
+ 确认后立即分派队列中的工单,优先分给未完成工单最少的合适成员。没有合适成员的工单会留在队列。
|
|
|
|
|
+ </p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {error && <p role="alert" className="workspace-error">{error}</p>}
|
|
|
|
|
+ <footer>
|
|
|
|
|
+ <Button type="button" variant="outline" disabled={saving} onClick={() => setConfirming(false)}>取消</Button>
|
|
|
|
|
+ <Button type="button" disabled={saving} onClick={() => void saveMode()}>{saving ? "提交中…" : "确认切换并分派"}</Button>
|
|
|
|
|
+ </footer>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </OpsDialog>
|
|
|
|
|
+ )}
|
|
|
{error && !confirming && <p role="alert" className="workspace-error">{error}</p>}
|
|
{error && !confirming && <p role="alert" className="workspace-error">{error}</p>}
|
|
|
{!!results.length && <WorkspacePanel title="本次自动分派结果" description="逐张展示本次切换时待派单的处理结果(后端按各单受影响行数如实回执)。"><div className="workspace-table-wrap"><table className="workspace-table"><thead><tr><th>工单</th><th>结果</th></tr></thead><tbody>{results.map((item) => <tr key={`${item.id}-${item.assignee}`}><td>{item.id}</td><td>{item.assignee}</td></tr>)}</tbody></table></div></WorkspacePanel>}
|
|
{!!results.length && <WorkspacePanel title="本次自动分派结果" description="逐张展示本次切换时待派单的处理结果(后端按各单受影响行数如实回执)。"><div className="workspace-table-wrap"><table className="workspace-table"><thead><tr><th>工单</th><th>结果</th></tr></thead><tbody>{results.map((item) => <tr key={`${item.id}-${item.assignee}`}><td>{item.id}</td><td>{item.assignee}</td></tr>)}</tbody></table></div></WorkspacePanel>}
|
|
|
{notice && <OpsNotice key={notice} message={notice} onClose={() => setNotice("")} />}
|
|
{notice && <OpsNotice key={notice} message={notice} onClose={() => setNotice("")} />}
|