feat: 添加MSW模拟服务和数据源集成
refactor: 重构页面组件移除冗余Layout组件 feat: 实现WebSocket和事件总线系统 feat: 添加队列和调度系统 docs: 更新架构文档和服务映射 style: 清理重复接口定义使用数据源 chore: 更新依赖项配置 feat: 添加运行时系统和领域引导 ci: 配置ESLint边界检查规则 build: 添加Redis和WebSocket依赖 test: 添加MSW浏览器环境入口 perf: 优化数据获取逻辑使用统一数据源 fix: 修复类型定义和状态管理问题
This commit is contained in:
@@ -2,24 +2,11 @@ import React, { useState, useEffect } from 'react';
|
||||
import { Table, Button, Input, Select, message, Card } from 'antd';
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, SearchOutlined, UserOutlined, PhoneOutlined, MailOutlined, HomeOutlined } from '@ant-design/icons';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { suppliersDataSource, Supplier } from '@/services/suppliersDataSource';
|
||||
|
||||
const { Option } = Select;
|
||||
const { Search } = Input;
|
||||
|
||||
interface Supplier {
|
||||
id: string;
|
||||
name: string;
|
||||
contactName: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
address: string;
|
||||
category: string;
|
||||
status: 'active' | 'inactive' | 'pending';
|
||||
rating: number;
|
||||
leadTime: number;
|
||||
minOrder: number;
|
||||
}
|
||||
|
||||
const Suppliers: React.FC = () => {
|
||||
const navigate = useNavigate();
|
||||
const [suppliers, setSuppliers] = useState<Supplier[]>([]);
|
||||
@@ -36,18 +23,15 @@ const Suppliers: React.FC = () => {
|
||||
|
||||
const fetchSuppliers = async () => {
|
||||
setLoading(true);
|
||||
// 模拟API调用
|
||||
setTimeout(() => {
|
||||
const mockSuppliers: Supplier[] = [
|
||||
{
|
||||
id: '1',
|
||||
name: 'Supplier A',
|
||||
contactName: 'John Doe',
|
||||
email: 'john@supplier-a.com',
|
||||
phone: '+1 (123) 456-7890',
|
||||
address: '123 Main St, New York, NY',
|
||||
category: 'Electronics',
|
||||
status: 'active',
|
||||
try {
|
||||
const data = await suppliersDataSource.fetchSuppliers();
|
||||
setSuppliers(data);
|
||||
} catch (error) {
|
||||
message.error('Failed to load suppliers');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
rating: 4.5,
|
||||
leadTime: 7,
|
||||
minOrder: 100,
|
||||
|
||||
Reference in New Issue
Block a user