@bit-sun/business-component 4.2.0-alpha.3 → 4.2.0-alpha.30

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 (138) hide show
  1. package/.fatherrc.ts +1 -1
  2. package/.umirc.ts +13 -9
  3. package/dist/components/Business/AddSelectBusiness/index.d.ts +3 -4
  4. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -2
  5. package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +1 -2
  6. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
  7. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
  8. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
  9. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +1 -2
  10. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +1 -2
  11. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
  12. package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +1 -2
  13. package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +1 -2
  14. package/dist/components/Business/BsLayouts/index.d.ts +1 -1
  15. package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +5 -5
  16. package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -2
  17. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +6 -6
  18. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +14 -15
  19. package/dist/components/Business/CommodityEntry/index.d.ts +1 -2
  20. package/dist/components/Business/CommonAlert/index.d.ts +1 -2
  21. package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
  22. package/dist/components/Business/DetailPageWrapper/index.d.ts +12 -12
  23. package/dist/components/Business/HomePageWrapper/index.d.ts +1 -2
  24. package/dist/components/Business/ImportExport/ExportButton/ModalTitle.d.ts +11 -0
  25. package/dist/components/Business/ImportExport/ExportButton/TemplatePicker.d.ts +13 -0
  26. package/dist/components/Business/ImportExport/ExportButton/index.d.ts +15 -0
  27. package/dist/components/Business/ImportExport/ImportWizard/Preview.d.ts +11 -0
  28. package/dist/components/Business/ImportExport/ImportWizard/index.d.ts +15 -0
  29. package/dist/components/Business/ImportExport/TaskDrawer/index.d.ts +15 -0
  30. package/dist/components/Business/ImportExport/TaskProgress/index.d.ts +15 -0
  31. package/dist/components/Business/ImportExport/businessFunction.d.ts +15 -0
  32. package/dist/components/Business/ImportExport/index.d.ts +14 -0
  33. package/dist/components/Business/ImportExport/sceneCapability.d.ts +20 -0
  34. package/dist/components/Business/ImportExport/services/importExport.d.ts +22 -0
  35. package/dist/components/Business/ImportExport/services/routing.d.ts +8 -0
  36. package/dist/components/Business/ImportExport/types.d.ts +134 -0
  37. package/dist/components/Business/ItemPropertySelector/index.d.ts +1 -2
  38. package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +1 -2
  39. package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +1 -2
  40. package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +1 -2
  41. package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +1 -2
  42. package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +1 -2
  43. package/dist/components/Business/PropertyModal/index.d.ts +1 -2
  44. package/dist/components/Business/PropertyModal/propertyGroup.d.ts +1 -1
  45. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  46. package/dist/components/Business/StateFlow/index.d.ts +1 -2
  47. package/dist/components/Business/SystemLog/index.d.ts +78 -0
  48. package/dist/components/Business/TreeSearchSelect/index.d.ts +1 -1
  49. package/dist/components/Business/TrialCalculation/index.d.ts +15 -0
  50. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +6 -6
  51. package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +1 -2
  52. package/dist/components/Business/columnSettingTable/index.d.ts +3 -3
  53. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +3 -3
  54. package/dist/components/Business/columnSettingTable/utils.d.ts +1 -2
  55. package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
  56. package/dist/components/Common/ParagraphCopier/index.d.ts +1 -1
  57. package/dist/components/Common/Section/index.d.ts +1 -1
  58. package/dist/components/Functional/AddSelect/index.d.ts +1 -2
  59. package/dist/components/Functional/AuthButton/index.d.ts +1 -2
  60. package/dist/components/Functional/DataImport/index.d.ts +3 -3
  61. package/dist/components/Functional/DataValidation/index.d.ts +5 -5
  62. package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -2
  63. package/dist/components/Functional/QueryMutipleInput/index.d.ts +1 -2
  64. package/dist/components/Functional/QueryMutipleSelect/index.d.ts +1 -2
  65. package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
  66. package/dist/components/Functional/SearchSelect/pagination.d.ts +22 -0
  67. package/dist/components/Functional/SearchSelect/utils.d.ts +2 -3
  68. package/dist/components/Functional/TreeSearchSelect/index.d.ts +1 -2
  69. package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +1 -1
  70. package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +1 -2
  71. package/dist/components/Solution/RuleComponent/Formula.d.ts +1 -2
  72. package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +1 -2
  73. package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +1 -2
  74. package/dist/components/Solution/RuleSetter/RuleInstance.d.ts +1 -2
  75. package/dist/components/Solution/RuleSetter/baseRule.d.ts +1 -1
  76. package/dist/components/Solution/RuleSetter/index.d.ts +1 -1
  77. package/dist/index.d.ts +5 -0
  78. package/dist/index.esm.js +5413 -1215
  79. package/dist/index.js +5433 -1208
  80. package/dist/plugin/TableColumnSetting/index.d.ts +5 -5
  81. package/dist/utils/TableUtils.d.ts +18 -19
  82. package/dist/utils/auth.d.ts +4 -0
  83. package/dist/utils/utils.d.ts +41 -0
  84. package/docs/error-record.md +52 -0
  85. package/docs/flow-control-readme.md +283 -0
  86. package/docs/task-records/2026-07-31-import-export-extraction.md +81 -0
  87. package/package.json +1 -1
  88. package/src/components/Business/AddSelectBusiness/index.tsx +3 -2
  89. package/src/components/Business/BsSulaQueryTable/index.md +57 -4
  90. package/src/components/Business/BsSulaQueryTable/index.tsx +174 -10
  91. package/src/components/Business/BsSulaQueryTable/setting.tsx +6 -0
  92. package/src/components/Business/DetailPageWrapper/index.tsx +81 -1
  93. package/src/components/Business/DetailPageWrapper/readme.md +89 -0
  94. package/src/components/Business/ImportExport/ExportButton/ModalTitle.tsx +27 -0
  95. package/src/components/Business/ImportExport/ExportButton/TemplatePicker.tsx +424 -0
  96. package/src/components/Business/ImportExport/ExportButton/index.module.less +382 -0
  97. package/src/components/Business/ImportExport/ExportButton/index.tsx +273 -0
  98. package/src/components/Business/ImportExport/ImportWizard/Preview.tsx +129 -0
  99. package/src/components/Business/ImportExport/ImportWizard/index.module.less +360 -0
  100. package/src/components/Business/ImportExport/ImportWizard/index.tsx +679 -0
  101. package/src/components/Business/ImportExport/TaskDrawer/index.tsx +285 -0
  102. package/src/components/Business/ImportExport/TaskProgress/index.tsx +267 -0
  103. package/src/components/Business/ImportExport/businessFunction.ts +29 -0
  104. package/src/components/Business/ImportExport/index.md +104 -0
  105. package/src/components/Business/ImportExport/index.tsx +208 -0
  106. package/src/components/Business/ImportExport/sceneCapability.ts +28 -0
  107. package/src/components/Business/ImportExport/services/importExport.ts +208 -0
  108. package/src/components/Business/ImportExport/services/routing.ts +21 -0
  109. package/src/components/Business/ImportExport/types.ts +180 -0
  110. package/src/components/Business/SearchSelect/BusinessUtils.tsx +713 -43
  111. package/src/components/Business/SearchSelect/index.md +2 -2
  112. package/src/components/Business/SystemLog/index.md +37 -0
  113. package/src/components/Business/SystemLog/index.tsx +87 -0
  114. package/src/components/Business/TrialCalculation/PathDisplay.less +93 -0
  115. package/src/components/Business/TrialCalculation/PathDisplay_README.md +77 -0
  116. package/src/components/Business/TrialCalculation/index.tsx +322 -0
  117. package/src/components/Business/columnSettingTable/index.tsx +7 -6
  118. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +23 -22
  119. package/src/components/Functional/AddSelect/index.tsx +95 -1
  120. package/src/components/Functional/DataValidation/index.tsx +31 -9
  121. package/src/components/Functional/QueryMutipleSelect/index.tsx +2 -2
  122. package/src/components/Functional/SearchSelect/index.md +109 -0
  123. package/src/components/Functional/SearchSelect/index.tsx +99 -17
  124. package/src/components/Functional/SearchSelect/pagination.ts +57 -0
  125. package/src/components/Functional/SearchSelect/utils.tsx +28 -18
  126. package/src/components/Functional/TreeSearchSelect/index.tsx +2 -1
  127. package/src/components/Solution/RuleComponent/README.md +187 -0
  128. package/src/components/Solution/RuleComponent/RenderCompItem.tsx +9 -1
  129. package/src/components/Solution/RuleComponent/RenderCompItem_README.md +189 -0
  130. package/src/components/Solution/RuleComponent/RuleField.md +63 -0
  131. package/src/components/Solution/RuleComponent/index.js +237 -8
  132. package/src/components/Solution/RuleComponent/ruleFiled.js +46 -6
  133. package/src/components/Solution/RuleSetter/README.md +97 -0
  134. package/src/index.ts +9 -0
  135. package/src/typings/umi.d.ts +9 -0
  136. package/src/utils/LocalstorageUtils.ts +1 -1
  137. package/src/utils/auth.ts +39 -2
  138. package/src/utils/utils.ts +41 -1
@@ -0,0 +1,382 @@
1
+ .exportModal {
2
+ :global {
3
+ .ant-modal {
4
+ top: 56px;
5
+ max-width: calc(100vw - 32px);
6
+ padding-bottom: 24px;
7
+ }
8
+
9
+ .ant-modal-content {
10
+ overflow: hidden;
11
+ border-radius: 8px;
12
+ box-shadow: 0 12px 40px rgba(31, 35, 41, 0.18);
13
+ }
14
+
15
+ .ant-modal-header {
16
+ padding: 18px 24px;
17
+ border-bottom-color: #eef0f3;
18
+ }
19
+
20
+ .ant-modal-body {
21
+ max-height: calc(100vh - 220px);
22
+ padding: 0;
23
+ overflow-y: auto;
24
+ background: #f7f8fa;
25
+ }
26
+
27
+ .ant-modal-footer {
28
+ padding: 14px 24px;
29
+ border-top-color: #eef0f3;
30
+ }
31
+
32
+ .ant-modal-close-x {
33
+ height: 76px;
34
+ line-height: 76px;
35
+ }
36
+ }
37
+ }
38
+
39
+ .modalTitle {
40
+ display: flex;
41
+ align-items: center;
42
+ min-height: 40px;
43
+ }
44
+
45
+ .modalTitleIcon {
46
+ display: inline-flex;
47
+ flex: 0 0 auto;
48
+ align-items: center;
49
+ justify-content: center;
50
+ width: 40px;
51
+ height: 40px;
52
+ margin-right: 12px;
53
+ color: #1677ff;
54
+ font-size: 20px;
55
+ background: #eaf3ff;
56
+ border-radius: 8px;
57
+ }
58
+
59
+ .modalTitleText,
60
+ .modalTitleDescription,
61
+ .sectionTitle,
62
+ .sectionDescription,
63
+ .scopeTitle,
64
+ .scopeDescription,
65
+ .fileTypeName,
66
+ .fileTypeDescription {
67
+ display: block;
68
+ }
69
+
70
+ .modalTitleText {
71
+ color: #1f2329;
72
+ font-weight: 600;
73
+ font-size: 16px;
74
+ line-height: 22px;
75
+ }
76
+
77
+ .modalTitleDescription {
78
+ margin-top: 2px;
79
+ color: #8f959e;
80
+ font-weight: 400;
81
+ font-size: 12px;
82
+ line-height: 18px;
83
+ }
84
+
85
+ .dialogBody {
86
+ padding: 16px 24px 24px;
87
+ }
88
+
89
+ .section {
90
+ margin-bottom: 16px;
91
+ padding: 18px 20px;
92
+ background: #fff;
93
+ border: 1px solid #e8eaed;
94
+ border-radius: 8px;
95
+ }
96
+
97
+ .section:last-child {
98
+ margin-bottom: 0;
99
+ }
100
+
101
+ .sectionHeader {
102
+ display: flex;
103
+ align-items: flex-start;
104
+ margin-bottom: 16px;
105
+ }
106
+
107
+ .sectionIndex {
108
+ display: inline-flex;
109
+ flex: 0 0 auto;
110
+ align-items: center;
111
+ justify-content: center;
112
+ width: 24px;
113
+ height: 24px;
114
+ margin-right: 10px;
115
+ color: #1677ff;
116
+ font-weight: 600;
117
+ font-size: 13px;
118
+ background: #eaf3ff;
119
+ border-radius: 50%;
120
+ }
121
+
122
+ .sectionTitle {
123
+ color: #1f2329;
124
+ font-weight: 600;
125
+ font-size: 15px;
126
+ line-height: 22px;
127
+ }
128
+
129
+ .sectionDescription {
130
+ margin-top: 2px;
131
+ color: #8f959e;
132
+ font-size: 12px;
133
+ line-height: 18px;
134
+ }
135
+
136
+ .scopeCard {
137
+ display: flex;
138
+ align-items: center;
139
+ min-height: 72px;
140
+ padding: 14px 16px;
141
+ background: #f7f8fa;
142
+ border: 1px solid #eef0f3;
143
+ border-radius: 6px;
144
+ }
145
+
146
+ .scopeIcon {
147
+ display: inline-flex;
148
+ flex: 0 0 auto;
149
+ align-items: center;
150
+ justify-content: center;
151
+ width: 36px;
152
+ height: 36px;
153
+ margin-right: 12px;
154
+ color: #1677ff;
155
+ font-size: 18px;
156
+ background: #fff;
157
+ border-radius: 6px;
158
+ box-shadow: 0 1px 3px rgba(31, 35, 41, 0.08);
159
+ }
160
+
161
+ .scopeContent {
162
+ min-width: 0;
163
+ }
164
+
165
+ .scopeTitle {
166
+ color: #1f2329;
167
+ font-weight: 500;
168
+ font-size: 14px;
169
+ line-height: 22px;
170
+ }
171
+
172
+ .scopeDescription {
173
+ margin-top: 2px;
174
+ color: #8f959e;
175
+ font-size: 12px;
176
+ line-height: 18px;
177
+ }
178
+
179
+ .resultCount {
180
+ flex: 0 0 auto;
181
+ margin-left: auto;
182
+ padding: 3px 10px;
183
+ color: #1677ff;
184
+ font-weight: 600;
185
+ font-size: 13px;
186
+ white-space: nowrap;
187
+ background: #eaf3ff;
188
+ border-radius: 12px;
189
+ }
190
+
191
+ .fileTypeGrid {
192
+ display: grid;
193
+ grid-template-columns: repeat(2, minmax(0, 1fr));
194
+ gap: 12px;
195
+ width: 100%;
196
+ }
197
+
198
+ .fileTypeOption {
199
+ display: flex;
200
+ align-items: flex-start;
201
+ min-height: 68px;
202
+ margin-right: 0;
203
+ padding: 12px 14px;
204
+ background: #fff;
205
+ border: 1px solid #d9dce1;
206
+ border-radius: 6px;
207
+ transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
208
+
209
+ &:hover {
210
+ border-color: #69a5ff;
211
+ }
212
+
213
+ &:global(.ant-radio-wrapper-checked) {
214
+ background: #f5f9ff;
215
+ border-color: #1677ff;
216
+ box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.08);
217
+ }
218
+
219
+ :global {
220
+ .ant-radio {
221
+ margin-top: 3px;
222
+ }
223
+ }
224
+ }
225
+
226
+ .fileTypeContent {
227
+ margin-left: 4px;
228
+ }
229
+
230
+ .fileTypeName {
231
+ color: #1f2329;
232
+ font-weight: 600;
233
+ font-size: 14px;
234
+ line-height: 22px;
235
+ }
236
+
237
+ .fileTypeDescription {
238
+ margin-top: 2px;
239
+ color: #8f959e;
240
+ font-size: 12px;
241
+ line-height: 18px;
242
+ }
243
+
244
+ .exportAlert {
245
+ margin-top: 14px;
246
+ border-color: #d9e8ff;
247
+ border-radius: 6px;
248
+ }
249
+
250
+ .templateForm {
251
+ :global {
252
+ .ant-form-item-label {
253
+ padding-bottom: 8px;
254
+ font-weight: 500;
255
+ }
256
+ }
257
+ }
258
+
259
+ .templateSelectItem {
260
+ margin-bottom: 0;
261
+ }
262
+
263
+ .templatePreview {
264
+ margin-top: 16px;
265
+ overflow: hidden;
266
+ border: 1px solid #e8eaed;
267
+ border-radius: 6px;
268
+ }
269
+
270
+ .templatePreviewHeader {
271
+ display: flex;
272
+ align-items: center;
273
+ justify-content: space-between;
274
+ min-height: 48px;
275
+ padding: 8px 14px;
276
+ background: #f7f8fa;
277
+ border-bottom: 1px solid #e8eaed;
278
+ }
279
+
280
+ .downloadTemplateButton {
281
+ padding-right: 0;
282
+ }
283
+
284
+ .templateSummary {
285
+ :global {
286
+ .ant-descriptions-view {
287
+ border-right: 0;
288
+ border-left: 0;
289
+ border-radius: 0;
290
+ }
291
+
292
+ .ant-descriptions-row > th,
293
+ .ant-descriptions-row > td {
294
+ padding: 10px 12px;
295
+ }
296
+
297
+ .ant-descriptions-item-label {
298
+ color: #646a73;
299
+ background: #fbfcfd;
300
+ }
301
+
302
+ .ant-descriptions-item-content {
303
+ color: #1f2329;
304
+ font-weight: 500;
305
+ }
306
+ }
307
+ }
308
+
309
+ .fieldPreview {
310
+ padding: 12px 14px 14px;
311
+ background: #fff;
312
+ }
313
+
314
+ .fieldPreviewHeader {
315
+ display: flex;
316
+ align-items: center;
317
+ justify-content: space-between;
318
+ margin-bottom: 10px;
319
+ }
320
+
321
+ .fieldPreviewLabel {
322
+ color: #646a73;
323
+ font-weight: 500;
324
+ font-size: 13px;
325
+ }
326
+
327
+ .fieldCount {
328
+ color: #8f959e;
329
+ font-size: 12px;
330
+ }
331
+
332
+ .fieldTags {
333
+ min-height: 42px;
334
+ max-height: 156px;
335
+ padding: 10px;
336
+ overflow-y: auto;
337
+ background: #f7f8fa;
338
+ border-radius: 6px;
339
+ }
340
+
341
+ .fieldTag {
342
+ margin-bottom: 6px;
343
+ color: #434a54;
344
+ background: #fff;
345
+ border-color: #dfe2e6;
346
+ border-radius: 4px;
347
+ }
348
+
349
+ .emptyFields {
350
+ display: flex;
351
+ align-items: center;
352
+ min-height: 22px;
353
+ color: #8f959e;
354
+ font-size: 12px;
355
+ }
356
+
357
+ @media (max-width: 576px) {
358
+ .modalTitleDescription {
359
+ display: none;
360
+ }
361
+
362
+ .dialogBody {
363
+ padding-right: 16px;
364
+ padding-left: 16px;
365
+ }
366
+
367
+ .section {
368
+ padding: 16px;
369
+ }
370
+
371
+ .scopeCard {
372
+ align-items: flex-start;
373
+ }
374
+
375
+ .resultCount {
376
+ margin-top: 7px;
377
+ }
378
+
379
+ .fileTypeGrid {
380
+ grid-template-columns: 1fr;
381
+ }
382
+ }
@@ -0,0 +1,273 @@
1
+ import React, { useState } from 'react';
2
+ import { Alert, Button, Dropdown, Menu, Modal, Radio, message } from 'antd';
3
+ import {
4
+ DownOutlined,
5
+ ExportOutlined,
6
+ FilterOutlined,
7
+ } from '@ant-design/icons';
8
+ import {
9
+ isConcurrentLimit,
10
+ normalizeTask,
11
+ unwrapResponse,
12
+ } from '../services/importExport';
13
+ import type {
14
+ FileTask,
15
+ ImportExportConfig,
16
+ ImportExportRequestContext,
17
+ ImportExportServices,
18
+ } from '../types';
19
+ import ModalTitle from './ModalTitle';
20
+ import TemplatePicker from './TemplatePicker';
21
+ import styles from './index.module.less';
22
+
23
+ export interface ExportButtonProps {
24
+ config: ImportExportConfig;
25
+ services: ImportExportServices;
26
+ resolveRequestContext: () => Promise<ImportExportRequestContext | undefined>;
27
+ showQuickExport: boolean;
28
+ showTemplateExport: boolean;
29
+ onTaskCreated: (task: FileTask) => void;
30
+ }
31
+
32
+ /**
33
+ * 提供快速导出和按模板导出入口。
34
+ */
35
+ const ExportButton: React.FC<ExportButtonProps> = ({
36
+ config,
37
+ services,
38
+ resolveRequestContext,
39
+ showQuickExport,
40
+ showTemplateExport,
41
+ onTaskCreated,
42
+ }) => {
43
+ const [pickerVisible, setPickerVisible] = useState(false);
44
+ const [quickVisible, setQuickVisible] = useState(false);
45
+ const [exporting, setExporting] = useState(false);
46
+ const [routeLoading, setRouteLoading] = useState<'QUICK' | 'TEMPLATE'>();
47
+ const [context, setContext] = useState<ImportExportRequestContext>();
48
+ const [quickFileType, setQuickFileType] = useState('XLSX');
49
+
50
+ const createTask = async (
51
+ currentContext: ImportExportRequestContext,
52
+ execute: (
53
+ serviceContext: string,
54
+ data: Record<string, any>,
55
+ ) => Promise<any>,
56
+ data: Record<string, any> = {},
57
+ fileType = 'XLSX',
58
+ ) => {
59
+ setExporting(true);
60
+ try {
61
+ const response = await execute(currentContext.serviceContext, {
62
+ businessFunctionCode: currentContext.businessFunctionCode,
63
+ conditions: currentContext.conditions,
64
+ ...data,
65
+ fileType,
66
+ });
67
+ if (isConcurrentLimit(response)) {
68
+ message.warning('当前导入导出任务较多,请稍后重试');
69
+ return;
70
+ }
71
+ const task = normalizeTask({
72
+ ...unwrapResponse<FileTask>(response),
73
+ taskType: 'EXPORT',
74
+ taskStatus: 'PENDING',
75
+ serviceContext: currentContext.serviceContext,
76
+ });
77
+ if (!task?.taskId) {
78
+ throw new Error((task as any)?.msg || 'export taskId is missing');
79
+ }
80
+ onTaskCreated(task);
81
+ message.success('已创建导出任务');
82
+ } catch (error) {
83
+ if (isConcurrentLimit(error)) {
84
+ message.warning('当前导入导出任务较多,请稍后重试');
85
+ return;
86
+ }
87
+ message.error('创建导出任务失败,请稍后重试');
88
+ } finally {
89
+ setExporting(false);
90
+ }
91
+ };
92
+
93
+ const resultCount = config.getResultCount?.();
94
+
95
+ const submitQuickExport = async () => {
96
+ if (!context) return;
97
+ if (resultCount === 0) {
98
+ message.warning('当前查询结果为空,不创建导出任务');
99
+ return;
100
+ }
101
+ await createTask(context, services.quickExport, {}, quickFileType);
102
+ setQuickVisible(false);
103
+ };
104
+
105
+ const openExport = async (type: 'QUICK' | 'TEMPLATE') => {
106
+ setRouteLoading(type);
107
+ try {
108
+ const resolvedContext = await resolveRequestContext();
109
+ if (!resolvedContext) return;
110
+ setContext(resolvedContext);
111
+ if (type === 'QUICK') {
112
+ setQuickVisible(true);
113
+ } else {
114
+ setPickerVisible(true);
115
+ }
116
+ } finally {
117
+ setRouteLoading(undefined);
118
+ }
119
+ };
120
+
121
+ const quickExportModal = (
122
+ <Modal
123
+ width={560}
124
+ title={
125
+ <ModalTitle
126
+ icon={<ExportOutlined />}
127
+ title={`${config.documentName}快速导出`}
128
+ description="使用系统默认字段导出当前筛选结果"
129
+ />
130
+ }
131
+ visible={quickVisible}
132
+ onCancel={() => setQuickVisible(false)}
133
+ onOk={submitQuickExport}
134
+ confirmLoading={exporting}
135
+ okText="创建导出任务"
136
+ cancelText="取消"
137
+ okButtonProps={{
138
+ disabled: resultCount === 0,
139
+ icon: <ExportOutlined />,
140
+ }}
141
+ wrapClassName={styles.exportModal}
142
+ destroyOnClose
143
+ >
144
+ <div className={styles.dialogBody}>
145
+ <section className={styles.section}>
146
+ <div className={styles.sectionHeader}>
147
+ <span className={styles.sectionIndex}>1</span>
148
+ <span>
149
+ <span className={styles.sectionTitle}>确认导出范围</span>
150
+ <span className={styles.sectionDescription}>
151
+ 导出内容与当前列表的查询条件保持一致
152
+ </span>
153
+ </span>
154
+ </div>
155
+ <div className={styles.scopeCard}>
156
+ <span className={styles.scopeIcon}>
157
+ <FilterOutlined />
158
+ </span>
159
+ <span className={styles.scopeContent}>
160
+ <span className={styles.scopeTitle}>当前筛选结果</span>
161
+ <span className={styles.scopeDescription}>
162
+ 系统将按列表当前查询条件生成导出文件
163
+ </span>
164
+ </span>
165
+ <span className={styles.resultCount}>
166
+ {resultCount == null ? '以查询结果为准' : `${resultCount} 条`}
167
+ </span>
168
+ </div>
169
+ </section>
170
+
171
+ <section className={styles.section}>
172
+ <div className={styles.sectionHeader}>
173
+ <span className={styles.sectionIndex}>2</span>
174
+ <span>
175
+ <span className={styles.sectionTitle}>选择文件格式</span>
176
+ <span className={styles.sectionDescription}>
177
+ 根据后续使用场景选择合适的文件类型
178
+ </span>
179
+ </span>
180
+ </div>
181
+ <Radio.Group
182
+ className={styles.fileTypeGrid}
183
+ value={quickFileType}
184
+ onChange={(event) => setQuickFileType(event.target.value)}
185
+ >
186
+ <Radio className={styles.fileTypeOption} value="XLSX">
187
+ <span className={styles.fileTypeContent}>
188
+ <span className={styles.fileTypeName}>XLSX</span>
189
+ <span className={styles.fileTypeDescription}>
190
+ 保留表格格式,适合查看与编辑
191
+ </span>
192
+ </span>
193
+ </Radio>
194
+ <Radio className={styles.fileTypeOption} value="CSV">
195
+ <span className={styles.fileTypeContent}>
196
+ <span className={styles.fileTypeName}>CSV</span>
197
+ <span className={styles.fileTypeDescription}>
198
+ 文件更轻量,适合系统间交换
199
+ </span>
200
+ </span>
201
+ </Radio>
202
+ </Radio.Group>
203
+ <Alert
204
+ className={styles.exportAlert}
205
+ type={resultCount === 0 ? 'warning' : 'info'}
206
+ showIcon
207
+ message={
208
+ resultCount === 0
209
+ ? '当前查询结果为空,暂时无法创建导出任务。'
210
+ : '快速导出使用系统默认字段;创建后可在任务中心查看进度并下载文件。'
211
+ }
212
+ />
213
+ </section>
214
+ </div>
215
+ </Modal>
216
+ );
217
+
218
+ return (
219
+ <>
220
+ {(showQuickExport || showTemplateExport) && (
221
+ <Dropdown
222
+ trigger={['hover', 'click']}
223
+ overlay={
224
+ <Menu>
225
+ {showQuickExport && (
226
+ <Menu.Item key="quick" onClick={() => openExport('QUICK')}>
227
+ 快速导出
228
+ </Menu.Item>
229
+ )}
230
+ {showTemplateExport && (
231
+ <Menu.Item
232
+ key="template"
233
+ onClick={() => openExport('TEMPLATE')}
234
+ >
235
+ 按模板导出
236
+ </Menu.Item>
237
+ )}
238
+ </Menu>
239
+ }
240
+ >
241
+ <Button loading={exporting || Boolean(routeLoading)}>
242
+ 导出 <DownOutlined />
243
+ </Button>
244
+ </Dropdown>
245
+ )}
246
+ {context && (
247
+ <TemplatePicker
248
+ visible={pickerVisible}
249
+ context={context}
250
+ services={services}
251
+ onCancel={() => setPickerVisible(false)}
252
+ onConfirm={async (templateCode, fileType) => {
253
+ if (!context) return;
254
+ setPickerVisible(false);
255
+ await createTask(
256
+ context,
257
+ services.templateExport,
258
+ {
259
+ templateCode,
260
+ },
261
+ fileType,
262
+ );
263
+ }}
264
+ documentName={config.documentName}
265
+ resultCount={resultCount}
266
+ />
267
+ )}
268
+ {quickExportModal}
269
+ </>
270
+ );
271
+ };
272
+
273
+ export default ExportButton;