|
|
@@ -426,8 +426,9 @@ function OrgEditor({ editor, onClose, onSaved }: { editor: Editor; onClose: () =
|
|
|
const regionParentRaw = editor.parent ?? (existing as Region | undefined)?.parent;
|
|
|
const regionParent = regionParentRaw && regionParentRaw !== V_ROOT ? regionParentRaw : null;
|
|
|
const editorTitle = editor.kind === "region" ? editor.id ? "重命名区域" : `新建${regionLevelTitle}` : `${editor.id ? "编辑" : "新建"}${kindTitle}`;
|
|
|
+ const editorBackdrop = editor.kind === "operator" || editor.kind === "partner" ? "org-centered-backdrop" : "org-editor-modal-backdrop";
|
|
|
if (createdInfo) {
|
|
|
- return <div className="org-dialog-backdrop org-editor-modal-backdrop" role="presentation" onMouseDown={onClose}><section aria-label={`${createdInfo.title}回执`} aria-modal="true" className="org-dialog org-editor-modal" onMouseDown={(e) => e.stopPropagation()} role="dialog">
|
|
|
+ return <div className={`org-dialog-backdrop ${editorBackdrop}`} role="presentation" onMouseDown={onClose}><section aria-label={`${createdInfo.title}回执`} aria-modal="true" className="org-dialog org-editor-modal" onMouseDown={(e) => e.stopPropagation()} role="dialog">
|
|
|
<header><div><span className="org-eyebrow">ORGANIZATION / CREATED</span><h2>{createdInfo.title}</h2></div><button aria-label="关闭" className="org-icon-button" onClick={onClose} type="button"><X size={18} /></button></header>
|
|
|
<div className="org-dialog-content"><p className="org-account-notice" role="status">档案与登录账号已开通</p><div className="org-account-secret"><span>名称</span><strong>{createdInfo.label}</strong><span>登录名</span><strong>{createdInfo.username || "—"}</strong>{createdInfo.password ? <><span>一次性凭据</span><strong>{createdInfo.password}</strong><small>由开通回执一次性下发(初始密码/激活码),关闭后无法再次查询,请立即转交本人。</small></> : <small>后端未回传一次性凭据(`credential_viewable=false` 或不含 `initial_password`),请通过账号设置重置激活码。</small>}</div></div>
|
|
|
<footer><button className="org-button" onClick={onClose} type="button">完成</button></footer>
|
|
|
@@ -447,7 +448,7 @@ function OrgEditor({ editor, onClose, onSaved }: { editor: Editor; onClose: () =
|
|
|
</footer>
|
|
|
</section></div>;
|
|
|
}
|
|
|
- return <div className={`org-dialog-backdrop ${editor.kind === "operator" ? "org-centered-backdrop" : "org-editor-modal-backdrop"}`} role="presentation" onMouseDown={onClose}><section aria-label={editorTitle} aria-describedby={hasScope ? "org-editor-scope-description" : undefined} aria-modal="true" className={`org-dialog org-editor-modal${editor.kind === "region" ? " org-region-editor-modal" : ""}`} onMouseDown={(e) => e.stopPropagation()} role="dialog">
|
|
|
+ return <div className={`org-dialog-backdrop ${editorBackdrop}`} role="presentation" onMouseDown={onClose}><section aria-label={editorTitle} aria-describedby={hasScope ? "org-editor-scope-description" : undefined} aria-modal="true" className={`org-dialog org-editor-modal${editor.kind === "region" ? " org-region-editor-modal" : ""}`} onMouseDown={(e) => e.stopPropagation()} role="dialog">
|
|
|
<header>
|
|
|
<div>
|
|
|
<span className="org-eyebrow">ORGANIZATION RECORD</span>
|
|
|
@@ -456,7 +457,7 @@ function OrgEditor({ editor, onClose, onSaved }: { editor: Editor; onClose: () =
|
|
|
</div>
|
|
|
<button aria-label="关闭" className="org-icon-button" onClick={onClose} type="button"><X size={18} /></button>
|
|
|
</header>
|
|
|
- <form noValidate onSubmit={submit}><div className={`org-dialog-content${editor.kind === "maintenance" ? " org-editor-form-grid" : ""}`}>
|
|
|
+ <form noValidate onSubmit={submit}><div className={`org-dialog-content${editor.kind === "maintenance" || editor.kind === "partner" ? " org-editor-form-grid" : ""}`}>
|
|
|
<label className="org-field"><span>{editor.kind === "region" ? `${regionLevelTitle}名称` : "名称"} <em>*</em></span><input autoFocus maxLength={60} onChange={(e) => setName(e.target.value)} value={name} /></label>
|
|
|
{editor.kind === "region" && !editor.id && <label className="org-field"><span>区域层级 <em>*</em></span><select className="org-select" onChange={(e) => setRegionLevelSel(e.target.value)} value={regionLevelSel}><option value="">请选择层级</option>{levelNames.map((item) => <option key={item} value={item}>{item}</option>)}</select></label>}
|
|
|
{editor.kind === "region" && <div className="org-region-editor-context"><span>{regionParent ? "所属上级区域" : "区域层级"}</span><strong>{regionParent ? regionPath(data, regionParent) : "省级 · 挂在平台树根下"}</strong><p>{editor.id ? "调整区域名称,所属层级与挂载关系保持不变。" : "层级由业务侧自持,请在上方点名(跨级挂靠是常态,系统不按上级推导)。"}</p></div>}
|
|
|
@@ -469,7 +470,7 @@ function OrgEditor({ editor, onClose, onSaved }: { editor: Editor; onClose: () =
|
|
|
{editor.kind === "operations" && <p className="org-helper">运营团队分成的口径与取值由结算域维护,后端未在团队档案上开放修改入参。</p>}
|
|
|
{editor.kind === "operations" && <label className="org-field"><span>团队说明</span><textarea onChange={(e) => setDesc(e.target.value)} rows={3} value={desc} /></label>}
|
|
|
{editor.kind === "operator" && <label className="org-field"><span>付款周期</span><select className="org-select" onChange={(e) => setPayCycle(e.target.value)} value={payCycle}><option value="">未配置</option>{payCycleOptions.map((value) => <option key={value} value={value}>{value}</option>)}</select></label>}
|
|
|
- {editor.kind === "partner" && <label className="org-field"><span>渠道说明</span><input onChange={(e) => setTitle(e.target.value)} value={title} /></label>}
|
|
|
+ {editor.kind === "partner" && <label className={editor.id ? "org-field" : "org-field org-editor-wide"}><span>渠道说明</span><input onChange={(e) => setTitle(e.target.value)} value={title} /></label>}
|
|
|
{editor.kind === "partner" && !editor.id && <><label className="org-field"><span>登录名 <em>*</em></span><input autoComplete="off" maxLength={64} onChange={(e) => setUsername(e.target.value)} value={username} /></label><label className="org-field"><span>手机号</span><input autoComplete="off" maxLength={20} onChange={(e) => setMobile(e.target.value)} value={mobile} /></label><p className="org-helper">后端创建合伙人时会同步创建其登录账号,登录名为必填;账号密码由后端以激活码下发。</p></>}
|
|
|
{editor.kind === "partner" && editor.id && <label className="org-field"><span>手机号 <small>留空则不改(不上传该字段)</small></span><input autoComplete="off" inputMode="tel" maxLength={11} onChange={(e) => setMobile(e.target.value)} placeholder="列表为脱敏值,请重新输入完整手机号;清空号码请联系总运营" value={mobile} /></label>}
|
|
|
{/* 合伙人账号并入「编辑合伙人」(2026-11-16 业主指示),沿用档案字段风格;手机号仍由上方档案字段维护。 */}
|
|
|
@@ -1056,6 +1057,17 @@ export function RegionManagementPage() {
|
|
|
}
|
|
|
|
|
|
|
|
|
+function DirectorySortHeader({ label, direction, onSort }: { label: string; direction?: SortDir; onSort: () => void }) {
|
|
|
+ const SortIcon = direction === "asc" ? ArrowUp : direction === "desc" ? ArrowDown : ArrowUpDown;
|
|
|
+ return (
|
|
|
+ <th scope="col" aria-sort={direction === "asc" ? "ascending" : direction === "desc" ? "descending" : undefined}>
|
|
|
+ <button className="org-directory-sort" type="button" onClick={onSort}>
|
|
|
+ {label}<SortIcon size={13} aria-hidden="true" />
|
|
|
+ </button>
|
|
|
+ </th>
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
export function OperatorManagementPage() {
|
|
|
// 名录不依赖客户全集;customer/get_list 曾把首开墙钟拖到 ~1s。
|
|
|
// 删除校验/编辑弹窗才要 enterprises → 延后补取。
|
|
|
@@ -1115,15 +1127,7 @@ export function OperatorManagementPage() {
|
|
|
]);
|
|
|
}
|
|
|
function sortHeader(key: OpSort, label: string) {
|
|
|
- const active = sortKey === key;
|
|
|
- const SortIcon = active ? (sortDir === "asc" ? ArrowUp : ArrowDown) : ArrowUpDown;
|
|
|
- return (
|
|
|
- <th scope="col" aria-sort={active ? (sortDir === "asc" ? "ascending" : "descending") : undefined}>
|
|
|
- <button className="org-operator-sort" type="button" onClick={() => toggleSort(key)}>
|
|
|
- {label}<SortIcon size={13} aria-hidden="true" />
|
|
|
- </button>
|
|
|
- </th>
|
|
|
- );
|
|
|
+ return <DirectorySortHeader label={label} direction={sortKey === key ? sortDir : undefined} onSort={() => toggleSort(key)} />;
|
|
|
}
|
|
|
return <div className="org-page org-operator-page page-fill">
|
|
|
<PageHead eyebrow="组织与区域 / 02" title="运营商管理" description="按所属区域建立结算对手方档案,集中核对对账口径。" action={<Button onClick={() => setEditor({ kind: "operator" })}><Plus size={16} /> 新增运营商</Button>} />
|
|
|
@@ -1160,16 +1164,16 @@ export function OperatorManagementPage() {
|
|
|
const shareLabel = o.sharePending ? "未配置" : `${shareText(o)} · ${o.shareMode}`;
|
|
|
const accountOpened = o.account !== "未开通";
|
|
|
return <tr className={selected === o.id ? "selected" : ""} key={o.id} tabIndex={0} aria-label={`查看${regionPath(data, o.region)}${o.name}档案`} onKeyDown={(event) => { if (event.key === "Enter" && event.target === event.currentTarget) setSelected(o.id); }} onClick={() => setSelected(o.id)}>
|
|
|
- <td className="org-operator-identity"><span className="org-operator-name" title={o.name}>{o.name}</span>{o.brand && <small>{o.brand}</small>}</td>
|
|
|
+ <td className="org-directory-identity"><span className="org-directory-name" title={o.name}>{o.name}</span>{o.brand && <small>{o.brand}</small>}</td>
|
|
|
<td title={regionPath(data, o.region)}>{regionPath(data, o.region)}</td>
|
|
|
- <td><span className="org-operator-value" title={reconcileDayTitle(o, defaultDay)}>{reconcileDayText(o, defaultDay)}</span></td>
|
|
|
+ <td><span className="org-directory-value" title={reconcileDayTitle(o, defaultDay)}>{reconcileDayText(o, defaultDay)}</span></td>
|
|
|
<td title={o.payCycle || undefined}>{o.payCycle || "未配置"}</td>
|
|
|
<td title={shareLabel}>
|
|
|
{o.sharePending ? <span className="org-operator-muted">{shareLabel}</span> : (
|
|
|
- <><span className="org-operator-value org-operator-share-value">{shareText(o)}</span><small>{o.shareMode}</small></>
|
|
|
+ <><span className="org-directory-value org-directory-share-value">{shareText(o)}</span><small>{o.shareMode}</small></>
|
|
|
)}
|
|
|
</td>
|
|
|
- <td className="org-operator-customer-count"><Count v={o.customerCount} /></td>
|
|
|
+ <td className="org-directory-customer-count"><Count v={o.customerCount} /></td>
|
|
|
<td>{/* 账号列只显示状态徽标;登录名/手机号挂 title,悬停可见。 */}
|
|
|
<OrganizationAccountStatus
|
|
|
status={o.account}
|
|
|
@@ -1205,12 +1209,11 @@ export function PartnerManagementPage() {
|
|
|
useOrganizationDemand(["enterprises"]);
|
|
|
const tableOverflow = useHorizontalOverflow();
|
|
|
// 2026-11-16 业主指示:合伙人操作列只有「编辑」「删除」两项,直接平铺,⛔ 收进「更多」菜单。
|
|
|
- const actionWidth = 180;
|
|
|
- const remaining = Math.max(0, (tableOverflow.width || 1200) - 180 - actionWidth);
|
|
|
- // 8 列:合伙人、所属区域、登录账号、分成方式、分成值、负责范围、覆盖客户、操作
|
|
|
- // 注意:Partner 表头只有一列「操作」,账号动作已并入「编辑合伙人」(2026-11-16),actionWidth 只承载右侧操作按钮组;
|
|
|
- // 不要像运营商/运营团队那样把数值列(客户数、账号状态)也给一个固定宽度——那些在这里已经被并入前面权重里了。
|
|
|
- const columnWidths = [.18, .20, .16, .14, .14, .24, .14].map((w) => remaining * w).concat([actionWidth]);
|
|
|
+ const minimumWidths = [122, 108, 110, 84, 96, 150, 88, 132];
|
|
|
+ const minimumTableWidth = minimumWidths.reduce((sum, width) => sum + width, 0);
|
|
|
+ const extraWidth = Math.max(0, tableOverflow.width - minimumTableWidth);
|
|
|
+ const extraShares = [.22, .18, .17, .07, .10, .26, 0, 0];
|
|
|
+ const columnWidths = minimumWidths.map((width, index) => width + extraWidth * extraShares[index]);
|
|
|
const [query, setQuery] = useState("");
|
|
|
const regionIds = useMemo(() => new Set(data.regions.map((item) => item.id)), [data.regions]);
|
|
|
const [region, setRegion, invalidRegion] = useRegionQueryFilter(regionIds);
|
|
|
@@ -1246,7 +1249,9 @@ export function PartnerManagementPage() {
|
|
|
...rows.map((p) => [p.name, p.title || "", regionPath(data, p.region), p.login || "", p.account, p.shareMode, p.sharePending ? "未配置" : shareText(p), scopeSummary(data, p.scope, p.scopeCustomerIds), p.coverageCustomers ?? ""]),
|
|
|
]);
|
|
|
}
|
|
|
- const sortAria = (key: PtSort) => sortKey === key ? (sortDir === "asc" ? "ascending" : "descending") : "none";
|
|
|
+ function sortHeader(key: PtSort, label: string) {
|
|
|
+ return <DirectorySortHeader label={label} direction={sortKey === key ? sortDir : undefined} onSort={() => toggleSort(key)} />;
|
|
|
+ }
|
|
|
return <div className="org-page org-partner-page page-fill"><PageHead eyebrow="组织与区域 / 03" title="合伙人管理" description="为渠道合伙人建档,明确客户覆盖范围和分成约定。" action={<Button onClick={() => setEditor({ kind: "partner" })}><Plus size={16} /> 新建合伙人</Button>} />
|
|
|
<OrgFetchState status={status} collections={["partners"]} />
|
|
|
<CollectionFailed status={status} collection="partners" title="合伙人" />
|
|
|
@@ -1254,10 +1259,64 @@ export function PartnerManagementPage() {
|
|
|
<div className="org-ledger list-shell-fill"><section className="org-ledger-main list-shell-fill">
|
|
|
<div className="org-filterbar"><SearchBox onChange={(value) => { setQuery(value); paging.resetPage(); }} placeholder="搜索合伙人名称、渠道说明或通知地址" value={query} /><RegionSelect all data={data} onChange={(value) => { setRegion(value); paging.resetPage(); }} value={region} />{(query || region) && <FilterResetButton variant="ghost" size="sm" onClick={() => { setQuery(""); setRegion(""); paging.resetPage(); }}>重置筛选</FilterResetButton>}<FilterResetButton variant="ghost" size="sm" disabled={!rows.length} onClick={exportRows}><Download size={14} /> 导出 CSV</FilterResetButton></div>
|
|
|
<div ref={tableOverflow.ref} tabIndex={0} role="region" aria-label="合伙人名录,可横向滚动查看字段" className={`measured-table-scroll org-table-wrap org-partner-table-scroll${tableOverflow.overflow ? " has-horizontal-overflow" : ""}${tableOverflow.width >= 600 ? " can-pin-identity" : ""}${tableOverflow.canScrollLeft ? " can-scroll-left" : ""}${tableOverflow.canScrollRight ? " can-scroll-right" : ""}`}>
|
|
|
- <table className="org-table org-partner-ledger"><OpsTableColumns widths={columnWidths} /><thead><tr><th className="sortable" aria-sort={sortAria("name")} onClick={() => toggleSort("name")}>合伙人</th><th className="sortable" aria-sort={sortAria("region")} onClick={() => toggleSort("region")}>所属区域</th><th>登录账号</th><th>分成方式</th><th>分成值</th><th>负责范围</th><th className="sortable" aria-sort={sortAria("coverage")} onClick={() => toggleSort("coverage")}>覆盖客户</th><th className="org-table-actions-heading">操作</th></tr></thead><tbody>{!status.partial.partners && pageRows.map((p) => <tr className={selected === p.id ? "selected" : ""} key={p.id} tabIndex={0} aria-label={`查看${regionPath(data, p.region)}${p.name}档案`} onKeyDown={(event) => { if (event.key === "Enter" && event.target === event.currentTarget) setSelected(p.id); }} onClick={() => setSelected(p.id)}><td><strong title={p.name}>{p.name}</strong><small>{p.title || "未填写渠道说明"}</small></td><td title={regionPath(data, p.region)}>{regionPath(data, p.region)}</td><td><OrganizationAccountStatus status={p.account} /><small>{p.login || "尚未设置登录名"}</small></td><td className="org-maintenance-share"><strong>{p.shareMode}</strong></td><td className="org-maintenance-share">{p.sharePending ? <Tri tone="missing" text="未配置" title="档案里分成方式/分成值为空=尚未配置,不是后端未下发" /> : <span className="org-number">{shareText(p)}</span>}</td><td className="org-maintenance-scope-cell" title={scopeSummary(data, p.scope, p.scopeCustomerIds)}>{scopeSummary(data, p.scope, p.scopeCustomerIds)}</td><td className="org-number"><Count v={p.coverageCustomers} /></td><td className="org-table-actions-cell"><div className="org-table-actions is-icons"><OpsResponsiveActions expanded items={[
|
|
|
- { label: "编辑合伙人", shortLabel: "编辑", icon: <PencilLine size={15} />, onSelect: () => { setSelected(p.id); setEditor({ kind: "partner", id: p.id }); } },
|
|
|
- { label: "删除合伙人", shortLabel: "删除", danger: true, icon: <Trash2 size={15} />, onSelect: () => { setSelected(p.id); setDeleteId(p.id); } },
|
|
|
- ]} /></div></td></tr>)}</tbody></table>{!rows.length && <Empty filtered={Boolean(query || region)} />}
|
|
|
+ <table className="org-table org-partner-ledger" style={{ minWidth: minimumTableWidth }}>
|
|
|
+ <OpsTableColumns widths={columnWidths} />
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ {sortHeader("name", "合伙人")}
|
|
|
+ {sortHeader("region", "所属区域")}
|
|
|
+ <th scope="col">登录账号</th>
|
|
|
+ <th scope="col">分成方式</th>
|
|
|
+ <th scope="col">分成值</th>
|
|
|
+ <th scope="col">负责范围</th>
|
|
|
+ {sortHeader("coverage", "覆盖客户")}
|
|
|
+ <th scope="col" className="org-table-actions-heading">操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ {!status.partial.partners && pageRows.map((p) => {
|
|
|
+ const regionName = regionPath(data, p.region);
|
|
|
+ const scopeLabel = scopeSummary(data, p.scope, p.scopeCustomerIds);
|
|
|
+ return (
|
|
|
+ <tr
|
|
|
+ className={selected === p.id ? "selected" : ""}
|
|
|
+ key={p.id}
|
|
|
+ tabIndex={0}
|
|
|
+ aria-label={`查看${regionName}${p.name}档案`}
|
|
|
+ onKeyDown={(event) => { if (event.key === "Enter" && event.target === event.currentTarget) setSelected(p.id); }}
|
|
|
+ onClick={() => setSelected(p.id)}
|
|
|
+ >
|
|
|
+ <td className="org-directory-identity">
|
|
|
+ <span className="org-directory-name" title={p.name}>{p.name}</span>
|
|
|
+ <small title={p.title || undefined}>{p.title || "未填写渠道说明"}</small>
|
|
|
+ </td>
|
|
|
+ <td title={regionName}>{regionName}</td>
|
|
|
+ <td>
|
|
|
+ <OrganizationAccountStatus status={p.account} />
|
|
|
+ <small title={p.login || undefined}>{p.login || "尚未设置登录名"}</small>
|
|
|
+ </td>
|
|
|
+ <td>{p.shareMode}</td>
|
|
|
+ <td title={p.sharePending ? undefined : shareText(p)}>
|
|
|
+ {p.sharePending ? (
|
|
|
+ <Tri tone="missing" text="未配置" title="档案里分成方式/分成值为空=尚未配置,不是后端未下发" />
|
|
|
+ ) : <span className="org-directory-value org-directory-share-value">{shareText(p)}</span>}
|
|
|
+ </td>
|
|
|
+ <td title={scopeLabel}>{scopeLabel}</td>
|
|
|
+ <td className="org-directory-customer-count"><Count v={p.coverageCustomers} /></td>
|
|
|
+ <td className="org-table-actions-cell">
|
|
|
+ <div className="org-table-actions is-icons">
|
|
|
+ <OpsResponsiveActions expanded items={[
|
|
|
+ { label: "编辑合伙人", shortLabel: "编辑", icon: <PencilLine size={15} />, onSelect: () => { setSelected(p.id); setEditor({ kind: "partner", id: p.id }); } },
|
|
|
+ { label: "删除合伙人", shortLabel: "删除", danger: true, icon: <Trash2 size={15} />, onSelect: () => { setSelected(p.id); setDeleteId(p.id); } },
|
|
|
+ ]} />
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ );
|
|
|
+ })}
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ {!rows.length && <Empty filtered={Boolean(query || region)} />}
|
|
|
</div>
|
|
|
<ListPager total={rows.length} page={paging.safePage} pageSize={paging.pageSize} onPageChange={paging.setPage} onPageSizeChange={paging.setPageSize} unit="位" className="org-list-pager" />
|
|
|
</section></div>
|