@bit-sun/business-component 4.2.0-alpha.27 → 4.2.0-alpha.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.fatherrc.ts +1 -1
  2. package/dist/components/Business/ImportExport/ExportButton/ModalTitle.d.ts +11 -0
  3. package/dist/components/Business/ImportExport/ExportButton/TemplatePicker.d.ts +13 -0
  4. package/dist/components/Business/ImportExport/ExportButton/index.d.ts +15 -0
  5. package/dist/components/Business/ImportExport/ImportWizard/Preview.d.ts +11 -0
  6. package/dist/components/Business/ImportExport/ImportWizard/index.d.ts +15 -0
  7. package/dist/components/Business/ImportExport/TaskDrawer/index.d.ts +15 -0
  8. package/dist/components/Business/ImportExport/TaskProgress/index.d.ts +15 -0
  9. package/dist/components/Business/ImportExport/businessFunction.d.ts +15 -0
  10. package/dist/components/Business/ImportExport/index.d.ts +14 -0
  11. package/dist/components/Business/ImportExport/sceneCapability.d.ts +20 -0
  12. package/dist/components/Business/ImportExport/services/importExport.d.ts +22 -0
  13. package/dist/components/Business/ImportExport/services/routing.d.ts +8 -0
  14. package/dist/components/Business/ImportExport/types.d.ts +134 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.esm.js +2461 -4
  17. package/dist/index.js +2480 -1
  18. package/dist/utils/auth.d.ts +4 -0
  19. package/docs/error-record.md +52 -0
  20. package/docs/task-records/2026-07-31-import-export-extraction.md +73 -0
  21. package/package.json +1 -1
  22. package/src/components/Business/ImportExport/ExportButton/ModalTitle.tsx +27 -0
  23. package/src/components/Business/ImportExport/ExportButton/TemplatePicker.tsx +424 -0
  24. package/src/components/Business/ImportExport/ExportButton/index.module.less +382 -0
  25. package/src/components/Business/ImportExport/ExportButton/index.tsx +273 -0
  26. package/src/components/Business/ImportExport/ImportWizard/Preview.tsx +129 -0
  27. package/src/components/Business/ImportExport/ImportWizard/index.module.less +360 -0
  28. package/src/components/Business/ImportExport/ImportWizard/index.tsx +679 -0
  29. package/src/components/Business/ImportExport/TaskDrawer/index.tsx +285 -0
  30. package/src/components/Business/ImportExport/TaskProgress/index.tsx +267 -0
  31. package/src/components/Business/ImportExport/businessFunction.ts +29 -0
  32. package/src/components/Business/ImportExport/index.md +104 -0
  33. package/src/components/Business/ImportExport/index.tsx +170 -0
  34. package/src/components/Business/ImportExport/sceneCapability.ts +28 -0
  35. package/src/components/Business/ImportExport/services/importExport.ts +208 -0
  36. package/src/components/Business/ImportExport/services/routing.ts +21 -0
  37. package/src/components/Business/ImportExport/types.ts +180 -0
  38. package/src/components/Business/SearchSelect/BusinessUtils.tsx +1 -1
  39. package/src/index.ts +2 -1
  40. package/src/typings/umi.d.ts +9 -0
  41. package/src/utils/LocalstorageUtils.ts +1 -1
  42. package/src/utils/auth.ts +39 -2
package/.fatherrc.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  esm: 'rollup',
3
3
  cjs: 'rollup',
4
- extraExternals: ['@ant-design/pro-layout', '@babel/parser'],
4
+ extraExternals: ['@ant-design/pro-layout', '@babel/parser', 'umi'],
5
5
  };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface ModalTitleProps {
3
+ icon: React.ReactNode;
4
+ title: React.ReactNode;
5
+ description: React.ReactNode;
6
+ }
7
+ /**
8
+ * 统一导出弹窗标题区的图标、主标题和辅助说明。
9
+ */
10
+ declare const ModalTitle: React.FC<ModalTitleProps>;
11
+ export default ModalTitle;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { ImportExportRequestContext, ImportExportServices } from '../types';
3
+ interface TemplatePickerProps {
4
+ visible: boolean;
5
+ context: ImportExportRequestContext;
6
+ services: ImportExportServices;
7
+ onCancel: () => void;
8
+ onConfirm: (templateCode: string, fileType: string) => Promise<void>;
9
+ documentName?: string;
10
+ resultCount?: number;
11
+ }
12
+ declare const TemplatePicker: React.FC<TemplatePickerProps>;
13
+ export default TemplatePicker;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { FileTask, ImportExportConfig, ImportExportRequestContext, ImportExportServices } from '../types';
3
+ export interface ExportButtonProps {
4
+ config: ImportExportConfig;
5
+ services: ImportExportServices;
6
+ resolveRequestContext: () => Promise<ImportExportRequestContext | undefined>;
7
+ showQuickExport: boolean;
8
+ showTemplateExport: boolean;
9
+ onTaskCreated: (task: FileTask) => void;
10
+ }
11
+ /**
12
+ * 提供快速导出和按模板导出入口。
13
+ */
14
+ declare const ExportButton: React.FC<ExportButtonProps>;
15
+ export default ExportButton;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface PreviewProps {
3
+ preview: any;
4
+ onBack: () => void;
5
+ onExecute: () => void;
6
+ onDownloadErrorFile: () => void;
7
+ executing: boolean;
8
+ downloadingErrorFile: boolean;
9
+ }
10
+ declare const Preview: React.FC<PreviewProps>;
11
+ export default Preview;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { FileTask, ImportExportRequestContext, ImportExportServices } from '../types';
3
+ export interface ImportWizardProps {
4
+ visible: boolean;
5
+ context: ImportExportRequestContext;
6
+ documentName?: string;
7
+ services: ImportExportServices;
8
+ onClose: () => void;
9
+ onTaskCreated?: (task: FileTask) => void;
10
+ }
11
+ /**
12
+ * 完成模板选择、文件上传、数据校验和正式导入的两步向导。
13
+ */
14
+ declare const ImportWizard: React.FC<ImportWizardProps>;
15
+ export default ImportWizard;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { ImportExportServices } from '../types';
3
+ export interface TaskDrawerProps {
4
+ /** 最近任务对应的业务功能编码集合。 */
5
+ businessFunctionCodes: string[];
6
+ services: ImportExportServices;
7
+ /** 任务中心路由。 */
8
+ taskCenterPath?: string;
9
+ onNavigateTaskCenter?: (path: string) => void;
10
+ }
11
+ /**
12
+ * 展示当前业务功能最近的文件任务。
13
+ */
14
+ declare const TaskDrawer: React.FC<TaskDrawerProps>;
15
+ export default TaskDrawer;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { FileTask, ImportExportServices } from '../types';
3
+ export interface TaskProgressProps {
4
+ tasks: FileTask[];
5
+ services: ImportExportServices;
6
+ taskCenterPath?: string;
7
+ onNavigateTaskCenter?: (path: string) => void;
8
+ onTaskUpdated: (task: FileTask) => void;
9
+ onClose: () => void;
10
+ }
11
+ /**
12
+ * 轮询并展示当前页面创建的文件任务进度。
13
+ */
14
+ declare const TaskProgress: React.FC<TaskProgressProps>;
15
+ export default TaskProgress;
@@ -0,0 +1,15 @@
1
+ import type { ImportExportOperationType } from './types';
2
+ /**
3
+ * 导入导出按钮权限编码集合。
4
+ */
5
+ export interface ImportExportAuthCodes {
6
+ importCode: string;
7
+ quickExportCode: string;
8
+ templateExportCode: string;
9
+ }
10
+ /**
11
+ * 根据操作类型和按钮权限编码解析关联的业务功能编码。
12
+ *
13
+ * 导入使用独立入口;快速导出和模板导出共用任一已配置的导出入口。
14
+ */
15
+ export declare const resolveBusinessFunctionCode: (operationType: ImportExportOperationType, authCodes: ImportExportAuthCodes) => string;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { ImportExportActionsProps } from './types';
3
+ /**
4
+ * 统一承载导入、快速导出、模板导出和文件任务入口。
5
+ */
6
+ export declare const ImportExportActions: React.FC<ImportExportActionsProps>;
7
+ export { default as ImportWizard } from './ImportWizard';
8
+ export { default as ExportButton } from './ExportButton';
9
+ export { default as TaskProgress } from './TaskProgress';
10
+ export { default as TaskDrawer } from './TaskDrawer';
11
+ export * from './types';
12
+ export * from './services/importExport';
13
+ export * from './sceneCapability';
14
+ export * from './businessFunction';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 导入导出场景能力开关。
3
+ */
4
+ export interface SceneCapabilityConfig {
5
+ multiSheet?: boolean;
6
+ horizontalExport?: boolean;
7
+ largeFile?: boolean;
8
+ }
9
+ /**
10
+ * 判断是否启用多工作表能力。
11
+ */
12
+ export declare const isMultiSheetEnabled: (config?: SceneCapabilityConfig) => boolean;
13
+ /**
14
+ * 判断是否启用横向导出能力。
15
+ */
16
+ export declare const isHorizontalExportEnabled: (config?: SceneCapabilityConfig) => boolean;
17
+ /**
18
+ * 判断是否启用大文件导出能力。
19
+ */
20
+ export declare const isLargeFileExportEnabled: (config?: SceneCapabilityConfig) => boolean;
@@ -0,0 +1,22 @@
1
+ import type { ImportExportRequest, ImportExportServices } from '../types';
2
+ export { buildSdkUrl, normalizeServiceContext } from './routing';
3
+ export declare const concurrentLimitCode = "IE-COM-CONCURRENT-FILE-LIMIT";
4
+ /**
5
+ * 使用业务项目提供的请求函数创建完整导入导出服务。
6
+ *
7
+ * 请求函数由消费方注入,以复用其鉴权、租户和异常处理拦截器。
8
+ */
9
+ export declare const createImportExportServices: (request: ImportExportRequest, overrides?: Partial<ImportExportServices>) => ImportExportServices;
10
+ /**
11
+ * 使用宿主项目的 Umi 请求实例创建默认导入导出服务。
12
+ */
13
+ export declare const defaultImportExportServices: ImportExportServices;
14
+ /**
15
+ * 将业务侧差异服务合并到默认导入导出服务。
16
+ */
17
+ export declare const resolveImportExportServices: (overrides?: Partial<ImportExportServices>) => ImportExportServices;
18
+ export declare const unwrapResponse: <T = any>(response: any) => T;
19
+ export declare const getItems: <T = any>(response: any) => T[];
20
+ export declare const normalizeTask: (task: any) => any;
21
+ export declare const taskTypeName: (taskType?: string) => string;
22
+ export declare const isConcurrentLimit: (response: any) => boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 校验并规范化业务功能服务上下文。
3
+ */
4
+ export declare const normalizeServiceContext: (serviceContext: string) => string;
5
+ /**
6
+ * 拼接导入导出 SDK 接口地址。
7
+ */
8
+ export declare const buildSdkUrl: (serviceContext: string, path: string) => string;
@@ -0,0 +1,134 @@
1
+ /**
2
+ * 导入导出的操作类型。
3
+ */
4
+ export type ImportExportOperationType = 'IMPORT' | 'EXPORT';
5
+ /**
6
+ * 导入导出功能的业务侧配置。
7
+ */
8
+ export interface ImportExportConfig {
9
+ documentName: string;
10
+ getQueryParams?: () => Record<string, any>;
11
+ getResultCount?: () => number | undefined;
12
+ }
13
+ /**
14
+ * 业务功能解析结果。
15
+ */
16
+ export interface ImportExportBusinessFunction {
17
+ functionCode: string;
18
+ functionName?: string;
19
+ serviceName: string;
20
+ serviceContext: string;
21
+ status: number;
22
+ }
23
+ /**
24
+ * 一次导入或导出操作所需的请求上下文。
25
+ */
26
+ export interface ImportExportRequestContext {
27
+ businessFunctionCode: string;
28
+ serviceContext: string;
29
+ operationType: ImportExportOperationType;
30
+ conditions?: Record<string, any>;
31
+ }
32
+ /**
33
+ * 导入导出模板摘要。
34
+ */
35
+ export interface ImportExportTemplate {
36
+ templateCode: string;
37
+ templateName: string;
38
+ visibility?: 'PUBLIC' | 'PERSONAL';
39
+ businessFunctionCode?: string;
40
+ defaultFlag?: boolean;
41
+ enabled?: boolean;
42
+ metadataEntityCode?: string;
43
+ fieldCount?: number;
44
+ fieldNames?: string[];
45
+ }
46
+ /**
47
+ * 模板字段定义。
48
+ */
49
+ export interface ImportExportTemplateField {
50
+ fieldCode: string;
51
+ displayName?: string;
52
+ mapped?: boolean;
53
+ required?: boolean;
54
+ groupKey?: boolean;
55
+ fieldStatus?: string;
56
+ }
57
+ /**
58
+ * 导入导出异步任务。
59
+ */
60
+ export interface FileTask {
61
+ taskId: string;
62
+ taskType: string;
63
+ templateName?: string;
64
+ taskStatus: string;
65
+ progress?: number;
66
+ processedCount?: number;
67
+ totalCount?: number;
68
+ elapsedSeconds?: number;
69
+ successCount?: number;
70
+ failedCount?: number;
71
+ skippedCount?: number;
72
+ operatorName?: string;
73
+ fileName?: string;
74
+ createdTime?: string;
75
+ resultDownloadUrl?: string;
76
+ errorDownloadUrl?: string;
77
+ errorMessage?: string;
78
+ serviceContext?: string;
79
+ }
80
+ /**
81
+ * 业务项目请求函数需要支持的最小请求参数。
82
+ */
83
+ export interface ImportExportRequestOptions {
84
+ method: 'GET' | 'POST';
85
+ data?: any;
86
+ params?: Record<string, any>;
87
+ responseType?: 'json' | 'text' | 'blob' | 'arrayBuffer' | 'formData';
88
+ }
89
+ /**
90
+ * 由业务项目注入的请求函数。
91
+ */
92
+ export type ImportExportRequest = (url: string, options: ImportExportRequestOptions) => Promise<any>;
93
+ /**
94
+ * 导入导出流程依赖的后端服务集合。
95
+ */
96
+ export interface ImportExportServices {
97
+ resolveBusinessFunction: (businessFunctionCode: string) => Promise<any>;
98
+ queryTemplates: (data: Record<string, any>) => Promise<any>;
99
+ queryTemplateFields: (data: Record<string, any>) => Promise<any>;
100
+ uploadFile: (file: File) => Promise<any>;
101
+ downloadTemplate: (templateCode: string, data: Record<string, any>) => Promise<any>;
102
+ previewImport: (serviceContext: string, data: Record<string, any>) => Promise<any>;
103
+ executeImport: (serviceContext: string, data: Record<string, any>) => Promise<any>;
104
+ downloadValidationErrorFile: (serviceContext: string, data: Record<string, any>) => Promise<any>;
105
+ quickExport: (serviceContext: string, data: Record<string, any>) => Promise<any>;
106
+ templateExport: (serviceContext: string, data: Record<string, any>) => Promise<any>;
107
+ queryRecentTasks: (data: Record<string, any>) => Promise<any>;
108
+ queryTask: (serviceContext: string, taskCode: string) => Promise<any>;
109
+ }
110
+ /**
111
+ * 导入导出操作区属性。
112
+ */
113
+ export interface ImportExportActionsProps {
114
+ /** 导入导出业务配置。 */
115
+ config: ImportExportConfig;
116
+ /** 导入导出服务集合。 */
117
+ services?: Partial<ImportExportServices>;
118
+ /** 导入按钮权限编码。 */
119
+ importCode: string;
120
+ /** 快速导出按钮权限编码。 */
121
+ quickExportCode: string;
122
+ /** 模板导出按钮权限编码。 */
123
+ templateExportCode: string;
124
+ /** 任务中心路由。 */
125
+ taskCenterPath?: string;
126
+ /** 是否显示最近任务入口。 */
127
+ showTaskDrawer?: boolean;
128
+ /** 跳转任务中心的业务侧回调。 */
129
+ onNavigateTaskCenter?: (path: string) => void;
130
+ }
131
+ /**
132
+ * 根据业务配置和后端服务上下文生成一次导入或导出请求上下文。
133
+ */
134
+ export declare const createRequestContext: (config: ImportExportConfig, businessFunctionCode: string, serviceContext: string, operationType: ImportExportOperationType) => ImportExportRequestContext;
package/dist/index.d.ts CHANGED
@@ -40,3 +40,4 @@ export { default as ExtendedCollapse } from './components/Common/ExtendedCollaps
40
40
  export { default as Section } from './components/Common/Section';
41
41
  export { default as ParagraphCopier } from './components/Common/ParagraphCopier';
42
42
  export { default as SystemLog } from './components/Business/SystemLog';
43
+ export * from './components/Business/ImportExport';