feat: 添加产品工具, 重构产品 #31

Closed
zksu wants to merge 37 commits from (deleted):main into main
3 changed files with 61 additions and 0 deletions
Showing only changes of commit 589f4c878d - Show all commits

View File

@ -437,6 +437,8 @@ const ListPage: React.FC = () => {
},
},
];
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
return (
<PageContainer ghost>
<Tabs items={tabs} activeKey={activeKey} onChange={setActiveKey} />
@ -446,6 +448,12 @@ const ListPage: React.FC = () => {
scroll={{ x: 'max-content' }}
actionRef={actionRef}
rowKey="id"
columns={columns}
rowSelection={{
selectedRowKeys,
onChange: (keys) => setSelectedRowKeys(keys),
}}
rowClassName={(record) => {
return record.id === activeLine
? styles['selected-line-order-protable']
@ -474,6 +482,41 @@ const ListPage: React.FC = () => {
}}
tableRef={actionRef}
/>,
// <Button
// type="primary"
// disabled={selectedRowKeys.length === 0}
// onClick={handleBatchExport}
// >
// 批量导出
// </Button>,
<Popconfirm
title="批量导出"
description="确认导出选中的订单吗?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerExportorder({
ids: selectedRowKeys,
});
if (!success) {
throw new Error(errMsg);
}
message.success('导出成功');
actionRef.current?.reload();
setSelectedRowKeys([]);
} catch (error: any) {
message.error(error?.message || '导出失败');
}
}}
>
<Button type="primary" disabled={selectedRowKeys.length === 0} ghost>
</Button>
</Popconfirm>
]}
request={async ({ date, ...param }: any) => {
if (param.status === 'all') {

View File

@ -177,6 +177,20 @@ export async function ordercontrollerCreateorder(
});
}
/** 此处后端没有提供注释 PUT /order/order/export/${param0} */
export async function ordercontrollerExportorder(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.ordercontrollerExportorderParams,
options?: { [key: string]: any },
) {
const { ids: param0, ...queryParams } = params;
return request<any>(`/order/order/export/${param0}`, {
method: 'PUT',
params: { ...queryParams },
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /order/order/pengding/items */
export async function ordercontrollerPengdingitems(
body: Record<string, any>,

View File

@ -398,6 +398,10 @@ declare namespace API {
orderId: number;
};
type ordercontrollerExportorderParams = {
ids: number[];
};
type ordercontrollerGetorderitemlistParams = {
/** 页码 */
current?: number;