feat(fulfillment): 映射操作全部展开并用居中弹窗编辑

- 每行直接展示编辑/启用停用/归档恢复/删除,不再收进更多菜单
- 新建和编辑改为居中 Modal,不再使用右侧抽屉
- 调整操作列宽,表格仍无横向滚动
This commit is contained in:
yml
2026-11-24 17:12:09 +08:00
parent 95bfa0dcb7
commit a1530b7e74
@@ -2,8 +2,8 @@ import { useCallback, useEffect, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
import { Alert, Button, Card, Col, DatePicker, Descriptions, Drawer, Dropdown, Empty, Input, InputNumber, Modal, QRCode, Row, Segmented, Select, Space, Switch, Table, Tag, Timeline, Typography } from 'antd';
import { CheckCircleOutlined, CopyOutlined, CreditCardOutlined, DownloadOutlined, GiftOutlined, LinkOutlined, MoreOutlined, QrcodeOutlined, ReloadOutlined, SettingOutlined, ShoppingOutlined, SyncOutlined, UndoOutlined, UserSwitchOutlined } from '@ant-design/icons';
import { Alert, Button, Card, Col, DatePicker, Descriptions, Drawer, Empty, Input, InputNumber, Modal, QRCode, Row, Segmented, Select, Space, Switch, Table, Tag, Timeline, Typography } from 'antd';
import { CheckCircleOutlined, CopyOutlined, CreditCardOutlined, DownloadOutlined, GiftOutlined, LinkOutlined, QrcodeOutlined, ReloadOutlined, SettingOutlined, ShoppingOutlined, SyncOutlined, UndoOutlined, UserSwitchOutlined } from '@ant-design/icons';
import type { ColumnsType } from 'antd/es/table';
import { douyuApi, platformFulfillmentApi } from '../api/modules';
import type { DouyuGoodsItem, DouyuTaskItem, PlatformFulfillmentBindingLog, PlatformFulfillmentDetail, PlatformFulfillmentMapping, PlatformFulfillmentSettings, PlatformFulfillmentTask } from '../api/modules';
@@ -2579,41 +2579,32 @@ export default function PlatformFulfillmentPage() {
{
title: '操作',
key: 'actions',
width: 150,
width: 250,
render: (_: unknown, row) => (
<Space size={4}>
<Space size={2} wrap>
<Button size="small" disabled={Boolean(row.archivedAt)} onClick={() => editMapping(row)}>
编辑
</Button>
<Dropdown
menu={{
items: [
...(row.archivedAt
? [{ key: 'restore', label: '恢复' }]
: [
{ key: 'toggle', label: row.enabled ? '停用' : '启用' },
{ key: 'archive', label: '归档' },
]),
{ type: 'divider' as const },
{ key: 'delete', label: '删除', danger: true },
],
onClick: ({ key }) => {
if (key === 'toggle') {
runMappingAction(row, row.enabled ? 'disable' : 'enable');
} else if (key === 'archive') {
runMappingAction(row, 'archive');
} else if (key === 'restore') {
runMappingAction(row, 'restore');
} else if (key === 'delete') {
removeMapping(row);
}
},
}}
>
<Button size="small" icon={<MoreOutlined />}>
更多
{row.archivedAt ? (
<Button size="small" onClick={() => runMappingAction(row, 'restore')}>
恢复
</Button>
</Dropdown>
) : (
<>
<Button
size="small"
onClick={() => runMappingAction(row, row.enabled ? 'disable' : 'enable')}
>
{row.enabled ? '停用' : '启用'}
</Button>
<Button size="small" onClick={() => runMappingAction(row, 'archive')}>
归档
</Button>
</>
)}
<Button size="small" danger onClick={() => removeMapping(row)}>
删除
</Button>
</Space>
),
},
@@ -2622,19 +2613,16 @@ export default function PlatformFulfillmentPage() {
</Space>
</Modal>
<Drawer
<Modal
title={mappingEditingId ? '编辑商品映射' : '新建商品映射'}
open={mappingEditorOpen}
width={560}
onClose={() => setMappingEditorOpen(false)}
extra={
<Space>
<Button onClick={() => setMappingEditorOpen(false)}>取消</Button>
<Button type="primary" loading={mappingSaving} onClick={() => void saveMapping()}>
保存映射
</Button>
</Space>
}
width={620}
centered
okText="保存映射"
cancelText="取消"
confirmLoading={mappingSaving}
onOk={() => void saveMapping()}
onCancel={() => setMappingEditorOpen(false)}
>
<Space direction="vertical" size={14} style={{ width: '100%' }}>
<div>
@@ -2737,7 +2725,7 @@ export default function PlatformFulfillmentPage() {
description="内部 SKU 必须和 order_site 订单商品一致;商品 ID 来自斗鱼精英宝典活动。"
/>
</Space>
</Drawer>
</Modal>
</Space>
);
}