feat: 添加产品工具, 重构产品 #31
|
|
@ -4,7 +4,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "max build",
|
"build": "max build",
|
||||||
"dev": "max dev",
|
"dev": "max dev",
|
||||||
"fix:openapi2ts": "sed -i '' 's/\r$//' /Users/zksu/Developer/work/workcode/web/node_modules/@umijs/openapi/dist/cli.js",
|
"fix:openapi2ts": "sed -i '' 's/\r$//' ./node_modules/@umijs/openapi/dist/cli.js",
|
||||||
"format": "prettier --cache --write .",
|
"format": "prettier --cache --write .",
|
||||||
"postinstall": "max setup",
|
"postinstall": "max setup",
|
||||||
"openapi2ts": "openapi2ts",
|
"openapi2ts": "openapi2ts",
|
||||||
|
|
|
||||||
|
|
@ -437,6 +437,8 @@ const ListPage: React.FC = () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer ghost>
|
<PageContainer ghost>
|
||||||
<Tabs items={tabs} activeKey={activeKey} onChange={setActiveKey} />
|
<Tabs items={tabs} activeKey={activeKey} onChange={setActiveKey} />
|
||||||
|
|
@ -446,6 +448,12 @@ const ListPage: React.FC = () => {
|
||||||
scroll={{ x: 'max-content' }}
|
scroll={{ x: 'max-content' }}
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
|
columns={columns}
|
||||||
|
rowSelection={{
|
||||||
|
selectedRowKeys,
|
||||||
|
onChange: (keys) => setSelectedRowKeys(keys),
|
||||||
|
}}
|
||||||
|
|
||||||
rowClassName={(record) => {
|
rowClassName={(record) => {
|
||||||
return record.id === activeLine
|
return record.id === activeLine
|
||||||
? styles['selected-line-order-protable']
|
? styles['selected-line-order-protable']
|
||||||
|
|
@ -474,6 +482,41 @@ const ListPage: React.FC = () => {
|
||||||
}}
|
}}
|
||||||
tableRef={actionRef}
|
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) => {
|
request={async ({ date, ...param }: any) => {
|
||||||
if (param.status === 'all') {
|
if (param.status === 'all') {
|
||||||
|
|
|
||||||
|
|
@ -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 */
|
/** 此处后端没有提供注释 POST /order/order/pengding/items */
|
||||||
export async function ordercontrollerPengdingitems(
|
export async function ordercontrollerPengdingitems(
|
||||||
body: Record<string, any>,
|
body: Record<string, any>,
|
||||||
|
|
|
||||||
|
|
@ -488,6 +488,10 @@ declare namespace API {
|
||||||
orderId: number;
|
orderId: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ordercontrollerExportorderParams = {
|
||||||
|
ids: number[];
|
||||||
|
};
|
||||||
|
|
||||||
type ordercontrollerGetorderitemlistParams = {
|
type ordercontrollerGetorderitemlistParams = {
|
||||||
/** 页码 */
|
/** 页码 */
|
||||||
current?: number;
|
current?: number;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue