生产管理系统 - 员工管理列表联调
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Card } from '../ui/card';
|
||||
import { Button } from '../ui/button';
|
||||
import { Badge } from '../ui/badge';
|
||||
@@ -15,7 +15,7 @@ import { getAllEnterprises } from '../../lib/authStorage';
|
||||
import type { Enterprise } from '../../types/auth';
|
||||
|
||||
export function EnterpriseManagement() {
|
||||
const [enterprises, setEnterprises] = useState<Enterprise[]>(getAllEnterprises());
|
||||
const [enterprises, setEnterprises] = useState<Enterprise[]>([]);
|
||||
const [showAddDialog, setShowAddDialog] = useState(false);
|
||||
const [showViewDialog, setShowViewDialog] = useState(false);
|
||||
const [showStatusDialog, setShowStatusDialog] = useState(false);
|
||||
@@ -30,6 +30,11 @@ export function EnterpriseManagement() {
|
||||
type: '',
|
||||
});
|
||||
|
||||
// 组件挂载时加载数据
|
||||
useEffect(() => {
|
||||
setEnterprises(getAllEnterprises());
|
||||
}, []);
|
||||
|
||||
// 筛选企业
|
||||
const filteredEnterprises = enterprises.filter(ent => {
|
||||
if (!searchText) return true;
|
||||
|
||||
Reference in New Issue
Block a user