feat(fulfillment): 工作台表头/内容居中,订单台账同步需绑定成功

- 表头和单元格统一居中
- 同步按钮改名“同步到订单台账”
- 行同步仅在绑定状态 bound 后可用,批量同步要求全选任务均已绑定
This commit is contained in:
yml
2026-11-24 22:02:29 +08:00
parent 292f61b56a
commit 8822f0ab42
@@ -347,7 +347,7 @@ function eventDescription(event: { eventType: string; detail: Record<string, unk
return String(detail.reason || '已转人工处理');
}
if (event.eventType === 'released_to_manual') {
return `转人工原因:${String(detail.reason || '以外部单协作人工处理为准')}`;
return `转人工原因:${String(detail.reason || '以订单台账人工处理为准')}`;
}
if (event.eventType === 'task_cancelled') {
return `取消原因:${String(detail.reason || '人工取消')}`;
@@ -709,7 +709,7 @@ export default function PlatformFulfillmentPage() {
const result = await platformFulfillmentApi.syncCollab(taskIds);
const syncedOrderNo =
result.items.find((item) => item.action === 'created' || item.action === 'updated')?.orderNo || '';
const summary = `外部协作同步完成:新增 ${result.created},更新 ${result.updated}${
const summary = `订单台账同步完成:新增 ${result.created},更新 ${result.updated}${
taskIds.length === 1 && syncedOrderNo ? `,订单 ${syncedOrderNo}` : ''
}`;
if (result.failed || result.skipped) {
@@ -1417,7 +1417,7 @@ export default function PlatformFulfillmentPage() {
),
},
{
title: '外部协作',
title: '订单台账',
key: 'collab',
width: 150,
render: (_, task) =>
@@ -1468,12 +1468,13 @@ export default function PlatformFulfillmentPage() {
loading={rowCollabSyncingId === task.id}
disabled={
!can('platform_fulfillment:use') ||
task.bindingStatus !== 'bound' ||
collabSyncing ||
(rowCollabSyncingId !== null && rowCollabSyncingId !== task.id)
}
onClick={() => void performCollabSync([task.id], task.id)}
>
同步外部单协作
同步到订单台账
</Button>
{task.executionStatus === 'pending_mapping' ? (
<Button size="small" type="primary" icon={<LinkOutlined />} disabled={!can('platform_fulfillment:admin')} onClick={() => void openMapping(task)}>
@@ -1537,6 +1538,20 @@ export default function PlatformFulfillmentPage() {
},
];
const centeredColumns = columns.map((column) => ({
...column,
align: 'center' as const,
onHeaderCell: () => ({ style: { textAlign: 'center' as const } }),
}));
const selectedCollabReady =
selectedRowKeys.length > 0 &&
rows.filter((row) => selectedRowKeys.map(String).includes(String(row.id))).length ===
selectedRowKeys.length &&
rows
.filter((row) => selectedRowKeys.map(String).includes(String(row.id)))
.every((row) => row.bindingStatus === 'bound');
const actionButtons = selected ? (
<Space wrap>
{selected.bindTask?.qrUrl ? (
@@ -1578,7 +1593,7 @@ export default function PlatformFulfillmentPage() {
icon={<UserSwitchOutlined />}
onClick={() => {
setManualReleaseTarget(selected);
setManualReleaseReason('以外部单协作人工处理为准');
setManualReleaseReason('以订单台账人工处理为准');
}}
>
释放并转人工
@@ -1642,11 +1657,12 @@ export default function PlatformFulfillmentPage() {
disabled={
!can('platform_fulfillment:use') ||
selectedRowKeys.length === 0 ||
!selectedCollabReady ||
rowCollabSyncingId !== null
}
onClick={() => void syncCollab()}
>
同步外部单协作{selectedRowKeys.length > 0 ? `(${selectedRowKeys.length})` : ''}
同步到订单台账{selectedRowKeys.length > 0 ? `(${selectedRowKeys.length})` : ''}
</Button>
<Button type="primary" loading={syncing} icon={<SyncOutlined />} onClick={() => void sync()}>
同步待履约订单
@@ -1694,7 +1710,7 @@ export default function PlatformFulfillmentPage() {
<Table<PlatformFulfillmentTask>
rowKey="id"
loading={loading}
columns={columns}
columns={centeredColumns}
dataSource={rows}
rowSelection={{
selectedRowKeys,
@@ -1835,7 +1851,7 @@ export default function PlatformFulfillmentPage() {
{bindingStatusLabel(selected.bindingStatus)}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="外部协作单" span={2}>
<Descriptions.Item label="订单台账" span={2}>
{selected.collabOrder
? `${selected.collabOrder.orderNo} · ${collabStatusLabel(selected.collabOrder.status)}`
: '未同步'}