|
@@ -1,5 +1,5 @@
|
|
|
import { useState, type FormEvent, type ReactNode } from "react";
|
|
import { useState, type FormEvent, type ReactNode } from "react";
|
|
|
-import { ArrowRightLeft, PencilLine, Plus, Search, Trash2, X } from "lucide-react";
|
|
|
|
|
|
|
+import { ArrowRight, ArrowRightLeft, CheckCircle2, PencilLine, Plus, Search, Trash2, X } from "lucide-react";
|
|
|
import { useSession } from "../auth/session";
|
|
import { useSession } from "../auth/session";
|
|
|
import { notifySessionNotice } from "../lib/session-notice";
|
|
import { notifySessionNotice } from "../lib/session-notice";
|
|
|
import { OrganizationAccountStatus } from "./OrganizationAccountStatus";
|
|
import { OrganizationAccountStatus } from "./OrganizationAccountStatus";
|
|
@@ -64,7 +64,7 @@ function MemberFormDialog({ title, onClose, busy, centered = true, children }: {
|
|
|
}) {
|
|
}) {
|
|
|
const close = () => { if (!busy) onClose(); };
|
|
const close = () => { if (!busy) onClose(); };
|
|
|
return <div className={centered ? "org-dialog-backdrop org-centered-backdrop" : "org-dialog-backdrop"} onMouseDown={close} role="presentation">
|
|
return <div className={centered ? "org-dialog-backdrop org-centered-backdrop" : "org-dialog-backdrop"} onMouseDown={close} role="presentation">
|
|
|
- <section aria-label={title} aria-modal="true" className={centered ? "org-dialog org-editor-modal" : "org-dialog"} onMouseDown={(event) => event.stopPropagation()} role="dialog">
|
|
|
|
|
|
|
+ <section aria-label={title} aria-modal="true" className={centered ? "org-dialog org-editor-modal org-member-dialog" : "org-dialog org-member-dialog"} onMouseDown={(event) => event.stopPropagation()} role="dialog">
|
|
|
<header>
|
|
<header>
|
|
|
<h2>{title}</h2>
|
|
<h2>{title}</h2>
|
|
|
<button aria-label="关闭" className="org-icon-button" disabled={busy} onClick={close} type="button"><X size={18} /></button>
|
|
<button aria-label="关闭" className="org-icon-button" disabled={busy} onClick={close} type="button"><X size={18} /></button>
|
|
@@ -305,6 +305,54 @@ function OperationsMemberEditDialog({ team, member, onClose }: { team: Operation
|
|
|
</MemberFormDialog>;
|
|
</MemberFormDialog>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function PrimaryTransferConfirmation({ team, from, to, effect, selfAffected, busy, error, done, onClose, onConfirm }: {
|
|
|
|
|
+ team: string;
|
|
|
|
|
+ from: { name: string; login?: string };
|
|
|
|
|
+ to: { name: string; login?: string };
|
|
|
|
|
+ effect: string;
|
|
|
|
|
+ selfAffected: boolean;
|
|
|
|
|
+ busy: boolean;
|
|
|
|
|
+ error: string;
|
|
|
|
|
+ done: string;
|
|
|
|
|
+ onClose: () => void;
|
|
|
|
|
+ onConfirm: () => Promise<void>;
|
|
|
|
|
+}) {
|
|
|
|
|
+ return <MemberFormDialog title={`设为主账号 · ${team}`} onClose={onClose} busy={busy}>
|
|
|
|
|
+ <div className="org-dialog-content">
|
|
|
|
|
+ {done ? <div className="org-primary-transfer-result" role="status">
|
|
|
|
|
+ <CheckCircle2 size={20} aria-hidden="true" />
|
|
|
|
|
+ <div><strong>主账号已转交</strong><p>{done}</p></div>
|
|
|
|
|
+ </div> : <>
|
|
|
|
|
+ <div className="org-primary-transfer-accounts">
|
|
|
|
|
+ <div className="org-primary-transfer-person">
|
|
|
|
|
+ <span className="org-primary-transfer-label">当前主账号</span>
|
|
|
|
|
+ <strong>{from.name}</strong>
|
|
|
|
|
+ {from.login && from.login !== from.name && <small>{from.login}</small>}
|
|
|
|
|
+ <span className="org-primary-transfer-role">转交后为子账号</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <ArrowRight className="org-primary-transfer-arrow" size={18} aria-hidden="true" />
|
|
|
|
|
+ <div className="org-primary-transfer-person is-recipient">
|
|
|
|
|
+ <span className="org-primary-transfer-label">接任成员</span>
|
|
|
|
|
+ <strong>{to.name}</strong>
|
|
|
|
|
+ {to.login && to.login !== to.name && <small>{to.login}</small>}
|
|
|
|
|
+ <span className="org-primary-transfer-role">转交后为主账号</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <p className="org-primary-transfer-effect">{effect}</p>
|
|
|
|
|
+ {selfAffected && <p className="org-primary-transfer-session" role="note">此次转交涉及当前登录账号,确认后会自动刷新你的权限。</p>}
|
|
|
|
|
+ {error && <p className="org-form-error" role="alert">{error}</p>}
|
|
|
|
|
+ </>}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <footer>{done
|
|
|
|
|
+ ? <button className="org-button" onClick={onClose} type="button">完成</button>
|
|
|
|
|
+ : <>
|
|
|
|
|
+ <Action onClick={onClose} disabled={busy}>取消</Action>
|
|
|
|
|
+ <button className="org-button" disabled={busy} onClick={() => void onConfirm()} type="button">{busy ? "正在转交…" : "确认转交"}</button>
|
|
|
|
|
+ </>}
|
|
|
|
|
+ </footer>
|
|
|
|
|
+ </MemberFormDialog>;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 运营团队主账号转交(OR-11):二次确认 → `ent_team/transfer_primary@v1`。
|
|
* 运营团队主账号转交(OR-11):二次确认 → `ent_team/transfer_primary@v1`。
|
|
|
*
|
|
*
|
|
@@ -342,20 +390,7 @@ function TransferPrimaryDialog({ team, from, to, onClose }: { team: OperationsTe
|
|
|
setBusy(false);
|
|
setBusy(false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- const heading = `设为主账号 · ${team.name}`;
|
|
|
|
|
- return <div className="org-dialog-backdrop" onMouseDown={onClose} role="presentation"><section aria-label={heading} aria-modal="true" className="org-confirm" onMouseDown={(event) => event.stopPropagation()} role="dialog"><h2>{heading}</h2>
|
|
|
|
|
- {done ? <><p className="org-account-notice" role="status">{done}</p><p>新主账号的菜单与可操作项在其下一次刷新页面或重新登录后按 `opsMain` 生效;本页成员标记已回读更新。</p><div className="org-confirm-actions"><button className="org-button" onClick={onClose} type="button">完成</button></div></> : <>
|
|
|
|
|
- <p>每团队有且仅有一个主账号。确认后立即生效:</p>
|
|
|
|
|
- <ul>
|
|
|
|
|
- <li>「{to.name}」(登录名 {to.login || FIELD_UNAVAILABLE})升为主账号,角色码 opsSub → opsMain;</li>
|
|
|
|
|
- <li>「{from.name}」(登录名 {from.login || FIELD_UNAVAILABLE})降为子账号,角色码 opsMain → opsSub;</li>
|
|
|
|
|
- <li>两人的团队归属、登录名与负责范围不变;权限按角色判,随本次转交互换。</li>
|
|
|
|
|
- </ul>
|
|
|
|
|
- {selfAffected && <p className="org-account-notice" role="note">你转交/接收的是当前登录账号本人:确认后会自动重取会话上下文并按新角色跳转,无需重新登录。</p>}
|
|
|
|
|
- {error && <p className="org-form-error" role="alert">{error}</p>}
|
|
|
|
|
- <div className="org-confirm-actions"><Action onClick={onClose} disabled={busy}>取消</Action><button className="org-button" disabled={busy} onClick={() => void submit()} type="button">确认设为主账号</button></div>
|
|
|
|
|
- </>}
|
|
|
|
|
- </section></div>;
|
|
|
|
|
|
|
+ return <PrimaryTransferConfirmation team={team.name} from={from} to={to} effect="确认后,双方的账号权限随角色调整,负责范围保持原样。" selfAffected={selfAffected} busy={busy} error={error} done={done} onClose={onClose} onConfirm={submit} />;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 删除成员:运营走 `ent_team/member_remove`(回 blockers 原文),运维走 `ops_team/member_remove`。 */
|
|
/** 删除成员:运营走 `ent_team/member_remove`(回 blockers 原文),运维走 `ops_team/member_remove`。 */
|
|
@@ -456,20 +491,7 @@ function MaintenanceTransferPrimaryDialog({ team, from, to, onClose }: { team: M
|
|
|
setBusy(false);
|
|
setBusy(false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- const heading = `设为主账号 · ${team.name}`;
|
|
|
|
|
- return <div className="org-dialog-backdrop" onMouseDown={onClose} role="presentation"><section aria-label={heading} aria-modal="true" className="org-confirm" onMouseDown={(event) => event.stopPropagation()} role="dialog"><h2>{heading}</h2>
|
|
|
|
|
- {done ? <><p className="org-account-notice" role="status">{done}</p><div className="org-confirm-actions"><button className="org-button" onClick={onClose} type="button">完成</button></div></> : <>
|
|
|
|
|
- <p>每团队有且仅有一个主账号。确认后立即生效:</p>
|
|
|
|
|
- <ul>
|
|
|
|
|
- <li>「{to.name}」(登录名 {to.login || FIELD_UNAVAILABLE})升为主账号,角色码 ops → teamLead;</li>
|
|
|
|
|
- <li>「{from.name}」(登录名 {from.login || FIELD_UNAVAILABLE})降为子账号,角色码 teamLead → ops;</li>
|
|
|
|
|
- <li>两人的团队归属、登录名与负责范围不变;新主账号可处理类型强制随团队。</li>
|
|
|
|
|
- </ul>
|
|
|
|
|
- {selfAffected && <p className="org-account-notice" role="note">你转交/接收的是当前登录账号本人:确认后会自动重取会话上下文并按新角色跳转,无需重新登录。</p>}
|
|
|
|
|
- {error && <p className="org-form-error" role="alert">{error}</p>}
|
|
|
|
|
- <div className="org-confirm-actions"><Action onClick={onClose} disabled={busy}>取消</Action><button className="org-button" disabled={busy} onClick={() => void submit()} type="button">确认设为主账号</button></div>
|
|
|
|
|
- </>}
|
|
|
|
|
- </section></div>;
|
|
|
|
|
|
|
+ return <PrimaryTransferConfirmation team={team.name} from={from} to={to} effect="确认后,新主账号可处理的工单类型将跟随团队。" selfAffected={selfAffected} busy={busy} error={error} done={done} onClose={onClose} onConfirm={submit} />;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function MaintenanceAccounts({ team }: { team: MaintenanceTeam }) {
|
|
export function MaintenanceAccounts({ team }: { team: MaintenanceTeam }) {
|