@pisell/materials 1.0.313 → 1.0.315
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +4 -4
- package/build/lowcode/render/default/view.js +6 -6
- package/build/lowcode/view.js +6 -6
- package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -1
- package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.js +5 -4
- package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.d.ts +6 -1
- package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js +37 -40
- package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -1
- package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.js +3 -2
- package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.js +14 -23
- package/es/components/table/Actions/component/ExportImport/index.js +34 -17
- package/es/components/table/serve.d.ts +3 -5
- package/es/components/table/serve.js +5 -22
- package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -1
- package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.js +4 -3
- package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.d.ts +6 -1
- package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.js +20 -23
- package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -1
- package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.js +2 -1
- package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.js +7 -4
- package/lib/components/table/Actions/component/ExportImport/index.js +23 -6
- package/lib/components/table/serve.d.ts +3 -5
- package/lib/components/table/serve.js +4 -18
- package/package.json +3 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ExportImportType } from "../../../../../types";
|
|
3
3
|
import "./index.less";
|
|
4
|
-
declare const ExportFile: (props:
|
|
4
|
+
declare const ExportFile: (props: {
|
|
5
|
+
exportImport: ExportImportType;
|
|
6
|
+
}) => React.JSX.Element;
|
|
5
7
|
export default ExportFile;
|
|
@@ -26,15 +26,16 @@ var defaultData = {
|
|
|
26
26
|
skip: 1,
|
|
27
27
|
num: 10
|
|
28
28
|
};
|
|
29
|
-
var
|
|
29
|
+
var exportStatusOptions = {
|
|
30
30
|
pending: getText("table-action-export-import-file-pending"),
|
|
31
31
|
processing: getText("table-action-export-import-file-processing"),
|
|
32
32
|
completed: getText("table-action-export-import-file-completed"),
|
|
33
33
|
complete: getText("table-action-export-import-file-completed")
|
|
34
34
|
};
|
|
35
35
|
var ExportFile = function ExportFile(props) {
|
|
36
|
-
var
|
|
37
|
-
|
|
36
|
+
var exportImport = props.exportImport;
|
|
37
|
+
var formId = exportImport.formId,
|
|
38
|
+
formCode = exportImport.formCode;
|
|
38
39
|
var _useState = useState([]),
|
|
39
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
41
|
list = _useState2[0],
|
|
@@ -96,7 +97,7 @@ var ExportFile = function ExportFile(props) {
|
|
|
96
97
|
title: getText("table-action-export-import-file-status"),
|
|
97
98
|
dataIndex: "status",
|
|
98
99
|
render: function render(text) {
|
|
99
|
-
return
|
|
100
|
+
return exportStatusOptions[text];
|
|
100
101
|
}
|
|
101
102
|
}, {
|
|
102
103
|
title: getText("table-action-export-import-file-account"),
|
package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
interface IExportParams {
|
|
2
|
+
type: string;
|
|
3
|
+
dataSource: any;
|
|
4
|
+
}
|
|
5
|
+
export declare const batchExport: (exportParams: IExportParams, exportImport: any) => Promise<true | undefined>;
|
|
6
|
+
export {};
|
package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js
CHANGED
|
@@ -4,37 +4,23 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
5
|
import { message } from "antd";
|
|
6
6
|
import { getText } from "../../../../../../../locales/index";
|
|
7
|
-
import {
|
|
7
|
+
import { exportData } from "../../../../../serve";
|
|
8
8
|
import { defaultOptions } from "../../../../../status";
|
|
9
9
|
import { getFileDateName } from "../../utils/file";
|
|
10
10
|
// 导出接口
|
|
11
11
|
var _batchExport = /*#__PURE__*/function () {
|
|
12
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(
|
|
13
|
-
var
|
|
14
|
-
var formId, formCode, res;
|
|
12
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
13
|
+
var _yield$exportData, status;
|
|
15
14
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
16
15
|
while (1) switch (_context.prev = _context.next) {
|
|
17
16
|
case 0:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_context.next = 6;
|
|
26
|
-
return formIdExport(formId, params);
|
|
27
|
-
case 6:
|
|
28
|
-
res = _context.sent;
|
|
29
|
-
_context.next = 10;
|
|
30
|
-
break;
|
|
31
|
-
case 9:
|
|
32
|
-
if (formCode) {
|
|
33
|
-
res = formCodeExport(formCode, params);
|
|
34
|
-
}
|
|
35
|
-
case 10:
|
|
36
|
-
if (!((_res = res) !== null && _res !== void 0 && _res.status)) {
|
|
37
|
-
_context.next = 16;
|
|
17
|
+
_context.next = 2;
|
|
18
|
+
return exportData(params);
|
|
19
|
+
case 2:
|
|
20
|
+
_yield$exportData = _context.sent;
|
|
21
|
+
status = _yield$exportData.status;
|
|
22
|
+
if (!status) {
|
|
23
|
+
_context.next = 10;
|
|
38
24
|
break;
|
|
39
25
|
}
|
|
40
26
|
message.success({
|
|
@@ -43,44 +29,55 @@ var _batchExport = /*#__PURE__*/function () {
|
|
|
43
29
|
});
|
|
44
30
|
localStorage.setItem("dot", "true");
|
|
45
31
|
return _context.abrupt("return", true);
|
|
46
|
-
case
|
|
32
|
+
case 10:
|
|
47
33
|
message.destroy();
|
|
48
|
-
case
|
|
34
|
+
case 11:
|
|
49
35
|
case "end":
|
|
50
36
|
return _context.stop();
|
|
51
37
|
}
|
|
52
38
|
}, _callee);
|
|
53
39
|
}));
|
|
54
|
-
return function _batchExport(_x
|
|
40
|
+
return function _batchExport(_x) {
|
|
55
41
|
return _ref.apply(this, arguments);
|
|
56
42
|
};
|
|
57
43
|
}();
|
|
58
44
|
|
|
59
45
|
// 导出格式化
|
|
60
|
-
export var batchExport = function batchExport(
|
|
61
|
-
var selectLists = exportImport.selectLists
|
|
46
|
+
export var batchExport = function batchExport(exportParams, exportImport) {
|
|
47
|
+
var selectLists = exportImport.selectLists,
|
|
48
|
+
formId = exportImport.formId,
|
|
49
|
+
formCode = exportImport.formCode;
|
|
62
50
|
var _name = getFileDateName();
|
|
51
|
+
var params = {};
|
|
52
|
+
if (formId) {
|
|
53
|
+
params.form_id = formId;
|
|
54
|
+
}
|
|
55
|
+
if (formCode) {
|
|
56
|
+
params.code = formCode;
|
|
57
|
+
}
|
|
58
|
+
var type = (exportParams === null || exportParams === void 0 ? void 0 : exportParams.type) || defaultOptions.exportType;
|
|
59
|
+
|
|
63
60
|
// 当前页面
|
|
64
61
|
if (type === defaultOptions.exportType) {
|
|
62
|
+
var _exportParams$dataSou;
|
|
65
63
|
_name = "".concat(getText("table-action-export-import-current-page")).concat(_name);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
params.ids = (exportParams === null || exportParams === void 0 ? void 0 : (_exportParams$dataSou = exportParams.dataSource) === null || _exportParams$dataSou === void 0 ? void 0 : _exportParams$dataSou.map(function (item) {
|
|
65
|
+
return (item === null || item === void 0 ? void 0 : item.id) || (item === null || item === void 0 ? void 0 : item.form_record_id);
|
|
66
|
+
})) || [];
|
|
67
|
+
params.file_name = _name;
|
|
70
68
|
}
|
|
69
|
+
|
|
71
70
|
// 所有记录
|
|
72
71
|
if (type === "all-records") {
|
|
73
72
|
_name = "".concat(getText("table-action-export-import-all-records")).concat(_name);
|
|
74
|
-
|
|
75
|
-
file_name: _name
|
|
76
|
-
});
|
|
73
|
+
params.file_name = _name;
|
|
77
74
|
}
|
|
75
|
+
|
|
78
76
|
// 所选记录
|
|
79
77
|
if (type === "selected-records") {
|
|
80
78
|
_name = "".concat(getText("table-action-export-import-selected-records"), "(").concat(getText("table-action-export-import-selected"), " ").concat(getText("table-action-export-import-item")(selectLists === null || selectLists === void 0 ? void 0 : selectLists.length), ") ").concat(_name);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
file_name: _name
|
|
84
|
-
});
|
|
79
|
+
params.ids = selectLists || [];
|
|
80
|
+
params.file_name = _name;
|
|
85
81
|
}
|
|
82
|
+
return _batchExport(params);
|
|
86
83
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ExportImportType } from "../../../../../types";
|
|
3
3
|
import "./index.less";
|
|
4
|
-
declare const ImportLog: (props:
|
|
4
|
+
declare const ImportLog: (props: {
|
|
5
|
+
exportImport: ExportImportType;
|
|
6
|
+
}) => React.JSX.Element;
|
|
5
7
|
export default ImportLog;
|
|
@@ -27,8 +27,9 @@ var defaultData = {
|
|
|
27
27
|
num: 10
|
|
28
28
|
};
|
|
29
29
|
var ImportLog = function ImportLog(props) {
|
|
30
|
-
var
|
|
31
|
-
|
|
30
|
+
var exportImport = props.exportImport;
|
|
31
|
+
var formId = exportImport.formId,
|
|
32
|
+
formCode = exportImport.formCode;
|
|
32
33
|
var detailRef = useRef(null);
|
|
33
34
|
var _useState = useState([]),
|
|
34
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -14,7 +14,7 @@ import React, { useMemo, useState } from "react";
|
|
|
14
14
|
import useEngineContext from "../../../../../../../hooks/useEngineContext";
|
|
15
15
|
import { getText } from "../../../../../../../locales/index";
|
|
16
16
|
import IconFont from "../../../../../../iconfont";
|
|
17
|
-
import {
|
|
17
|
+
import { importTemplate } from "../../../../../serve";
|
|
18
18
|
import { defaultOptions } from "../../../../../status";
|
|
19
19
|
import { request } from "../../../../../utils";
|
|
20
20
|
import download from "../../utils/download";
|
|
@@ -36,42 +36,33 @@ var ImportTable = function ImportTable(props) {
|
|
|
36
36
|
request.setRequest(context.appHelper.utils.request);
|
|
37
37
|
var handleDownload = /*#__PURE__*/function () {
|
|
38
38
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
39
|
-
var _res
|
|
40
|
-
var res;
|
|
39
|
+
var _res$data;
|
|
40
|
+
var params, res;
|
|
41
41
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
42
42
|
while (1) switch (_context.prev = _context.next) {
|
|
43
43
|
case 0:
|
|
44
|
+
console.log("wh_export", exportImport);
|
|
44
45
|
message.loading({
|
|
45
46
|
content: "Loading...",
|
|
46
47
|
key: loadingKey
|
|
47
48
|
});
|
|
48
|
-
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
break;
|
|
49
|
+
params = {};
|
|
50
|
+
if (formId) {
|
|
51
|
+
params.form_id = formId;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
case 5:
|
|
56
|
-
res = _context.sent;
|
|
57
|
-
_context.next = 12;
|
|
58
|
-
break;
|
|
59
|
-
case 8:
|
|
60
|
-
if (!formCode) {
|
|
61
|
-
_context.next = 12;
|
|
62
|
-
break;
|
|
53
|
+
if (formCode) {
|
|
54
|
+
params.code = formCode;
|
|
63
55
|
}
|
|
64
|
-
_context.next =
|
|
65
|
-
return
|
|
66
|
-
case
|
|
56
|
+
_context.next = 7;
|
|
57
|
+
return importTemplate(params);
|
|
58
|
+
case 7:
|
|
67
59
|
res = _context.sent;
|
|
68
|
-
|
|
69
|
-
download((_res = res) === null || _res === void 0 ? void 0 : (_res$data = _res.data) === null || _res$data === void 0 ? void 0 : _res$data.url);
|
|
60
|
+
download(res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.url);
|
|
70
61
|
message.success({
|
|
71
62
|
content: getText("table-action-export-import-table-success-download"),
|
|
72
63
|
key: loadingKey
|
|
73
64
|
});
|
|
74
|
-
case
|
|
65
|
+
case 10:
|
|
75
66
|
case "end":
|
|
76
67
|
return _context.stop();
|
|
77
68
|
}
|
|
@@ -23,6 +23,8 @@ import ExportTable from "./components/ExportTable";
|
|
|
23
23
|
import { batchExport } from "./components/ExportTable/function";
|
|
24
24
|
import ImportLog from "./components/ImportLog";
|
|
25
25
|
import ImportTable from "./components/ImportTable";
|
|
26
|
+
import { useSharedState } from "../../../../../hooks";
|
|
27
|
+
import { Context } from "../../../model";
|
|
26
28
|
import "./index.less";
|
|
27
29
|
var Com = {
|
|
28
30
|
import: ImportTable,
|
|
@@ -32,9 +34,6 @@ var Com = {
|
|
|
32
34
|
};
|
|
33
35
|
var ExportImport = function ExportImport(_ref) {
|
|
34
36
|
var exportImport = _ref.exportImport;
|
|
35
|
-
var selectLists = exportImport.selectLists,
|
|
36
|
-
formId = exportImport.formId,
|
|
37
|
-
formCode = exportImport.formCode;
|
|
38
37
|
var _useState = useState(false),
|
|
39
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
39
|
open = _useState2[0],
|
|
@@ -55,8 +54,13 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
55
54
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
56
55
|
errorStatus = _useState10[0],
|
|
57
56
|
setErrorStatus = _useState10[1];
|
|
57
|
+
var _useSharedState = useSharedState(Context),
|
|
58
|
+
state = _useSharedState.state;
|
|
59
|
+
var defaultDataSource = state.dataSource,
|
|
60
|
+
originDataSource = state.originDataSource;
|
|
58
61
|
var context = useEngineContext();
|
|
59
62
|
request.setRequest(context.appHelper.utils.request);
|
|
63
|
+
console.log(defaultDataSource, originDataSource, "wh77");
|
|
60
64
|
var _items = useMemo(function () {
|
|
61
65
|
// 将对象转成数组
|
|
62
66
|
var result = Object.entries(exportImportOptions).map(function (_ref2) {
|
|
@@ -85,14 +89,19 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
85
89
|
return types.includes(value) ? 900 : defaultOptions.importValue ? 600 : 400;
|
|
86
90
|
}, [value]);
|
|
87
91
|
var _title = useMemo(function () {
|
|
88
|
-
if (exportImport !== null && exportImport !== void 0 && exportImport.title) return exportImport.title;
|
|
89
92
|
if (!value) return null;
|
|
93
|
+
var types = defaultOptions.okShowButtonTypes;
|
|
94
|
+
|
|
95
|
+
// 导出导入标题
|
|
96
|
+
if (types.includes(value) && exportImport !== null && exportImport !== void 0 && exportImport.title) {
|
|
97
|
+
return "".concat(exportImportOptions[value]).concat(exportImport.title);
|
|
98
|
+
}
|
|
90
99
|
return exportImportOptions[value];
|
|
91
100
|
}, [value, exportImport === null || exportImport === void 0 ? void 0 : exportImport.title]);
|
|
92
101
|
var _okText = useMemo(function () {
|
|
93
102
|
var types = defaultOptions.okShowButtonTypes;
|
|
94
103
|
if (types.includes(value)) {
|
|
95
|
-
return defaultOptions.exportValue ? getText("table-action-export-import-button") : getText("table-action-export-import-button-import");
|
|
104
|
+
return value === defaultOptions.exportValue ? getText("table-action-export-import-button") : getText("table-action-export-import-button-import");
|
|
96
105
|
}
|
|
97
106
|
}, [value]);
|
|
98
107
|
var handleClick = function handleClick(e) {
|
|
@@ -117,10 +126,9 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
117
126
|
content: getText("table-action-export-import-import-success"),
|
|
118
127
|
key: value
|
|
119
128
|
});
|
|
129
|
+
localStorage.setItem("dot", "true");
|
|
120
130
|
onCancel();
|
|
121
|
-
// localStorage.setItem("dot", "true");
|
|
122
131
|
},
|
|
123
|
-
|
|
124
132
|
onError: function onError(err) {
|
|
125
133
|
message.destroy();
|
|
126
134
|
setErrorStatus((err === null || err === void 0 ? void 0 : err.message) || null);
|
|
@@ -128,29 +136,38 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
128
136
|
});
|
|
129
137
|
var onOk = /*#__PURE__*/function () {
|
|
130
138
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
131
|
-
var result, formData;
|
|
139
|
+
var formId, formCode, _params, result, formData;
|
|
132
140
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
133
141
|
while (1) switch (_context.prev = _context.next) {
|
|
134
142
|
case 0:
|
|
143
|
+
formId = exportImport.formId, formCode = exportImport.formCode; // 导出
|
|
135
144
|
if (!(value === defaultOptions.exportValue)) {
|
|
136
|
-
_context.next =
|
|
145
|
+
_context.next = 9;
|
|
137
146
|
break;
|
|
138
147
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
148
|
+
_params = {
|
|
149
|
+
type: type,
|
|
150
|
+
dataSource: defaultDataSource
|
|
151
|
+
};
|
|
152
|
+
_context.next = 5;
|
|
153
|
+
return batchExport(_params, exportImport);
|
|
154
|
+
case 5:
|
|
142
155
|
result = _context.sent;
|
|
143
156
|
if (result) {
|
|
144
157
|
onCancel();
|
|
145
158
|
}
|
|
146
|
-
_context.next =
|
|
159
|
+
_context.next = 10;
|
|
147
160
|
break;
|
|
148
|
-
case
|
|
161
|
+
case 9:
|
|
149
162
|
if (value === defaultOptions.importValue) {
|
|
150
163
|
formData = new FormData();
|
|
151
164
|
formData.append("file", file);
|
|
152
|
-
|
|
153
|
-
|
|
165
|
+
if (formId) {
|
|
166
|
+
formData.append("form_id", formId);
|
|
167
|
+
}
|
|
168
|
+
if (formCode) {
|
|
169
|
+
formData.append("code", formCode);
|
|
170
|
+
}
|
|
154
171
|
if (formData) {
|
|
155
172
|
message.loading({
|
|
156
173
|
content: "Loading...",
|
|
@@ -159,7 +176,7 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
159
176
|
_batchImport.run(formData);
|
|
160
177
|
}
|
|
161
178
|
}
|
|
162
|
-
case
|
|
179
|
+
case 10:
|
|
163
180
|
case "end":
|
|
164
181
|
return _context.stop();
|
|
165
182
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
declare type exportParams = {
|
|
2
2
|
ids?: Array<string | number>;
|
|
3
3
|
file_name?: string;
|
|
4
|
+
form_id?: string | number;
|
|
5
|
+
code?: string;
|
|
4
6
|
};
|
|
5
7
|
export declare const exportData: (params: exportParams) => Promise<any>;
|
|
6
|
-
export declare const batchExport: (params: any) => Promise<any>;
|
|
7
|
-
export declare const formIdExport: (form_id: string | number, params: exportParams) => Promise<any>;
|
|
8
|
-
export declare const formCodeExport: (code: string, params: exportParams) => Promise<any>;
|
|
9
8
|
export declare const batchImport: (params: any) => Promise<any>;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const importFormIdTemplate: (form_id: string | number) => Promise<any>;
|
|
9
|
+
export declare const importTemplate: (params: exportParams) => Promise<any>;
|
|
12
10
|
export declare const historyData: (params: any) => Promise<any>;
|
|
13
11
|
export {};
|
|
@@ -5,34 +5,17 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
5
5
|
import { request } from "./utils";
|
|
6
6
|
// 导出
|
|
7
7
|
export var exportData = function exportData(params) {
|
|
8
|
-
return request.getRequest().
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// 导出
|
|
12
|
-
export var batchExport = function batchExport(params) {
|
|
13
|
-
return request.getRequest().get("/shop/form/data/export", params);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// 根据表单id导出
|
|
17
|
-
export var formIdExport = function formIdExport(form_id, params) {
|
|
18
|
-
return request.getRequest().post("/shop/form/data/export/".concat(form_id), params);
|
|
19
|
-
};
|
|
20
|
-
// 根据表单code导出
|
|
21
|
-
export var formCodeExport = function formCodeExport(code, params) {
|
|
22
|
-
return request.getRequest().get("/shop/form/data/export/code/".concat(code), params);
|
|
8
|
+
return request.getRequest().post("/shop/form/data/export", params);
|
|
23
9
|
};
|
|
24
10
|
|
|
25
11
|
// 导入
|
|
26
12
|
export var batchImport = function batchImport(params) {
|
|
27
13
|
return request.getRequest().post('/shop/form/data/import', params);
|
|
28
14
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// 根据form_id导入模版
|
|
34
|
-
export var importFormIdTemplate = function importFormIdTemplate(form_id) {
|
|
35
|
-
return request.getRequest().get("/shop/form/data/download-template/id/".concat(form_id));
|
|
15
|
+
|
|
16
|
+
// 导入模版
|
|
17
|
+
export var importTemplate = function importTemplate(params) {
|
|
18
|
+
return request.getRequest().post('/shop/form/data/download-template', params);
|
|
36
19
|
};
|
|
37
20
|
export var historyData = /*#__PURE__*/function () {
|
|
38
21
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ExportImportType } from "../../../../../types";
|
|
3
3
|
import "./index.less";
|
|
4
|
-
declare const ExportFile: (props:
|
|
4
|
+
declare const ExportFile: (props: {
|
|
5
|
+
exportImport: ExportImportType;
|
|
6
|
+
}) => React.JSX.Element;
|
|
5
7
|
export default ExportFile;
|
|
@@ -48,14 +48,15 @@ var defaultData = {
|
|
|
48
48
|
skip: 1,
|
|
49
49
|
num: 10
|
|
50
50
|
};
|
|
51
|
-
var
|
|
51
|
+
var exportStatusOptions = {
|
|
52
52
|
pending: (0, import_locales.getText)("table-action-export-import-file-pending"),
|
|
53
53
|
processing: (0, import_locales.getText)("table-action-export-import-file-processing"),
|
|
54
54
|
completed: (0, import_locales.getText)("table-action-export-import-file-completed"),
|
|
55
55
|
complete: (0, import_locales.getText)("table-action-export-import-file-completed")
|
|
56
56
|
};
|
|
57
57
|
var ExportFile = (props) => {
|
|
58
|
-
const {
|
|
58
|
+
const { exportImport } = props;
|
|
59
|
+
const { formId, formCode } = exportImport;
|
|
59
60
|
const [list, setList] = (0, import_react.useState)([]);
|
|
60
61
|
const [defaultParams, setDefaultParams] = (0, import_react.useState)(defaultData);
|
|
61
62
|
const context = (0, import_useEngineContext.default)();
|
|
@@ -114,7 +115,7 @@ var ExportFile = (props) => {
|
|
|
114
115
|
{
|
|
115
116
|
title: (0, import_locales.getText)("table-action-export-import-file-status"),
|
|
116
117
|
dataIndex: "status",
|
|
117
|
-
render: (text) =>
|
|
118
|
+
render: (text) => exportStatusOptions[text]
|
|
118
119
|
},
|
|
119
120
|
{
|
|
120
121
|
title: (0, import_locales.getText)("table-action-export-import-file-account"),
|
package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
interface IExportParams {
|
|
2
|
+
type: string;
|
|
3
|
+
dataSource: any;
|
|
4
|
+
}
|
|
5
|
+
export declare const batchExport: (exportParams: IExportParams, exportImport: any) => Promise<true | undefined>;
|
|
6
|
+
export {};
|
package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.js
CHANGED
|
@@ -27,16 +27,9 @@ var import_locales = require("../../../../../../../locales/index");
|
|
|
27
27
|
var import_serve = require("../../../../../serve");
|
|
28
28
|
var import_status = require("../../../../../status");
|
|
29
29
|
var import_file = require("../../utils/file");
|
|
30
|
-
var _batchExport = async (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.log(formCode, formId, "wh77");
|
|
34
|
-
if (formId) {
|
|
35
|
-
res = await (0, import_serve.formIdExport)(formId, params);
|
|
36
|
-
} else if (formCode) {
|
|
37
|
-
res = (0, import_serve.formCodeExport)(formCode, params);
|
|
38
|
-
}
|
|
39
|
-
if (res == null ? void 0 : res.status) {
|
|
30
|
+
var _batchExport = async (params) => {
|
|
31
|
+
let { status } = await (0, import_serve.exportData)(params);
|
|
32
|
+
if (status) {
|
|
40
33
|
import_antd.message.success({
|
|
41
34
|
content: (0, import_locales.getText)("table-action-export-import-export-success"),
|
|
42
35
|
key: import_status.defaultOptions.exportValue
|
|
@@ -47,31 +40,35 @@ var _batchExport = async (idCode, params) => {
|
|
|
47
40
|
import_antd.message.destroy();
|
|
48
41
|
}
|
|
49
42
|
};
|
|
50
|
-
var batchExport = (
|
|
51
|
-
|
|
43
|
+
var batchExport = (exportParams, exportImport) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const { selectLists, formId, formCode } = exportImport;
|
|
52
46
|
let _name = (0, import_file.getFileDateName)();
|
|
47
|
+
let params = {};
|
|
48
|
+
if (formId) {
|
|
49
|
+
params.form_id = formId;
|
|
50
|
+
}
|
|
51
|
+
if (formCode) {
|
|
52
|
+
params.code = formCode;
|
|
53
|
+
}
|
|
54
|
+
const type = (exportParams == null ? void 0 : exportParams.type) || import_status.defaultOptions.exportType;
|
|
53
55
|
if (type === import_status.defaultOptions.exportType) {
|
|
54
56
|
_name = `${(0, import_locales.getText)("table-action-export-import-current-page")}${_name}`;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
file_name: _name
|
|
58
|
-
});
|
|
57
|
+
params.ids = ((_a = exportParams == null ? void 0 : exportParams.dataSource) == null ? void 0 : _a.map((item) => (item == null ? void 0 : item.id) || (item == null ? void 0 : item.form_record_id))) || [];
|
|
58
|
+
params.file_name = _name;
|
|
59
59
|
}
|
|
60
60
|
if (type === "all-records") {
|
|
61
61
|
_name = `${(0, import_locales.getText)("table-action-export-import-all-records")}${_name}`;
|
|
62
|
-
|
|
63
|
-
file_name: _name
|
|
64
|
-
});
|
|
62
|
+
params.file_name = _name;
|
|
65
63
|
}
|
|
66
64
|
if (type === "selected-records") {
|
|
67
65
|
_name = `${(0, import_locales.getText)(
|
|
68
66
|
"table-action-export-import-selected-records"
|
|
69
67
|
)}(${(0, import_locales.getText)("table-action-export-import-selected")} ${(0, import_locales.getText)("table-action-export-import-item")(selectLists == null ? void 0 : selectLists.length)}) ${_name}`;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
file_name: _name
|
|
73
|
-
});
|
|
68
|
+
params.ids = selectLists || [];
|
|
69
|
+
params.file_name = _name;
|
|
74
70
|
}
|
|
71
|
+
return _batchExport(params);
|
|
75
72
|
};
|
|
76
73
|
// Annotate the CommonJS export names for ESM import in node:
|
|
77
74
|
0 && (module.exports = {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ExportImportType } from "../../../../../types";
|
|
3
3
|
import "./index.less";
|
|
4
|
-
declare const ImportLog: (props:
|
|
4
|
+
declare const ImportLog: (props: {
|
|
5
|
+
exportImport: ExportImportType;
|
|
6
|
+
}) => React.JSX.Element;
|
|
5
7
|
export default ImportLog;
|
|
@@ -49,7 +49,8 @@ var defaultData = {
|
|
|
49
49
|
num: 10
|
|
50
50
|
};
|
|
51
51
|
var ImportLog = (props) => {
|
|
52
|
-
const {
|
|
52
|
+
const { exportImport } = props;
|
|
53
|
+
const { formId, formCode } = exportImport;
|
|
53
54
|
const detailRef = (0, import_react.useRef)(null);
|
|
54
55
|
const [list, setList] = (0, import_react.useState)([]);
|
|
55
56
|
const [defaultParams, setDefaultParams] = (0, import_react.useState)(defaultData);
|
|
@@ -52,13 +52,16 @@ var ImportTable = (props) => {
|
|
|
52
52
|
import_utils.request.setRequest(context.appHelper.utils.request);
|
|
53
53
|
const handleDownload = async () => {
|
|
54
54
|
var _a;
|
|
55
|
+
console.log("wh_export", exportImport);
|
|
55
56
|
import_antd.message.loading({ content: "Loading...", key: loadingKey });
|
|
56
|
-
|
|
57
|
+
const params = {};
|
|
57
58
|
if (formId) {
|
|
58
|
-
|
|
59
|
-
} else if (formCode) {
|
|
60
|
-
res = await (0, import_serve.importCodeTemplate)(formCode);
|
|
59
|
+
params.form_id = formId;
|
|
61
60
|
}
|
|
61
|
+
if (formCode) {
|
|
62
|
+
params.code = formCode;
|
|
63
|
+
}
|
|
64
|
+
let res = await (0, import_serve.importTemplate)(params);
|
|
62
65
|
(0, import_download.default)((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.url);
|
|
63
66
|
import_antd.message.success({
|
|
64
67
|
content: (0, import_locales.getText)("table-action-export-import-table-success-download"),
|