refactor(types): 重构类型系统,统一共享类型定义

feat(types): 新增共享类型中心,包含用户、产品、订单等核心领域类型
fix(types): 修复类型定义错误,统一各模块类型引用
style(types): 优化类型文件格式和注释
docs(types): 更新类型文档和变更日志
test(types): 添加类型测试用例
build(types): 配置类型共享路径
chore(types): 清理重复类型定义文件
This commit is contained in:
2026-03-20 17:53:46 +08:00
parent 989c4b13a6
commit 427becbc8f
222 changed files with 25676 additions and 6328 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Card, Row, Col, Button, Form, Input, Select, message, Tabs, Table } from 'antd';
import { ArrowLeftOutlined, SaveOutlined, UserOutlined, PhoneOutlined, MailOutlined, HomeOutlined, DollarOutlined, ClockOutlined, ShoppingCartOutlined } from '@ant-design/icons';
import { ArrowLeftOutlined, SaveOutlined, UserOutlined, PhoneOutlined, MailOutlined, HomeOutlined, DollarOutlined, LockOutlined, ShoppingCartOutlined } from '@ant-design/icons';
import { useParams, useNavigate } from 'react-router-dom';
import { suppliersDataSource, Supplier, SupplierProduct } from '@/services/suppliersDataSource';
@@ -11,7 +11,7 @@ const SupplierDetail: React.FC = () => {
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
const [supplier, setSupplier] = useState<Supplier | null>(null);
const [products, setProducts] = useState<Product[]>([]);
const [products, setProducts] = useState<SupplierProduct[]>([]);
const [loading, setLoading] = useState(false);
const [form] = Form.useForm();
@@ -26,6 +26,7 @@ const SupplierDetail: React.FC = () => {
const mockSupplier: Supplier = {
id: id || '1',
name: 'Supplier A',
contact: 'John Doe',
contactName: 'John Doe',
email: 'john@supplier-a.com',
phone: '+1 (123) 456-7890',
@@ -34,38 +35,51 @@ const SupplierDetail: React.FC = () => {
status: 'active',
rating: 4.5,
leadTime: 7,
minOrder: 100,
minOrderQty: 100,
paymentTerms: 'Net 30',
notes: 'Preferred supplier for electronics components',
createdAt: new Date().toISOString(),
};
const mockProducts: Product[] = [
const mockProducts: SupplierProduct[] = [
{
id: '1',
supplierId: id || '1',
sku: 'COMP-001',
name: 'Component 1',
productName: 'Component 1',
price: 10.99,
costPrice: 8.99,
stock: 1000,
moq: 50,
leadTime: 5,
quality: 'A',
},
{
id: '2',
supplierId: id || '1',
sku: 'COMP-002',
name: 'Component 2',
productName: 'Component 2',
price: 15.99,
costPrice: 12.99,
stock: 500,
moq: 25,
leadTime: 3,
quality: 'A',
},
{
id: '3',
supplierId: id || '1',
sku: 'COMP-003',
name: 'Component 3',
productName: 'Component 3',
price: 20.99,
costPrice: 16.99,
stock: 750,
moq: 30,
leadTime: 7,
quality: 'B',
},
];

View File

@@ -1,9 +1,5 @@
import Suppliers from './index';
import SupplierDetail from './SupplierDetail';
export {
Suppliers,
SupplierDetail,
};
export default Suppliers;
};