新项目, antd6, react19

This commit is contained in:
zhengw
2026-01-05 17:06:16 +08:00
commit fcb43c0cbd
84 changed files with 6939 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import type React from 'react';
import { useImperativeHandle, useState } from 'react';
import ModalPlugin from '@/components/ModalPlugin';
import type { IRef } from '@/utils/type';
interface IProps extends IRef {}
export type IUserEditModalType = {
show: () => void;
};
export const UserEditModal: React.FC<IProps> = (props) => {
console.log(props.ref);
const [open, setOpen] = useState(false);
useImperativeHandle(props.ref, () => ({
show: () => {
setOpen(true);
},
}));
return (
<ModalPlugin open={open} onCancel={() => setOpen(false)}>
11111
</ModalPlugin>
);
};

View File

@@ -0,0 +1,89 @@
import { proxy } from 'valtio';
import { deepClone } from 'valtio/utils';
import type { IOption, IParamsBase } from '@/interfaces/common';
import { UserServices } from '@/services/UserServices';
import { toArray, toNumber, toObject } from '@/utils/common';
import { requestLite } from '@/utils/useRequest2';
const defaultParams = { curr_page: 1, page_count: 20 };
type IParams = IParamsBase & {
order_no?: string;
custom_order_no?: string;
custom_name?: string;
custom_phone?: string;
end_user_address?: string;
end_user_phone?: string;
end_user_name?: string;
payed_state?: string;
document_dateL?: string;
document_dateU?: string;
create_dateL?: string;
create_dateU?: string;
process_state?: any[];
order_step?: any[];
category_id?: any;
};
export const userListStateProxy = proxy<{
params: IParams;
loading: boolean;
ajaxData: any[];
orderStepsOptions: IOption[];
count: number;
amount: {
tot_discount_money?: string;
tot_payed_amount?: string;
tot_tax_last_money?: string;
tot_un_payed_amount?: string;
};
showMoreSearch: boolean;
reset: () => void;
getData: () => void;
clear: () => void;
page: (current?: number, pageSize?: number) => void;
// !分页回调函数
pageCallback?: () => void;
}>({
params: deepClone(defaultParams),
loading: false,
showMoreSearch: false,
ajaxData: [],
orderStepsOptions: [],
amount: {},
count: 0,
reset() {
this.params = deepClone(defaultParams);
this.getData();
},
page(current, pageSize) {
if (!this.loading) {
this.params.curr_page = current || 1;
this.params.page_count = pageSize || this.params.page_count;
this.getData();
this.pageCallback?.();
}
},
async getData() {
this.loading = true;
const temp: any = deepClone(this.params);
if (temp.process_state?.length) {
temp.process_state = temp.process_state.join(',');
}
if (temp.order_step?.length) {
temp.order_step = temp.order_step.join(',');
}
const res: any = await requestLite(UserServices.list, temp);
this.loading = false;
this.ajaxData = toArray(res?.data);
if (this.ajaxData.length == 0 && this.params.curr_page > 1) {
this.page(this.params.curr_page - 1);
}
this.count = toNumber(res?.count);
this.amount = toObject(res?.amount);
},
clear() {
this.ajaxData = [];
this.pageCallback = undefined;
},
});