refactor: 重构代码结构和类型定义,优化类型安全性和代码可维护性
- 添加类型定义文件和类型引用 - 删除废弃的页面模块和导出文件 - 新增聚合管理模块和插件系统 - 修复类型错误和潜在运行时问题 - 更新API基础URL和配置 - 优化组件类型定义和事件处理 - 重构数据源接口和实现 - 完善文档和开发进度记录
This commit is contained in:
@@ -8,10 +8,13 @@
|
||||
* @created 2026-03-19
|
||||
*/
|
||||
|
||||
import { Certificate, CertificateQueryParams } from '@/types/certificate';
|
||||
import { Certificate, CertificateQueryParams, CertificateStatus, CertificateType } from '@/types/certificate';
|
||||
import { IDataSource } from '@/types/datasource';
|
||||
import { BaseDataSource, BaseMockDataSource, DataSourceFactory } from './dataSourceFactory';
|
||||
|
||||
export type { Certificate } from '@/types/certificate';
|
||||
export { CertificateStatus, CertificateType };
|
||||
|
||||
// ============================================
|
||||
// 真实API实现
|
||||
// ============================================
|
||||
@@ -72,8 +75,8 @@ class MockCertificateDataSource extends BaseMockDataSource<Certificate, Certific
|
||||
{
|
||||
id: '1',
|
||||
name: 'CE认证证书',
|
||||
type: 'PRODUCT_CERT',
|
||||
status: 'APPROVED',
|
||||
type: CertificateType.PRODUCT_CERT,
|
||||
status: CertificateStatus.APPROVED,
|
||||
fileUrl: '/files/ce-cert.pdf',
|
||||
fileName: 'CE-Certificate-2026.pdf',
|
||||
uploadDate: '2026-03-15',
|
||||
@@ -87,8 +90,8 @@ class MockCertificateDataSource extends BaseMockDataSource<Certificate, Certific
|
||||
{
|
||||
id: '2',
|
||||
name: '营业执照',
|
||||
type: 'BUSINESS_LICENSE',
|
||||
status: 'APPROVED',
|
||||
type: CertificateType.BUSINESS_LICENSE,
|
||||
status: CertificateStatus.APPROVED,
|
||||
fileUrl: '/files/business-license.pdf',
|
||||
fileName: 'Business-License-2026.pdf',
|
||||
uploadDate: '2026-01-10',
|
||||
@@ -100,8 +103,8 @@ class MockCertificateDataSource extends BaseMockDataSource<Certificate, Certific
|
||||
{
|
||||
id: '3',
|
||||
name: 'FCC认证',
|
||||
type: 'SAFETY_CERT',
|
||||
status: 'PENDING',
|
||||
type: CertificateType.SAFETY_CERT,
|
||||
status: CertificateStatus.PENDING,
|
||||
fileUrl: '/files/fcc-cert.pdf',
|
||||
fileName: 'FCC-Certificate.pdf',
|
||||
uploadDate: '2026-03-18',
|
||||
@@ -113,8 +116,8 @@ class MockCertificateDataSource extends BaseMockDataSource<Certificate, Certific
|
||||
{
|
||||
id: '4',
|
||||
name: 'ISO9001',
|
||||
type: 'QUALITY_CERT',
|
||||
status: 'EXPIRED',
|
||||
type: CertificateType.QUALITY_CERT,
|
||||
status: CertificateStatus.EXPIRED,
|
||||
fileUrl: '/files/iso9001.pdf',
|
||||
fileName: 'ISO9001-2025.pdf',
|
||||
uploadDate: '2025-01-01',
|
||||
@@ -126,8 +129,8 @@ class MockCertificateDataSource extends BaseMockDataSource<Certificate, Certific
|
||||
{
|
||||
id: '5',
|
||||
name: 'RoHS认证',
|
||||
type: 'PRODUCT_CERT',
|
||||
status: 'APPROVED',
|
||||
type: CertificateType.PRODUCT_CERT,
|
||||
status: CertificateStatus.APPROVED,
|
||||
fileUrl: '/files/rohs-cert.pdf',
|
||||
fileName: 'RoHS-Certificate.pdf',
|
||||
uploadDate: '2026-02-20',
|
||||
@@ -141,8 +144,8 @@ class MockCertificateDataSource extends BaseMockDataSource<Certificate, Certific
|
||||
{
|
||||
id: '6',
|
||||
name: 'UL认证',
|
||||
type: 'SAFETY_CERT',
|
||||
status: 'PENDING',
|
||||
type: CertificateType.SAFETY_CERT,
|
||||
status: CertificateStatus.PENDING,
|
||||
fileUrl: '/files/ul-cert.pdf',
|
||||
fileName: 'UL-Certificate.pdf',
|
||||
uploadDate: '2026-03-19',
|
||||
@@ -168,7 +171,7 @@ class MockCertificateDataSource extends BaseMockDataSource<Certificate, Certific
|
||||
}
|
||||
|
||||
const updates: Partial<Certificate> = {
|
||||
status: status as 'APPROVED' | 'PENDING' | 'REJECTED' | 'EXPIRED',
|
||||
status: status as CertificateStatus,
|
||||
};
|
||||
|
||||
if (status === 'APPROVED') {
|
||||
|
||||
Reference in New Issue
Block a user