main #42

Merged
zhuotianyuan merged 1 commits from zhuotianyuan/WEB:main into main 2026-01-14 12:05:57 +00:00
3 changed files with 40 additions and 15 deletions

View File

@ -5,8 +5,10 @@ import {
DrawerForm, DrawerForm,
ProForm, ProForm,
ProFormSelect, ProFormSelect,
ProFormDateRangePicker,
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { Button } from 'antd'; import { Button } from 'antd';
import dayjs from 'dayjs';
import React from 'react'; import React from 'react';
// 定义SyncForm组件的props类型 // 定义SyncForm组件的props类型
@ -14,6 +16,7 @@ interface SyncFormProps {
tableRef: React.MutableRefObject<ActionType | undefined>; tableRef: React.MutableRefObject<ActionType | undefined>;
onFinish: (values: any) => Promise<void>; onFinish: (values: any) => Promise<void>;
siteId?: string; siteId?: string;
dateRange?: [dayjs.Dayjs, dayjs.Dayjs];
} }
/** /**
@ -21,7 +24,7 @@ interface SyncFormProps {
* @param {SyncFormProps} props * @param {SyncFormProps} props
* @returns {React.ReactElement} * @returns {React.ReactElement}
*/ */
const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId }) => { const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId, dateRange }) => {
// 使用 antd 的 App 组件提供的 message API // 使用 antd 的 App 组件提供的 message API
const [loading, setLoading] = React.useState(false); const [loading, setLoading] = React.useState(false);
@ -49,7 +52,11 @@ const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId }) => {
// 返回一个抽屉表单 // 返回一个抽屉表单
return ( return (
<DrawerForm<API.ordercontrollerSyncorderParams> <DrawerForm<API.ordercontrollerSyncorderParams>
title="同步订单" initialValues={{
dateRange: [dayjs().subtract(1, 'week'), dayjs()],
}}
title="同步订单"
// 表单的触发器,一个带图标的按钮 // 表单的触发器,一个带图标的按钮
trigger={ trigger={
<Button key="syncSite" type="primary"> <Button key="syncSite" type="primary">
@ -67,6 +74,7 @@ const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId }) => {
onFinish={onFinish} onFinish={onFinish}
> >
<ProForm.Group> <ProForm.Group>
{/* 站点选择框 */} {/* 站点选择框 */}
<ProFormSelect <ProFormSelect
name="siteId" name="siteId"
@ -83,6 +91,22 @@ const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId }) => {
})); }));
}} }}
/> />
<ProFormDateRangePicker
name="dateRange"
label="同步日期范围"
placeholder={['开始日期', '结束日期']}
transform={(value) => {
return {
dateRange: value,
};
}}
fieldProps={{
showTime: false,
style: { width: '100%' },
}}
/>
</ProForm.Group> </ProForm.Group>
</DrawerForm> </DrawerForm>
); );

View File

@ -502,7 +502,7 @@ const ListPage: React.FC = () => {
success, success,
message: errMsg, message: errMsg,
data, data,
} = await ordercontrollerSyncorders(values); } = await ordercontrollerSyncorders(values,{after:values.dateRange?.[0]+'T00:00:00Z',before:values.dateRange?.[1]+'T23:59:59Z'});
if (!success) { if (!success) {
throw new Error(errMsg); throw new Error(errMsg);
} }
@ -997,6 +997,7 @@ const Detail: React.FC<{
); );
}} }}
/> />
{/* 显示 related order */} {/* 显示 related order */}
<ProDescriptions.Item <ProDescriptions.Item
label="关联" label="关联"
@ -1506,16 +1507,16 @@ const Shipping: React.FC<{
<ProFormList <ProFormList
label="发货产品" label="发货产品"
name="sales" name="sales"
// rules={[ // rules={[
// { // {
// required: true, // required: true,
// message: '至少需要一个商品', // message: '至少需要一个商品',
// validator: (_, value) => // validator: (_, value) =>
// value && value.length > 0 // value && value.length > 0
// ? Promise.resolve() //</Col> ? Promise.resolve()
// : Promise.reject('至少需要一个商品'), // : Promise.reject('至少需要一个商品'),
// }, // },
// ]} // ]}
> >
<ProForm.Group> <ProForm.Group>
<ProFormSelect <ProFormSelect

View File

@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
import { import {
statisticscontrollerGetinativeusersbymonth, statisticscontrollerGetinativeusersbymonth,
statisticscontrollerGetordersorce, statisticscontrollerGetordersource,
} from '@/servers/api/statistics'; } from '@/servers/api/statistics';
import { import {
ActionType, ActionType,
@ -25,7 +25,7 @@ const ListPage: React.FC = () => {
country: ['CA'], country: ['CA'],
}; };
function handleSubmit(values: typeof initialValues) { function handleSubmit(values: typeof initialValues) {
statisticscontrollerGetordersorce({params: values}).then(({ data, success }) => { statisticscontrollerGetordersource({params: values}).then(({ data, success }) => {
if (success) setData(data); if (success) setData(data);
}); });
} }