Merge pull request 'dev_zty' (#1) from dev_zty into main

Reviewed-on: zksu/WEB#1
This commit is contained in:
zksu 2025-12-19 09:17:37 +00:00
commit 3a547922cd
4 changed files with 62 additions and 1 deletions

View File

@ -4,7 +4,7 @@
"scripts": {
"build": "max build",
"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 .",
"postinstall": "max setup",
"openapi2ts": "openapi2ts",

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

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