feat(fulfillment): 映射操作全部展开并用居中弹窗编辑
- 每行直接展示编辑/启用停用/归档恢复/删除,不再收进更多菜单 - 新建和编辑改为居中 Modal,不再使用右侧抽屉 - 调整操作列宽,表格仍无横向滚动
This commit is contained in:
@@ -2,8 +2,8 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import type { 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 { 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, MoreOutlined, QrcodeOutlined, ReloadOutlined, SettingOutlined, ShoppingOutlined, SyncOutlined, UndoOutlined, UserSwitchOutlined } from '@ant-design/icons';
|
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 type { ColumnsType } from 'antd/es/table';
|
||||||
import { douyuApi, platformFulfillmentApi } from '../api/modules';
|
import { douyuApi, platformFulfillmentApi } from '../api/modules';
|
||||||
import type { DouyuGoodsItem, DouyuTaskItem, PlatformFulfillmentBindingLog, PlatformFulfillmentDetail, PlatformFulfillmentMapping, PlatformFulfillmentSettings, PlatformFulfillmentTask } from '../api/modules';
|
import type { DouyuGoodsItem, DouyuTaskItem, PlatformFulfillmentBindingLog, PlatformFulfillmentDetail, PlatformFulfillmentMapping, PlatformFulfillmentSettings, PlatformFulfillmentTask } from '../api/modules';
|
||||||
@@ -2579,41 +2579,32 @@ export default function PlatformFulfillmentPage() {
|
|||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'actions',
|
key: 'actions',
|
||||||
width: 150,
|
width: 250,
|
||||||
render: (_: unknown, row) => (
|
render: (_: unknown, row) => (
|
||||||
<Space size={4}>
|
<Space size={2} wrap>
|
||||||
<Button size="small" disabled={Boolean(row.archivedAt)} onClick={() => editMapping(row)}>
|
<Button size="small" disabled={Boolean(row.archivedAt)} onClick={() => editMapping(row)}>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Dropdown
|
{row.archivedAt ? (
|
||||||
menu={{
|
<Button size="small" onClick={() => runMappingAction(row, 'restore')}>
|
||||||
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 />}>
|
|
||||||
更多
|
|
||||||
</Button>
|
</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>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -2622,19 +2613,16 @@ export default function PlatformFulfillmentPage() {
|
|||||||
</Space>
|
</Space>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Drawer
|
<Modal
|
||||||
title={mappingEditingId ? '编辑商品映射' : '新建商品映射'}
|
title={mappingEditingId ? '编辑商品映射' : '新建商品映射'}
|
||||||
open={mappingEditorOpen}
|
open={mappingEditorOpen}
|
||||||
width={560}
|
width={620}
|
||||||
onClose={() => setMappingEditorOpen(false)}
|
centered
|
||||||
extra={
|
okText="保存映射"
|
||||||
<Space>
|
cancelText="取消"
|
||||||
<Button onClick={() => setMappingEditorOpen(false)}>取消</Button>
|
confirmLoading={mappingSaving}
|
||||||
<Button type="primary" loading={mappingSaving} onClick={() => void saveMapping()}>
|
onOk={() => void saveMapping()}
|
||||||
保存映射
|
onCancel={() => setMappingEditorOpen(false)}
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Space direction="vertical" size={14} style={{ width: '100%' }}>
|
<Space direction="vertical" size={14} style={{ width: '100%' }}>
|
||||||
<div>
|
<div>
|
||||||
@@ -2737,7 +2725,7 @@ export default function PlatformFulfillmentPage() {
|
|||||||
description="内部 SKU 必须和 order_site 订单商品一致;商品 ID 来自斗鱼精英宝典活动。"
|
description="内部 SKU 必须和 order_site 订单商品一致;商品 ID 来自斗鱼精英宝典活动。"
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
</Drawer>
|
</Modal>
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user