@bit-sun/business-component 4.2.0-alpha.28 → 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.
- package/.fatherrc.ts +1 -1
- package/dist/components/Business/ImportExport/ExportButton/ModalTitle.d.ts +11 -0
- package/dist/components/Business/ImportExport/ExportButton/TemplatePicker.d.ts +13 -0
- package/dist/components/Business/ImportExport/ExportButton/index.d.ts +15 -0
- package/dist/components/Business/ImportExport/ImportWizard/Preview.d.ts +11 -0
- package/dist/components/Business/ImportExport/ImportWizard/index.d.ts +15 -0
- package/dist/components/Business/ImportExport/TaskDrawer/index.d.ts +15 -0
- package/dist/components/Business/ImportExport/TaskProgress/index.d.ts +15 -0
- package/dist/components/Business/ImportExport/businessFunction.d.ts +15 -0
- package/dist/components/Business/ImportExport/index.d.ts +14 -0
- package/dist/components/Business/ImportExport/sceneCapability.d.ts +20 -0
- package/dist/components/Business/ImportExport/services/importExport.d.ts +22 -0
- package/dist/components/Business/ImportExport/services/routing.d.ts +8 -0
- package/dist/components/Business/ImportExport/types.d.ts +134 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +2465 -10
- package/dist/index.js +2484 -7
- package/dist/utils/auth.d.ts +4 -0
- package/docs/error-record.md +52 -0
- package/docs/task-records/2026-07-31-import-export-extraction.md +73 -0
- package/package.json +1 -1
- package/src/components/Business/AddSelectBusiness/index.tsx +1 -1
- package/src/components/Business/ImportExport/ExportButton/ModalTitle.tsx +27 -0
- package/src/components/Business/ImportExport/ExportButton/TemplatePicker.tsx +424 -0
- package/src/components/Business/ImportExport/ExportButton/index.module.less +382 -0
- package/src/components/Business/ImportExport/ExportButton/index.tsx +273 -0
- package/src/components/Business/ImportExport/ImportWizard/Preview.tsx +129 -0
- package/src/components/Business/ImportExport/ImportWizard/index.module.less +360 -0
- package/src/components/Business/ImportExport/ImportWizard/index.tsx +679 -0
- package/src/components/Business/ImportExport/TaskDrawer/index.tsx +285 -0
- package/src/components/Business/ImportExport/TaskProgress/index.tsx +267 -0
- package/src/components/Business/ImportExport/businessFunction.ts +29 -0
- package/src/components/Business/ImportExport/index.md +104 -0
- package/src/components/Business/ImportExport/index.tsx +170 -0
- package/src/components/Business/ImportExport/sceneCapability.ts +28 -0
- package/src/components/Business/ImportExport/services/importExport.ts +208 -0
- package/src/components/Business/ImportExport/services/routing.ts +21 -0
- package/src/components/Business/ImportExport/types.ts +180 -0
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +1 -1
- package/src/components/Functional/SearchSelect/utils.tsx +0 -1
- package/src/index.ts +2 -1
- package/src/typings/umi.d.ts +9 -0
- package/src/utils/LocalstorageUtils.ts +1 -1
- package/src/utils/auth.ts +39 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import request$1 from 'umi-request';
|
|
3
3
|
import cookie from 'js-cookie';
|
|
4
|
-
import { message as message$1, Tooltip, Image, Popover, Card, Avatar, Badge, Menu, Input, InputNumber, Space, Button, Dropdown, Upload, Checkbox, Modal, ConfigProvider, Tag, Select, Spin, Form, Table, Empty, Row, Col, Tabs, TreeSelect, DatePicker, Typography, Alert, Breadcrumb, Drawer as Drawer$1, List, Radio, Tree, Result, Affix, Cascader, TimePicker, Divider, Switch, Collapse } from 'antd';
|
|
4
|
+
import { message as message$1, Tooltip, Image, Popover, Card, Avatar, Badge, Menu, Input, InputNumber, Space, Button, Dropdown, Upload, Checkbox, Modal, ConfigProvider, Tag, Select, Spin, Form, Table, Empty, Row, Col, Tabs, TreeSelect, DatePicker, Typography, Alert, Breadcrumb, Drawer as Drawer$1, List, Radio, Tree, Result, Affix, Cascader, TimePicker, Divider, Switch, Collapse, Descriptions, Steps, Progress } from 'antd';
|
|
5
5
|
import _, { omit, uniqBy, escapeRegExp, isNil, cloneDeep, isEmpty, isBoolean, debounce, throttle } from 'lodash';
|
|
6
6
|
import memoizeOne from 'memoize-one';
|
|
7
7
|
import { formatMessage, history, useLocation, Link, useModel, setLocale, useIntl, request as request$3 } from 'umi';
|
|
@@ -9,7 +9,7 @@ import isEqual from 'lodash/isEqual';
|
|
|
9
9
|
import React$1, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, Component, Fragment, useCallback, useLayoutEffect, createRef } from 'react';
|
|
10
10
|
import { renderToString as renderToString$1 } from 'react-dom/server';
|
|
11
11
|
import moment$1 from 'moment';
|
|
12
|
-
import { EyeOutlined, DeleteOutlined, EditOutlined, CopyOutlined, CloseSquareOutlined, WarningOutlined, SendOutlined, ProfileTwoTone, ExclamationCircleOutlined, DownOutlined, UnorderedListOutlined, DashOutlined, CaretUpOutlined, CaretDownOutlined, SearchOutlined, CloseCircleOutlined, DownCircleFilled, ArrowLeftOutlined, FolderOutlined, EllipsisOutlined, HomeOutlined, DoubleLeftOutlined, DoubleRightOutlined, MenuUnfoldOutlined, CaretLeftOutlined, SettingOutlined, BulbOutlined, PlayCircleOutlined, SaveOutlined, FullscreenExitOutlined, MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons';
|
|
12
|
+
import { EyeOutlined, DeleteOutlined, EditOutlined, CopyOutlined, CloseSquareOutlined, WarningOutlined, SendOutlined, ProfileTwoTone, ExclamationCircleOutlined, DownOutlined, UnorderedListOutlined, DashOutlined, CaretUpOutlined, CaretDownOutlined, SearchOutlined, CloseCircleOutlined, DownCircleFilled, ArrowLeftOutlined, FolderOutlined, EllipsisOutlined, HomeOutlined, DoubleLeftOutlined, DoubleRightOutlined, MenuUnfoldOutlined, CaretLeftOutlined, SettingOutlined, BulbOutlined, PlayCircleOutlined, SaveOutlined, FullscreenExitOutlined, MinusCircleOutlined, PlusCircleOutlined, FileExcelOutlined, DownloadOutlined, FilterOutlined, ExportOutlined, CheckOutlined, UploadOutlined, QuestionCircleOutlined, InboxOutlined, UpOutlined } from '@ant-design/icons';
|
|
13
13
|
import { request as request$2, Table as Table$1, QueryTable, Form as Form$1 } from 'bssula';
|
|
14
14
|
import 'qs';
|
|
15
15
|
import { utils, writeFile, read } from 'xlsx';
|
|
@@ -1301,6 +1301,38 @@ var formContainerAndItemLayout = function formContainerAndItemLayout(type, title
|
|
|
1301
1301
|
};
|
|
1302
1302
|
};
|
|
1303
1303
|
|
|
1304
|
+
/**
|
|
1305
|
+
* 根据上游权限编码获取关联的导入导出业务功能编码。
|
|
1306
|
+
*/
|
|
1307
|
+
var getRelationTemplateCode = function getRelationTemplateCode(authCode) {
|
|
1308
|
+
var _buttonDataList$find;
|
|
1309
|
+
if (!authCode) return '';
|
|
1310
|
+
var menuData = [];
|
|
1311
|
+
try {
|
|
1312
|
+
var storedMenuData = JSON.parse(localStorage.getItem(getLimitMenuDataKey()) || '[]');
|
|
1313
|
+
menuData = Array.isArray(storedMenuData) ? storedMenuData : [];
|
|
1314
|
+
} catch (error) {
|
|
1315
|
+
return '';
|
|
1316
|
+
}
|
|
1317
|
+
var buttonDataList = [];
|
|
1318
|
+
/**
|
|
1319
|
+
* 递归收集叶子菜单下的按钮配置。
|
|
1320
|
+
*/
|
|
1321
|
+
var _collectButtons = function collectButtons(items) {
|
|
1322
|
+
items.forEach(function (item) {
|
|
1323
|
+
var _item$children;
|
|
1324
|
+
if (item === null || item === void 0 ? void 0 : (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) {
|
|
1325
|
+
_collectButtons(item.children);
|
|
1326
|
+
} else {
|
|
1327
|
+
buttonDataList = [].concat(_toConsumableArray(buttonDataList), _toConsumableArray((item === null || item === void 0 ? void 0 : item.buttons) || []));
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
};
|
|
1331
|
+
_collectButtons(menuData);
|
|
1332
|
+
return ((_buttonDataList$find = buttonDataList.find(function (item) {
|
|
1333
|
+
return item.bizCode === authCode;
|
|
1334
|
+
})) === null || _buttonDataList$find === void 0 ? void 0 : _buttonDataList$find.relationExcelTemplateCode) || '';
|
|
1335
|
+
};
|
|
1304
1336
|
// 判断某个按钮/菜单 是否有权限,返回布尔值
|
|
1305
1337
|
var authFunc = function authFunc(code) {
|
|
1306
1338
|
var _JSON$parse;
|
|
@@ -4260,7 +4292,7 @@ var handleParams = function handleParams(params) {
|
|
|
4260
4292
|
//处理单据编号查询 如果是查询单条数据 就是模糊查询 两条以上就是精准查询
|
|
4261
4293
|
var convertOrderNo = function convertOrderNo(params) {
|
|
4262
4294
|
//需要处理得编号字段名
|
|
4263
|
-
var arr = ['qp-skuCode-in', 'qp-eancode-in', 'qp-itemCode-in'
|
|
4295
|
+
var arr = ['qp-skuCode-in', 'qp-eancode-in', 'qp-itemCode-in'];
|
|
4264
4296
|
for (var i = 0; i < arr.length; i++) {
|
|
4265
4297
|
if (params[arr[i]]) {
|
|
4266
4298
|
if (!params[arr[i]].includes(',')) {
|
|
@@ -10991,9 +11023,8 @@ function commonFun(type, prefixUrl, parentProps) {
|
|
|
10991
11023
|
}]
|
|
10992
11024
|
}, selectConfigProps);
|
|
10993
11025
|
var _tableSearchForm = handleHiddenFields([{
|
|
10994
|
-
name: 'qp-code-
|
|
10995
|
-
label: 'SKC编码'
|
|
10996
|
-
type: 'multipleQueryInput'
|
|
11026
|
+
name: 'qp-code-like',
|
|
11027
|
+
label: 'SKC编码'
|
|
10997
11028
|
}, {
|
|
10998
11029
|
name: 'qp-skcName-like',
|
|
10999
11030
|
label: 'SKC名称'
|
|
@@ -14664,9 +14695,8 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
|
|
|
14664
14695
|
}];
|
|
14665
14696
|
var mTpTableColumn = handleTableColumn(initialTableColumn, parProps);
|
|
14666
14697
|
var initialTableSearchForm = [{
|
|
14667
|
-
name: 'qp-code-
|
|
14668
|
-
label: 'SKC编码'
|
|
14669
|
-
type: 'multipleQueryInput'
|
|
14698
|
+
name: 'qp-code-like',
|
|
14699
|
+
label: 'SKC编码'
|
|
14670
14700
|
}, {
|
|
14671
14701
|
name: 'qp-skcName-like',
|
|
14672
14702
|
label: 'SKC名称'
|
|
@@ -41714,4 +41744,2429 @@ var SystemLog = function SystemLog(_ref) {
|
|
|
41714
41744
|
});
|
|
41715
41745
|
};
|
|
41716
41746
|
|
|
41717
|
-
|
|
41747
|
+
var SDK_PREFIX = '/import-export';
|
|
41748
|
+
/**
|
|
41749
|
+
* 校验并规范化业务功能服务上下文。
|
|
41750
|
+
*/
|
|
41751
|
+
var normalizeServiceContext = function normalizeServiceContext(serviceContext) {
|
|
41752
|
+
var value = String(serviceContext || '').trim();
|
|
41753
|
+
if (!/^\/[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*$/.test(value) || value.includes('..')) {
|
|
41754
|
+
throw new Error('业务功能服务上下文配置无效');
|
|
41755
|
+
}
|
|
41756
|
+
return value.replace(/\/+$/, '');
|
|
41757
|
+
};
|
|
41758
|
+
/**
|
|
41759
|
+
* 拼接导入导出 SDK 接口地址。
|
|
41760
|
+
*/
|
|
41761
|
+
var buildSdkUrl = function buildSdkUrl(serviceContext, path) {
|
|
41762
|
+
return "".concat(normalizeServiceContext(serviceContext)).concat(SDK_PREFIX).concat(path);
|
|
41763
|
+
};
|
|
41764
|
+
|
|
41765
|
+
var CONFIG_PREFIX = '/basic/import-export';
|
|
41766
|
+
var BUSINESS_FUNCTION_PREFIX = '/basic/business-functions';
|
|
41767
|
+
var OSS_UPLOAD_URL = '/basic/upload';
|
|
41768
|
+
var concurrentLimitCode = 'IE-COM-CONCURRENT-FILE-LIMIT';
|
|
41769
|
+
/**
|
|
41770
|
+
* 使用业务项目提供的请求函数创建完整导入导出服务。
|
|
41771
|
+
*
|
|
41772
|
+
* 请求函数由消费方注入,以复用其鉴权、租户和异常处理拦截器。
|
|
41773
|
+
*/
|
|
41774
|
+
var createImportExportServices = function createImportExportServices(request) {
|
|
41775
|
+
var overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
41776
|
+
if (typeof request !== 'function') {
|
|
41777
|
+
throw new Error('创建导入导出服务时必须提供请求函数');
|
|
41778
|
+
}
|
|
41779
|
+
var services = {
|
|
41780
|
+
resolveBusinessFunction: function resolveBusinessFunction(businessFunctionCode) {
|
|
41781
|
+
return request("".concat(BUSINESS_FUNCTION_PREFIX, "/").concat(encodeURIComponent(businessFunctionCode), "/resolve"), {
|
|
41782
|
+
method: 'GET'
|
|
41783
|
+
});
|
|
41784
|
+
},
|
|
41785
|
+
queryTemplates: function queryTemplates(data) {
|
|
41786
|
+
return request("".concat(CONFIG_PREFIX, "/templates/query"), {
|
|
41787
|
+
method: 'POST',
|
|
41788
|
+
data: data
|
|
41789
|
+
});
|
|
41790
|
+
},
|
|
41791
|
+
queryTemplateFields: function queryTemplateFields(data) {
|
|
41792
|
+
return request("".concat(CONFIG_PREFIX, "/fields/candidates"), {
|
|
41793
|
+
method: 'POST',
|
|
41794
|
+
data: data
|
|
41795
|
+
});
|
|
41796
|
+
},
|
|
41797
|
+
uploadFile: function uploadFile(file) {
|
|
41798
|
+
var formData = new FormData();
|
|
41799
|
+
formData.append('file', file);
|
|
41800
|
+
return request(OSS_UPLOAD_URL, {
|
|
41801
|
+
method: 'POST',
|
|
41802
|
+
data: formData
|
|
41803
|
+
});
|
|
41804
|
+
},
|
|
41805
|
+
downloadTemplate: function downloadTemplate(templateCode, data) {
|
|
41806
|
+
return request("".concat(CONFIG_PREFIX, "/templates/").concat(encodeURIComponent(templateCode), "/download"), {
|
|
41807
|
+
method: 'GET',
|
|
41808
|
+
params: data,
|
|
41809
|
+
responseType: 'blob'
|
|
41810
|
+
});
|
|
41811
|
+
},
|
|
41812
|
+
previewImport: function previewImport(serviceContext, data) {
|
|
41813
|
+
return request(buildSdkUrl(serviceContext, '/imports/preview'), {
|
|
41814
|
+
method: 'POST',
|
|
41815
|
+
data: data
|
|
41816
|
+
});
|
|
41817
|
+
},
|
|
41818
|
+
executeImport: function executeImport(serviceContext, data) {
|
|
41819
|
+
return request(buildSdkUrl(serviceContext, '/imports/execute'), {
|
|
41820
|
+
method: 'POST',
|
|
41821
|
+
data: data
|
|
41822
|
+
});
|
|
41823
|
+
},
|
|
41824
|
+
downloadValidationErrorFile: function downloadValidationErrorFile(serviceContext, data) {
|
|
41825
|
+
return request(buildSdkUrl(serviceContext, '/imports/error-file'), {
|
|
41826
|
+
method: 'POST',
|
|
41827
|
+
data: data
|
|
41828
|
+
});
|
|
41829
|
+
},
|
|
41830
|
+
quickExport: function quickExport(serviceContext, data) {
|
|
41831
|
+
return request(buildSdkUrl(serviceContext, '/exports/quick'), {
|
|
41832
|
+
method: 'POST',
|
|
41833
|
+
data: data
|
|
41834
|
+
});
|
|
41835
|
+
},
|
|
41836
|
+
templateExport: function templateExport(serviceContext, data) {
|
|
41837
|
+
return request(buildSdkUrl(serviceContext, '/exports/template'), {
|
|
41838
|
+
method: 'POST',
|
|
41839
|
+
data: data
|
|
41840
|
+
});
|
|
41841
|
+
},
|
|
41842
|
+
queryRecentTasks: function queryRecentTasks(data) {
|
|
41843
|
+
return request("".concat(CONFIG_PREFIX, "/tasks/recent"), {
|
|
41844
|
+
method: 'POST',
|
|
41845
|
+
data: data
|
|
41846
|
+
});
|
|
41847
|
+
},
|
|
41848
|
+
queryTask: function queryTask(serviceContext, taskCode) {
|
|
41849
|
+
if (!taskCode) {
|
|
41850
|
+
return Promise.reject(new Error('taskId is required'));
|
|
41851
|
+
}
|
|
41852
|
+
return request(buildSdkUrl(serviceContext, '/tasks/progress'), {
|
|
41853
|
+
method: 'POST',
|
|
41854
|
+
data: {
|
|
41855
|
+
taskId: taskCode
|
|
41856
|
+
}
|
|
41857
|
+
});
|
|
41858
|
+
}
|
|
41859
|
+
};
|
|
41860
|
+
return _objectSpread2(_objectSpread2({}, services), overrides);
|
|
41861
|
+
};
|
|
41862
|
+
/**
|
|
41863
|
+
* 使用宿主项目的 Umi 请求实例创建默认导入导出服务。
|
|
41864
|
+
*/
|
|
41865
|
+
var defaultImportExportServices = createImportExportServices(function (url, options) {
|
|
41866
|
+
return request$3(url, options);
|
|
41867
|
+
});
|
|
41868
|
+
/**
|
|
41869
|
+
* 将业务侧差异服务合并到默认导入导出服务。
|
|
41870
|
+
*/
|
|
41871
|
+
var resolveImportExportServices = function resolveImportExportServices(overrides) {
|
|
41872
|
+
return _objectSpread2(_objectSpread2({}, defaultImportExportServices), overrides || {});
|
|
41873
|
+
};
|
|
41874
|
+
var unwrapResponse = function unwrapResponse(response) {
|
|
41875
|
+
var _response$data;
|
|
41876
|
+
return (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.data) || (response === null || response === void 0 ? void 0 : response.data) || response;
|
|
41877
|
+
};
|
|
41878
|
+
var getItems = function getItems(response) {
|
|
41879
|
+
var data = unwrapResponse(response);
|
|
41880
|
+
return (data === null || data === void 0 ? void 0 : data.records) || (data === null || data === void 0 ? void 0 : data.items) || (data === null || data === void 0 ? void 0 : data.list) || [];
|
|
41881
|
+
};
|
|
41882
|
+
var normalizeTask = function normalizeTask(task) {
|
|
41883
|
+
var _task$progress, _ref, _ref2, _ref3, _task$processedCount, _ref4, _ref5, _task$totalCount, _task$elapsedSeconds, _ref6, _ref7, _task$successCount, _ref8, _task$failedCount, _task$skippedCount, _task$operatorName, _task$fileName, _task$createdTime, _task$errorMessage;
|
|
41884
|
+
var attributes = (task === null || task === void 0 ? void 0 : task.attributes) || {};
|
|
41885
|
+
var result = (task === null || task === void 0 ? void 0 : task.result) || {};
|
|
41886
|
+
var taskStatus = (task === null || task === void 0 ? void 0 : task.taskStatus) || (task === null || task === void 0 ? void 0 : task.status) || (attributes === null || attributes === void 0 ? void 0 : attributes.status);
|
|
41887
|
+
var completedCount = (attributes === null || attributes === void 0 ? void 0 : attributes.successCount) != null || (attributes === null || attributes === void 0 ? void 0 : attributes.failedCount) != null ? Number((attributes === null || attributes === void 0 ? void 0 : attributes.successCount) || 0) + Number((attributes === null || attributes === void 0 ? void 0 : attributes.failedCount) || 0) : undefined;
|
|
41888
|
+
var terminal = ['SUCCESS', 'PARTIAL_SUCCESS', 'PASSED', 'COMPLETED_WITH_ERRORS', 'FAILED', 'CANCELLED'].includes(taskStatus);
|
|
41889
|
+
return _objectSpread2(_objectSpread2({}, task), {}, {
|
|
41890
|
+
taskId: (task === null || task === void 0 ? void 0 : task.taskId) || (result === null || result === void 0 ? void 0 : result.taskId) || (task === null || task === void 0 ? void 0 : task.taskCode),
|
|
41891
|
+
taskType: (task === null || task === void 0 ? void 0 : task.taskType) || (attributes === null || attributes === void 0 ? void 0 : attributes.taskType) || (attributes === null || attributes === void 0 ? void 0 : attributes.operationType),
|
|
41892
|
+
taskStatus: taskStatus,
|
|
41893
|
+
progress: (_task$progress = task === null || task === void 0 ? void 0 : task.progress) !== null && _task$progress !== void 0 ? _task$progress : attributes === null || attributes === void 0 ? void 0 : attributes.percent,
|
|
41894
|
+
processedCount: (_ref = (_ref2 = (_ref3 = (_task$processedCount = task === null || task === void 0 ? void 0 : task.processedCount) !== null && _task$processedCount !== void 0 ? _task$processedCount : task === null || task === void 0 ? void 0 : task.processedRows) !== null && _ref3 !== void 0 ? _ref3 : attributes === null || attributes === void 0 ? void 0 : attributes.processedCount) !== null && _ref2 !== void 0 ? _ref2 : completedCount) !== null && _ref !== void 0 ? _ref : result === null || result === void 0 ? void 0 : result.rowCount,
|
|
41895
|
+
totalCount: (_ref4 = (_ref5 = (_task$totalCount = task === null || task === void 0 ? void 0 : task.totalCount) !== null && _task$totalCount !== void 0 ? _task$totalCount : task === null || task === void 0 ? void 0 : task.totalRows) !== null && _ref5 !== void 0 ? _ref5 : attributes === null || attributes === void 0 ? void 0 : attributes.totalCount) !== null && _ref4 !== void 0 ? _ref4 : terminal ? completedCount !== null && completedCount !== void 0 ? completedCount : result === null || result === void 0 ? void 0 : result.rowCount : undefined,
|
|
41896
|
+
elapsedSeconds: (_task$elapsedSeconds = task === null || task === void 0 ? void 0 : task.elapsedSeconds) !== null && _task$elapsedSeconds !== void 0 ? _task$elapsedSeconds : task === null || task === void 0 ? void 0 : task.durationSeconds,
|
|
41897
|
+
successCount: (_ref6 = (_ref7 = (_task$successCount = task === null || task === void 0 ? void 0 : task.successCount) !== null && _task$successCount !== void 0 ? _task$successCount : task === null || task === void 0 ? void 0 : task.successRows) !== null && _ref7 !== void 0 ? _ref7 : attributes === null || attributes === void 0 ? void 0 : attributes.successCount) !== null && _ref6 !== void 0 ? _ref6 : result === null || result === void 0 ? void 0 : result.rowCount,
|
|
41898
|
+
failedCount: (_ref8 = (_task$failedCount = task === null || task === void 0 ? void 0 : task.failedCount) !== null && _task$failedCount !== void 0 ? _task$failedCount : task === null || task === void 0 ? void 0 : task.failedRows) !== null && _ref8 !== void 0 ? _ref8 : attributes === null || attributes === void 0 ? void 0 : attributes.failedCount,
|
|
41899
|
+
skippedCount: (_task$skippedCount = task === null || task === void 0 ? void 0 : task.skippedCount) !== null && _task$skippedCount !== void 0 ? _task$skippedCount : task === null || task === void 0 ? void 0 : task.skippedRows,
|
|
41900
|
+
operatorName: (_task$operatorName = task === null || task === void 0 ? void 0 : task.operatorName) !== null && _task$operatorName !== void 0 ? _task$operatorName : task === null || task === void 0 ? void 0 : task.operator,
|
|
41901
|
+
fileName: (_task$fileName = task === null || task === void 0 ? void 0 : task.fileName) !== null && _task$fileName !== void 0 ? _task$fileName : result === null || result === void 0 ? void 0 : result.objectKey,
|
|
41902
|
+
createdTime: (_task$createdTime = task === null || task === void 0 ? void 0 : task.createdTime) !== null && _task$createdTime !== void 0 ? _task$createdTime : task === null || task === void 0 ? void 0 : task.createTime,
|
|
41903
|
+
resultDownloadUrl: (task === null || task === void 0 ? void 0 : task.resultDownloadUrl) || (task === null || task === void 0 ? void 0 : task.resultFileUrl) || (result === null || result === void 0 ? void 0 : result.fileUrl),
|
|
41904
|
+
errorDownloadUrl: (task === null || task === void 0 ? void 0 : task.errorDownloadUrl) || (task === null || task === void 0 ? void 0 : task.errorFileUrl),
|
|
41905
|
+
errorMessage: (_task$errorMessage = task === null || task === void 0 ? void 0 : task.errorMessage) !== null && _task$errorMessage !== void 0 ? _task$errorMessage : attributes === null || attributes === void 0 ? void 0 : attributes.errorMessage
|
|
41906
|
+
});
|
|
41907
|
+
};
|
|
41908
|
+
var taskTypeNames = {
|
|
41909
|
+
IMPORT_VALIDATION: '导入校验',
|
|
41910
|
+
IMPORT_EXECUTION: '导入执行',
|
|
41911
|
+
IMPORT: '导入执行',
|
|
41912
|
+
EXPORT: '导出',
|
|
41913
|
+
TEMPLATE_DOWNLOAD: '模板下载'
|
|
41914
|
+
};
|
|
41915
|
+
var taskTypeName = function taskTypeName(taskType) {
|
|
41916
|
+
return taskTypeNames[String(taskType || '').toUpperCase()] || '文件任务';
|
|
41917
|
+
};
|
|
41918
|
+
var isConcurrentLimit = function isConcurrentLimit(response) {
|
|
41919
|
+
var _response$response;
|
|
41920
|
+
var candidates = [response, response === null || response === void 0 ? void 0 : response.data, response === null || response === void 0 ? void 0 : response.response, response === null || response === void 0 ? void 0 : (_response$response = response.response) === null || _response$response === void 0 ? void 0 : _response$response.data];
|
|
41921
|
+
return candidates.some(function (item) {
|
|
41922
|
+
return (item === null || item === void 0 ? void 0 : item.code) === concurrentLimitCode || String((item === null || item === void 0 ? void 0 : item.message) || (item === null || item === void 0 ? void 0 : item.msg) || '').includes(concurrentLimitCode);
|
|
41923
|
+
});
|
|
41924
|
+
};
|
|
41925
|
+
|
|
41926
|
+
var css_248z$B = ".index-module_exportModal__3w1bk .ant-modal {\n top: 56px;\n max-width: calc(100vw - 32px);\n padding-bottom: 24px;\n}\n.index-module_exportModal__3w1bk .ant-modal-content {\n overflow: hidden;\n border-radius: 8px;\n box-shadow: 0 12px 40px rgba(31, 35, 41, 0.18);\n}\n.index-module_exportModal__3w1bk .ant-modal-header {\n padding: 18px 24px;\n border-bottom-color: #eef0f3;\n}\n.index-module_exportModal__3w1bk .ant-modal-body {\n max-height: calc(100vh - 220px);\n padding: 0;\n overflow-y: auto;\n background: #f7f8fa;\n}\n.index-module_exportModal__3w1bk .ant-modal-footer {\n padding: 14px 24px;\n border-top-color: #eef0f3;\n}\n.index-module_exportModal__3w1bk .ant-modal-close-x {\n height: 76px;\n line-height: 76px;\n}\n.index-module_modalTitle__15u3X {\n display: flex;\n align-items: center;\n min-height: 40px;\n}\n.index-module_modalTitleIcon__3xmvU {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n margin-right: 12px;\n color: #1677ff;\n font-size: 20px;\n background: #eaf3ff;\n border-radius: 8px;\n}\n.index-module_modalTitleText__3utGV,\n.index-module_modalTitleDescription__cDWV4,\n.index-module_sectionTitle__16-aX,\n.index-module_sectionDescription__2tpp1,\n.index-module_scopeTitle__1ac6w,\n.index-module_scopeDescription__1s-IV,\n.index-module_fileTypeName__1OYwi,\n.index-module_fileTypeDescription__1FtJb {\n display: block;\n}\n.index-module_modalTitleText__3utGV {\n color: #1f2329;\n font-weight: 600;\n font-size: 16px;\n line-height: 22px;\n}\n.index-module_modalTitleDescription__cDWV4 {\n margin-top: 2px;\n color: #8f959e;\n font-weight: 400;\n font-size: 12px;\n line-height: 18px;\n}\n.index-module_dialogBody__2juxt {\n padding: 16px 24px 24px;\n}\n.index-module_section__16q24 {\n margin-bottom: 16px;\n padding: 18px 20px;\n background: #fff;\n border: 1px solid #e8eaed;\n border-radius: 8px;\n}\n.index-module_section__16q24:last-child {\n margin-bottom: 0;\n}\n.index-module_sectionHeader__1grBk {\n display: flex;\n align-items: flex-start;\n margin-bottom: 16px;\n}\n.index-module_sectionIndex__kzg5U {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n margin-right: 10px;\n color: #1677ff;\n font-weight: 600;\n font-size: 13px;\n background: #eaf3ff;\n border-radius: 50%;\n}\n.index-module_sectionTitle__16-aX {\n color: #1f2329;\n font-weight: 600;\n font-size: 15px;\n line-height: 22px;\n}\n.index-module_sectionDescription__2tpp1 {\n margin-top: 2px;\n color: #8f959e;\n font-size: 12px;\n line-height: 18px;\n}\n.index-module_scopeCard__36rit {\n display: flex;\n align-items: center;\n min-height: 72px;\n padding: 14px 16px;\n background: #f7f8fa;\n border: 1px solid #eef0f3;\n border-radius: 6px;\n}\n.index-module_scopeIcon__3kCNV {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n margin-right: 12px;\n color: #1677ff;\n font-size: 18px;\n background: #fff;\n border-radius: 6px;\n box-shadow: 0 1px 3px rgba(31, 35, 41, 0.08);\n}\n.index-module_scopeContent__GxJMB {\n min-width: 0;\n}\n.index-module_scopeTitle__1ac6w {\n color: #1f2329;\n font-weight: 500;\n font-size: 14px;\n line-height: 22px;\n}\n.index-module_scopeDescription__1s-IV {\n margin-top: 2px;\n color: #8f959e;\n font-size: 12px;\n line-height: 18px;\n}\n.index-module_resultCount__24HI7 {\n flex: 0 0 auto;\n margin-left: auto;\n padding: 3px 10px;\n color: #1677ff;\n font-weight: 600;\n font-size: 13px;\n white-space: nowrap;\n background: #eaf3ff;\n border-radius: 12px;\n}\n.index-module_fileTypeGrid__3DEH7 {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 12px;\n width: 100%;\n}\n.index-module_fileTypeOption__3xdv7 {\n display: flex;\n align-items: flex-start;\n min-height: 68px;\n margin-right: 0;\n padding: 12px 14px;\n background: #fff;\n border: 1px solid #d9dce1;\n border-radius: 6px;\n transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;\n}\n.index-module_fileTypeOption__3xdv7:hover {\n border-color: #69a5ff;\n}\n.index-module_fileTypeOption__3xdv7.ant-radio-wrapper-checked {\n background: #f5f9ff;\n border-color: #1677ff;\n box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.08);\n}\n.index-module_fileTypeOption__3xdv7 .ant-radio {\n margin-top: 3px;\n}\n.index-module_fileTypeContent__j3dIT {\n margin-left: 4px;\n}\n.index-module_fileTypeName__1OYwi {\n color: #1f2329;\n font-weight: 600;\n font-size: 14px;\n line-height: 22px;\n}\n.index-module_fileTypeDescription__1FtJb {\n margin-top: 2px;\n color: #8f959e;\n font-size: 12px;\n line-height: 18px;\n}\n.index-module_exportAlert__9T7FJ {\n margin-top: 14px;\n border-color: #d9e8ff;\n border-radius: 6px;\n}\n.index-module_templateForm__2B-el .ant-form-item-label {\n padding-bottom: 8px;\n font-weight: 500;\n}\n.index-module_templateSelectItem__1tYgm {\n margin-bottom: 0;\n}\n.index-module_templatePreview__2iSqd {\n margin-top: 16px;\n overflow: hidden;\n border: 1px solid #e8eaed;\n border-radius: 6px;\n}\n.index-module_templatePreviewHeader__3OlGX {\n display: flex;\n align-items: center;\n justify-content: space-between;\n min-height: 48px;\n padding: 8px 14px;\n background: #f7f8fa;\n border-bottom: 1px solid #e8eaed;\n}\n.index-module_downloadTemplateButton__3eGfx {\n padding-right: 0;\n}\n.index-module_templateSummary__qCzi- .ant-descriptions-view {\n border-right: 0;\n border-left: 0;\n border-radius: 0;\n}\n.index-module_templateSummary__qCzi- .ant-descriptions-row > th,\n.index-module_templateSummary__qCzi- .ant-descriptions-row > td {\n padding: 10px 12px;\n}\n.index-module_templateSummary__qCzi- .ant-descriptions-item-label {\n color: #646a73;\n background: #fbfcfd;\n}\n.index-module_templateSummary__qCzi- .ant-descriptions-item-content {\n color: #1f2329;\n font-weight: 500;\n}\n.index-module_fieldPreview__3fZ94 {\n padding: 12px 14px 14px;\n background: #fff;\n}\n.index-module_fieldPreviewHeader__1Dnjl {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 10px;\n}\n.index-module_fieldPreviewLabel__3YyqT {\n color: #646a73;\n font-weight: 500;\n font-size: 13px;\n}\n.index-module_fieldCount__3b__K {\n color: #8f959e;\n font-size: 12px;\n}\n.index-module_fieldTags__3sAMg {\n min-height: 42px;\n max-height: 156px;\n padding: 10px;\n overflow-y: auto;\n background: #f7f8fa;\n border-radius: 6px;\n}\n.index-module_fieldTag__UP35F {\n margin-bottom: 6px;\n color: #434a54;\n background: #fff;\n border-color: #dfe2e6;\n border-radius: 4px;\n}\n.index-module_emptyFields__3GVvx {\n display: flex;\n align-items: center;\n min-height: 22px;\n color: #8f959e;\n font-size: 12px;\n}\n@media (max-width: 576px) {\n .index-module_modalTitleDescription__cDWV4 {\n display: none;\n }\n .index-module_dialogBody__2juxt {\n padding-right: 16px;\n padding-left: 16px;\n }\n .index-module_section__16q24 {\n padding: 16px;\n }\n .index-module_scopeCard__36rit {\n align-items: flex-start;\n }\n .index-module_resultCount__24HI7 {\n margin-top: 7px;\n }\n .index-module_fileTypeGrid__3DEH7 {\n grid-template-columns: 1fr;\n }\n}\n";
|
|
41927
|
+
var styles$1 = {"exportModal":"index-module_exportModal__3w1bk","modalTitle":"index-module_modalTitle__15u3X","modalTitleIcon":"index-module_modalTitleIcon__3xmvU","modalTitleText":"index-module_modalTitleText__3utGV","modalTitleDescription":"index-module_modalTitleDescription__cDWV4","sectionTitle":"index-module_sectionTitle__16-aX","sectionDescription":"index-module_sectionDescription__2tpp1","scopeTitle":"index-module_scopeTitle__1ac6w","scopeDescription":"index-module_scopeDescription__1s-IV","fileTypeName":"index-module_fileTypeName__1OYwi","fileTypeDescription":"index-module_fileTypeDescription__1FtJb","dialogBody":"index-module_dialogBody__2juxt","section":"index-module_section__16q24","sectionHeader":"index-module_sectionHeader__1grBk","sectionIndex":"index-module_sectionIndex__kzg5U","scopeCard":"index-module_scopeCard__36rit","scopeIcon":"index-module_scopeIcon__3kCNV","scopeContent":"index-module_scopeContent__GxJMB","resultCount":"index-module_resultCount__24HI7","fileTypeGrid":"index-module_fileTypeGrid__3DEH7","fileTypeOption":"index-module_fileTypeOption__3xdv7","fileTypeContent":"index-module_fileTypeContent__j3dIT","exportAlert":"index-module_exportAlert__9T7FJ","templateForm":"index-module_templateForm__2B-el","templateSelectItem":"index-module_templateSelectItem__1tYgm","templatePreview":"index-module_templatePreview__2iSqd","templatePreviewHeader":"index-module_templatePreviewHeader__3OlGX","downloadTemplateButton":"index-module_downloadTemplateButton__3eGfx","templateSummary":"index-module_templateSummary__qCzi-","fieldPreview":"index-module_fieldPreview__3fZ94","fieldPreviewHeader":"index-module_fieldPreviewHeader__1Dnjl","fieldPreviewLabel":"index-module_fieldPreviewLabel__3YyqT","fieldCount":"index-module_fieldCount__3b__K","fieldTags":"index-module_fieldTags__3sAMg","fieldTag":"index-module_fieldTag__UP35F","emptyFields":"index-module_emptyFields__3GVvx"};
|
|
41928
|
+
styleInject(css_248z$B);
|
|
41929
|
+
|
|
41930
|
+
/**
|
|
41931
|
+
* 统一导出弹窗标题区的图标、主标题和辅助说明。
|
|
41932
|
+
*/
|
|
41933
|
+
var ModalTitle = function ModalTitle(_ref) {
|
|
41934
|
+
var icon = _ref.icon,
|
|
41935
|
+
title = _ref.title,
|
|
41936
|
+
description = _ref.description;
|
|
41937
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
41938
|
+
className: styles$1.modalTitle
|
|
41939
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
41940
|
+
className: styles$1.modalTitleIcon
|
|
41941
|
+
}, icon), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
41942
|
+
className: styles$1.modalTitleText
|
|
41943
|
+
}, title), /*#__PURE__*/React$1.createElement("span", {
|
|
41944
|
+
className: styles$1.modalTitleDescription
|
|
41945
|
+
}, description)));
|
|
41946
|
+
};
|
|
41947
|
+
|
|
41948
|
+
var TemplatePicker = function TemplatePicker(_ref) {
|
|
41949
|
+
var visible = _ref.visible,
|
|
41950
|
+
context = _ref.context,
|
|
41951
|
+
services = _ref.services,
|
|
41952
|
+
onCancel = _ref.onCancel,
|
|
41953
|
+
onConfirm = _ref.onConfirm,
|
|
41954
|
+
documentName = _ref.documentName,
|
|
41955
|
+
resultCount = _ref.resultCount;
|
|
41956
|
+
var _useState = useState([]),
|
|
41957
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41958
|
+
items = _useState2[0],
|
|
41959
|
+
setItems = _useState2[1];
|
|
41960
|
+
var _useState3 = useState([]),
|
|
41961
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
41962
|
+
fields = _useState4[0],
|
|
41963
|
+
setFields = _useState4[1];
|
|
41964
|
+
var _useState5 = useState(),
|
|
41965
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
41966
|
+
templateCode = _useState6[0],
|
|
41967
|
+
setTemplateCode = _useState6[1];
|
|
41968
|
+
var _useState7 = useState(false),
|
|
41969
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
41970
|
+
loading = _useState8[0],
|
|
41971
|
+
setLoading = _useState8[1];
|
|
41972
|
+
var _useState9 = useState(false),
|
|
41973
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
41974
|
+
fieldLoading = _useState0[0],
|
|
41975
|
+
setFieldLoading = _useState0[1];
|
|
41976
|
+
var _useState1 = useState(false),
|
|
41977
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
41978
|
+
confirming = _useState10[0],
|
|
41979
|
+
setConfirming = _useState10[1];
|
|
41980
|
+
var _useState11 = useState(false),
|
|
41981
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
41982
|
+
downloading = _useState12[0],
|
|
41983
|
+
setDownloading = _useState12[1];
|
|
41984
|
+
var _useState13 = useState('XLSX'),
|
|
41985
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
41986
|
+
fileType = _useState14[0],
|
|
41987
|
+
setFileType = _useState14[1];
|
|
41988
|
+
var searchTimer = useRef();
|
|
41989
|
+
var loadTemplates = useCallback(/*#__PURE__*/function () {
|
|
41990
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(keyword) {
|
|
41991
|
+
var response, loaded, defaultTemplate, _t;
|
|
41992
|
+
return _regenerator().w(function (_context) {
|
|
41993
|
+
while (1) switch (_context.p = _context.n) {
|
|
41994
|
+
case 0:
|
|
41995
|
+
setLoading(true);
|
|
41996
|
+
_context.p = 1;
|
|
41997
|
+
_context.n = 2;
|
|
41998
|
+
return services.queryTemplates({
|
|
41999
|
+
operationType: context.operationType,
|
|
42000
|
+
businessFunctionCode: context.businessFunctionCode,
|
|
42001
|
+
keyword: keyword,
|
|
42002
|
+
enabled: true,
|
|
42003
|
+
currentPage: 1,
|
|
42004
|
+
pageSize: 100
|
|
42005
|
+
});
|
|
42006
|
+
case 2:
|
|
42007
|
+
response = _context.v;
|
|
42008
|
+
loaded = getItems(response);
|
|
42009
|
+
setItems(loaded);
|
|
42010
|
+
if (!keyword) {
|
|
42011
|
+
defaultTemplate = loaded.find(function (template) {
|
|
42012
|
+
return template.defaultFlag && template.enabled !== false;
|
|
42013
|
+
});
|
|
42014
|
+
if (!defaultTemplate) {
|
|
42015
|
+
message$1.error('当前业务功能未配置启用的默认导出模板');
|
|
42016
|
+
} else {
|
|
42017
|
+
setTemplateCode(defaultTemplate.templateCode);
|
|
42018
|
+
}
|
|
42019
|
+
}
|
|
42020
|
+
_context.n = 4;
|
|
42021
|
+
break;
|
|
42022
|
+
case 3:
|
|
42023
|
+
_context.p = 3;
|
|
42024
|
+
_t = _context.v;
|
|
42025
|
+
message$1.error('导出模板加载失败,请稍后重试');
|
|
42026
|
+
case 4:
|
|
42027
|
+
_context.p = 4;
|
|
42028
|
+
setLoading(false);
|
|
42029
|
+
return _context.f(4);
|
|
42030
|
+
case 5:
|
|
42031
|
+
return _context.a(2);
|
|
42032
|
+
}
|
|
42033
|
+
}, _callee, null, [[1, 3, 4, 5]]);
|
|
42034
|
+
}));
|
|
42035
|
+
return function (_x) {
|
|
42036
|
+
return _ref2.apply(this, arguments);
|
|
42037
|
+
};
|
|
42038
|
+
}(), [context.businessFunctionCode, context.operationType, services]);
|
|
42039
|
+
useEffect(function () {
|
|
42040
|
+
if (!visible) return;
|
|
42041
|
+
setTemplateCode(undefined);
|
|
42042
|
+
setFields([]);
|
|
42043
|
+
setFileType('XLSX');
|
|
42044
|
+
loadTemplates();
|
|
42045
|
+
}, [visible, loadTemplates]);
|
|
42046
|
+
useEffect(function () {
|
|
42047
|
+
return function () {
|
|
42048
|
+
if (searchTimer.current) {
|
|
42049
|
+
window.clearTimeout(searchTimer.current);
|
|
42050
|
+
}
|
|
42051
|
+
};
|
|
42052
|
+
}, []);
|
|
42053
|
+
var selectedTemplate = useMemo(function () {
|
|
42054
|
+
return items.find(function (item) {
|
|
42055
|
+
return item.templateCode === templateCode;
|
|
42056
|
+
});
|
|
42057
|
+
}, [items, templateCode]);
|
|
42058
|
+
var personalTemplates = items.filter(function (item) {
|
|
42059
|
+
return item.visibility === 'PERSONAL';
|
|
42060
|
+
});
|
|
42061
|
+
var publicTemplates = items.filter(function (item) {
|
|
42062
|
+
return item.visibility !== 'PERSONAL';
|
|
42063
|
+
});
|
|
42064
|
+
var previewFieldNames = fields.length > 0 ? fields.map(function (field) {
|
|
42065
|
+
return field.displayName || field.fieldCode;
|
|
42066
|
+
}) : (selectedTemplate === null || selectedTemplate === void 0 ? void 0 : selectedTemplate.fieldNames) || [];
|
|
42067
|
+
var previewFieldCount = fields.length || (selectedTemplate === null || selectedTemplate === void 0 ? void 0 : selectedTemplate.fieldCount) || previewFieldNames.length;
|
|
42068
|
+
var searchTemplates = function searchTemplates(keyword) {
|
|
42069
|
+
if (searchTimer.current) {
|
|
42070
|
+
window.clearTimeout(searchTimer.current);
|
|
42071
|
+
}
|
|
42072
|
+
searchTimer.current = window.setTimeout(function () {
|
|
42073
|
+
return loadTemplates(keyword.trim() || undefined);
|
|
42074
|
+
}, 300);
|
|
42075
|
+
};
|
|
42076
|
+
useEffect(function () {
|
|
42077
|
+
if (!selectedTemplate) {
|
|
42078
|
+
setFields([]);
|
|
42079
|
+
return;
|
|
42080
|
+
}
|
|
42081
|
+
setFieldLoading(true);
|
|
42082
|
+
services.queryTemplateFields({
|
|
42083
|
+
templateCode: selectedTemplate.templateCode,
|
|
42084
|
+
metadataEntityCode: selectedTemplate.metadataEntityCode,
|
|
42085
|
+
onlyUnmapped: false,
|
|
42086
|
+
currentPage: 1,
|
|
42087
|
+
pageSize: 500
|
|
42088
|
+
}).then(function (response) {
|
|
42089
|
+
setFields(getItems(response).filter(function (field) {
|
|
42090
|
+
return field.mapped;
|
|
42091
|
+
}));
|
|
42092
|
+
}).catch(function () {
|
|
42093
|
+
setFields([]);
|
|
42094
|
+
message$1.error('模板字段预览加载失败,请稍后重试');
|
|
42095
|
+
}).finally(function () {
|
|
42096
|
+
return setFieldLoading(false);
|
|
42097
|
+
});
|
|
42098
|
+
}, [selectedTemplate, services]);
|
|
42099
|
+
var confirm = /*#__PURE__*/function () {
|
|
42100
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
42101
|
+
return _regenerator().w(function (_context2) {
|
|
42102
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
42103
|
+
case 0:
|
|
42104
|
+
if (templateCode) {
|
|
42105
|
+
_context2.n = 1;
|
|
42106
|
+
break;
|
|
42107
|
+
}
|
|
42108
|
+
return _context2.a(2);
|
|
42109
|
+
case 1:
|
|
42110
|
+
if (!(resultCount === 0)) {
|
|
42111
|
+
_context2.n = 2;
|
|
42112
|
+
break;
|
|
42113
|
+
}
|
|
42114
|
+
message$1.warning('当前查询结果为空,不创建导出任务');
|
|
42115
|
+
return _context2.a(2);
|
|
42116
|
+
case 2:
|
|
42117
|
+
setConfirming(true);
|
|
42118
|
+
_context2.p = 3;
|
|
42119
|
+
_context2.n = 4;
|
|
42120
|
+
return onConfirm(templateCode, fileType);
|
|
42121
|
+
case 4:
|
|
42122
|
+
_context2.p = 4;
|
|
42123
|
+
setConfirming(false);
|
|
42124
|
+
return _context2.f(4);
|
|
42125
|
+
case 5:
|
|
42126
|
+
return _context2.a(2);
|
|
42127
|
+
}
|
|
42128
|
+
}, _callee2, null, [[3,, 4, 5]]);
|
|
42129
|
+
}));
|
|
42130
|
+
return function confirm() {
|
|
42131
|
+
return _ref3.apply(this, arguments);
|
|
42132
|
+
};
|
|
42133
|
+
}();
|
|
42134
|
+
var downloadTemplate = /*#__PURE__*/function () {
|
|
42135
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
42136
|
+
var file, url, link, _t2;
|
|
42137
|
+
return _regenerator().w(function (_context3) {
|
|
42138
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
42139
|
+
case 0:
|
|
42140
|
+
if (templateCode) {
|
|
42141
|
+
_context3.n = 1;
|
|
42142
|
+
break;
|
|
42143
|
+
}
|
|
42144
|
+
message$1.warning('请先选择模板');
|
|
42145
|
+
return _context3.a(2);
|
|
42146
|
+
case 1:
|
|
42147
|
+
setDownloading(true);
|
|
42148
|
+
_context3.p = 2;
|
|
42149
|
+
_context3.n = 3;
|
|
42150
|
+
return services.downloadTemplate(templateCode, context);
|
|
42151
|
+
case 3:
|
|
42152
|
+
file = _context3.v;
|
|
42153
|
+
url = URL.createObjectURL(file instanceof Blob ? file : new Blob([file]));
|
|
42154
|
+
link = document.createElement('a');
|
|
42155
|
+
link.href = url;
|
|
42156
|
+
link.download = "".concat((selectedTemplate === null || selectedTemplate === void 0 ? void 0 : selectedTemplate.templateName) || templateCode, ".xlsx");
|
|
42157
|
+
document.body.appendChild(link);
|
|
42158
|
+
link.click();
|
|
42159
|
+
document.body.removeChild(link);
|
|
42160
|
+
URL.revokeObjectURL(url);
|
|
42161
|
+
message$1.success('模板下载成功');
|
|
42162
|
+
_context3.n = 5;
|
|
42163
|
+
break;
|
|
42164
|
+
case 4:
|
|
42165
|
+
_context3.p = 4;
|
|
42166
|
+
_t2 = _context3.v;
|
|
42167
|
+
message$1.error('模板下载失败,请稍后重试');
|
|
42168
|
+
case 5:
|
|
42169
|
+
_context3.p = 5;
|
|
42170
|
+
setDownloading(false);
|
|
42171
|
+
return _context3.f(5);
|
|
42172
|
+
case 6:
|
|
42173
|
+
return _context3.a(2);
|
|
42174
|
+
}
|
|
42175
|
+
}, _callee3, null, [[2, 4, 5, 6]]);
|
|
42176
|
+
}));
|
|
42177
|
+
return function downloadTemplate() {
|
|
42178
|
+
return _ref4.apply(this, arguments);
|
|
42179
|
+
};
|
|
42180
|
+
}();
|
|
42181
|
+
return /*#__PURE__*/React$1.createElement(Modal, {
|
|
42182
|
+
width: 760,
|
|
42183
|
+
title: /*#__PURE__*/React$1.createElement(ModalTitle, {
|
|
42184
|
+
icon: /*#__PURE__*/React$1.createElement(FileExcelOutlined, null),
|
|
42185
|
+
title: "".concat(documentName || '业务单据', "\u6309\u6A21\u677F\u5BFC\u51FA"),
|
|
42186
|
+
description: "\u6309\u5DF2\u914D\u7F6E\u7684\u5B57\u6BB5\u6A21\u677F\u751F\u6210\u5F53\u524D\u7B5B\u9009\u7ED3\u679C"
|
|
42187
|
+
}),
|
|
42188
|
+
visible: visible,
|
|
42189
|
+
onCancel: onCancel,
|
|
42190
|
+
onOk: confirm,
|
|
42191
|
+
confirmLoading: confirming,
|
|
42192
|
+
okButtonProps: {
|
|
42193
|
+
disabled: !templateCode || resultCount === 0
|
|
42194
|
+
},
|
|
42195
|
+
okText: "\u521B\u5EFA\u5BFC\u51FA\u4EFB\u52A1",
|
|
42196
|
+
cancelText: "\u53D6\u6D88",
|
|
42197
|
+
wrapClassName: styles$1.exportModal,
|
|
42198
|
+
destroyOnClose: true
|
|
42199
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
42200
|
+
className: styles$1.dialogBody
|
|
42201
|
+
}, /*#__PURE__*/React$1.createElement(Form, {
|
|
42202
|
+
layout: "vertical",
|
|
42203
|
+
className: styles$1.templateForm
|
|
42204
|
+
}, /*#__PURE__*/React$1.createElement("section", {
|
|
42205
|
+
className: styles$1.section
|
|
42206
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
42207
|
+
className: styles$1.sectionHeader
|
|
42208
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42209
|
+
className: styles$1.sectionIndex
|
|
42210
|
+
}, "1"), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
42211
|
+
className: styles$1.sectionTitle
|
|
42212
|
+
}, "\u9009\u62E9\u5BFC\u51FA\u6A21\u677F"), /*#__PURE__*/React$1.createElement("span", {
|
|
42213
|
+
className: styles$1.sectionDescription
|
|
42214
|
+
}, "\u6A21\u677F\u51B3\u5B9A\u5BFC\u51FA\u6587\u4EF6\u5305\u542B\u7684\u5B57\u6BB5\u53CA\u5B57\u6BB5\u987A\u5E8F"))), /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
42215
|
+
label: "\u5BFC\u51FA\u6A21\u677F",
|
|
42216
|
+
required: true,
|
|
42217
|
+
className: styles$1.templateSelectItem
|
|
42218
|
+
}, /*#__PURE__*/React$1.createElement(Spin, {
|
|
42219
|
+
spinning: loading
|
|
42220
|
+
}, /*#__PURE__*/React$1.createElement(Select, {
|
|
42221
|
+
size: "large",
|
|
42222
|
+
showSearch: true,
|
|
42223
|
+
allowClear: true,
|
|
42224
|
+
filterOption: false,
|
|
42225
|
+
onSearch: searchTemplates,
|
|
42226
|
+
onClear: function onClear() {
|
|
42227
|
+
return loadTemplates();
|
|
42228
|
+
},
|
|
42229
|
+
placeholder: "\u8F93\u5165\u6A21\u677F\u540D\u79F0\u5B9E\u65F6\u67E5\u8BE2",
|
|
42230
|
+
value: templateCode,
|
|
42231
|
+
onChange: setTemplateCode,
|
|
42232
|
+
style: {
|
|
42233
|
+
width: '100%'
|
|
42234
|
+
},
|
|
42235
|
+
notFoundContent: /*#__PURE__*/React$1.createElement(Empty, {
|
|
42236
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
42237
|
+
})
|
|
42238
|
+
}, personalTemplates.length > 0 && (/*#__PURE__*/React$1.createElement(Select.OptGroup, {
|
|
42239
|
+
label: "\u4E2A\u4EBA\u6A21\u677F"
|
|
42240
|
+
}, personalTemplates.map(function (item) {
|
|
42241
|
+
return /*#__PURE__*/React$1.createElement(Select.Option, {
|
|
42242
|
+
key: item.templateCode,
|
|
42243
|
+
value: item.templateCode
|
|
42244
|
+
}, item.templateName);
|
|
42245
|
+
}))), publicTemplates.length > 0 && (/*#__PURE__*/React$1.createElement(Select.OptGroup, {
|
|
42246
|
+
label: "\u516C\u5171\u6A21\u677F"
|
|
42247
|
+
}, publicTemplates.map(function (item) {
|
|
42248
|
+
return /*#__PURE__*/React$1.createElement(Select.Option, {
|
|
42249
|
+
key: item.templateCode,
|
|
42250
|
+
value: item.templateCode
|
|
42251
|
+
}, item.templateName);
|
|
42252
|
+
})))))), selectedTemplate && (/*#__PURE__*/React$1.createElement("div", {
|
|
42253
|
+
className: styles$1.templatePreview
|
|
42254
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
42255
|
+
className: styles$1.templatePreviewHeader
|
|
42256
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42257
|
+
className: styles$1.sectionTitle
|
|
42258
|
+
}, "\u6A21\u677F\u4FE1\u606F\u4E0E\u5B57\u6BB5\u9884\u89C8"), /*#__PURE__*/React$1.createElement(Button, {
|
|
42259
|
+
className: styles$1.downloadTemplateButton,
|
|
42260
|
+
type: "link",
|
|
42261
|
+
icon: /*#__PURE__*/React$1.createElement(DownloadOutlined, null),
|
|
42262
|
+
loading: downloading,
|
|
42263
|
+
onClick: downloadTemplate
|
|
42264
|
+
}, "\u4E0B\u8F7D\u7A7A\u767D\u6A21\u677F")), /*#__PURE__*/React$1.createElement(Descriptions, {
|
|
42265
|
+
bordered: true,
|
|
42266
|
+
size: "small",
|
|
42267
|
+
column: {
|
|
42268
|
+
xs: 1,
|
|
42269
|
+
sm: 3
|
|
42270
|
+
},
|
|
42271
|
+
className: styles$1.templateSummary
|
|
42272
|
+
}, /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
42273
|
+
label: "\u6A21\u677F\u540D\u79F0"
|
|
42274
|
+
}, selectedTemplate.templateName), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
42275
|
+
label: "\u6A21\u677F\u7C7B\u578B"
|
|
42276
|
+
}, selectedTemplate.visibility === 'PERSONAL' ? '个人模板' : '公共模板'), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
42277
|
+
label: "\u4E1A\u52A1\u529F\u80FD"
|
|
42278
|
+
}, documentName || selectedTemplate.businessFunctionCode || '-')), /*#__PURE__*/React$1.createElement("div", {
|
|
42279
|
+
className: styles$1.fieldPreview
|
|
42280
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
42281
|
+
className: styles$1.fieldPreviewHeader
|
|
42282
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42283
|
+
className: styles$1.fieldPreviewLabel
|
|
42284
|
+
}, "\u5B57\u6BB5\u9884\u89C8"), /*#__PURE__*/React$1.createElement("span", {
|
|
42285
|
+
className: styles$1.fieldCount
|
|
42286
|
+
}, previewFieldCount, " \u4E2A\u5B57\u6BB5")), /*#__PURE__*/React$1.createElement("div", {
|
|
42287
|
+
className: styles$1.fieldTags
|
|
42288
|
+
}, /*#__PURE__*/React$1.createElement(Spin, {
|
|
42289
|
+
spinning: fieldLoading
|
|
42290
|
+
}, /*#__PURE__*/React$1.createElement(Space, {
|
|
42291
|
+
size: [4, 0],
|
|
42292
|
+
wrap: true
|
|
42293
|
+
}, previewFieldNames.map(function (name) {
|
|
42294
|
+
return /*#__PURE__*/React$1.createElement(Tag, {
|
|
42295
|
+
className: styles$1.fieldTag,
|
|
42296
|
+
key: name
|
|
42297
|
+
}, name);
|
|
42298
|
+
}), !fieldLoading && previewFieldNames.length === 0 && (/*#__PURE__*/React$1.createElement("span", {
|
|
42299
|
+
className: styles$1.emptyFields
|
|
42300
|
+
}, "\u6682\u65E0\u5DF2\u6620\u5C04\u5B57\u6BB5"))))))))), /*#__PURE__*/React$1.createElement("section", {
|
|
42301
|
+
className: styles$1.section
|
|
42302
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
42303
|
+
className: styles$1.sectionHeader
|
|
42304
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42305
|
+
className: styles$1.sectionIndex
|
|
42306
|
+
}, "2"), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
42307
|
+
className: styles$1.sectionTitle
|
|
42308
|
+
}, "\u8BBE\u7F6E\u5BFC\u51FA\u53C2\u6570"), /*#__PURE__*/React$1.createElement("span", {
|
|
42309
|
+
className: styles$1.sectionDescription
|
|
42310
|
+
}, "\u786E\u8BA4\u5F53\u524D\u5BFC\u51FA\u8303\u56F4\u5E76\u9009\u62E9\u6587\u4EF6\u683C\u5F0F"))), /*#__PURE__*/React$1.createElement("div", {
|
|
42311
|
+
className: styles$1.scopeCard
|
|
42312
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42313
|
+
className: styles$1.scopeIcon
|
|
42314
|
+
}, /*#__PURE__*/React$1.createElement(FilterOutlined, null)), /*#__PURE__*/React$1.createElement("span", {
|
|
42315
|
+
className: styles$1.scopeContent
|
|
42316
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42317
|
+
className: styles$1.scopeTitle
|
|
42318
|
+
}, "\u5F53\u524D\u7B5B\u9009\u7ED3\u679C"), /*#__PURE__*/React$1.createElement("span", {
|
|
42319
|
+
className: styles$1.scopeDescription
|
|
42320
|
+
}, "\u7CFB\u7EDF\u5C06\u6309\u5217\u8868\u5F53\u524D\u67E5\u8BE2\u6761\u4EF6\u548C\u6240\u9009\u6A21\u677F\u5B57\u6BB5\u5BFC\u51FA")), /*#__PURE__*/React$1.createElement("span", {
|
|
42321
|
+
className: styles$1.resultCount
|
|
42322
|
+
}, resultCount == null ? '以查询结果为准' : "".concat(resultCount, " \u6761"))), /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
42323
|
+
label: "\u6587\u4EF6\u683C\u5F0F",
|
|
42324
|
+
style: {
|
|
42325
|
+
marginTop: 16,
|
|
42326
|
+
marginBottom: 0
|
|
42327
|
+
}
|
|
42328
|
+
}, /*#__PURE__*/React$1.createElement(Radio.Group, {
|
|
42329
|
+
className: styles$1.fileTypeGrid,
|
|
42330
|
+
value: fileType,
|
|
42331
|
+
onChange: function onChange(event) {
|
|
42332
|
+
return setFileType(event.target.value);
|
|
42333
|
+
}
|
|
42334
|
+
}, /*#__PURE__*/React$1.createElement(Radio, {
|
|
42335
|
+
className: styles$1.fileTypeOption,
|
|
42336
|
+
value: "XLSX"
|
|
42337
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42338
|
+
className: styles$1.fileTypeContent
|
|
42339
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42340
|
+
className: styles$1.fileTypeName
|
|
42341
|
+
}, "XLSX"), /*#__PURE__*/React$1.createElement("span", {
|
|
42342
|
+
className: styles$1.fileTypeDescription
|
|
42343
|
+
}, "\u4FDD\u7559\u8868\u683C\u683C\u5F0F\uFF0C\u9002\u5408\u67E5\u770B\u4E0E\u7F16\u8F91"))), /*#__PURE__*/React$1.createElement(Radio, {
|
|
42344
|
+
className: styles$1.fileTypeOption,
|
|
42345
|
+
value: "CSV"
|
|
42346
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42347
|
+
className: styles$1.fileTypeContent
|
|
42348
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42349
|
+
className: styles$1.fileTypeName
|
|
42350
|
+
}, "CSV"), /*#__PURE__*/React$1.createElement("span", {
|
|
42351
|
+
className: styles$1.fileTypeDescription
|
|
42352
|
+
}, "\u6587\u4EF6\u66F4\u8F7B\u91CF\uFF0C\u9002\u5408\u7CFB\u7EDF\u95F4\u4EA4\u6362"))))), /*#__PURE__*/React$1.createElement(Alert, {
|
|
42353
|
+
className: styles$1.exportAlert,
|
|
42354
|
+
type: resultCount === 0 ? 'warning' : 'info',
|
|
42355
|
+
showIcon: true,
|
|
42356
|
+
message: resultCount === 0 ? '当前查询结果为空,暂时无法创建导出任务。' : '创建后可在任务中心查看处理进度并下载导出文件。'
|
|
42357
|
+
})))));
|
|
42358
|
+
};
|
|
42359
|
+
|
|
42360
|
+
/**
|
|
42361
|
+
* 提供快速导出和按模板导出入口。
|
|
42362
|
+
*/
|
|
42363
|
+
var ExportButton = function ExportButton(_ref) {
|
|
42364
|
+
var _config$getResultCoun;
|
|
42365
|
+
var config = _ref.config,
|
|
42366
|
+
services = _ref.services,
|
|
42367
|
+
resolveRequestContext = _ref.resolveRequestContext,
|
|
42368
|
+
showQuickExport = _ref.showQuickExport,
|
|
42369
|
+
showTemplateExport = _ref.showTemplateExport,
|
|
42370
|
+
onTaskCreated = _ref.onTaskCreated;
|
|
42371
|
+
var _useState = useState(false),
|
|
42372
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42373
|
+
pickerVisible = _useState2[0],
|
|
42374
|
+
setPickerVisible = _useState2[1];
|
|
42375
|
+
var _useState3 = useState(false),
|
|
42376
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
42377
|
+
quickVisible = _useState4[0],
|
|
42378
|
+
setQuickVisible = _useState4[1];
|
|
42379
|
+
var _useState5 = useState(false),
|
|
42380
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
42381
|
+
exporting = _useState6[0],
|
|
42382
|
+
setExporting = _useState6[1];
|
|
42383
|
+
var _useState7 = useState(),
|
|
42384
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
42385
|
+
routeLoading = _useState8[0],
|
|
42386
|
+
setRouteLoading = _useState8[1];
|
|
42387
|
+
var _useState9 = useState(),
|
|
42388
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
42389
|
+
context = _useState0[0],
|
|
42390
|
+
setContext = _useState0[1];
|
|
42391
|
+
var _useState1 = useState('XLSX'),
|
|
42392
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
42393
|
+
quickFileType = _useState10[0],
|
|
42394
|
+
setQuickFileType = _useState10[1];
|
|
42395
|
+
var createTask = /*#__PURE__*/function () {
|
|
42396
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(currentContext, execute) {
|
|
42397
|
+
var data,
|
|
42398
|
+
fileType,
|
|
42399
|
+
response,
|
|
42400
|
+
task,
|
|
42401
|
+
_args = arguments,
|
|
42402
|
+
_t;
|
|
42403
|
+
return _regenerator().w(function (_context) {
|
|
42404
|
+
while (1) switch (_context.p = _context.n) {
|
|
42405
|
+
case 0:
|
|
42406
|
+
data = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
|
42407
|
+
fileType = _args.length > 3 && _args[3] !== undefined ? _args[3] : 'XLSX';
|
|
42408
|
+
setExporting(true);
|
|
42409
|
+
_context.p = 1;
|
|
42410
|
+
_context.n = 2;
|
|
42411
|
+
return execute(currentContext.serviceContext, _objectSpread2(_objectSpread2({
|
|
42412
|
+
businessFunctionCode: currentContext.businessFunctionCode,
|
|
42413
|
+
conditions: currentContext.conditions
|
|
42414
|
+
}, data), {}, {
|
|
42415
|
+
fileType: fileType
|
|
42416
|
+
}));
|
|
42417
|
+
case 2:
|
|
42418
|
+
response = _context.v;
|
|
42419
|
+
if (!isConcurrentLimit(response)) {
|
|
42420
|
+
_context.n = 3;
|
|
42421
|
+
break;
|
|
42422
|
+
}
|
|
42423
|
+
message$1.warning('当前导入导出任务较多,请稍后重试');
|
|
42424
|
+
return _context.a(2);
|
|
42425
|
+
case 3:
|
|
42426
|
+
task = normalizeTask(_objectSpread2(_objectSpread2({}, unwrapResponse(response)), {}, {
|
|
42427
|
+
taskType: 'EXPORT',
|
|
42428
|
+
taskStatus: 'PENDING',
|
|
42429
|
+
serviceContext: currentContext.serviceContext
|
|
42430
|
+
}));
|
|
42431
|
+
if (task === null || task === void 0 ? void 0 : task.taskId) {
|
|
42432
|
+
_context.n = 4;
|
|
42433
|
+
break;
|
|
42434
|
+
}
|
|
42435
|
+
throw new Error((task === null || task === void 0 ? void 0 : task.msg) || 'export taskId is missing');
|
|
42436
|
+
case 4:
|
|
42437
|
+
onTaskCreated(task);
|
|
42438
|
+
message$1.success('已创建导出任务');
|
|
42439
|
+
_context.n = 7;
|
|
42440
|
+
break;
|
|
42441
|
+
case 5:
|
|
42442
|
+
_context.p = 5;
|
|
42443
|
+
_t = _context.v;
|
|
42444
|
+
if (!isConcurrentLimit(_t)) {
|
|
42445
|
+
_context.n = 6;
|
|
42446
|
+
break;
|
|
42447
|
+
}
|
|
42448
|
+
message$1.warning('当前导入导出任务较多,请稍后重试');
|
|
42449
|
+
return _context.a(2);
|
|
42450
|
+
case 6:
|
|
42451
|
+
message$1.error('创建导出任务失败,请稍后重试');
|
|
42452
|
+
case 7:
|
|
42453
|
+
_context.p = 7;
|
|
42454
|
+
setExporting(false);
|
|
42455
|
+
return _context.f(7);
|
|
42456
|
+
case 8:
|
|
42457
|
+
return _context.a(2);
|
|
42458
|
+
}
|
|
42459
|
+
}, _callee, null, [[1, 5, 7, 8]]);
|
|
42460
|
+
}));
|
|
42461
|
+
return function createTask(_x, _x2) {
|
|
42462
|
+
return _ref2.apply(this, arguments);
|
|
42463
|
+
};
|
|
42464
|
+
}();
|
|
42465
|
+
var resultCount = (_config$getResultCoun = config.getResultCount) === null || _config$getResultCoun === void 0 ? void 0 : _config$getResultCoun.call(config);
|
|
42466
|
+
var submitQuickExport = /*#__PURE__*/function () {
|
|
42467
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
42468
|
+
return _regenerator().w(function (_context2) {
|
|
42469
|
+
while (1) switch (_context2.n) {
|
|
42470
|
+
case 0:
|
|
42471
|
+
if (context) {
|
|
42472
|
+
_context2.n = 1;
|
|
42473
|
+
break;
|
|
42474
|
+
}
|
|
42475
|
+
return _context2.a(2);
|
|
42476
|
+
case 1:
|
|
42477
|
+
if (!(resultCount === 0)) {
|
|
42478
|
+
_context2.n = 2;
|
|
42479
|
+
break;
|
|
42480
|
+
}
|
|
42481
|
+
message$1.warning('当前查询结果为空,不创建导出任务');
|
|
42482
|
+
return _context2.a(2);
|
|
42483
|
+
case 2:
|
|
42484
|
+
_context2.n = 3;
|
|
42485
|
+
return createTask(context, services.quickExport, {}, quickFileType);
|
|
42486
|
+
case 3:
|
|
42487
|
+
setQuickVisible(false);
|
|
42488
|
+
case 4:
|
|
42489
|
+
return _context2.a(2);
|
|
42490
|
+
}
|
|
42491
|
+
}, _callee2);
|
|
42492
|
+
}));
|
|
42493
|
+
return function submitQuickExport() {
|
|
42494
|
+
return _ref3.apply(this, arguments);
|
|
42495
|
+
};
|
|
42496
|
+
}();
|
|
42497
|
+
var openExport = /*#__PURE__*/function () {
|
|
42498
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(type) {
|
|
42499
|
+
var resolvedContext;
|
|
42500
|
+
return _regenerator().w(function (_context3) {
|
|
42501
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
42502
|
+
case 0:
|
|
42503
|
+
setRouteLoading(type);
|
|
42504
|
+
_context3.p = 1;
|
|
42505
|
+
_context3.n = 2;
|
|
42506
|
+
return resolveRequestContext();
|
|
42507
|
+
case 2:
|
|
42508
|
+
resolvedContext = _context3.v;
|
|
42509
|
+
if (resolvedContext) {
|
|
42510
|
+
_context3.n = 3;
|
|
42511
|
+
break;
|
|
42512
|
+
}
|
|
42513
|
+
return _context3.a(2);
|
|
42514
|
+
case 3:
|
|
42515
|
+
setContext(resolvedContext);
|
|
42516
|
+
if (type === 'QUICK') {
|
|
42517
|
+
setQuickVisible(true);
|
|
42518
|
+
} else {
|
|
42519
|
+
setPickerVisible(true);
|
|
42520
|
+
}
|
|
42521
|
+
case 4:
|
|
42522
|
+
_context3.p = 4;
|
|
42523
|
+
setRouteLoading(undefined);
|
|
42524
|
+
return _context3.f(4);
|
|
42525
|
+
case 5:
|
|
42526
|
+
return _context3.a(2);
|
|
42527
|
+
}
|
|
42528
|
+
}, _callee3, null, [[1,, 4, 5]]);
|
|
42529
|
+
}));
|
|
42530
|
+
return function openExport(_x3) {
|
|
42531
|
+
return _ref4.apply(this, arguments);
|
|
42532
|
+
};
|
|
42533
|
+
}();
|
|
42534
|
+
var quickExportModal = /*#__PURE__*/React$1.createElement(Modal, {
|
|
42535
|
+
width: 560,
|
|
42536
|
+
title: /*#__PURE__*/React$1.createElement(ModalTitle, {
|
|
42537
|
+
icon: /*#__PURE__*/React$1.createElement(ExportOutlined, null),
|
|
42538
|
+
title: "".concat(config.documentName, "\u5FEB\u901F\u5BFC\u51FA"),
|
|
42539
|
+
description: "\u4F7F\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u5B57\u6BB5\u5BFC\u51FA\u5F53\u524D\u7B5B\u9009\u7ED3\u679C"
|
|
42540
|
+
}),
|
|
42541
|
+
visible: quickVisible,
|
|
42542
|
+
onCancel: function onCancel() {
|
|
42543
|
+
return setQuickVisible(false);
|
|
42544
|
+
},
|
|
42545
|
+
onOk: submitQuickExport,
|
|
42546
|
+
confirmLoading: exporting,
|
|
42547
|
+
okText: "\u521B\u5EFA\u5BFC\u51FA\u4EFB\u52A1",
|
|
42548
|
+
cancelText: "\u53D6\u6D88",
|
|
42549
|
+
okButtonProps: {
|
|
42550
|
+
disabled: resultCount === 0,
|
|
42551
|
+
icon: /*#__PURE__*/React$1.createElement(ExportOutlined, null)
|
|
42552
|
+
},
|
|
42553
|
+
wrapClassName: styles$1.exportModal,
|
|
42554
|
+
destroyOnClose: true
|
|
42555
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
42556
|
+
className: styles$1.dialogBody
|
|
42557
|
+
}, /*#__PURE__*/React$1.createElement("section", {
|
|
42558
|
+
className: styles$1.section
|
|
42559
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
42560
|
+
className: styles$1.sectionHeader
|
|
42561
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42562
|
+
className: styles$1.sectionIndex
|
|
42563
|
+
}, "1"), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
42564
|
+
className: styles$1.sectionTitle
|
|
42565
|
+
}, "\u786E\u8BA4\u5BFC\u51FA\u8303\u56F4"), /*#__PURE__*/React$1.createElement("span", {
|
|
42566
|
+
className: styles$1.sectionDescription
|
|
42567
|
+
}, "\u5BFC\u51FA\u5185\u5BB9\u4E0E\u5F53\u524D\u5217\u8868\u7684\u67E5\u8BE2\u6761\u4EF6\u4FDD\u6301\u4E00\u81F4"))), /*#__PURE__*/React$1.createElement("div", {
|
|
42568
|
+
className: styles$1.scopeCard
|
|
42569
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42570
|
+
className: styles$1.scopeIcon
|
|
42571
|
+
}, /*#__PURE__*/React$1.createElement(FilterOutlined, null)), /*#__PURE__*/React$1.createElement("span", {
|
|
42572
|
+
className: styles$1.scopeContent
|
|
42573
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42574
|
+
className: styles$1.scopeTitle
|
|
42575
|
+
}, "\u5F53\u524D\u7B5B\u9009\u7ED3\u679C"), /*#__PURE__*/React$1.createElement("span", {
|
|
42576
|
+
className: styles$1.scopeDescription
|
|
42577
|
+
}, "\u7CFB\u7EDF\u5C06\u6309\u5217\u8868\u5F53\u524D\u67E5\u8BE2\u6761\u4EF6\u751F\u6210\u5BFC\u51FA\u6587\u4EF6")), /*#__PURE__*/React$1.createElement("span", {
|
|
42578
|
+
className: styles$1.resultCount
|
|
42579
|
+
}, resultCount == null ? '以查询结果为准' : "".concat(resultCount, " \u6761")))), /*#__PURE__*/React$1.createElement("section", {
|
|
42580
|
+
className: styles$1.section
|
|
42581
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
42582
|
+
className: styles$1.sectionHeader
|
|
42583
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42584
|
+
className: styles$1.sectionIndex
|
|
42585
|
+
}, "2"), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
42586
|
+
className: styles$1.sectionTitle
|
|
42587
|
+
}, "\u9009\u62E9\u6587\u4EF6\u683C\u5F0F"), /*#__PURE__*/React$1.createElement("span", {
|
|
42588
|
+
className: styles$1.sectionDescription
|
|
42589
|
+
}, "\u6839\u636E\u540E\u7EED\u4F7F\u7528\u573A\u666F\u9009\u62E9\u5408\u9002\u7684\u6587\u4EF6\u7C7B\u578B"))), /*#__PURE__*/React$1.createElement(Radio.Group, {
|
|
42590
|
+
className: styles$1.fileTypeGrid,
|
|
42591
|
+
value: quickFileType,
|
|
42592
|
+
onChange: function onChange(event) {
|
|
42593
|
+
return setQuickFileType(event.target.value);
|
|
42594
|
+
}
|
|
42595
|
+
}, /*#__PURE__*/React$1.createElement(Radio, {
|
|
42596
|
+
className: styles$1.fileTypeOption,
|
|
42597
|
+
value: "XLSX"
|
|
42598
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42599
|
+
className: styles$1.fileTypeContent
|
|
42600
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42601
|
+
className: styles$1.fileTypeName
|
|
42602
|
+
}, "XLSX"), /*#__PURE__*/React$1.createElement("span", {
|
|
42603
|
+
className: styles$1.fileTypeDescription
|
|
42604
|
+
}, "\u4FDD\u7559\u8868\u683C\u683C\u5F0F\uFF0C\u9002\u5408\u67E5\u770B\u4E0E\u7F16\u8F91"))), /*#__PURE__*/React$1.createElement(Radio, {
|
|
42605
|
+
className: styles$1.fileTypeOption,
|
|
42606
|
+
value: "CSV"
|
|
42607
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42608
|
+
className: styles$1.fileTypeContent
|
|
42609
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42610
|
+
className: styles$1.fileTypeName
|
|
42611
|
+
}, "CSV"), /*#__PURE__*/React$1.createElement("span", {
|
|
42612
|
+
className: styles$1.fileTypeDescription
|
|
42613
|
+
}, "\u6587\u4EF6\u66F4\u8F7B\u91CF\uFF0C\u9002\u5408\u7CFB\u7EDF\u95F4\u4EA4\u6362")))), /*#__PURE__*/React$1.createElement(Alert, {
|
|
42614
|
+
className: styles$1.exportAlert,
|
|
42615
|
+
type: resultCount === 0 ? 'warning' : 'info',
|
|
42616
|
+
showIcon: true,
|
|
42617
|
+
message: resultCount === 0 ? '当前查询结果为空,暂时无法创建导出任务。' : '快速导出使用系统默认字段;创建后可在任务中心查看进度并下载文件。'
|
|
42618
|
+
}))));
|
|
42619
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, (showQuickExport || showTemplateExport) && (/*#__PURE__*/React$1.createElement(Dropdown, {
|
|
42620
|
+
trigger: ['hover', 'click'],
|
|
42621
|
+
overlay: /*#__PURE__*/React$1.createElement(Menu, null, showQuickExport && (/*#__PURE__*/React$1.createElement(Menu.Item, {
|
|
42622
|
+
key: "quick",
|
|
42623
|
+
onClick: function onClick() {
|
|
42624
|
+
return openExport('QUICK');
|
|
42625
|
+
}
|
|
42626
|
+
}, "\u5FEB\u901F\u5BFC\u51FA")), showTemplateExport && (/*#__PURE__*/React$1.createElement(Menu.Item, {
|
|
42627
|
+
key: "template",
|
|
42628
|
+
onClick: function onClick() {
|
|
42629
|
+
return openExport('TEMPLATE');
|
|
42630
|
+
}
|
|
42631
|
+
}, "\u6309\u6A21\u677F\u5BFC\u51FA")))
|
|
42632
|
+
}, /*#__PURE__*/React$1.createElement(Button, {
|
|
42633
|
+
loading: exporting || Boolean(routeLoading)
|
|
42634
|
+
}, "\u5BFC\u51FA ", /*#__PURE__*/React$1.createElement(DownOutlined, null)))), context && (/*#__PURE__*/React$1.createElement(TemplatePicker, {
|
|
42635
|
+
visible: pickerVisible,
|
|
42636
|
+
context: context,
|
|
42637
|
+
services: services,
|
|
42638
|
+
onCancel: function onCancel() {
|
|
42639
|
+
return setPickerVisible(false);
|
|
42640
|
+
},
|
|
42641
|
+
onConfirm: function () {
|
|
42642
|
+
var _onConfirm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(templateCode, fileType) {
|
|
42643
|
+
return _regenerator().w(function (_context4) {
|
|
42644
|
+
while (1) switch (_context4.n) {
|
|
42645
|
+
case 0:
|
|
42646
|
+
if (context) {
|
|
42647
|
+
_context4.n = 1;
|
|
42648
|
+
break;
|
|
42649
|
+
}
|
|
42650
|
+
return _context4.a(2);
|
|
42651
|
+
case 1:
|
|
42652
|
+
setPickerVisible(false);
|
|
42653
|
+
_context4.n = 2;
|
|
42654
|
+
return createTask(context, services.templateExport, {
|
|
42655
|
+
templateCode: templateCode
|
|
42656
|
+
}, fileType);
|
|
42657
|
+
case 2:
|
|
42658
|
+
return _context4.a(2);
|
|
42659
|
+
}
|
|
42660
|
+
}, _callee4);
|
|
42661
|
+
}));
|
|
42662
|
+
function onConfirm(_x4, _x5) {
|
|
42663
|
+
return _onConfirm.apply(this, arguments);
|
|
42664
|
+
}
|
|
42665
|
+
return onConfirm;
|
|
42666
|
+
}(),
|
|
42667
|
+
documentName: config.documentName,
|
|
42668
|
+
resultCount: resultCount
|
|
42669
|
+
})), quickExportModal);
|
|
42670
|
+
};
|
|
42671
|
+
|
|
42672
|
+
var css_248z$C = ".index-module_importModal__1JaEc .ant-modal {\n top: 32px;\n max-width: calc(100vw - 32px);\n padding-bottom: 24px;\n}\n.index-module_importModal__1JaEc .ant-modal-content {\n overflow: hidden;\n border-radius: 8px;\n box-shadow: 0 12px 40px rgba(31, 35, 41, 0.18);\n}\n.index-module_importModal__1JaEc .ant-modal-header {\n padding: 18px 24px;\n border-bottom-color: #eef0f3;\n}\n.index-module_importModal__1JaEc .ant-modal-body {\n max-height: calc(100vh - 196px);\n padding: 0;\n overflow-y: auto;\n background: #f7f8fa;\n}\n.index-module_importModal__1JaEc .ant-modal-footer {\n padding: 14px 24px;\n border-top-color: #eef0f3;\n}\n.index-module_importModal__1JaEc .ant-modal-close-x {\n height: 76px;\n line-height: 76px;\n}\n.index-module_modalTitle__3d39a {\n display: flex;\n align-items: center;\n min-height: 40px;\n}\n.index-module_modalTitleIcon__2AtL9 {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n margin-right: 12px;\n color: #1677ff;\n font-size: 20px;\n background: #eaf3ff;\n border-radius: 8px;\n}\n.index-module_modalTitleText__2UW-U,\n.index-module_modalTitleDescription__1Qcq4,\n.index-module_sectionTitle__qZI6w,\n.index-module_sectionDescription__3E7Zk {\n display: block;\n}\n.index-module_modalTitleText__2UW-U {\n color: #1f2329;\n font-weight: 600;\n font-size: 16px;\n line-height: 22px;\n}\n.index-module_modalTitleDescription__1Qcq4 {\n margin-top: 2px;\n color: #8f959e;\n font-weight: 400;\n font-size: 12px;\n line-height: 18px;\n}\n.index-module_stepsPanel__MuG00 {\n padding: 18px 112px;\n background: #fff;\n border-bottom: 1px solid #eef0f3;\n}\n.index-module_form__bTCme {\n padding: 16px 24px 24px;\n}\n.index-module_section__BJBpD {\n margin-bottom: 16px;\n padding: 18px 20px;\n background: #fff;\n border: 1px solid #e8eaed;\n border-radius: 8px;\n}\n.index-module_sectionHeader__1h2gs {\n display: flex;\n align-items: flex-start;\n margin-bottom: 16px;\n}\n.index-module_sectionIndex__24-YU {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n margin-right: 10px;\n color: #1677ff;\n font-weight: 600;\n font-size: 13px;\n background: #eaf3ff;\n border-radius: 50%;\n}\n.index-module_sectionTitle__qZI6w {\n color: #1f2329;\n font-weight: 600;\n font-size: 15px;\n line-height: 22px;\n}\n.index-module_sectionDescription__3E7Zk {\n margin-top: 2px;\n color: #8f959e;\n font-size: 12px;\n line-height: 18px;\n}\n.index-module_templateRow__rfmnk {\n display: flex;\n align-items: flex-end;\n}\n.index-module_templateField__1_mqV {\n flex: 1;\n margin-bottom: 12px;\n}\n.index-module_downloadButton__2qPVb {\n flex: 0 0 auto;\n margin-bottom: 12px;\n margin-left: 12px;\n}\n.index-module_templateSummary__2r3lb .ant-descriptions-item-label {\n color: #646a73;\n background: #f7f8fa;\n}\n.index-module_templateSummary__2r3lb .ant-descriptions-item-content {\n color: #1f2329;\n}\n.index-module_settingGrid__eJkC9 {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 12px;\n}\n.index-module_settingItem__3WPVC {\n min-width: 0;\n margin-bottom: 0;\n padding: 14px 16px;\n background: #f7f8fa;\n border-radius: 6px;\n}\n.index-module_settingItem__3WPVC .ant-form-item-label {\n padding-bottom: 10px;\n font-weight: 500;\n}\n.index-module_radioGroup__2Jr25 {\n display: flex;\n flex-wrap: wrap;\n gap: 10px 16px;\n}\n.index-module_radioGroup__2Jr25 .ant-radio-wrapper {\n margin-right: 0;\n}\n.index-module_uploadSection__14gcF {\n margin-bottom: 0;\n}\n.index-module_uploadDragger__1WiN- .ant-upload.ant-upload-drag {\n min-height: 156px;\n background: #fbfcfd;\n border-color: #c9cdd4;\n border-radius: 8px;\n}\n.index-module_uploadDragger__1WiN- .ant-upload.ant-upload-drag:hover {\n background: #f5f9ff;\n border-color: #1677ff;\n}\n.index-module_uploadDragger__1WiN- .ant-upload.ant-upload-drag .ant-upload {\n padding: 24px;\n}\n.index-module_uploadDragger__1WiN- .ant-upload-drag-icon {\n margin-bottom: 8px;\n}\n.index-module_uploadDragger__1WiN- .ant-upload-drag-icon .anticon {\n color: #1677ff;\n font-size: 42px;\n}\n.index-module_uploadDragger__1WiN- .ant-upload-text {\n margin-bottom: 4px;\n color: #1f2329;\n font-weight: 500;\n font-size: 14px;\n}\n.index-module_uploadDragger__1WiN- .ant-upload-hint {\n color: #8f959e;\n font-size: 12px;\n}\n.index-module_uploadDragger__1WiN- .ant-upload-list-item {\n margin-top: 10px;\n}\n.index-module_uploadAlert__3cAKI {\n margin-top: 12px;\n border-color: #d9e8ff;\n border-radius: 6px;\n}\n.index-module_progressPanel__q541a {\n margin-top: 14px;\n padding: 12px 14px 8px;\n background: #f7f8fa;\n border-radius: 6px;\n}\n.index-module_progressTitle__2LZCd {\n margin-bottom: 6px;\n color: #646a73;\n font-size: 13px;\n}\n.index-module_formFooter__gpQVO {\n position: sticky;\n bottom: 0;\n z-index: 1;\n display: flex;\n justify-content: flex-end;\n margin: 16px -24px 0;\n padding: 14px 24px;\n background: #fff;\n border-top: 1px solid #eef0f3;\n gap: 8px;\n}\n.index-module_preview__31wWm {\n padding: 16px 24px 0;\n}\n.index-module_previewCard__1yjnj {\n min-height: 280px;\n padding: 18px 20px;\n background: #fff;\n border: 1px solid #e8eaed;\n border-radius: 8px;\n}\n.index-module_previewSummary__1ZXyN .ant-descriptions-item-label {\n color: #646a73;\n background: #f7f8fa;\n}\n.index-module_previewSummary__1ZXyN .ant-descriptions-item-content {\n color: #1f2329;\n font-weight: 500;\n}\n.index-module_previewAlert__1Iy7j,\n.index-module_previewTable__Jn5wH {\n margin-top: 12px;\n}\n.index-module_previewFooter__3kH-h {\n justify-content: space-between;\n}\n@media (max-width: 768px) {\n .index-module_stepsPanel__MuG00 {\n padding: 16px 32px;\n }\n .index-module_form__bTCme {\n padding-right: 16px;\n padding-left: 16px;\n }\n .index-module_preview__31wWm {\n padding-right: 16px;\n padding-left: 16px;\n }\n .index-module_section__BJBpD {\n padding: 16px;\n }\n .index-module_settingGrid__eJkC9 {\n grid-template-columns: 1fr;\n }\n .index-module_formFooter__gpQVO {\n margin-right: -16px;\n margin-left: -16px;\n padding-right: 16px;\n padding-left: 16px;\n }\n}\n@media (max-width: 576px) {\n .index-module_modalTitleDescription__1Qcq4 {\n display: none;\n }\n .index-module_stepsPanel__MuG00 {\n padding: 14px 20px;\n }\n .index-module_templateRow__rfmnk {\n display: block;\n }\n .index-module_downloadButton__2qPVb {\n margin-top: 0;\n margin-bottom: 12px;\n margin-left: 0;\n }\n}\n";
|
|
42673
|
+
var styles$2 = {"importModal":"index-module_importModal__1JaEc","modalTitle":"index-module_modalTitle__3d39a","modalTitleIcon":"index-module_modalTitleIcon__2AtL9","modalTitleText":"index-module_modalTitleText__2UW-U","modalTitleDescription":"index-module_modalTitleDescription__1Qcq4","sectionTitle":"index-module_sectionTitle__qZI6w","sectionDescription":"index-module_sectionDescription__3E7Zk","stepsPanel":"index-module_stepsPanel__MuG00","form":"index-module_form__bTCme","section":"index-module_section__BJBpD","sectionHeader":"index-module_sectionHeader__1h2gs","sectionIndex":"index-module_sectionIndex__24-YU","templateRow":"index-module_templateRow__rfmnk","templateField":"index-module_templateField__1_mqV","downloadButton":"index-module_downloadButton__2qPVb","templateSummary":"index-module_templateSummary__2r3lb","settingGrid":"index-module_settingGrid__eJkC9","settingItem":"index-module_settingItem__3WPVC","radioGroup":"index-module_radioGroup__2Jr25","uploadSection":"index-module_uploadSection__14gcF","uploadDragger":"index-module_uploadDragger__1WiN-","uploadAlert":"index-module_uploadAlert__3cAKI","progressPanel":"index-module_progressPanel__q541a","progressTitle":"index-module_progressTitle__2LZCd","formFooter":"index-module_formFooter__gpQVO","preview":"index-module_preview__31wWm","previewCard":"index-module_previewCard__1yjnj","previewSummary":"index-module_previewSummary__1ZXyN","previewAlert":"index-module_previewAlert__1Iy7j","previewTable":"index-module_previewTable__Jn5wH","previewFooter":"index-module_previewFooter__3kH-h"};
|
|
42674
|
+
styleInject(css_248z$C);
|
|
42675
|
+
|
|
42676
|
+
var Preview = function Preview(_ref) {
|
|
42677
|
+
var _preview$totalCount, _preview$failedCount, _preview$categoryCoun;
|
|
42678
|
+
var preview = _ref.preview,
|
|
42679
|
+
onBack = _ref.onBack,
|
|
42680
|
+
onExecute = _ref.onExecute,
|
|
42681
|
+
onDownloadErrorFile = _ref.onDownloadErrorFile,
|
|
42682
|
+
executing = _ref.executing,
|
|
42683
|
+
downloadingErrorFile = _ref.downloadingErrorFile;
|
|
42684
|
+
var errorTypes = Array.isArray(preview === null || preview === void 0 ? void 0 : preview.errorCategories) ? preview.errorCategories : [];
|
|
42685
|
+
var totalCount = Number((_preview$totalCount = preview === null || preview === void 0 ? void 0 : preview.totalCount) !== null && _preview$totalCount !== void 0 ? _preview$totalCount : 0);
|
|
42686
|
+
var failedCount = Number((_preview$failedCount = preview === null || preview === void 0 ? void 0 : preview.failedCount) !== null && _preview$failedCount !== void 0 ? _preview$failedCount : 0);
|
|
42687
|
+
var errorTypeCount = Number((_preview$categoryCoun = preview === null || preview === void 0 ? void 0 : preview.categoryCount) !== null && _preview$categoryCoun !== void 0 ? _preview$categoryCoun : errorTypes.length);
|
|
42688
|
+
var hasErrors = failedCount > 0;
|
|
42689
|
+
var canExecute = (preview === null || preview === void 0 ? void 0 : preview.canExecute) === true;
|
|
42690
|
+
var errorFileAvailable = (preview === null || preview === void 0 ? void 0 : preview.errorFileAvailable) === true;
|
|
42691
|
+
var handleExecute = function handleExecute() {
|
|
42692
|
+
if (hasErrors && canExecute) {
|
|
42693
|
+
Modal.confirm({
|
|
42694
|
+
title: '确认导入合格业务单据?',
|
|
42695
|
+
content: '异常所属业务单据将整单跳过,仅导入其余合格业务单据。',
|
|
42696
|
+
okText: '确认导入',
|
|
42697
|
+
cancelText: '取消',
|
|
42698
|
+
onOk: onExecute
|
|
42699
|
+
});
|
|
42700
|
+
return;
|
|
42701
|
+
}
|
|
42702
|
+
onExecute();
|
|
42703
|
+
};
|
|
42704
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
42705
|
+
className: styles$2.preview
|
|
42706
|
+
}, /*#__PURE__*/React$1.createElement("section", {
|
|
42707
|
+
className: styles$2.previewCard
|
|
42708
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
42709
|
+
className: styles$2.sectionHeader
|
|
42710
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
42711
|
+
className: styles$2.sectionIndex
|
|
42712
|
+
}, /*#__PURE__*/React$1.createElement(CheckOutlined, null)), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
42713
|
+
className: styles$2.sectionTitle
|
|
42714
|
+
}, "\u6570\u636E\u6821\u9A8C\u7ED3\u679C"), /*#__PURE__*/React$1.createElement("span", {
|
|
42715
|
+
className: styles$2.sectionDescription
|
|
42716
|
+
}, "\u8BF7\u786E\u8BA4\u6821\u9A8C\u7ED3\u679C\u540E\u518D\u6267\u884C\u6B63\u5F0F\u5BFC\u5165"))), /*#__PURE__*/React$1.createElement(Descriptions, {
|
|
42717
|
+
bordered: true,
|
|
42718
|
+
size: "small",
|
|
42719
|
+
column: {
|
|
42720
|
+
xs: 1,
|
|
42721
|
+
sm: 3
|
|
42722
|
+
},
|
|
42723
|
+
className: styles$2.previewSummary
|
|
42724
|
+
}, /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
42725
|
+
label: "\u603B\u660E\u7EC6\u6570"
|
|
42726
|
+
}, totalCount), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
42727
|
+
label: "\u5F02\u5E38\u660E\u7EC6\u6570"
|
|
42728
|
+
}, failedCount), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
42729
|
+
label: "\u9519\u8BEF\u7C7B\u578B\u6570"
|
|
42730
|
+
}, errorTypeCount)), hasErrors && (/*#__PURE__*/React$1.createElement(Alert, {
|
|
42731
|
+
className: styles$2.previewAlert,
|
|
42732
|
+
type: "warning",
|
|
42733
|
+
showIcon: true,
|
|
42734
|
+
message: "\u5B58\u5728 ".concat(failedCount, " \u6761\u5F02\u5E38\u660E\u7EC6"),
|
|
42735
|
+
description: canExecute ? '异常所属业务单据将整单阻断,其余合格业务单据可继续导入。' : '当前没有可执行的合格业务单据,请下载错误文件并重新上传校验。'
|
|
42736
|
+
})), errorTypes.length > 0 && (/*#__PURE__*/React$1.createElement(Table, {
|
|
42737
|
+
className: styles$2.previewTable,
|
|
42738
|
+
rowKey: "reason",
|
|
42739
|
+
size: "small",
|
|
42740
|
+
pagination: false,
|
|
42741
|
+
dataSource: errorTypes,
|
|
42742
|
+
columns: [{
|
|
42743
|
+
title: '错误原因',
|
|
42744
|
+
dataIndex: 'reason'
|
|
42745
|
+
}, {
|
|
42746
|
+
title: '异常明细数',
|
|
42747
|
+
dataIndex: 'count',
|
|
42748
|
+
width: 120
|
|
42749
|
+
}]
|
|
42750
|
+
}))), /*#__PURE__*/React$1.createElement("div", {
|
|
42751
|
+
className: "".concat(styles$2.formFooter, " ").concat(styles$2.previewFooter)
|
|
42752
|
+
}, /*#__PURE__*/React$1.createElement("div", null, errorFileAvailable && (/*#__PURE__*/React$1.createElement(Button, {
|
|
42753
|
+
loading: downloadingErrorFile,
|
|
42754
|
+
onClick: onDownloadErrorFile
|
|
42755
|
+
}, "\u4E0B\u8F7D\u9519\u8BEF\u6587\u4EF6"))), /*#__PURE__*/React$1.createElement(Space, null, /*#__PURE__*/React$1.createElement(Button, {
|
|
42756
|
+
onClick: onBack
|
|
42757
|
+
}, "\u4E0A\u4E00\u6B65"), /*#__PURE__*/React$1.createElement(Button, {
|
|
42758
|
+
type: "primary",
|
|
42759
|
+
loading: executing,
|
|
42760
|
+
disabled: !canExecute,
|
|
42761
|
+
onClick: handleExecute
|
|
42762
|
+
}, "\u5F00\u59CB\u5BFC\u5165"))));
|
|
42763
|
+
};
|
|
42764
|
+
|
|
42765
|
+
var POLL_INTERVAL_MS = 1000;
|
|
42766
|
+
var MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
42767
|
+
var PREFERENCE_KEY = 'import-export:last-import-preference';
|
|
42768
|
+
var SUPPORTED_ERROR_HANDLING_MODE = 'PARTIAL_SUCCESS';
|
|
42769
|
+
var PREVIEW_EXPIRED_MESSAGE = '校验结果已过期,请重新上传并校验';
|
|
42770
|
+
var PREVIEW_CONSUMED_MESSAGE = '校验结果已执行或正在执行,请勿重复提交';
|
|
42771
|
+
var wait = function wait() {
|
|
42772
|
+
return new Promise(function (resolve) {
|
|
42773
|
+
return setTimeout(resolve, POLL_INTERVAL_MS);
|
|
42774
|
+
});
|
|
42775
|
+
};
|
|
42776
|
+
var operationErrorMessages = function operationErrorMessages(error) {
|
|
42777
|
+
var _error$data, _error$data2, _error$response, _error$response$data, _error$response2, _error$response2$data;
|
|
42778
|
+
return [error === null || error === void 0 ? void 0 : error.message, error === null || error === void 0 ? void 0 : error.msg, error === null || error === void 0 ? void 0 : (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message, error === null || error === void 0 ? void 0 : (_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.msg, error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message, error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : _error$response2$data.msg].filter(Boolean).map(String);
|
|
42779
|
+
};
|
|
42780
|
+
var isPreviewExpiredError = function isPreviewExpiredError(error) {
|
|
42781
|
+
return operationErrorMessages(error).some(function (text) {
|
|
42782
|
+
return text.includes(PREVIEW_EXPIRED_MESSAGE);
|
|
42783
|
+
});
|
|
42784
|
+
};
|
|
42785
|
+
var isPreviewConsumedError = function isPreviewConsumedError(error) {
|
|
42786
|
+
return operationErrorMessages(error).some(function (text) {
|
|
42787
|
+
return text.includes('已执行或正在执行') || text.includes('请勿重复提交');
|
|
42788
|
+
});
|
|
42789
|
+
};
|
|
42790
|
+
/**
|
|
42791
|
+
* 完成模板选择、文件上传、数据校验和正式导入的两步向导。
|
|
42792
|
+
*/
|
|
42793
|
+
var ImportWizard = function ImportWizard(_ref) {
|
|
42794
|
+
var _selectedTemplate$fie, _selectedTemplate$fie2;
|
|
42795
|
+
var visible = _ref.visible,
|
|
42796
|
+
context = _ref.context,
|
|
42797
|
+
documentName = _ref.documentName,
|
|
42798
|
+
services = _ref.services,
|
|
42799
|
+
onClose = _ref.onClose,
|
|
42800
|
+
onTaskCreated = _ref.onTaskCreated;
|
|
42801
|
+
var _Form$useForm = Form.useForm(),
|
|
42802
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
42803
|
+
form = _Form$useForm2[0];
|
|
42804
|
+
var _useState = useState(0),
|
|
42805
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42806
|
+
step = _useState2[0],
|
|
42807
|
+
setStep = _useState2[1];
|
|
42808
|
+
var _useState3 = useState(false),
|
|
42809
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
42810
|
+
parsing = _useState4[0],
|
|
42811
|
+
setParsing = _useState4[1];
|
|
42812
|
+
var _useState5 = useState(),
|
|
42813
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
42814
|
+
preview = _useState6[0],
|
|
42815
|
+
setPreview = _useState6[1];
|
|
42816
|
+
var _useState7 = useState(false),
|
|
42817
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
42818
|
+
executing = _useState8[0],
|
|
42819
|
+
setExecuting = _useState8[1];
|
|
42820
|
+
var _useState9 = useState([]),
|
|
42821
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
42822
|
+
templates = _useState0[0],
|
|
42823
|
+
setTemplates = _useState0[1];
|
|
42824
|
+
var _useState1 = useState(false),
|
|
42825
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
42826
|
+
downloading = _useState10[0],
|
|
42827
|
+
setDownloading = _useState10[1];
|
|
42828
|
+
var _useState11 = useState(false),
|
|
42829
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
42830
|
+
downloadingErrorFile = _useState12[0],
|
|
42831
|
+
setDownloadingErrorFile = _useState12[1];
|
|
42832
|
+
var _useState13 = useState(),
|
|
42833
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
42834
|
+
selectedTemplateCode = _useState14[0],
|
|
42835
|
+
setSelectedTemplateCode = _useState14[1];
|
|
42836
|
+
var _useState15 = useState(),
|
|
42837
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
42838
|
+
selectedFile = _useState16[0],
|
|
42839
|
+
setSelectedFile = _useState16[1];
|
|
42840
|
+
var _useState17 = useState(''),
|
|
42841
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
42842
|
+
fileName = _useState18[0],
|
|
42843
|
+
setFileName = _useState18[1];
|
|
42844
|
+
useEffect(function () {
|
|
42845
|
+
if (!visible) return;
|
|
42846
|
+
setStep(0);
|
|
42847
|
+
setPreview(undefined);
|
|
42848
|
+
setSelectedTemplateCode(undefined);
|
|
42849
|
+
setSelectedFile(undefined);
|
|
42850
|
+
setFileName('');
|
|
42851
|
+
setExecuting(false);
|
|
42852
|
+
setDownloadingErrorFile(false);
|
|
42853
|
+
var preference = {};
|
|
42854
|
+
try {
|
|
42855
|
+
preference = JSON.parse(localStorage.getItem(PREFERENCE_KEY) || '{}');
|
|
42856
|
+
} catch (error) {
|
|
42857
|
+
preference = {};
|
|
42858
|
+
}
|
|
42859
|
+
form.setFieldsValue({
|
|
42860
|
+
strategy: preference.strategy || 'UPSERT',
|
|
42861
|
+
errorHandlingMode: SUPPORTED_ERROR_HANDLING_MODE
|
|
42862
|
+
});
|
|
42863
|
+
services.queryTemplates({
|
|
42864
|
+
operationType: 'IMPORT',
|
|
42865
|
+
businessFunctionCode: context.businessFunctionCode,
|
|
42866
|
+
enabled: true,
|
|
42867
|
+
currentPage: 1,
|
|
42868
|
+
pageSize: 100
|
|
42869
|
+
}).then(function (response) {
|
|
42870
|
+
var loaded = getItems(response);
|
|
42871
|
+
setTemplates(loaded);
|
|
42872
|
+
var defaultTemplate = loaded.find(function (template) {
|
|
42873
|
+
return template.defaultFlag && template.enabled !== false;
|
|
42874
|
+
});
|
|
42875
|
+
if (!defaultTemplate) {
|
|
42876
|
+
message$1.error('当前业务功能未配置启用的默认导入模板');
|
|
42877
|
+
return;
|
|
42878
|
+
}
|
|
42879
|
+
setSelectedTemplateCode(defaultTemplate.templateCode);
|
|
42880
|
+
form.setFieldsValue({
|
|
42881
|
+
templateCode: defaultTemplate.templateCode
|
|
42882
|
+
});
|
|
42883
|
+
}).catch(function () {
|
|
42884
|
+
return message$1.error('导入模板加载失败,请稍后重试');
|
|
42885
|
+
});
|
|
42886
|
+
}, [visible, context.businessFunctionCode, form, services]);
|
|
42887
|
+
var expirePreview = useCallback(function () {
|
|
42888
|
+
setPreview(undefined);
|
|
42889
|
+
setStep(0);
|
|
42890
|
+
setSelectedFile(undefined);
|
|
42891
|
+
setFileName('');
|
|
42892
|
+
setExecuting(false);
|
|
42893
|
+
setDownloadingErrorFile(false);
|
|
42894
|
+
message$1.warning(PREVIEW_EXPIRED_MESSAGE);
|
|
42895
|
+
}, []);
|
|
42896
|
+
useEffect(function () {
|
|
42897
|
+
if (!visible || step !== 1) return undefined;
|
|
42898
|
+
var expiresAt = Number(preview === null || preview === void 0 ? void 0 : preview.expiresAt);
|
|
42899
|
+
if (!Number.isFinite(expiresAt) || expiresAt <= 0) return undefined;
|
|
42900
|
+
var remaining = expiresAt - Date.now();
|
|
42901
|
+
if (remaining <= 0) {
|
|
42902
|
+
expirePreview();
|
|
42903
|
+
return undefined;
|
|
42904
|
+
}
|
|
42905
|
+
var timer = window.setTimeout(expirePreview, remaining);
|
|
42906
|
+
return function () {
|
|
42907
|
+
return window.clearTimeout(timer);
|
|
42908
|
+
};
|
|
42909
|
+
}, [visible, step, preview === null || preview === void 0 ? void 0 : preview.expiresAt, expirePreview]);
|
|
42910
|
+
var waitForPreviewTask = /*#__PURE__*/function () {
|
|
42911
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(taskId, previewResult) {
|
|
42912
|
+
var task, merged, _t, _t2;
|
|
42913
|
+
return _regenerator().w(function (_context) {
|
|
42914
|
+
while (1) switch (_context.n) {
|
|
42915
|
+
case 0:
|
|
42916
|
+
_t = normalizeTask;
|
|
42917
|
+
_t2 = unwrapResponse;
|
|
42918
|
+
_context.n = 1;
|
|
42919
|
+
return services.queryTask(context.serviceContext, taskId);
|
|
42920
|
+
case 1:
|
|
42921
|
+
task = _t(_t2(_context.v));
|
|
42922
|
+
if (task.taskStatus) {
|
|
42923
|
+
_context.n = 2;
|
|
42924
|
+
break;
|
|
42925
|
+
}
|
|
42926
|
+
throw new Error((task === null || task === void 0 ? void 0 : task.msg) || 'preview task status is missing');
|
|
42927
|
+
case 2:
|
|
42928
|
+
merged = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, previewResult), task.result || {}), task), {}, {
|
|
42929
|
+
taskId: taskId,
|
|
42930
|
+
serviceContext: context.serviceContext
|
|
42931
|
+
});
|
|
42932
|
+
setPreview(merged);
|
|
42933
|
+
onTaskCreated === null || onTaskCreated === void 0 ? void 0 : onTaskCreated(task);
|
|
42934
|
+
if (!(task.stage === 'PREVIEW_COMPLETED')) {
|
|
42935
|
+
_context.n = 3;
|
|
42936
|
+
break;
|
|
42937
|
+
}
|
|
42938
|
+
if (!['PASSED', 'COMPLETED_WITH_ERRORS', 'SUCCESS', 'PARTIAL_SUCCESS'].includes(task.taskStatus)) {
|
|
42939
|
+
_context.n = 3;
|
|
42940
|
+
break;
|
|
42941
|
+
}
|
|
42942
|
+
return _context.a(2, merged);
|
|
42943
|
+
case 3:
|
|
42944
|
+
if (!(task.taskStatus === 'FAILED' || task.taskStatus === 'CANCELLED')) {
|
|
42945
|
+
_context.n = 4;
|
|
42946
|
+
break;
|
|
42947
|
+
}
|
|
42948
|
+
throw new Error(task.errorMessage || 'preview task failed');
|
|
42949
|
+
case 4:
|
|
42950
|
+
_context.n = 5;
|
|
42951
|
+
return wait();
|
|
42952
|
+
case 5:
|
|
42953
|
+
_context.n = 0;
|
|
42954
|
+
break;
|
|
42955
|
+
case 6:
|
|
42956
|
+
return _context.a(2);
|
|
42957
|
+
}
|
|
42958
|
+
}, _callee);
|
|
42959
|
+
}));
|
|
42960
|
+
return function waitForPreviewTask(_x, _x2) {
|
|
42961
|
+
return _ref2.apply(this, arguments);
|
|
42962
|
+
};
|
|
42963
|
+
}();
|
|
42964
|
+
var selectFile = function selectFile(file) {
|
|
42965
|
+
var _String$split$pop;
|
|
42966
|
+
var extension = (_String$split$pop = String((file === null || file === void 0 ? void 0 : file.name) || '').split('.').pop()) === null || _String$split$pop === void 0 ? void 0 : _String$split$pop.toLowerCase();
|
|
42967
|
+
if (!['xlsx', 'xls', 'csv'].includes(extension || '')) {
|
|
42968
|
+
message$1.warning('仅支持 .xlsx、.xls、.csv 文件');
|
|
42969
|
+
setSelectedFile(undefined);
|
|
42970
|
+
return false;
|
|
42971
|
+
}
|
|
42972
|
+
if (Number((file === null || file === void 0 ? void 0 : file.size) || 0) > MAX_FILE_SIZE) {
|
|
42973
|
+
message$1.warning('文件不能超过 10MB');
|
|
42974
|
+
setSelectedFile(undefined);
|
|
42975
|
+
return false;
|
|
42976
|
+
}
|
|
42977
|
+
setSelectedFile(file);
|
|
42978
|
+
setFileName((file === null || file === void 0 ? void 0 : file.name) || '');
|
|
42979
|
+
setPreview(undefined);
|
|
42980
|
+
return false;
|
|
42981
|
+
};
|
|
42982
|
+
var parse = /*#__PURE__*/function () {
|
|
42983
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
42984
|
+
var values, uploaded, objectKey, response, created, completed, _t3, _t4;
|
|
42985
|
+
return _regenerator().w(function (_context2) {
|
|
42986
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
42987
|
+
case 0:
|
|
42988
|
+
if (selectedFile) {
|
|
42989
|
+
_context2.n = 1;
|
|
42990
|
+
break;
|
|
42991
|
+
}
|
|
42992
|
+
message$1.warning('请先选择导入文件');
|
|
42993
|
+
return _context2.a(2);
|
|
42994
|
+
case 1:
|
|
42995
|
+
setParsing(true);
|
|
42996
|
+
_context2.p = 2;
|
|
42997
|
+
_context2.n = 3;
|
|
42998
|
+
return form.validateFields(['templateCode', 'strategy', 'errorHandlingMode']);
|
|
42999
|
+
case 3:
|
|
43000
|
+
values = _context2.v;
|
|
43001
|
+
localStorage.setItem(PREFERENCE_KEY, JSON.stringify({
|
|
43002
|
+
strategy: values.strategy,
|
|
43003
|
+
errorHandlingMode: SUPPORTED_ERROR_HANDLING_MODE
|
|
43004
|
+
}));
|
|
43005
|
+
_t3 = unwrapResponse;
|
|
43006
|
+
_context2.n = 4;
|
|
43007
|
+
return services.uploadFile(selectedFile);
|
|
43008
|
+
case 4:
|
|
43009
|
+
uploaded = _t3(_context2.v);
|
|
43010
|
+
objectKey = (uploaded === null || uploaded === void 0 ? void 0 : uploaded.objectKey) || (uploaded === null || uploaded === void 0 ? void 0 : uploaded.name) || (uploaded === null || uploaded === void 0 ? void 0 : uploaded.url);
|
|
43011
|
+
if (objectKey) {
|
|
43012
|
+
_context2.n = 5;
|
|
43013
|
+
break;
|
|
43014
|
+
}
|
|
43015
|
+
throw new Error('uploaded objectKey is missing');
|
|
43016
|
+
case 5:
|
|
43017
|
+
_context2.n = 6;
|
|
43018
|
+
return services.previewImport(context.serviceContext, {
|
|
43019
|
+
businessFunctionCode: context.businessFunctionCode,
|
|
43020
|
+
templateCode: values.templateCode,
|
|
43021
|
+
importStrategy: values.strategy,
|
|
43022
|
+
errorHandlingMode: SUPPORTED_ERROR_HANDLING_MODE,
|
|
43023
|
+
objectKey: objectKey,
|
|
43024
|
+
sourceFileName: selectedFile.name
|
|
43025
|
+
});
|
|
43026
|
+
case 6:
|
|
43027
|
+
response = _context2.v;
|
|
43028
|
+
if (!isConcurrentLimit(response)) {
|
|
43029
|
+
_context2.n = 7;
|
|
43030
|
+
break;
|
|
43031
|
+
}
|
|
43032
|
+
message$1.warning('当前导入导出任务较多,请稍后重试');
|
|
43033
|
+
return _context2.a(2, false);
|
|
43034
|
+
case 7:
|
|
43035
|
+
created = unwrapResponse(response);
|
|
43036
|
+
if (created === null || created === void 0 ? void 0 : created.taskId) {
|
|
43037
|
+
_context2.n = 8;
|
|
43038
|
+
break;
|
|
43039
|
+
}
|
|
43040
|
+
throw new Error((created === null || created === void 0 ? void 0 : created.msg) || 'preview taskId is missing');
|
|
43041
|
+
case 8:
|
|
43042
|
+
setPreview(created);
|
|
43043
|
+
onTaskCreated === null || onTaskCreated === void 0 ? void 0 : onTaskCreated(normalizeTask(_objectSpread2(_objectSpread2({
|
|
43044
|
+
taskType: 'IMPORT_VALIDATION',
|
|
43045
|
+
taskStatus: 'PENDING'
|
|
43046
|
+
}, created), {}, {
|
|
43047
|
+
serviceContext: context.serviceContext
|
|
43048
|
+
})));
|
|
43049
|
+
_context2.n = 9;
|
|
43050
|
+
return waitForPreviewTask(created.taskId, created);
|
|
43051
|
+
case 9:
|
|
43052
|
+
completed = _context2.v;
|
|
43053
|
+
setPreview(completed);
|
|
43054
|
+
setStep(1);
|
|
43055
|
+
_context2.n = 12;
|
|
43056
|
+
break;
|
|
43057
|
+
case 10:
|
|
43058
|
+
_context2.p = 10;
|
|
43059
|
+
_t4 = _context2.v;
|
|
43060
|
+
if (!isConcurrentLimit(_t4)) {
|
|
43061
|
+
_context2.n = 11;
|
|
43062
|
+
break;
|
|
43063
|
+
}
|
|
43064
|
+
message$1.warning('当前导入导出任务较多,请稍后重试');
|
|
43065
|
+
return _context2.a(2, false);
|
|
43066
|
+
case 11:
|
|
43067
|
+
message$1.error('文件解析失败,请稍后重试');
|
|
43068
|
+
case 12:
|
|
43069
|
+
_context2.p = 12;
|
|
43070
|
+
setParsing(false);
|
|
43071
|
+
return _context2.f(12);
|
|
43072
|
+
case 13:
|
|
43073
|
+
return _context2.a(2, false);
|
|
43074
|
+
}
|
|
43075
|
+
}, _callee2, null, [[2, 10, 12, 13]]);
|
|
43076
|
+
}));
|
|
43077
|
+
return function parse() {
|
|
43078
|
+
return _ref3.apply(this, arguments);
|
|
43079
|
+
};
|
|
43080
|
+
}();
|
|
43081
|
+
var selectedTemplate = templates.find(function (item) {
|
|
43082
|
+
return item.templateCode === selectedTemplateCode;
|
|
43083
|
+
});
|
|
43084
|
+
var personalTemplates = templates.filter(function (item) {
|
|
43085
|
+
return item.visibility === 'PERSONAL';
|
|
43086
|
+
});
|
|
43087
|
+
var publicTemplates = templates.filter(function (item) {
|
|
43088
|
+
return item.visibility !== 'PERSONAL';
|
|
43089
|
+
});
|
|
43090
|
+
var selectedTemplateFieldCount = (_selectedTemplate$fie = selectedTemplate === null || selectedTemplate === void 0 ? void 0 : selectedTemplate.fieldCount) !== null && _selectedTemplate$fie !== void 0 ? _selectedTemplate$fie : selectedTemplate === null || selectedTemplate === void 0 ? void 0 : (_selectedTemplate$fie2 = selectedTemplate.fieldNames) === null || _selectedTemplate$fie2 === void 0 ? void 0 : _selectedTemplate$fie2.length;
|
|
43091
|
+
var execute = /*#__PURE__*/function () {
|
|
43092
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
43093
|
+
var expiresAt, submitted, _preview$result, previewId, res, _t5;
|
|
43094
|
+
return _regenerator().w(function (_context3) {
|
|
43095
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
43096
|
+
case 0:
|
|
43097
|
+
expiresAt = Number(preview === null || preview === void 0 ? void 0 : preview.expiresAt);
|
|
43098
|
+
if (!(Number.isFinite(expiresAt) && expiresAt <= Date.now())) {
|
|
43099
|
+
_context3.n = 1;
|
|
43100
|
+
break;
|
|
43101
|
+
}
|
|
43102
|
+
expirePreview();
|
|
43103
|
+
return _context3.a(2);
|
|
43104
|
+
case 1:
|
|
43105
|
+
if (!((preview === null || preview === void 0 ? void 0 : preview.canExecute) !== true)) {
|
|
43106
|
+
_context3.n = 2;
|
|
43107
|
+
break;
|
|
43108
|
+
}
|
|
43109
|
+
message$1.warning('当前校验结果没有可执行的合格业务单据');
|
|
43110
|
+
return _context3.a(2);
|
|
43111
|
+
case 2:
|
|
43112
|
+
submitted = false;
|
|
43113
|
+
setExecuting(true);
|
|
43114
|
+
_context3.p = 3;
|
|
43115
|
+
previewId = (preview === null || preview === void 0 ? void 0 : preview.previewId) || (preview === null || preview === void 0 ? void 0 : (_preview$result = preview.result) === null || _preview$result === void 0 ? void 0 : _preview$result.previewId);
|
|
43116
|
+
if (previewId) {
|
|
43117
|
+
_context3.n = 4;
|
|
43118
|
+
break;
|
|
43119
|
+
}
|
|
43120
|
+
throw new Error('previewId is missing');
|
|
43121
|
+
case 4:
|
|
43122
|
+
submitted = true;
|
|
43123
|
+
_context3.n = 5;
|
|
43124
|
+
return services.executeImport(context.serviceContext, {
|
|
43125
|
+
previewId: previewId
|
|
43126
|
+
});
|
|
43127
|
+
case 5:
|
|
43128
|
+
res = _context3.v;
|
|
43129
|
+
if (!isConcurrentLimit(res)) {
|
|
43130
|
+
_context3.n = 6;
|
|
43131
|
+
break;
|
|
43132
|
+
}
|
|
43133
|
+
message$1.warning('当前导入导出任务较多,请稍后重试');
|
|
43134
|
+
return _context3.a(2);
|
|
43135
|
+
case 6:
|
|
43136
|
+
onTaskCreated === null || onTaskCreated === void 0 ? void 0 : onTaskCreated(normalizeTask(_objectSpread2(_objectSpread2({
|
|
43137
|
+
taskType: 'IMPORT_EXECUTION',
|
|
43138
|
+
taskStatus: 'PENDING'
|
|
43139
|
+
}, unwrapResponse(res)), {}, {
|
|
43140
|
+
serviceContext: context.serviceContext
|
|
43141
|
+
})));
|
|
43142
|
+
message$1.success('已创建导入任务');
|
|
43143
|
+
onClose();
|
|
43144
|
+
_context3.n = 12;
|
|
43145
|
+
break;
|
|
43146
|
+
case 7:
|
|
43147
|
+
_context3.p = 7;
|
|
43148
|
+
_t5 = _context3.v;
|
|
43149
|
+
if (!isConcurrentLimit(_t5)) {
|
|
43150
|
+
_context3.n = 8;
|
|
43151
|
+
break;
|
|
43152
|
+
}
|
|
43153
|
+
message$1.warning('当前导入导出任务较多,请稍后重试');
|
|
43154
|
+
return _context3.a(2);
|
|
43155
|
+
case 8:
|
|
43156
|
+
if (!isPreviewExpiredError(_t5)) {
|
|
43157
|
+
_context3.n = 9;
|
|
43158
|
+
break;
|
|
43159
|
+
}
|
|
43160
|
+
expirePreview();
|
|
43161
|
+
return _context3.a(2);
|
|
43162
|
+
case 9:
|
|
43163
|
+
if (!isPreviewConsumedError(_t5)) {
|
|
43164
|
+
_context3.n = 10;
|
|
43165
|
+
break;
|
|
43166
|
+
}
|
|
43167
|
+
setPreview(function (current) {
|
|
43168
|
+
return current ? _objectSpread2(_objectSpread2({}, current), {}, {
|
|
43169
|
+
canExecute: false
|
|
43170
|
+
}) : current;
|
|
43171
|
+
});
|
|
43172
|
+
message$1.error(PREVIEW_CONSUMED_MESSAGE);
|
|
43173
|
+
return _context3.a(2);
|
|
43174
|
+
case 10:
|
|
43175
|
+
if (!submitted) {
|
|
43176
|
+
_context3.n = 11;
|
|
43177
|
+
break;
|
|
43178
|
+
}
|
|
43179
|
+
setPreview(function (current) {
|
|
43180
|
+
return current ? _objectSpread2(_objectSpread2({}, current), {}, {
|
|
43181
|
+
canExecute: false
|
|
43182
|
+
}) : current;
|
|
43183
|
+
});
|
|
43184
|
+
message$1.error('执行结果待核对,请勿重复提交,请在任务中心核对业务数据');
|
|
43185
|
+
return _context3.a(2);
|
|
43186
|
+
case 11:
|
|
43187
|
+
message$1.error('执行导入失败,请重新上传并校验');
|
|
43188
|
+
case 12:
|
|
43189
|
+
_context3.p = 12;
|
|
43190
|
+
setExecuting(false);
|
|
43191
|
+
return _context3.f(12);
|
|
43192
|
+
case 13:
|
|
43193
|
+
return _context3.a(2);
|
|
43194
|
+
}
|
|
43195
|
+
}, _callee3, null, [[3, 7, 12, 13]]);
|
|
43196
|
+
}));
|
|
43197
|
+
return function execute() {
|
|
43198
|
+
return _ref4.apply(this, arguments);
|
|
43199
|
+
};
|
|
43200
|
+
}();
|
|
43201
|
+
var downloadValidationErrorFile = /*#__PURE__*/function () {
|
|
43202
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
43203
|
+
var expiresAt, _preview$result2, previewId, response, result, link, _t6;
|
|
43204
|
+
return _regenerator().w(function (_context4) {
|
|
43205
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
43206
|
+
case 0:
|
|
43207
|
+
expiresAt = Number(preview === null || preview === void 0 ? void 0 : preview.expiresAt);
|
|
43208
|
+
if (!(Number.isFinite(expiresAt) && expiresAt <= Date.now())) {
|
|
43209
|
+
_context4.n = 1;
|
|
43210
|
+
break;
|
|
43211
|
+
}
|
|
43212
|
+
expirePreview();
|
|
43213
|
+
return _context4.a(2);
|
|
43214
|
+
case 1:
|
|
43215
|
+
if (!((preview === null || preview === void 0 ? void 0 : preview.errorFileAvailable) !== true)) {
|
|
43216
|
+
_context4.n = 2;
|
|
43217
|
+
break;
|
|
43218
|
+
}
|
|
43219
|
+
message$1.warning('当前校验结果没有可下载的错误文件');
|
|
43220
|
+
return _context4.a(2);
|
|
43221
|
+
case 2:
|
|
43222
|
+
setDownloadingErrorFile(true);
|
|
43223
|
+
_context4.p = 3;
|
|
43224
|
+
previewId = (preview === null || preview === void 0 ? void 0 : preview.previewId) || (preview === null || preview === void 0 ? void 0 : (_preview$result2 = preview.result) === null || _preview$result2 === void 0 ? void 0 : _preview$result2.previewId);
|
|
43225
|
+
if (previewId) {
|
|
43226
|
+
_context4.n = 4;
|
|
43227
|
+
break;
|
|
43228
|
+
}
|
|
43229
|
+
throw new Error('previewId is missing');
|
|
43230
|
+
case 4:
|
|
43231
|
+
_context4.n = 5;
|
|
43232
|
+
return services.downloadValidationErrorFile(context.serviceContext, {
|
|
43233
|
+
previewId: previewId
|
|
43234
|
+
});
|
|
43235
|
+
case 5:
|
|
43236
|
+
response = _context4.v;
|
|
43237
|
+
result = unwrapResponse(response);
|
|
43238
|
+
if (result === null || result === void 0 ? void 0 : result.fileUrl) {
|
|
43239
|
+
_context4.n = 6;
|
|
43240
|
+
break;
|
|
43241
|
+
}
|
|
43242
|
+
throw new Error('validation error fileUrl is missing');
|
|
43243
|
+
case 6:
|
|
43244
|
+
link = document.createElement('a');
|
|
43245
|
+
link.href = result.fileUrl;
|
|
43246
|
+
link.download = "".concat(fileName || '导入文件', "-\u9519\u8BEF\u6570\u636E.xlsx");
|
|
43247
|
+
document.body.appendChild(link);
|
|
43248
|
+
link.click();
|
|
43249
|
+
document.body.removeChild(link);
|
|
43250
|
+
message$1.success('错误文件下载已开始');
|
|
43251
|
+
_context4.n = 9;
|
|
43252
|
+
break;
|
|
43253
|
+
case 7:
|
|
43254
|
+
_context4.p = 7;
|
|
43255
|
+
_t6 = _context4.v;
|
|
43256
|
+
if (!isPreviewExpiredError(_t6)) {
|
|
43257
|
+
_context4.n = 8;
|
|
43258
|
+
break;
|
|
43259
|
+
}
|
|
43260
|
+
expirePreview();
|
|
43261
|
+
return _context4.a(2);
|
|
43262
|
+
case 8:
|
|
43263
|
+
message$1.error('错误文件下载失败,请稍后重试');
|
|
43264
|
+
case 9:
|
|
43265
|
+
_context4.p = 9;
|
|
43266
|
+
setDownloadingErrorFile(false);
|
|
43267
|
+
return _context4.f(9);
|
|
43268
|
+
case 10:
|
|
43269
|
+
return _context4.a(2);
|
|
43270
|
+
}
|
|
43271
|
+
}, _callee4, null, [[3, 7, 9, 10]]);
|
|
43272
|
+
}));
|
|
43273
|
+
return function downloadValidationErrorFile() {
|
|
43274
|
+
return _ref5.apply(this, arguments);
|
|
43275
|
+
};
|
|
43276
|
+
}();
|
|
43277
|
+
var downloadSelectedTemplate = /*#__PURE__*/function () {
|
|
43278
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
43279
|
+
var templateCode, file, selected, url, link, _t7;
|
|
43280
|
+
return _regenerator().w(function (_context5) {
|
|
43281
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
43282
|
+
case 0:
|
|
43283
|
+
templateCode = form.getFieldValue('templateCode');
|
|
43284
|
+
if (templateCode) {
|
|
43285
|
+
_context5.n = 1;
|
|
43286
|
+
break;
|
|
43287
|
+
}
|
|
43288
|
+
message$1.warning('请先选择模板');
|
|
43289
|
+
return _context5.a(2);
|
|
43290
|
+
case 1:
|
|
43291
|
+
setDownloading(true);
|
|
43292
|
+
_context5.p = 2;
|
|
43293
|
+
_context5.n = 3;
|
|
43294
|
+
return services.downloadTemplate(templateCode, context);
|
|
43295
|
+
case 3:
|
|
43296
|
+
file = _context5.v;
|
|
43297
|
+
selected = templates.find(function (item) {
|
|
43298
|
+
return item.templateCode === templateCode;
|
|
43299
|
+
});
|
|
43300
|
+
url = URL.createObjectURL(file instanceof Blob ? file : new Blob([file]));
|
|
43301
|
+
link = document.createElement('a');
|
|
43302
|
+
link.href = url;
|
|
43303
|
+
link.download = "".concat((selected === null || selected === void 0 ? void 0 : selected.templateName) || templateCode, ".xlsx");
|
|
43304
|
+
document.body.appendChild(link);
|
|
43305
|
+
link.click();
|
|
43306
|
+
document.body.removeChild(link);
|
|
43307
|
+
URL.revokeObjectURL(url);
|
|
43308
|
+
message$1.success('模板下载成功');
|
|
43309
|
+
_context5.n = 5;
|
|
43310
|
+
break;
|
|
43311
|
+
case 4:
|
|
43312
|
+
_context5.p = 4;
|
|
43313
|
+
_t7 = _context5.v;
|
|
43314
|
+
message$1.error('模板下载失败,请稍后重试');
|
|
43315
|
+
case 5:
|
|
43316
|
+
_context5.p = 5;
|
|
43317
|
+
setDownloading(false);
|
|
43318
|
+
return _context5.f(5);
|
|
43319
|
+
case 6:
|
|
43320
|
+
return _context5.a(2);
|
|
43321
|
+
}
|
|
43322
|
+
}, _callee5, null, [[2, 4, 5, 6]]);
|
|
43323
|
+
}));
|
|
43324
|
+
return function downloadSelectedTemplate() {
|
|
43325
|
+
return _ref6.apply(this, arguments);
|
|
43326
|
+
};
|
|
43327
|
+
}();
|
|
43328
|
+
return /*#__PURE__*/React$1.createElement(Modal, {
|
|
43329
|
+
width: 920,
|
|
43330
|
+
title: /*#__PURE__*/React$1.createElement("div", {
|
|
43331
|
+
className: styles$2.modalTitle
|
|
43332
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
43333
|
+
className: styles$2.modalTitleIcon
|
|
43334
|
+
}, /*#__PURE__*/React$1.createElement(FileExcelOutlined, null)), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
43335
|
+
className: styles$2.modalTitleText
|
|
43336
|
+
}, documentName || '业务单据', "\u5BFC\u5165"), /*#__PURE__*/React$1.createElement("span", {
|
|
43337
|
+
className: styles$2.modalTitleDescription
|
|
43338
|
+
}, "\u4E0B\u8F7D\u6A21\u677F\u3001\u586B\u5199\u6570\u636E\u5E76\u4E0A\u4F20\u6821\u9A8C"))),
|
|
43339
|
+
visible: visible,
|
|
43340
|
+
footer: step === 0 ? [/*#__PURE__*/React$1.createElement(Button, {
|
|
43341
|
+
key: "cancel",
|
|
43342
|
+
onClick: onClose
|
|
43343
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React$1.createElement(Button, {
|
|
43344
|
+
key: "parse",
|
|
43345
|
+
type: "primary",
|
|
43346
|
+
icon: /*#__PURE__*/React$1.createElement(UploadOutlined, null),
|
|
43347
|
+
loading: parsing,
|
|
43348
|
+
disabled: !selectedTemplateCode || !selectedFile,
|
|
43349
|
+
onClick: parse
|
|
43350
|
+
}, "\u4E0A\u4F20\u5E76\u89E3\u6790")] : null,
|
|
43351
|
+
onCancel: onClose,
|
|
43352
|
+
wrapClassName: styles$2.importModal,
|
|
43353
|
+
destroyOnClose: true
|
|
43354
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
43355
|
+
className: styles$2.stepsPanel
|
|
43356
|
+
}, /*#__PURE__*/React$1.createElement(Steps, {
|
|
43357
|
+
current: step,
|
|
43358
|
+
size: "small"
|
|
43359
|
+
}, /*#__PURE__*/React$1.createElement(Steps.Step, {
|
|
43360
|
+
title: "\u914D\u7F6E\u5E76\u4E0A\u4F20"
|
|
43361
|
+
}), /*#__PURE__*/React$1.createElement(Steps.Step, {
|
|
43362
|
+
title: "\u6821\u9A8C\u5E76\u5BFC\u5165"
|
|
43363
|
+
}))), step === 0 && (/*#__PURE__*/React$1.createElement(Form, {
|
|
43364
|
+
form: form,
|
|
43365
|
+
layout: "vertical",
|
|
43366
|
+
className: styles$2.form
|
|
43367
|
+
}, /*#__PURE__*/React$1.createElement("section", {
|
|
43368
|
+
className: styles$2.section
|
|
43369
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
43370
|
+
className: styles$2.sectionHeader
|
|
43371
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
43372
|
+
className: styles$2.sectionIndex
|
|
43373
|
+
}, "1"), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
43374
|
+
className: styles$2.sectionTitle
|
|
43375
|
+
}, "\u9009\u62E9\u5BFC\u5165\u6A21\u677F"), /*#__PURE__*/React$1.createElement("span", {
|
|
43376
|
+
className: styles$2.sectionDescription
|
|
43377
|
+
}, "\u8BF7\u5148\u4E0B\u8F7D\u5E76\u4F7F\u7528\u5F53\u524D\u6A21\u677F\u6574\u7406\u6570\u636E"))), /*#__PURE__*/React$1.createElement("div", {
|
|
43378
|
+
className: styles$2.templateRow
|
|
43379
|
+
}, /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
43380
|
+
label: "\u5BFC\u5165\u6A21\u677F",
|
|
43381
|
+
name: "templateCode",
|
|
43382
|
+
className: styles$2.templateField,
|
|
43383
|
+
rules: [{
|
|
43384
|
+
required: true,
|
|
43385
|
+
message: '请选择导入模板'
|
|
43386
|
+
}]
|
|
43387
|
+
}, /*#__PURE__*/React$1.createElement(Select, {
|
|
43388
|
+
showSearch: true,
|
|
43389
|
+
optionFilterProp: "children",
|
|
43390
|
+
placeholder: "\u8BF7\u9009\u62E9\u5BFC\u5165\u6A21\u677F",
|
|
43391
|
+
onChange: setSelectedTemplateCode
|
|
43392
|
+
}, personalTemplates.length > 0 && (/*#__PURE__*/React$1.createElement(Select.OptGroup, {
|
|
43393
|
+
label: "\u4E2A\u4EBA\u6A21\u677F"
|
|
43394
|
+
}, personalTemplates.map(function (item) {
|
|
43395
|
+
return /*#__PURE__*/React$1.createElement(Select.Option, {
|
|
43396
|
+
key: item.templateCode,
|
|
43397
|
+
value: item.templateCode
|
|
43398
|
+
}, item.templateName);
|
|
43399
|
+
}))), publicTemplates.length > 0 && (/*#__PURE__*/React$1.createElement(Select.OptGroup, {
|
|
43400
|
+
label: "\u516C\u5171\u6A21\u677F"
|
|
43401
|
+
}, publicTemplates.map(function (item) {
|
|
43402
|
+
return /*#__PURE__*/React$1.createElement(Select.Option, {
|
|
43403
|
+
key: item.templateCode,
|
|
43404
|
+
value: item.templateCode
|
|
43405
|
+
}, item.templateName);
|
|
43406
|
+
}))))), /*#__PURE__*/React$1.createElement(Button, {
|
|
43407
|
+
className: styles$2.downloadButton,
|
|
43408
|
+
icon: /*#__PURE__*/React$1.createElement(DownloadOutlined, null),
|
|
43409
|
+
loading: downloading,
|
|
43410
|
+
onClick: downloadSelectedTemplate
|
|
43411
|
+
}, "\u4E0B\u8F7D\u6A21\u677F")), selectedTemplate && (/*#__PURE__*/React$1.createElement(Descriptions, {
|
|
43412
|
+
bordered: true,
|
|
43413
|
+
size: "small",
|
|
43414
|
+
column: {
|
|
43415
|
+
xs: 1,
|
|
43416
|
+
sm: 3
|
|
43417
|
+
},
|
|
43418
|
+
className: styles$2.templateSummary
|
|
43419
|
+
}, /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43420
|
+
label: "\u6A21\u677F\u540D\u79F0"
|
|
43421
|
+
}, selectedTemplate.templateName), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43422
|
+
label: "\u4E1A\u52A1\u5355\u636E"
|
|
43423
|
+
}, documentName || selectedTemplate.businessFunctionCode || '-'), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43424
|
+
label: "\u5B57\u6BB5\u6620\u5C04"
|
|
43425
|
+
}, selectedTemplateFieldCount == null ? '以模板配置为准' : "".concat(selectedTemplateFieldCount, " \u4E2A\u5B57\u6BB5"))))), /*#__PURE__*/React$1.createElement("section", {
|
|
43426
|
+
className: styles$2.section
|
|
43427
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
43428
|
+
className: styles$2.sectionHeader
|
|
43429
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
43430
|
+
className: styles$2.sectionIndex
|
|
43431
|
+
}, "2"), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
43432
|
+
className: styles$2.sectionTitle
|
|
43433
|
+
}, "\u8BBE\u7F6E\u5BFC\u5165\u89C4\u5219"), /*#__PURE__*/React$1.createElement("span", {
|
|
43434
|
+
className: styles$2.sectionDescription
|
|
43435
|
+
}, "\u9009\u62E9\u6570\u636E\u5199\u5165\u65B9\u5F0F\u4E0E\u5F02\u5E38\u5904\u7406\u65B9\u5F0F"))), /*#__PURE__*/React$1.createElement("div", {
|
|
43436
|
+
className: styles$2.settingGrid
|
|
43437
|
+
}, /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
43438
|
+
className: styles$2.settingItem,
|
|
43439
|
+
label: /*#__PURE__*/React$1.createElement(Space, null, "\u5BFC\u5165\u7B56\u7565", /*#__PURE__*/React$1.createElement(Tooltip, {
|
|
43440
|
+
title: "\u4EC5\u65B0\u589E\uFF1A\u5DF2\u6709\u6570\u636E\u62A5\u9519\uFF1B\u4EC5\u66F4\u65B0\uFF1A\u4E0D\u5B58\u5728\u7684\u6570\u636E\u62A5\u9519\uFF1B\u66F4\u65B0\u5E76\u65B0\u589E\uFF1A\u5DF2\u6709\u6570\u636E\u66F4\u65B0\uFF0C\u4E0D\u5B58\u5728\u7684\u6570\u636E\u65B0\u589E\u3002"
|
|
43441
|
+
}, /*#__PURE__*/React$1.createElement(QuestionCircleOutlined, null))),
|
|
43442
|
+
name: "strategy"
|
|
43443
|
+
}, /*#__PURE__*/React$1.createElement(Radio.Group, {
|
|
43444
|
+
className: styles$2.radioGroup
|
|
43445
|
+
}, /*#__PURE__*/React$1.createElement(Radio, {
|
|
43446
|
+
value: "CREATE_ONLY"
|
|
43447
|
+
}, "\u4EC5\u65B0\u589E"), /*#__PURE__*/React$1.createElement(Radio, {
|
|
43448
|
+
value: "UPDATE_ONLY"
|
|
43449
|
+
}, "\u4EC5\u66F4\u65B0"), /*#__PURE__*/React$1.createElement(Radio, {
|
|
43450
|
+
value: "UPSERT"
|
|
43451
|
+
}, "\u66F4\u65B0\u5E76\u65B0\u589E"))), /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
43452
|
+
className: styles$2.settingItem,
|
|
43453
|
+
label: "\u9519\u8BEF\u5904\u7406",
|
|
43454
|
+
name: "errorHandlingMode"
|
|
43455
|
+
}, /*#__PURE__*/React$1.createElement(Radio.Group, {
|
|
43456
|
+
className: styles$2.radioGroup
|
|
43457
|
+
}, /*#__PURE__*/React$1.createElement(Radio, {
|
|
43458
|
+
value: "ALL_ROLLBACK",
|
|
43459
|
+
disabled: true
|
|
43460
|
+
}, "\u5168\u90E8\u56DE\u6EDA"), /*#__PURE__*/React$1.createElement(Radio, {
|
|
43461
|
+
value: "PARTIAL_SUCCESS"
|
|
43462
|
+
}, "\u90E8\u5206\u6210\u529F\uFF08\u5141\u8BB8\u90E8\u5206\u5931\u8D25\uFF09"))))), /*#__PURE__*/React$1.createElement("section", {
|
|
43463
|
+
className: "".concat(styles$2.section, " ").concat(styles$2.uploadSection)
|
|
43464
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
43465
|
+
className: styles$2.sectionHeader
|
|
43466
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
43467
|
+
className: styles$2.sectionIndex
|
|
43468
|
+
}, "3"), /*#__PURE__*/React$1.createElement("span", null, /*#__PURE__*/React$1.createElement("span", {
|
|
43469
|
+
className: styles$2.sectionTitle
|
|
43470
|
+
}, "\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"), /*#__PURE__*/React$1.createElement("span", {
|
|
43471
|
+
className: styles$2.sectionDescription
|
|
43472
|
+
}, "\u4E0A\u4F20\u540E\u7CFB\u7EDF\u5C06\u5148\u6821\u9A8C\u6570\u636E\uFF0C\u4E0D\u4F1A\u76F4\u63A5\u5199\u5165\u4E1A\u52A1\u5355\u636E"))), /*#__PURE__*/React$1.createElement(Upload.Dragger, {
|
|
43473
|
+
className: styles$2.uploadDragger,
|
|
43474
|
+
beforeUpload: selectFile,
|
|
43475
|
+
fileList: selectedFile ? [selectedFile] : [],
|
|
43476
|
+
onRemove: function onRemove() {
|
|
43477
|
+
setSelectedFile(undefined);
|
|
43478
|
+
setFileName('');
|
|
43479
|
+
setPreview(undefined);
|
|
43480
|
+
},
|
|
43481
|
+
multiple: false,
|
|
43482
|
+
accept: ".xls,.xlsx,.csv"
|
|
43483
|
+
}, /*#__PURE__*/React$1.createElement("p", {
|
|
43484
|
+
className: "ant-upload-drag-icon"
|
|
43485
|
+
}, /*#__PURE__*/React$1.createElement(InboxOutlined, null)), /*#__PURE__*/React$1.createElement("p", {
|
|
43486
|
+
className: "ant-upload-text"
|
|
43487
|
+
}, "\u70B9\u51FB\u6216\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u533A\u57DF\u4E0A\u4F20"), /*#__PURE__*/React$1.createElement("p", {
|
|
43488
|
+
className: "ant-upload-hint"
|
|
43489
|
+
}, "\u652F\u6301 XLSX\u3001XLS\u3001CSV\uFF0C\u5355\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7 10 MB")), /*#__PURE__*/React$1.createElement(Alert, {
|
|
43490
|
+
className: styles$2.uploadAlert,
|
|
43491
|
+
type: "info",
|
|
43492
|
+
showIcon: true,
|
|
43493
|
+
message: "\u884C\u6570\u4E0A\u9650\u7531\u7CFB\u7EDF\u914D\u7F6E\u51B3\u5B9A\uFF0C\u9ED8\u8BA4\u6700\u591A 100,000 \u884C\uFF1B\u7CFB\u7EDF\u7E41\u5FD9\u65F6\u6587\u4EF6\u4E0D\u4F1A\u8FDB\u5165\u89E3\u6790\u3002"
|
|
43494
|
+
}), parsing && (/*#__PURE__*/React$1.createElement("div", {
|
|
43495
|
+
className: styles$2.progressPanel
|
|
43496
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
43497
|
+
className: styles$2.progressTitle
|
|
43498
|
+
}, fileName, " \xB7 ", (preview === null || preview === void 0 ? void 0 : preview.stageName) || '文件解析中'), /*#__PURE__*/React$1.createElement(Progress, {
|
|
43499
|
+
percent: (preview === null || preview === void 0 ? void 0 : preview.progress) || 0,
|
|
43500
|
+
size: "small"
|
|
43501
|
+
})))))), step === 1 && (/*#__PURE__*/React$1.createElement(Preview, {
|
|
43502
|
+
preview: preview,
|
|
43503
|
+
executing: executing,
|
|
43504
|
+
downloadingErrorFile: downloadingErrorFile,
|
|
43505
|
+
onBack: function onBack() {
|
|
43506
|
+
return setStep(0);
|
|
43507
|
+
},
|
|
43508
|
+
onExecute: execute,
|
|
43509
|
+
onDownloadErrorFile: downloadValidationErrorFile
|
|
43510
|
+
})));
|
|
43511
|
+
};
|
|
43512
|
+
|
|
43513
|
+
var statusNames = {
|
|
43514
|
+
CREATED: '等待执行',
|
|
43515
|
+
RUNNING: '执行中',
|
|
43516
|
+
WAITING_EXECUTE: '等待确认',
|
|
43517
|
+
VERIFYING: '结果核对中',
|
|
43518
|
+
SUCCESS: '成功',
|
|
43519
|
+
PARTIAL_SUCCESS: '部分成功',
|
|
43520
|
+
PASSED: '校验通过',
|
|
43521
|
+
COMPLETED_WITH_ERRORS: '校验完成(含异常)',
|
|
43522
|
+
FAILED: '失败',
|
|
43523
|
+
CANCELLED: '已取消'
|
|
43524
|
+
};
|
|
43525
|
+
/**
|
|
43526
|
+
* 展示当前业务功能最近的文件任务。
|
|
43527
|
+
*/
|
|
43528
|
+
var TaskDrawer = function TaskDrawer(_ref) {
|
|
43529
|
+
var _detail$successCount, _detail$failedCount, _detail$skippedCount;
|
|
43530
|
+
var businessFunctionCodes = _ref.businessFunctionCodes,
|
|
43531
|
+
services = _ref.services,
|
|
43532
|
+
taskCenterPath = _ref.taskCenterPath,
|
|
43533
|
+
onNavigateTaskCenter = _ref.onNavigateTaskCenter;
|
|
43534
|
+
var _useState = useState(false),
|
|
43535
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43536
|
+
visible = _useState2[0],
|
|
43537
|
+
setVisible = _useState2[1];
|
|
43538
|
+
var _useState3 = useState(''),
|
|
43539
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
43540
|
+
keyword = _useState4[0],
|
|
43541
|
+
setKeyword = _useState4[1];
|
|
43542
|
+
var _useState5 = useState([]),
|
|
43543
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
43544
|
+
tasks = _useState6[0],
|
|
43545
|
+
setTasks = _useState6[1];
|
|
43546
|
+
var _useState7 = useState(false),
|
|
43547
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
43548
|
+
loading = _useState8[0],
|
|
43549
|
+
setLoading = _useState8[1];
|
|
43550
|
+
var _useState9 = useState(),
|
|
43551
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
43552
|
+
detail = _useState0[0],
|
|
43553
|
+
setDetail = _useState0[1];
|
|
43554
|
+
var _useState1 = useState(false),
|
|
43555
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
43556
|
+
unreadFailure = _useState10[0],
|
|
43557
|
+
setUnreadFailure = _useState10[1];
|
|
43558
|
+
var businessFunctionCodeKey = businessFunctionCodes.join('|');
|
|
43559
|
+
useEffect(function () {
|
|
43560
|
+
if (!visible) return;
|
|
43561
|
+
setLoading(true);
|
|
43562
|
+
var currentBusinessFunctionCodes = businessFunctionCodeKey.split('|').filter(Boolean);
|
|
43563
|
+
Promise.all(currentBusinessFunctionCodes.map(function (businessFunctionCode) {
|
|
43564
|
+
return services.queryRecentTasks({
|
|
43565
|
+
businessFunctionCode: businessFunctionCode,
|
|
43566
|
+
days: 3
|
|
43567
|
+
});
|
|
43568
|
+
})).then(function (responses) {
|
|
43569
|
+
var taskIds = new Set();
|
|
43570
|
+
var recent = responses.reduce(function (items, response) {
|
|
43571
|
+
return [].concat(_toConsumableArray(items), _toConsumableArray(getItems(response)));
|
|
43572
|
+
}, []).map(normalizeTask).filter(function (task) {
|
|
43573
|
+
if (!task.taskId || taskIds.has(task.taskId)) return false;
|
|
43574
|
+
taskIds.add(task.taskId);
|
|
43575
|
+
return true;
|
|
43576
|
+
});
|
|
43577
|
+
setTasks(recent);
|
|
43578
|
+
setUnreadFailure(false);
|
|
43579
|
+
}).catch(function () {
|
|
43580
|
+
return message$1.error('最近文件任务加载失败,请稍后重试');
|
|
43581
|
+
}).finally(function () {
|
|
43582
|
+
return setLoading(false);
|
|
43583
|
+
});
|
|
43584
|
+
}, [visible, businessFunctionCodeKey, services]);
|
|
43585
|
+
useEffect(function () {
|
|
43586
|
+
if (!visible && tasks.some(function (item) {
|
|
43587
|
+
return item.taskStatus === 'FAILED' || item.taskStatus === 'PARTIAL_SUCCESS' || item.taskStatus === 'COMPLETED_WITH_ERRORS';
|
|
43588
|
+
})) {
|
|
43589
|
+
setUnreadFailure(true);
|
|
43590
|
+
}
|
|
43591
|
+
}, [visible, tasks]);
|
|
43592
|
+
var items = useMemo(function () {
|
|
43593
|
+
return tasks.filter(function (item) {
|
|
43594
|
+
var _item$templateName, _item$taskId;
|
|
43595
|
+
return !keyword || ((_item$templateName = item.templateName) === null || _item$templateName === void 0 ? void 0 : _item$templateName.includes(keyword)) || ((_item$taskId = item.taskId) === null || _item$taskId === void 0 ? void 0 : _item$taskId.includes(keyword));
|
|
43596
|
+
});
|
|
43597
|
+
}, [tasks, keyword]);
|
|
43598
|
+
var openFile = function openFile(url, fileName) {
|
|
43599
|
+
var link = document.createElement('a');
|
|
43600
|
+
link.href = url;
|
|
43601
|
+
link.download = fileName;
|
|
43602
|
+
document.body.appendChild(link);
|
|
43603
|
+
link.click();
|
|
43604
|
+
document.body.removeChild(link);
|
|
43605
|
+
message$1.success('文件下载已开始');
|
|
43606
|
+
};
|
|
43607
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Badge, {
|
|
43608
|
+
dot: unreadFailure
|
|
43609
|
+
}, /*#__PURE__*/React$1.createElement(Button, {
|
|
43610
|
+
onClick: function onClick() {
|
|
43611
|
+
setUnreadFailure(false);
|
|
43612
|
+
setVisible(true);
|
|
43613
|
+
}
|
|
43614
|
+
}, "\u6587\u4EF6\u4EFB\u52A1")), /*#__PURE__*/React$1.createElement(Drawer$1, {
|
|
43615
|
+
width: 400,
|
|
43616
|
+
title: "\u6700\u8FD1\u6587\u4EF6\u4EFB\u52A1",
|
|
43617
|
+
visible: visible,
|
|
43618
|
+
onClose: function onClose() {
|
|
43619
|
+
return setVisible(false);
|
|
43620
|
+
}
|
|
43621
|
+
}, /*#__PURE__*/React$1.createElement(Input.Search, {
|
|
43622
|
+
allowClear: true,
|
|
43623
|
+
placeholder: "\u641C\u7D22\u6A21\u677F\u540D\u79F0\u6216\u4EFB\u52A1\u7F16\u53F7",
|
|
43624
|
+
value: keyword,
|
|
43625
|
+
onChange: function onChange(event) {
|
|
43626
|
+
return setKeyword(event.target.value);
|
|
43627
|
+
}
|
|
43628
|
+
}), /*#__PURE__*/React$1.createElement(Spin, {
|
|
43629
|
+
spinning: loading
|
|
43630
|
+
}, /*#__PURE__*/React$1.createElement(List, {
|
|
43631
|
+
dataSource: items,
|
|
43632
|
+
locale: {
|
|
43633
|
+
emptyText: (/*#__PURE__*/React$1.createElement(Empty, {
|
|
43634
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
43635
|
+
description: "\u6700\u8FD13\u5929\u6682\u65E0\u5BFC\u5165\u5BFC\u51FA\u4EFB\u52A1"
|
|
43636
|
+
}))
|
|
43637
|
+
},
|
|
43638
|
+
renderItem: function renderItem(item) {
|
|
43639
|
+
return /*#__PURE__*/React$1.createElement(List.Item, {
|
|
43640
|
+
style: {
|
|
43641
|
+
cursor: 'pointer'
|
|
43642
|
+
},
|
|
43643
|
+
onClick: function onClick() {
|
|
43644
|
+
return setDetail(item);
|
|
43645
|
+
},
|
|
43646
|
+
actions: [item.resultDownloadUrl ? (/*#__PURE__*/React$1.createElement(Button, {
|
|
43647
|
+
type: "link",
|
|
43648
|
+
size: "small",
|
|
43649
|
+
onClick: function onClick(event) {
|
|
43650
|
+
event.stopPropagation();
|
|
43651
|
+
openFile(item.resultDownloadUrl, "".concat(item.taskId, "-\u7ED3\u679C\u6587\u4EF6"));
|
|
43652
|
+
}
|
|
43653
|
+
}, "\u4E0B\u8F7D")) : null, item.errorDownloadUrl ? (/*#__PURE__*/React$1.createElement(Button, {
|
|
43654
|
+
type: "link",
|
|
43655
|
+
size: "small",
|
|
43656
|
+
danger: true,
|
|
43657
|
+
onClick: function onClick(event) {
|
|
43658
|
+
event.stopPropagation();
|
|
43659
|
+
openFile(item.errorDownloadUrl, "".concat(item.taskId, "-\u9519\u8BEF\u6587\u4EF6"));
|
|
43660
|
+
}
|
|
43661
|
+
}, "\u5BFC\u51FA\u9519\u8BEF")) : null].filter(Boolean)
|
|
43662
|
+
}, /*#__PURE__*/React$1.createElement(List.Item.Meta, {
|
|
43663
|
+
title: /*#__PURE__*/React$1.createElement(Space, null, taskTypeName(item.taskType), /*#__PURE__*/React$1.createElement(Tag, null, statusNames[item.taskStatus] || item.taskStatus)),
|
|
43664
|
+
description: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("div", null, item.taskId), /*#__PURE__*/React$1.createElement(Progress, {
|
|
43665
|
+
percent: item.progress || 0,
|
|
43666
|
+
size: "small"
|
|
43667
|
+
}))
|
|
43668
|
+
}));
|
|
43669
|
+
}
|
|
43670
|
+
})), taskCenterPath && onNavigateTaskCenter && (/*#__PURE__*/React$1.createElement(Button, {
|
|
43671
|
+
type: "link",
|
|
43672
|
+
onClick: function onClick() {
|
|
43673
|
+
setVisible(false);
|
|
43674
|
+
onNavigateTaskCenter(taskCenterPath);
|
|
43675
|
+
}
|
|
43676
|
+
}, "\u67E5\u770B\u5168\u90E8"))), /*#__PURE__*/React$1.createElement(Modal, {
|
|
43677
|
+
width: 720,
|
|
43678
|
+
title: "\u4EFB\u52A1\u8BE6\u60C5 \xB7 ".concat((detail === null || detail === void 0 ? void 0 : detail.taskId) || ''),
|
|
43679
|
+
visible: !!detail,
|
|
43680
|
+
footer: null,
|
|
43681
|
+
onCancel: function onCancel() {
|
|
43682
|
+
return setDetail(undefined);
|
|
43683
|
+
},
|
|
43684
|
+
destroyOnClose: true
|
|
43685
|
+
}, detail && (/*#__PURE__*/React$1.createElement(Descriptions, {
|
|
43686
|
+
bordered: true,
|
|
43687
|
+
size: "small",
|
|
43688
|
+
column: 2
|
|
43689
|
+
}, /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43690
|
+
label: "\u7C7B\u578B"
|
|
43691
|
+
}, taskTypeName(detail.taskType)), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43692
|
+
label: "\u72B6\u6001"
|
|
43693
|
+
}, statusNames[detail.taskStatus] || detail.taskStatus), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43694
|
+
label: "\u6A21\u677F"
|
|
43695
|
+
}, detail.templateName || '-'), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43696
|
+
label: "\u64CD\u4F5C\u4EBA"
|
|
43697
|
+
}, detail.operatorName || '-'), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43698
|
+
label: "\u6587\u4EF6\u540D"
|
|
43699
|
+
}, detail.fileName || '-'), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43700
|
+
label: "\u521B\u5EFA\u65F6\u95F4"
|
|
43701
|
+
}, detail.createdTime || '-'), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43702
|
+
label: "\u6210\u529F\u884C\u6570"
|
|
43703
|
+
}, (_detail$successCount = detail.successCount) !== null && _detail$successCount !== void 0 ? _detail$successCount : '-'), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43704
|
+
label: "\u5931\u8D25\u884C\u6570"
|
|
43705
|
+
}, (_detail$failedCount = detail.failedCount) !== null && _detail$failedCount !== void 0 ? _detail$failedCount : '-'), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43706
|
+
label: "\u8DF3\u8FC7\u884C\u6570"
|
|
43707
|
+
}, (_detail$skippedCount = detail.skippedCount) !== null && _detail$skippedCount !== void 0 ? _detail$skippedCount : '-'), /*#__PURE__*/React$1.createElement(Descriptions.Item, {
|
|
43708
|
+
label: "\u8017\u65F6"
|
|
43709
|
+
}, detail.elapsedSeconds == null ? '-' : "".concat(detail.elapsedSeconds, "s"))))));
|
|
43710
|
+
};
|
|
43711
|
+
|
|
43712
|
+
var POLL_INTERVAL_MS$1 = 2000;
|
|
43713
|
+
var terminalStatuses = ['SUCCESS', 'PARTIAL_SUCCESS', 'PASSED', 'COMPLETED_WITH_ERRORS', 'FAILED', 'CANCELLED'];
|
|
43714
|
+
var statusView = {
|
|
43715
|
+
PENDING: {
|
|
43716
|
+
color: 'default',
|
|
43717
|
+
text: '等待执行'
|
|
43718
|
+
},
|
|
43719
|
+
CREATED: {
|
|
43720
|
+
color: 'default',
|
|
43721
|
+
text: '等待执行'
|
|
43722
|
+
},
|
|
43723
|
+
RUNNING: {
|
|
43724
|
+
color: 'processing',
|
|
43725
|
+
text: '执行中'
|
|
43726
|
+
},
|
|
43727
|
+
WAITING_EXECUTE: {
|
|
43728
|
+
color: 'warning',
|
|
43729
|
+
text: '等待确认'
|
|
43730
|
+
},
|
|
43731
|
+
VERIFYING: {
|
|
43732
|
+
color: 'processing',
|
|
43733
|
+
text: '结果核对中'
|
|
43734
|
+
},
|
|
43735
|
+
SUCCESS: {
|
|
43736
|
+
color: 'success',
|
|
43737
|
+
text: '成功'
|
|
43738
|
+
},
|
|
43739
|
+
PARTIAL_SUCCESS: {
|
|
43740
|
+
color: 'warning',
|
|
43741
|
+
text: '部分成功'
|
|
43742
|
+
},
|
|
43743
|
+
PASSED: {
|
|
43744
|
+
color: 'success',
|
|
43745
|
+
text: '校验通过'
|
|
43746
|
+
},
|
|
43747
|
+
COMPLETED_WITH_ERRORS: {
|
|
43748
|
+
color: 'warning',
|
|
43749
|
+
text: '校验完成(含异常)'
|
|
43750
|
+
},
|
|
43751
|
+
FAILED: {
|
|
43752
|
+
color: 'error',
|
|
43753
|
+
text: '失败'
|
|
43754
|
+
},
|
|
43755
|
+
CANCELLED: {
|
|
43756
|
+
color: 'default',
|
|
43757
|
+
text: '已取消'
|
|
43758
|
+
}
|
|
43759
|
+
};
|
|
43760
|
+
var taskTypeColors = {
|
|
43761
|
+
IMPORT_VALIDATION: 'blue',
|
|
43762
|
+
IMPORT_EXECUTION: 'geekblue',
|
|
43763
|
+
IMPORT: 'geekblue',
|
|
43764
|
+
EXPORT: 'purple',
|
|
43765
|
+
TEMPLATE_DOWNLOAD: 'cyan'
|
|
43766
|
+
};
|
|
43767
|
+
var triggerDownload = function triggerDownload(url, fileName) {
|
|
43768
|
+
var link = document.createElement('a');
|
|
43769
|
+
link.href = url;
|
|
43770
|
+
link.download = fileName;
|
|
43771
|
+
document.body.appendChild(link);
|
|
43772
|
+
link.click();
|
|
43773
|
+
document.body.removeChild(link);
|
|
43774
|
+
message$1.success('文件下载已开始');
|
|
43775
|
+
};
|
|
43776
|
+
/**
|
|
43777
|
+
* 轮询并展示当前页面创建的文件任务进度。
|
|
43778
|
+
*/
|
|
43779
|
+
var TaskProgress = function TaskProgress(_ref) {
|
|
43780
|
+
var tasks = _ref.tasks,
|
|
43781
|
+
services = _ref.services,
|
|
43782
|
+
taskCenterPath = _ref.taskCenterPath,
|
|
43783
|
+
onNavigateTaskCenter = _ref.onNavigateTaskCenter,
|
|
43784
|
+
onTaskUpdated = _ref.onTaskUpdated,
|
|
43785
|
+
onClose = _ref.onClose;
|
|
43786
|
+
var _useState = useState(false),
|
|
43787
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43788
|
+
collapsed = _useState2[0],
|
|
43789
|
+
setCollapsed = _useState2[1];
|
|
43790
|
+
var runningTasks = useMemo(function () {
|
|
43791
|
+
return tasks.filter(function (task) {
|
|
43792
|
+
return Boolean(task.taskId) && !terminalStatuses.includes(task.taskStatus);
|
|
43793
|
+
});
|
|
43794
|
+
}, [tasks]);
|
|
43795
|
+
var pollingKey = runningTasks.map(function (task) {
|
|
43796
|
+
return "".concat(task.taskId, ":").concat(task.serviceContext || '');
|
|
43797
|
+
}).join('|');
|
|
43798
|
+
useEffect(function () {
|
|
43799
|
+
if (runningTasks.length === 0) return undefined;
|
|
43800
|
+
var stopped = false;
|
|
43801
|
+
var timer;
|
|
43802
|
+
var _poll = /*#__PURE__*/function () {
|
|
43803
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
43804
|
+
return _regenerator().w(function (_context2) {
|
|
43805
|
+
while (1) switch (_context2.n) {
|
|
43806
|
+
case 0:
|
|
43807
|
+
_context2.n = 1;
|
|
43808
|
+
return Promise.all(runningTasks.map(/*#__PURE__*/function () {
|
|
43809
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(task) {
|
|
43810
|
+
var response, _t;
|
|
43811
|
+
return _regenerator().w(function (_context) {
|
|
43812
|
+
while (1) switch (_context.p = _context.n) {
|
|
43813
|
+
case 0:
|
|
43814
|
+
if (task.serviceContext) {
|
|
43815
|
+
_context.n = 1;
|
|
43816
|
+
break;
|
|
43817
|
+
}
|
|
43818
|
+
return _context.a(2);
|
|
43819
|
+
case 1:
|
|
43820
|
+
_context.p = 1;
|
|
43821
|
+
_context.n = 2;
|
|
43822
|
+
return services.queryTask(task.serviceContext, task.taskId);
|
|
43823
|
+
case 2:
|
|
43824
|
+
response = _context.v;
|
|
43825
|
+
if (!stopped) {
|
|
43826
|
+
onTaskUpdated(_objectSpread2(_objectSpread2(_objectSpread2({}, task), normalizeTask(unwrapResponse(response))), {}, {
|
|
43827
|
+
serviceContext: task.serviceContext
|
|
43828
|
+
}));
|
|
43829
|
+
}
|
|
43830
|
+
_context.n = 4;
|
|
43831
|
+
break;
|
|
43832
|
+
case 3:
|
|
43833
|
+
_context.p = 3;
|
|
43834
|
+
_t = _context.v;
|
|
43835
|
+
case 4:
|
|
43836
|
+
return _context.a(2);
|
|
43837
|
+
}
|
|
43838
|
+
}, _callee, null, [[1, 3]]);
|
|
43839
|
+
}));
|
|
43840
|
+
return function (_x) {
|
|
43841
|
+
return _ref3.apply(this, arguments);
|
|
43842
|
+
};
|
|
43843
|
+
}()));
|
|
43844
|
+
case 1:
|
|
43845
|
+
if (!stopped) {
|
|
43846
|
+
timer = window.setTimeout(_poll, POLL_INTERVAL_MS$1);
|
|
43847
|
+
}
|
|
43848
|
+
case 2:
|
|
43849
|
+
return _context2.a(2);
|
|
43850
|
+
}
|
|
43851
|
+
}, _callee2);
|
|
43852
|
+
}));
|
|
43853
|
+
return function poll() {
|
|
43854
|
+
return _ref2.apply(this, arguments);
|
|
43855
|
+
};
|
|
43856
|
+
}();
|
|
43857
|
+
_poll();
|
|
43858
|
+
return function () {
|
|
43859
|
+
stopped = true;
|
|
43860
|
+
if (timer != null) window.clearTimeout(timer);
|
|
43861
|
+
};
|
|
43862
|
+
}, [pollingKey, services, onTaskUpdated]);
|
|
43863
|
+
if (tasks.length === 0) return null;
|
|
43864
|
+
var primaryTask = runningTasks[0] || tasks[0];
|
|
43865
|
+
return /*#__PURE__*/React$1.createElement(Card, {
|
|
43866
|
+
size: "small",
|
|
43867
|
+
title: /*#__PURE__*/React$1.createElement(Space, null, "\u6587\u4EF6\u4EFB\u52A1", /*#__PURE__*/React$1.createElement(Badge, {
|
|
43868
|
+
count: tasks.length
|
|
43869
|
+
})),
|
|
43870
|
+
extra: /*#__PURE__*/React$1.createElement(Space, null, taskCenterPath && onNavigateTaskCenter && (/*#__PURE__*/React$1.createElement(Button, {
|
|
43871
|
+
type: "link",
|
|
43872
|
+
size: "small",
|
|
43873
|
+
onClick: function onClick() {
|
|
43874
|
+
return onNavigateTaskCenter(taskCenterPath);
|
|
43875
|
+
}
|
|
43876
|
+
}, "\u5168\u90E8")), /*#__PURE__*/React$1.createElement(Button, {
|
|
43877
|
+
type: "link",
|
|
43878
|
+
size: "small",
|
|
43879
|
+
onClick: onClose
|
|
43880
|
+
}, "\u5173\u95ED"), /*#__PURE__*/React$1.createElement(Button, {
|
|
43881
|
+
type: "text",
|
|
43882
|
+
size: "small",
|
|
43883
|
+
"aria-label": collapsed ? '展开文件任务' : '收起文件任务',
|
|
43884
|
+
icon: collapsed ? /*#__PURE__*/React$1.createElement(UpOutlined, null) : /*#__PURE__*/React$1.createElement(DownOutlined, null),
|
|
43885
|
+
onClick: function onClick() {
|
|
43886
|
+
return setCollapsed(function (value) {
|
|
43887
|
+
return !value;
|
|
43888
|
+
});
|
|
43889
|
+
}
|
|
43890
|
+
})),
|
|
43891
|
+
style: {
|
|
43892
|
+
position: 'fixed',
|
|
43893
|
+
right: 24,
|
|
43894
|
+
bottom: 24,
|
|
43895
|
+
width: 360,
|
|
43896
|
+
zIndex: 40
|
|
43897
|
+
},
|
|
43898
|
+
bodyStyle: {
|
|
43899
|
+
maxHeight: 'min(520px, calc(100vh - 180px))',
|
|
43900
|
+
overflowY: 'auto'
|
|
43901
|
+
}
|
|
43902
|
+
}, collapsed ? (/*#__PURE__*/React$1.createElement(Space, {
|
|
43903
|
+
direction: "vertical",
|
|
43904
|
+
style: {
|
|
43905
|
+
width: '100%'
|
|
43906
|
+
}
|
|
43907
|
+
}, /*#__PURE__*/React$1.createElement(Tag, {
|
|
43908
|
+
color: taskTypeColors[primaryTask.taskType] || 'default'
|
|
43909
|
+
}, taskTypeName(primaryTask.taskType)), /*#__PURE__*/React$1.createElement(Progress, {
|
|
43910
|
+
percent: primaryTask.progress || 0,
|
|
43911
|
+
size: "small"
|
|
43912
|
+
}))) : tasks.map(function (task) {
|
|
43913
|
+
var status = statusView[task.taskStatus] || {
|
|
43914
|
+
color: 'default',
|
|
43915
|
+
text: task.taskStatus
|
|
43916
|
+
};
|
|
43917
|
+
var operationLabel = taskTypeName(task.taskType);
|
|
43918
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
43919
|
+
key: task.taskId,
|
|
43920
|
+
style: {
|
|
43921
|
+
padding: '10px 0',
|
|
43922
|
+
borderBottom: '1px solid #f0f0f0'
|
|
43923
|
+
}
|
|
43924
|
+
}, /*#__PURE__*/React$1.createElement(Tag, {
|
|
43925
|
+
color: taskTypeColors[task.taskType] || 'default'
|
|
43926
|
+
}, operationLabel), /*#__PURE__*/React$1.createElement(Space, {
|
|
43927
|
+
style: {
|
|
43928
|
+
marginTop: 6
|
|
43929
|
+
}
|
|
43930
|
+
}, /*#__PURE__*/React$1.createElement(Tag, {
|
|
43931
|
+
color: status.color
|
|
43932
|
+
}, status.text), /*#__PURE__*/React$1.createElement("span", null, "\u5DF2\u5904\u7406 ", task.processedCount || 0, task.totalCount == null ? ' 行' : " / ".concat(task.totalCount, " \u884C")), task.elapsedSeconds != null && (/*#__PURE__*/React$1.createElement("span", null, "\u8017\u65F6 ", task.elapsedSeconds, "s"))), /*#__PURE__*/React$1.createElement(Progress, {
|
|
43933
|
+
percent: task.progress || 0,
|
|
43934
|
+
size: "small"
|
|
43935
|
+
}), task.taskStatus === 'FAILED' && task.errorMessage && (/*#__PURE__*/React$1.createElement(Tooltip, {
|
|
43936
|
+
title: task.errorMessage
|
|
43937
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
43938
|
+
"aria-label": task.errorMessage,
|
|
43939
|
+
style: {
|
|
43940
|
+
color: '#e82d1e',
|
|
43941
|
+
marginBottom: 4,
|
|
43942
|
+
overflow: 'hidden',
|
|
43943
|
+
textOverflow: 'ellipsis',
|
|
43944
|
+
whiteSpace: 'nowrap'
|
|
43945
|
+
}
|
|
43946
|
+
}, task.errorMessage))), /*#__PURE__*/React$1.createElement(Space, null, task.resultDownloadUrl && (/*#__PURE__*/React$1.createElement(Button, {
|
|
43947
|
+
type: "link",
|
|
43948
|
+
size: "small",
|
|
43949
|
+
onClick: function onClick() {
|
|
43950
|
+
return triggerDownload(task.resultDownloadUrl, "".concat(task.templateName || task.taskId, "-\u7ED3\u679C\u6587\u4EF6"));
|
|
43951
|
+
}
|
|
43952
|
+
}, "\u4E0B\u8F7D\u7ED3\u679C\u6587\u4EF6")), task.errorDownloadUrl && (/*#__PURE__*/React$1.createElement(Button, {
|
|
43953
|
+
type: "link",
|
|
43954
|
+
size: "small",
|
|
43955
|
+
danger: true,
|
|
43956
|
+
onClick: function onClick() {
|
|
43957
|
+
return triggerDownload(task.errorDownloadUrl, "".concat(task.templateName || task.taskId, "-\u9519\u8BEF\u6587\u4EF6"));
|
|
43958
|
+
}
|
|
43959
|
+
}, "\u4E0B\u8F7D\u9519\u8BEF\u6587\u4EF6"))));
|
|
43960
|
+
}));
|
|
43961
|
+
};
|
|
43962
|
+
|
|
43963
|
+
/**
|
|
43964
|
+
* 根据业务配置和后端服务上下文生成一次导入或导出请求上下文。
|
|
43965
|
+
*/
|
|
43966
|
+
var createRequestContext = function createRequestContext(config, businessFunctionCode, serviceContext, operationType) {
|
|
43967
|
+
var _config$getQueryParam;
|
|
43968
|
+
return _objectSpread2({
|
|
43969
|
+
businessFunctionCode: businessFunctionCode,
|
|
43970
|
+
serviceContext: serviceContext,
|
|
43971
|
+
operationType: operationType
|
|
43972
|
+
}, operationType === 'EXPORT' ? {
|
|
43973
|
+
conditions: ((_config$getQueryParam = config.getQueryParams) === null || _config$getQueryParam === void 0 ? void 0 : _config$getQueryParam.call(config)) || {}
|
|
43974
|
+
} : {});
|
|
43975
|
+
};
|
|
43976
|
+
|
|
43977
|
+
/**
|
|
43978
|
+
* 根据操作类型和按钮权限编码解析关联的业务功能编码。
|
|
43979
|
+
*
|
|
43980
|
+
* 导入使用独立入口;快速导出和模板导出共用任一已配置的导出入口。
|
|
43981
|
+
*/
|
|
43982
|
+
var resolveBusinessFunctionCode = function resolveBusinessFunctionCode(operationType, authCodes) {
|
|
43983
|
+
if (operationType === 'IMPORT') {
|
|
43984
|
+
return getRelationTemplateCode(authCodes.importCode);
|
|
43985
|
+
}
|
|
43986
|
+
return getRelationTemplateCode(authCodes.quickExportCode) || getRelationTemplateCode(authCodes.templateExportCode);
|
|
43987
|
+
};
|
|
43988
|
+
|
|
43989
|
+
/**
|
|
43990
|
+
* 判断是否启用多工作表能力。
|
|
43991
|
+
*/
|
|
43992
|
+
var isMultiSheetEnabled = function isMultiSheetEnabled(config) {
|
|
43993
|
+
return (config === null || config === void 0 ? void 0 : config.multiSheet) === true;
|
|
43994
|
+
};
|
|
43995
|
+
/**
|
|
43996
|
+
* 判断是否启用横向导出能力。
|
|
43997
|
+
*/
|
|
43998
|
+
var isHorizontalExportEnabled = function isHorizontalExportEnabled(config) {
|
|
43999
|
+
return (config === null || config === void 0 ? void 0 : config.horizontalExport) === true;
|
|
44000
|
+
};
|
|
44001
|
+
/**
|
|
44002
|
+
* 判断是否启用大文件导出能力。
|
|
44003
|
+
*/
|
|
44004
|
+
var isLargeFileExportEnabled = function isLargeFileExportEnabled(config) {
|
|
44005
|
+
return (config === null || config === void 0 ? void 0 : config.largeFile) === true;
|
|
44006
|
+
};
|
|
44007
|
+
|
|
44008
|
+
var BUSINESS_FUNCTION_UNAVAILABLE = '业务功能未配置或已停用,请联系管理员维护业务功能档案';
|
|
44009
|
+
/**
|
|
44010
|
+
* 统一承载导入、快速导出、模板导出和文件任务入口。
|
|
44011
|
+
*/
|
|
44012
|
+
var ImportExportActions = function ImportExportActions(_ref) {
|
|
44013
|
+
var config = _ref.config,
|
|
44014
|
+
serviceOverrides = _ref.services,
|
|
44015
|
+
importCode = _ref.importCode,
|
|
44016
|
+
quickExportCode = _ref.quickExportCode,
|
|
44017
|
+
templateExportCode = _ref.templateExportCode,
|
|
44018
|
+
_ref$taskCenterPath = _ref.taskCenterPath,
|
|
44019
|
+
taskCenterPath = _ref$taskCenterPath === void 0 ? '/configure/importExport/taskCenter' : _ref$taskCenterPath,
|
|
44020
|
+
_ref$showTaskDrawer = _ref.showTaskDrawer,
|
|
44021
|
+
showTaskDrawer = _ref$showTaskDrawer === void 0 ? true : _ref$showTaskDrawer,
|
|
44022
|
+
onNavigateTaskCenter = _ref.onNavigateTaskCenter;
|
|
44023
|
+
var _useState = useState(false),
|
|
44024
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44025
|
+
importVisible = _useState2[0],
|
|
44026
|
+
setImportVisible = _useState2[1];
|
|
44027
|
+
var _useState3 = useState(false),
|
|
44028
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
44029
|
+
importRouteLoading = _useState4[0],
|
|
44030
|
+
setImportRouteLoading = _useState4[1];
|
|
44031
|
+
var _useState5 = useState(),
|
|
44032
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
44033
|
+
importContext = _useState6[0],
|
|
44034
|
+
setImportContext = _useState6[1];
|
|
44035
|
+
var _useState7 = useState([]),
|
|
44036
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
44037
|
+
tasks = _useState8[0],
|
|
44038
|
+
setTasks = _useState8[1];
|
|
44039
|
+
var services = useMemo(function () {
|
|
44040
|
+
return resolveImportExportServices(serviceOverrides);
|
|
44041
|
+
}, [serviceOverrides]);
|
|
44042
|
+
var showImport = !!authFunc(importCode);
|
|
44043
|
+
var showQuickExport = !!authFunc(quickExportCode);
|
|
44044
|
+
var showTemplateExport = !!authFunc(templateExportCode);
|
|
44045
|
+
var authCodes = {
|
|
44046
|
+
importCode: importCode,
|
|
44047
|
+
quickExportCode: quickExportCode,
|
|
44048
|
+
templateExportCode: templateExportCode
|
|
44049
|
+
};
|
|
44050
|
+
var taskBusinessFunctionCodes = Array.from(new Set([resolveBusinessFunctionCode('IMPORT', authCodes), resolveBusinessFunctionCode('EXPORT', authCodes)].filter(Boolean)));
|
|
44051
|
+
/**
|
|
44052
|
+
* 解析当前操作使用的业务功能和服务上下文。
|
|
44053
|
+
*/
|
|
44054
|
+
var _resolveRequestContext = /*#__PURE__*/function () {
|
|
44055
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(operationType) {
|
|
44056
|
+
var businessFunctionCode, _response$data, response, resolved, _t;
|
|
44057
|
+
return _regenerator().w(function (_context) {
|
|
44058
|
+
while (1) switch (_context.p = _context.n) {
|
|
44059
|
+
case 0:
|
|
44060
|
+
businessFunctionCode = resolveBusinessFunctionCode(operationType, authCodes);
|
|
44061
|
+
if (businessFunctionCode) {
|
|
44062
|
+
_context.n = 1;
|
|
44063
|
+
break;
|
|
44064
|
+
}
|
|
44065
|
+
message$1.warning(BUSINESS_FUNCTION_UNAVAILABLE);
|
|
44066
|
+
return _context.a(2, undefined);
|
|
44067
|
+
case 1:
|
|
44068
|
+
_context.p = 1;
|
|
44069
|
+
_context.n = 2;
|
|
44070
|
+
return services.resolveBusinessFunction(businessFunctionCode);
|
|
44071
|
+
case 2:
|
|
44072
|
+
response = _context.v;
|
|
44073
|
+
resolved = (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.data) || (response === null || response === void 0 ? void 0 : response.data) || response;
|
|
44074
|
+
if (!(!(resolved === null || resolved === void 0 ? void 0 : resolved.serviceContext) || Number(resolved.status) !== 1)) {
|
|
44075
|
+
_context.n = 3;
|
|
44076
|
+
break;
|
|
44077
|
+
}
|
|
44078
|
+
throw new Error(BUSINESS_FUNCTION_UNAVAILABLE);
|
|
44079
|
+
case 3:
|
|
44080
|
+
return _context.a(2, createRequestContext(config, businessFunctionCode, resolved.serviceContext, operationType));
|
|
44081
|
+
case 4:
|
|
44082
|
+
_context.p = 4;
|
|
44083
|
+
_t = _context.v;
|
|
44084
|
+
message$1.warning(BUSINESS_FUNCTION_UNAVAILABLE);
|
|
44085
|
+
return _context.a(2, undefined);
|
|
44086
|
+
}
|
|
44087
|
+
}, _callee, null, [[1, 4]]);
|
|
44088
|
+
}));
|
|
44089
|
+
return function resolveRequestContext(_x) {
|
|
44090
|
+
return _ref2.apply(this, arguments);
|
|
44091
|
+
};
|
|
44092
|
+
}();
|
|
44093
|
+
var openImport = /*#__PURE__*/function () {
|
|
44094
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
44095
|
+
var context;
|
|
44096
|
+
return _regenerator().w(function (_context2) {
|
|
44097
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
44098
|
+
case 0:
|
|
44099
|
+
setImportRouteLoading(true);
|
|
44100
|
+
_context2.p = 1;
|
|
44101
|
+
_context2.n = 2;
|
|
44102
|
+
return _resolveRequestContext('IMPORT');
|
|
44103
|
+
case 2:
|
|
44104
|
+
context = _context2.v;
|
|
44105
|
+
if (context) {
|
|
44106
|
+
_context2.n = 3;
|
|
44107
|
+
break;
|
|
44108
|
+
}
|
|
44109
|
+
return _context2.a(2);
|
|
44110
|
+
case 3:
|
|
44111
|
+
setImportContext(context);
|
|
44112
|
+
setImportVisible(true);
|
|
44113
|
+
case 4:
|
|
44114
|
+
_context2.p = 4;
|
|
44115
|
+
setImportRouteLoading(false);
|
|
44116
|
+
return _context2.f(4);
|
|
44117
|
+
case 5:
|
|
44118
|
+
return _context2.a(2);
|
|
44119
|
+
}
|
|
44120
|
+
}, _callee2, null, [[1,, 4, 5]]);
|
|
44121
|
+
}));
|
|
44122
|
+
return function openImport() {
|
|
44123
|
+
return _ref3.apply(this, arguments);
|
|
44124
|
+
};
|
|
44125
|
+
}();
|
|
44126
|
+
var addTask = useCallback(function (task) {
|
|
44127
|
+
if (!(task === null || task === void 0 ? void 0 : task.taskId)) return;
|
|
44128
|
+
setTasks(function (items) {
|
|
44129
|
+
return [task].concat(_toConsumableArray(items.filter(function (item) {
|
|
44130
|
+
return item.taskId !== task.taskId;
|
|
44131
|
+
})));
|
|
44132
|
+
});
|
|
44133
|
+
}, []);
|
|
44134
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Space, null, showImport && (/*#__PURE__*/React$1.createElement(Button, {
|
|
44135
|
+
loading: importRouteLoading,
|
|
44136
|
+
onClick: openImport
|
|
44137
|
+
}, "\u5BFC\u5165")), (showQuickExport || showTemplateExport) && (/*#__PURE__*/React$1.createElement(ExportButton, {
|
|
44138
|
+
config: config,
|
|
44139
|
+
services: services,
|
|
44140
|
+
resolveRequestContext: function resolveRequestContext() {
|
|
44141
|
+
return _resolveRequestContext('EXPORT');
|
|
44142
|
+
},
|
|
44143
|
+
showQuickExport: showQuickExport,
|
|
44144
|
+
showTemplateExport: showTemplateExport,
|
|
44145
|
+
onTaskCreated: addTask
|
|
44146
|
+
})), showTaskDrawer && (/*#__PURE__*/React$1.createElement(TaskDrawer, {
|
|
44147
|
+
businessFunctionCodes: taskBusinessFunctionCodes,
|
|
44148
|
+
services: services,
|
|
44149
|
+
taskCenterPath: taskCenterPath,
|
|
44150
|
+
onNavigateTaskCenter: onNavigateTaskCenter
|
|
44151
|
+
}))), importContext && (/*#__PURE__*/React$1.createElement(ImportWizard, {
|
|
44152
|
+
visible: importVisible,
|
|
44153
|
+
context: importContext,
|
|
44154
|
+
documentName: config.documentName,
|
|
44155
|
+
services: services,
|
|
44156
|
+
onClose: function onClose() {
|
|
44157
|
+
return setImportVisible(false);
|
|
44158
|
+
},
|
|
44159
|
+
onTaskCreated: addTask
|
|
44160
|
+
})), /*#__PURE__*/React$1.createElement(TaskProgress, {
|
|
44161
|
+
tasks: tasks,
|
|
44162
|
+
services: services,
|
|
44163
|
+
taskCenterPath: taskCenterPath,
|
|
44164
|
+
onNavigateTaskCenter: onNavigateTaskCenter,
|
|
44165
|
+
onTaskUpdated: addTask,
|
|
44166
|
+
onClose: function onClose() {
|
|
44167
|
+
return setTasks([]);
|
|
44168
|
+
}
|
|
44169
|
+
}));
|
|
44170
|
+
};
|
|
44171
|
+
|
|
44172
|
+
export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, AuthButton, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, CustomSelector, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportButton, ExportIcon, index$8 as ExtendedCollapse, GuideWrapper, HandleTotalCount, index$4 as HomePageWrapper, ImportExportActions, ImportWizard, JsonQueryTable, ModalUtils, index$6 as MoreTreeTable, ParagraphCopier, PropertySelector, QueryMutipleInput, QueryMutipleSearchSelect, RenderCompItem, RuleObjectComponent as RuleComponent, index$7 as RuleSetter, SearchSelect, Section, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, SystemLog, TableColumnSetting, TaskDrawer, TaskProgress, TreeSearchSelect, PathDisplay as TrialCalculation, authFunc, buildSdkUrl, calculateValidPeriod, checkQuantityAccuracy, concurrentLimitCode, _coverToParallel as coverToParallel, createImportExportServices, createRequestContext, createUniqID, defaultImportExportServices, downloadExcel, ergodicMenuRoutes, formContainerAndItemLayout, _formatter as formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getCommonInfoKey, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth$1 as getItemDefaultWidth, getItems, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getRelationTemplateCode, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender$1 as handleCommonTimeRender, handleConvertResponse, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble$1 as handleTextDouble, handleTextDoubleOrId, handleTextLineFeed$1 as handleTextLineFeed, handleTextOverflow$1 as handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip$1 as handleTooltip, handleTooltipHours$1 as handleTooltipHours, handleUserPhone, isConcurrentLimit, isHorizontalExportEnabled, isLargeFileExportEnabled, isMultiSheetEnabled, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, keyToWord, memoizeOneFormatter, noEmptyArr, noEmptyArray, normalizeServiceContext, normalizeTask, paramsControl, parseWidth, precisionQuantity, processDetailButtonsVisible, randomString, readerXlsxToList, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, resolveBusinessFunctionCode, resolveImportExportServices, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, socketFunctions, sulaTableRenderTooltip, tableColumnsImage$1 as tableColumnsImage, taskTypeName, textIcon, unwrapResponse, updateGuanDate, userColumns$1 as userColumns, userInfoCard$1 as userInfoCard, uuid, writeListToXlsx };
|