生产管理系统 - 员工管理列表联调

This commit is contained in:
2025-11-04 15:55:29 +08:00
parent aec67101cb
commit fffd37a0a9
23 changed files with 2251 additions and 276 deletions

View File

@@ -106,23 +106,14 @@ export default function TenantUserManagementPage() {
// 加载用户数据
const loadUsers = async (resetPage = false) => {
try {
dispatch({ type: 'SET_LOADING', payload: true });
const params: UsersQueryParams = {
search: state.filters.searchKeyword || undefined,
page: resetPage ? 1 : state.pagination.page,
size: state.pagination.size,
order_by: state.sortBy,
sort_order: state.sortOrder,
is_active: true,
};
// 根据状态筛选器设置 is_active 参数
if (state.filters.statusFilter === 'active') {
params.is_active = true;
} else if (state.filters.statusFilter === 'inactive') {
params.is_active = false;
}
const response: UsersApiResponse = await fetchUsers(params);
const transformedUsers = response.data.map(transformUserData);
@@ -150,15 +141,15 @@ export default function TenantUserManagementPage() {
};
// 加载企业数据这里暂时使用mock数据后续可以添加企业API
const loadEnterprises = () => {
// 这里可以添加企业API调用现在使用mock数据
const mockEnterprises: Enterprise[] = [
{ id: 'ent-1', name: '丰收现代农业集团' },
{ id: 'ent-2', name: '绿色种植科技有限公司' },
{ id: 'ent-3', name: '智慧农业示范区' },
];
dispatch({ type: 'SET_ENTERPRISES', payload: mockEnterprises });
};
// const loadEnterprises = () => {
// // 这里可以添加企业API调用现在使用mock数据
// const mockEnterprises: Enterprise[] = [
// { id: 'ent-1', name: '丰收现代农业集团' },
// { id: 'ent-2', name: '绿色种植科技有限公司' },
// { id: 'ent-3', name: '智慧农业示范区' },
// ];
// dispatch({ type: 'SET_ENTERPRISES', payload: mockEnterprises });
// };
// 搜索处理
const handleSearch = (value: string) => {
@@ -262,18 +253,8 @@ export default function TenantUserManagementPage() {
},
];
// 初始化和监听器
useEffect(() => {
loadUsers();
loadEnterprises();
}, []);
useEffect(() => {
const timer = setTimeout(() => {
loadUsers();
}, 300);
return () => clearTimeout(timer);
}, [state.filters.searchKeyword, state.filters.statusFilter, state.filters.typeFilter, state.sortBy, state.sortOrder]);
useEffect(() => {