uepay-mesh 4.0.12 → 4.0.13

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.
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ require("core-js/modules/web.dom.iterable.js");
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _antd = require("antd");
13
+
14
+ var _ExclamationCircleOutlined = _interopRequireDefault(require("@ant-design/icons/lib/icons/ExclamationCircleOutlined"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ const {
23
+ warning
24
+ } = _antd.Modal;
25
+
26
+ function Empty() {}
27
+
28
+ ;
29
+ /**
30
+ *
31
+ * @param title
32
+ * @param content
33
+ * @param delayTip {string} 延遲提示的信息
34
+ * @param delaySecond {number} 默認延遲時間 秒
35
+ * @param onCancel
36
+ * @param onComplete
37
+ */
38
+
39
+ function delayTip(title, content) {
40
+ let delayTip = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '執行';
41
+ let delaySecond = arguments.length > 3 ? arguments[3] : undefined;
42
+ let onComplete = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Empty;
43
+ let onCancel = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : Empty;
44
+
45
+ function handleDelayComplete() {
46
+ instance.destroy();
47
+ onComplete();
48
+ }
49
+
50
+ const instance = warning({
51
+ title: title,
52
+ icon: /*#__PURE__*/_react.default.createElement(_ExclamationCircleOutlined.default, null),
53
+ content: /*#__PURE__*/_react.default.createElement(_antd.Spin, null, /*#__PURE__*/_react.default.createElement(_antd.Alert, {
54
+ message: content,
55
+ type: "info"
56
+ })),
57
+ okText: /*#__PURE__*/_react.default.createElement(DelayBtn, {
58
+ delayTip: delayTip,
59
+ delaySecond: delaySecond,
60
+ onDelayComplete: handleDelayComplete
61
+ }),
62
+ okType: 'ghost',
63
+ onOk: onCancel
64
+ });
65
+ }
66
+
67
+ var _default = delayTip;
68
+ exports.default = _default;
69
+
70
+ function DelayBtn(_ref) {
71
+ let {
72
+ delayTip,
73
+ delaySecond,
74
+ onDelayComplete
75
+ } = _ref;
76
+ const [delay, setDelay] = (0, _react.useState)(delaySecond);
77
+ (0, _react.useEffect)(() => {
78
+ const idl = setInterval(() => {
79
+ setDelay(prev => {
80
+ const now = prev - 1;
81
+
82
+ if (0 === now) {
83
+ onDelayComplete();
84
+ clearInterval(idl);
85
+ }
86
+
87
+ return now;
88
+ });
89
+ }, 1000);
90
+ }, []);
91
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "\u53D6\u6D88(", delay, "\u79D2\u540E", delayTip, ")");
92
+ }
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.OptValidateUtil = exports.OptTypeList = exports.OptTypeDict = exports.OptType = exports.OptCombineUtil = void 0;
7
7
 
8
- var _serverEnums = require("./serverEnums");
9
-
10
8
  /**
11
9
  * 表單、表格權限控制相關的數據和相關識別功能。
12
10
  * 所有的權限識別配置都使用2進制占位的方式實現=>1、10、100、1000、10000。位真則具備該權限。
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PipeType = void 0;
7
+
8
+ /**
9
+ * 客戶端進行操作時分配的綫程類型
10
+ * @type {{MulitWorker: number, CoreNio: number, SingleWorker: number}}
11
+ */
12
+ const PipeType = {
13
+ /**
14
+ * 非柱塞類型,服務端會盡最大能力提供綫程支持此操作
15
+ */
16
+ CoreNio: {
17
+ value: 0,
18
+ label: '核心綫程',
19
+ tip: '非柱塞類型,服務端會盡最大能力提供綫程支持此操作'
20
+ },
21
+
22
+ /**
23
+ * 單一工作綫程。所有該類任務都會放置到一個異步隊列中,任務等待前序任務執行完畢后才會繼續執行
24
+ */
25
+ SingleWorker: {
26
+ value: 1,
27
+ label: '單一工作綫程',
28
+ tip: '單一工作綫程。所有該類任務都會放置到一個異步隊列中,任務等待前序任務執行完畢后才會繼續執行, 隊列超過一定長度會拒絕服務,前端重新等待'
29
+ },
30
+
31
+ /**
32
+ * 和SingleWorker的工作機制類似,只是更加
33
+ */
34
+ MulitWorker: {
35
+ value: 2,
36
+ label: '多個工作綫程',
37
+ tip: 'SingleWorker的工作機制類似,只是使用多個隊列在處理'
38
+ }
39
+ };
40
+ exports.PipeType = PipeType;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.updateWithId = exports.updateWithClassDes = exports.listQueryWithId = exports.listQueryWithClassDes = exports.getCollectById = exports.formWithId = exports.formWithClassDes = exports.downloadWithId = exports.downloadWithClassDes = exports.deleteWithId = exports.deleteWithClassDes = exports.batchUpdateWithId = exports.batchUpdateWithClassDes = exports.batchAddWithId = exports.batchAddWithClassDes = exports.addWithId = exports.addWithClassDes = void 0;
6
+ exports.updateWithId = exports.updateWithClassDes = exports.listQueryWithId = exports.listQueryWithClassDes = exports.getCollectById = exports.formWithId = exports.formWithClassDes = exports.deleteWithId = exports.deleteWithClassDes = exports.batchUpdateWithId = exports.batchUpdateWithClassDes = exports.batchAddWithId = exports.batchAddWithClassDes = exports.addWithId = exports.addWithClassDes = void 0;
7
7
 
8
8
  require("core-js/modules/es6.regexp.search.js");
9
9
 
@@ -67,7 +67,8 @@ const listQueryWithId = _ref3 => {
67
67
  collectId,
68
68
  search = false,
69
69
  sorter = false,
70
- page = false
70
+ page = false,
71
+ pipe = 0
71
72
  } = _ref3;
72
73
  const params = {
73
74
  collectId
@@ -77,67 +78,7 @@ const listQueryWithId = _ref3 => {
77
78
  page && (params.page = page);
78
79
  const json = JSON.stringify(params),
79
80
  encode = encodeURIComponent(json);
80
- return (0, _net.get)("".concat(host, "/data/mesh/execute/query?params=").concat(encode));
81
- };
82
- /**
83
- *
84
- * @param host
85
- * @param collectId
86
- * @param search
87
- * @param sorter
88
- * @param page
89
- * @return {Promise<Response>}
90
- */
91
-
92
-
93
- exports.listQueryWithId = listQueryWithId;
94
-
95
- const downloadWithClassDes = _ref4 => {
96
- let {
97
- host,
98
- collect,
99
- search = false,
100
- sorter = false,
101
- page = false
102
- } = _ref4;
103
- const params = {
104
- collect
105
- };
106
- search && (params.search = search);
107
- sorter && (params.sorter = sorter);
108
- page && (params.page = page);
109
- return (0, _net.post)("".concat(host, "/data/mesh/execute/preview/excel/download"), params);
110
- };
111
- /**
112
- *
113
- * @param host
114
- * @param collectId
115
- * @param search
116
- * @param sorter
117
- * @param page
118
- * @return {Promise<Response>}
119
- */
120
-
121
-
122
- exports.downloadWithClassDes = downloadWithClassDes;
123
-
124
- const downloadWithId = _ref5 => {
125
- let {
126
- host,
127
- collectId,
128
- search = false,
129
- sorter = false,
130
- page = false
131
- } = _ref5;
132
- const params = {
133
- collectId
134
- };
135
- search && (params.search = search);
136
- sorter && (params.sorter = sorter);
137
- page && (params.page = page);
138
- const json = JSON.stringify(params),
139
- encode = encodeURIComponent(json);
140
- return (0, _net.get)("".concat(host, "/data/mesh/execute/excel/download?params=").concat(encode));
81
+ return (0, _net.get)("".concat(host, "/data/mesh/execute/query?params=").concat(encode, "&pipe=").concat(pipe));
141
82
  };
142
83
  /**
143
84
  * 獲取單條數據
@@ -148,14 +89,14 @@ const downloadWithId = _ref5 => {
148
89
  */
149
90
 
150
91
 
151
- exports.downloadWithId = downloadWithId;
92
+ exports.listQueryWithId = listQueryWithId;
152
93
 
153
- const formWithClassDes = _ref6 => {
94
+ const formWithClassDes = _ref4 => {
154
95
  let {
155
96
  host,
156
97
  collect,
157
98
  pkData
158
- } = _ref6;
99
+ } = _ref4;
159
100
  return (0, _net.post)("".concat(host, "/data/mesh/execute/preview/form"), {
160
101
  collect,
161
102
  pkData
@@ -172,12 +113,12 @@ const formWithClassDes = _ref6 => {
172
113
 
173
114
  exports.formWithClassDes = formWithClassDes;
174
115
 
175
- const formWithId = _ref7 => {
116
+ const formWithId = _ref5 => {
176
117
  let {
177
118
  host,
178
119
  collectId,
179
120
  pkData
180
- } = _ref7;
121
+ } = _ref5;
181
122
  return (0, _net.get)("".concat(host, "/data/mesh/execute/form?params=").concat(encodeURIComponent(JSON.stringify({
182
123
  collectId,
183
124
  pkData
@@ -197,7 +138,7 @@ const formWithId = _ref7 => {
197
138
 
198
139
  exports.formWithId = formWithId;
199
140
 
200
- const updateWithClassDes = _ref8 => {
141
+ const updateWithClassDes = _ref6 => {
201
142
  let {
202
143
  host,
203
144
  collect,
@@ -205,7 +146,7 @@ const updateWithClassDes = _ref8 => {
205
146
  pkValue,
206
147
  data,
207
148
  bpm = null
208
- } = _ref8;
149
+ } = _ref6;
209
150
  const dataList = [{
210
151
  data,
211
152
  pkData,
@@ -231,7 +172,7 @@ const updateWithClassDes = _ref8 => {
231
172
 
232
173
  exports.updateWithClassDes = updateWithClassDes;
233
174
 
234
- const updateWithId = _ref9 => {
175
+ const updateWithId = _ref7 => {
235
176
  let {
236
177
  host,
237
178
  collectId,
@@ -239,7 +180,7 @@ const updateWithId = _ref9 => {
239
180
  pkValue,
240
181
  data,
241
182
  bpm = null
242
- } = _ref9;
183
+ } = _ref7;
243
184
  const dataList = [{
244
185
  data,
245
186
  pkData,
@@ -273,13 +214,13 @@ const updateWithId = _ref9 => {
273
214
 
274
215
  exports.updateWithId = updateWithId;
275
216
 
276
- const batchUpdateWithClassDes = _ref10 => {
217
+ const batchUpdateWithClassDes = _ref8 => {
277
218
  let {
278
219
  host,
279
220
  collect,
280
221
  dataList,
281
222
  bpm
282
- } = _ref10;
223
+ } = _ref8;
283
224
  return (0, _net.post)("".concat(host, "/data/mesh/execute/preview/update"), {
284
225
  collect,
285
226
  dataList,
@@ -303,13 +244,13 @@ const batchUpdateWithClassDes = _ref10 => {
303
244
 
304
245
  exports.batchUpdateWithClassDes = batchUpdateWithClassDes;
305
246
 
306
- const batchUpdateWithId = _ref11 => {
247
+ const batchUpdateWithId = _ref9 => {
307
248
  let {
308
249
  host,
309
250
  collectId,
310
251
  dataList,
311
252
  bpm
312
- } = _ref11;
253
+ } = _ref9;
313
254
  return (0, _net.post)("".concat(host, "/data/mesh/execute/update"), {
314
255
  collectId,
315
256
  dataList,
@@ -329,13 +270,13 @@ const batchUpdateWithId = _ref11 => {
329
270
 
330
271
  exports.batchUpdateWithId = batchUpdateWithId;
331
272
 
332
- const addWithId = _ref12 => {
273
+ const addWithId = _ref10 => {
333
274
  let {
334
275
  host,
335
276
  collectId,
336
277
  data,
337
278
  bpm
338
- } = _ref12;
279
+ } = _ref10;
339
280
  const dataList = [{
340
281
  data
341
282
  }];
@@ -357,13 +298,13 @@ const addWithId = _ref12 => {
357
298
 
358
299
  exports.addWithId = addWithId;
359
300
 
360
- const addWithClassDes = _ref13 => {
301
+ const addWithClassDes = _ref11 => {
361
302
  let {
362
303
  host,
363
304
  collect,
364
305
  data,
365
306
  bpm
366
- } = _ref13;
307
+ } = _ref11;
367
308
  const dataList = [{
368
309
  data
369
310
  }];
@@ -385,13 +326,13 @@ const addWithClassDes = _ref13 => {
385
326
 
386
327
  exports.addWithClassDes = addWithClassDes;
387
328
 
388
- const batchAddWithId = _ref14 => {
329
+ const batchAddWithId = _ref12 => {
389
330
  let {
390
331
  host,
391
332
  collectId,
392
333
  dataList,
393
334
  bpm
394
- } = _ref14;
335
+ } = _ref12;
395
336
  return (0, _net.post)("".concat(host, "/data/mesh/execute/add"), {
396
337
  collectId,
397
338
  dataList,
@@ -410,13 +351,13 @@ const batchAddWithId = _ref14 => {
410
351
 
411
352
  exports.batchAddWithId = batchAddWithId;
412
353
 
413
- const batchAddWithClassDes = _ref15 => {
354
+ const batchAddWithClassDes = _ref13 => {
414
355
  let {
415
356
  host,
416
357
  collect,
417
358
  dataList,
418
359
  bpm
419
- } = _ref15;
360
+ } = _ref13;
420
361
  return (0, _net.post)("".concat(host, "/data/mesh/execute/preview/add"), {
421
362
  collect,
422
363
  dataList,
@@ -436,13 +377,13 @@ const batchAddWithClassDes = _ref15 => {
436
377
 
437
378
  exports.batchAddWithClassDes = batchAddWithClassDes;
438
379
 
439
- const deleteWithId = _ref16 => {
380
+ const deleteWithId = _ref14 => {
440
381
  let {
441
382
  host,
442
383
  collectId,
443
384
  bpm,
444
385
  dataList
445
- } = _ref16;
386
+ } = _ref14;
446
387
  return (0, _net.post)("".concat(host, "/data/mesh/execute/delete"), {
447
388
  collectId,
448
389
  dataList,
@@ -462,13 +403,13 @@ const deleteWithId = _ref16 => {
462
403
 
463
404
  exports.deleteWithId = deleteWithId;
464
405
 
465
- const deleteWithClassDes = _ref17 => {
406
+ const deleteWithClassDes = _ref15 => {
466
407
  let {
467
408
  host,
468
409
  collect,
469
410
  bpm,
470
411
  dataList
471
- } = _ref17;
412
+ } = _ref15;
472
413
  return (0, _net.post)("".concat(host, "/data/mesh/execute/preview/delete"), {
473
414
  collect,
474
415
  dataList,
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.buildExtension = buildExtension;
7
+ exports.combineExtension = combineExtension;
8
+ exports.default = void 0;
9
+
10
+ require("core-js/modules/web.dom.iterable.js");
11
+
12
+ var _clientEnums = require("../../config/clientEnums");
13
+
14
+ /**
15
+ 數據集的擴展對象,此對象僅用於前端解析。他是一個不可變對象
16
+ * @param json {string|boolean} json字符串
17
+ * @constructor
18
+ */
19
+ function Extension(json) {
20
+ this.pipe = _clientEnums.PipeType.CoreNio.value;
21
+ const obj = json ? JSON.parse(json) : {};
22
+ obj.pipe && (this.pipe = obj.pipe);
23
+ }
24
+
25
+ Extension.prototype.toJson = function () {
26
+ return JSON.stringify(this);
27
+ };
28
+ /**
29
+ *
30
+ * @param other {Extension}
31
+ * @param combine {Object}
32
+ */
33
+
34
+
35
+ Extension.prototype.clone = function (other, combine) {
36
+ const keys = Object.keys(other);
37
+
38
+ for (let key of keys) {
39
+ const val = combine[key];
40
+ this[key] = val || other[key];
41
+ }
42
+ };
43
+
44
+ var _default = Extension;
45
+ /**
46
+ *
47
+ * @param json {string|boolean}
48
+ * @return {Extension}
49
+ */
50
+
51
+ exports.default = _default;
52
+
53
+ function buildExtension() {
54
+ let json = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
55
+ return new Extension(json);
56
+ }
57
+ /**
58
+ *
59
+ * @param origin
60
+ * @param combine
61
+ */
62
+
63
+
64
+ function combineExtension(origin) {
65
+ let combine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
66
+ const target = new Extension(false);
67
+ target.clone(origin, combine);
68
+ return target;
69
+ }
@@ -29,6 +29,8 @@ var _LoadingOutlined = _interopRequireDefault(require("@ant-design/icons/lib/ico
29
29
 
30
30
  var _ExclamationCircleOutlined = _interopRequireDefault(require("@ant-design/icons/lib/icons/ExclamationCircleOutlined"));
31
31
 
32
+ var _delayTip = _interopRequireDefault(require("../../common/model/delayTip"));
33
+
32
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
35
 
34
36
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -105,33 +107,38 @@ class OptionsAbleExcel extends _react.default.Component {
105
107
  from: 0,
106
108
  to: 1
107
109
  }
108
- }).then(res => {
109
- if (res && res.total) {
110
- if (ConfirmTotal < res.total) {
111
- _this.showConfirm(res.total);
112
- } else {
113
- _this.download(res.total);
114
- }
115
- } else if (res && 0 === res.total) {
116
- _antd.notification.info({
117
- message: '無下載數據!請修改查詢條件!'
118
- });
119
-
120
- _this.unloading();
121
- } else if (res) {
122
- _antd.notification.error({
123
- message: res.msg || '網絡故障!請稍後再試!'
124
- });
110
+ }).then(this.handleResult);
111
+ });
125
112
 
126
- _this.unloading();
113
+ _defineProperty(this, "handleResult", res => {
114
+ if (res && res.total) {
115
+ if (ConfirmTotal < res.total) {
116
+ this.showConfirm(res.total);
127
117
  } else {
128
- _antd.notification.error({
129
- message: '網絡故障!請稍後再試!'
130
- });
131
-
132
- _this.unloading();
118
+ this.download(res.total);
133
119
  }
134
- });
120
+ } else if (res && 0 === res.total) {
121
+ _antd.notification.info({
122
+ message: '無下載數據!請修改查詢條件!'
123
+ });
124
+
125
+ this.unloading();
126
+ } else if (res && -100 === res.code) {
127
+ (0, _delayTip.default)("查詢隊列已滿", res.msg, '重新下載', 20, this.handleDownload);
128
+ this.unloading();
129
+ } else if (res) {
130
+ _antd.notification.error({
131
+ message: res.msg || '網絡故障!請稍後再試!'
132
+ });
133
+
134
+ this.unloading();
135
+ } else {
136
+ _antd.notification.error({
137
+ message: '網絡故障!請稍後再試!'
138
+ });
139
+
140
+ this.unloading();
141
+ }
135
142
  });
136
143
 
137
144
  _defineProperty(this, "downloadProcess", (type, present, from, to) => {
@@ -324,19 +331,23 @@ class OptionsAbleExcel extends _react.default.Component {
324
331
  sorter,
325
332
  total,
326
333
  cb: (type, rows, colsOptions, rowsOptions) => {
327
- const sheet = _xlsx.default.utils.aoa_to_sheet(rows);
328
-
329
- sheet['!rows'] = rowsOptions;
330
- sheet['!cols'] = colsOptions;
331
- this.setState({
332
- info: {
333
- text: '下載進度100%',
334
- icon: /*#__PURE__*/_react.default.createElement(_CheckCircleOutlined.default, null),
335
- type: 'suc'
336
- },
337
- loading: false
338
- });
339
- writeFile(collect.display, sheet, ModifyName);
334
+ if ('complete' === type) {
335
+ const sheet = _xlsx.default.utils.aoa_to_sheet(rows);
336
+
337
+ sheet['!rows'] = rowsOptions;
338
+ sheet['!cols'] = colsOptions;
339
+ this.setState({
340
+ info: {
341
+ text: '下載進度100%',
342
+ icon: /*#__PURE__*/_react.default.createElement(_CheckCircleOutlined.default, null),
343
+ type: 'suc'
344
+ },
345
+ loading: false
346
+ });
347
+ writeFile(collect.display, sheet, ModifyName);
348
+ } else {
349
+ this.unloading();
350
+ }
340
351
  },
341
352
  processCb: this.downloadProcess
342
353
  });
@@ -21,6 +21,8 @@ var _cell = _interopRequireDefault(require("../cell"));
21
21
 
22
22
  var _authOptions = require("../config/authOptions");
23
23
 
24
+ var _delayTip = _interopRequireDefault(require("../../common/model/delayTip"));
25
+
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
27
 
26
28
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -188,19 +190,19 @@ const checkAliasForAdd = (fieldNameDict, field) => {
188
190
  };
189
191
  /**
190
192
  * 下載Excel數據
191
- * @param host
192
- * @param collect
193
- * @param collectId
194
- * @param search
195
- * @param sorter
196
- * @param total
197
- * @param cb 下載完成的回調 (type, sheet, colsOptions)=>{
193
+ * @param props.host
194
+ * @param props.collect
195
+ * @param props.collectId
196
+ * @param props.search
197
+ * @param props.sorter
198
+ * @param props.total
199
+ * @param props.cb 下載完成的回調 (type, sheet, colsOptions)=>{
198
200
  * type:下載完結狀態[complete|error]
199
201
  * sheet: excel中的sheet頁對象,
200
202
  * colsOptions: 列數據設置,
201
203
  * rowsOptions: 行數據設置
202
204
  * }
203
- * @param processCb 處理過程的回調 (type, present,from, to)=>{
205
+ * @param props.processCb 處理過程的回調 (type, present,from, to)=>{
204
206
  * type:下載類型[begin|end|error] 下載開始|下載結束|出現錯誤
205
207
  * present: 下載百分比
206
208
  * from:下載開始位置
@@ -209,87 +211,156 @@ const checkAliasForAdd = (fieldNameDict, field) => {
209
211
  */
210
212
 
211
213
 
212
- const modifyAbleDownload = _ref2 => {
213
- let {
214
- host,
215
- collect,
216
- collectId,
217
- search,
218
- sorter,
219
- total,
220
- cb,
221
- processCb
222
- } = _ref2;
223
-
224
- let index = 0,
225
- _page,
226
- _present,
227
- _from,
228
- _to;
229
-
214
+ const modifyAbleDownload = props => {
230
215
  const {
231
216
  rows,
232
217
  colsOptions,
233
218
  rowsOptions,
234
219
  formatDict
235
- } = modifyAbleHeaderRow(collect),
220
+ } = modifyAbleHeaderRow(props.collect),
236
221
  //生成頭列表
237
222
  labels = rows[0],
238
223
  //獲取列表Label
239
224
  {
240
- page,
241
- present
242
- } = getPageAndPresent(total),
225
+ pageList,
226
+ presentList
227
+ } = getPageAndPresent(props.total),
243
228
  //生成分頁和進度信息
244
- request = collectId ? _request.listQueryWithId : _request.listQueryWithClassDes,
245
- //獲取後台請求方法
246
- download = () => {
247
- //下載功能
248
- _page = page[index];
249
- _from = _page.from;
250
- _to = total > _page.to ? _page.to : total;
251
- _present = present[index];
252
- processCb('begin', _present, _from, _to);
253
- request({
254
- host,
255
- collect,
256
- collectId,
257
- search,
258
- sorter,
259
- page: _page
260
- }).then(res => {
261
- if (res && 0 < res.code) {
262
- for (let row of res.result) {
263
- rows.push(labels.map(label => {
264
- const {
265
- format,
266
- config
267
- } = formatDict[label];
268
- return format(_objectSpread({
269
- value: row[label]
270
- }, config));
271
- }));
272
- }
229
+ request = props.collectId ? _request.listQueryWithId : _request.listQueryWithClassDes; //獲取後台請求方法
230
+
231
+ downloadRequest(_objectSpread(_objectSpread({}, props), {}, {
232
+ labels,
233
+ pageList,
234
+ presentList,
235
+ request,
236
+ colsOptions,
237
+ rowsOptions,
238
+ formatDict
239
+ }), 0, rows);
240
+ };
241
+ /**
242
+ *
243
+ * @param regular {Object} 由初始方法創建,整個遞歸規程不會修改的數值
244
+ * //外部傳入的數據
245
+ * @param regular.host
246
+ * @param regular.collect,
247
+ * @param regular.collectId,
248
+ * @param regular.labels,
249
+ * @param regular.search
250
+ * @param regular.sorter
251
+ * @param regular.total
252
+ * @param regular.cb
253
+ * @param regular.processCb
254
+ * //modifyAbleDownload 構建的數據
255
+ * @param regular.labels {Object} 列表的label索引
256
+ * @param regular.pageList {Array} modifyAbleHeaderRow方法構建的分頁列表
257
+ * @param regular.presentList {Array} modifyAbleHeaderRow方法構建的百分比列表
258
+ * @param regular.request {Function} 向服務器發送請求的方法 listQueryWithId 或 listQueryWithClassDes
259
+ * @param regular.colsOptions
260
+ * @param regular.rowsOptions
261
+ * @param regular.formatDict
262
+ * @param index
263
+ * @param rows
264
+ */
273
265
 
274
- processCb('end', _present, _from, _to);
275
266
 
276
- if (++index < page.length) {
277
- download();
278
- } else {
279
- cb('complete', rows, colsOptions, rowsOptions);
280
- }
281
- } else {
282
- processCb('error', _present, _from, _to);
267
+ exports.modifyAbleDownload = modifyAbleDownload;
283
268
 
284
- _antd.notification.error({
285
- message: res && res.msg || '網絡故障!請稍後再試!'
286
- });
269
+ function downloadRequest(regular, index, rows) {
270
+ const page = regular.pageList[index],
271
+ present = regular.presentList[index],
272
+ {
273
+ host,
274
+ collect,
275
+ collectId,
276
+ search,
277
+ sorter
278
+ } = regular;
279
+ regular.processCb('begin', present, page.from, page.to);
280
+ regular.request({
281
+ host,
282
+ collect,
283
+ collectId,
284
+ search,
285
+ sorter,
286
+ page
287
+ }).then(downloadResponse(regular, present, page, index, rows));
288
+ }
289
+ /**
290
+ *
291
+ * @param regular
292
+ * @param regular.host
293
+ * @param regular.collect,
294
+ * @param regular.collectId,
295
+ * @param regular.labels,
296
+ * @param regular.search
297
+ * @param regular.sorter
298
+ * @param regular.pageList
299
+ * @param regular.presentList
300
+ * @param regular.total
301
+ * @param regular.request
302
+ * @param regular.colsOptions,
303
+ * @param regular.rowsOptions,
304
+ * @param regular.formatDict,
305
+ * @param regular.cb
306
+ * @param regular.processCb
307
+ * @param present
308
+ * @param page
309
+ * @param page.from,
310
+ * @param page.to
311
+ * @param index
312
+ * @param rows
313
+ */
314
+
315
+
316
+ function downloadResponse(regular, present, page, index, rows) {
317
+ const {
318
+ labels,
319
+ pageList,
320
+ colsOptions,
321
+ rowsOptions,
322
+ formatDict,
323
+ cb,
324
+ processCb
325
+ } = regular;
326
+ return res => {
327
+ if (res && 0 < res.code) {
328
+ for (let row of res.result) {
329
+ rows.push(labels.map(label => {
330
+ const {
331
+ format,
332
+ config
333
+ } = formatDict[label];
334
+ return format(_objectSpread({
335
+ value: row[label]
336
+ }, config));
337
+ }));
287
338
  }
288
- });
289
- };
290
339
 
291
- download(); //執行
292
- };
340
+ processCb('end', present, page.from, page.to);
341
+
342
+ if (++index < pageList.length) {
343
+ downloadRequest(regular, index, rows);
344
+ } else {
345
+ cb('complete', rows, colsOptions, rowsOptions);
346
+ }
347
+ } else if (res && -100 === res.code) {
348
+ (0, _delayTip.default)("查詢隊列已滿", res.msg, '繼續下載', 20, () => {
349
+ downloadRequest(regular, index, rows);
350
+ }, () => {
351
+ cb('error', rows, colsOptions, rowsOptions);
352
+ });
353
+ processCb('error', present, page.from, page.to);
354
+ } else {
355
+ processCb('error', present, page.from, page.to);
356
+ cb('error', rows, colsOptions, rowsOptions);
357
+
358
+ _antd.notification.error({
359
+ message: res && res.msg || '網絡故障!請稍後再試!'
360
+ });
361
+ }
362
+ };
363
+ }
293
364
  /**
294
365
  * 獲取單條頭數據信息
295
366
  * @param fieldLabelDict
@@ -297,8 +368,6 @@ const modifyAbleDownload = _ref2 => {
297
368
  */
298
369
 
299
370
 
300
- exports.modifyAbleDownload = modifyAbleDownload;
301
-
302
371
  function getExplainHeaderColumn(fieldLabelDict, field) {
303
372
  let text = "".concat(Dict[field.edit]);
304
373
 
@@ -316,34 +385,35 @@ function getExplainHeaderColumn(fieldLabelDict, field) {
316
385
 
317
386
 
318
387
  const getPageAndPresent = total => {
319
- const page = [],
320
- present = [],
388
+ const pageList = [],
389
+ presentList = [],
321
390
  len = Math.ceil(total / PageSize),
322
391
  presentLen = Math.ceil(100 / len);
323
-
324
392
  let index = 0,
325
393
  curPos = 0,
326
394
  curPresent = 0,
327
- _page,
328
- _present,
329
- _from,
330
- _to;
331
-
332
- present.push(curPresent);
395
+ to;
396
+ presentList.push(curPresent);
333
397
 
334
398
  for (; index < len; index++) {
335
399
  curPresent += presentLen;
336
- page.push({
400
+ to = curPos + PageSize;
401
+
402
+ if (to > total) {
403
+ to = total;
404
+ }
405
+
406
+ pageList.push({
337
407
  from: curPos,
338
- to: curPos + PageSize
408
+ to
339
409
  });
340
- present.push(curPresent);
410
+ presentList.push(curPresent);
341
411
  curPos += PageSize;
342
412
  }
343
413
 
344
414
  return {
345
- page,
346
- present
415
+ pageList,
416
+ presentList
347
417
  };
348
418
  };
349
419
  /**
@@ -365,7 +435,7 @@ const getPageAndPresent = total => {
365
435
  */
366
436
 
367
437
 
368
- const modify = _ref3 => {
438
+ const modify = _ref2 => {
369
439
  let {
370
440
  host,
371
441
  collect,
@@ -373,7 +443,7 @@ const modify = _ref3 => {
373
443
  dataList,
374
444
  cb,
375
445
  processCb
376
- } = _ref3;
446
+ } = _ref2;
377
447
  processCb('start', 0, 0, 0);
378
448
 
379
449
  const {
@@ -476,7 +546,7 @@ const modify = _ref3 => {
476
546
 
477
547
  exports.modify = modify;
478
548
 
479
- const add = _ref4 => {
549
+ const add = _ref3 => {
480
550
  let {
481
551
  host,
482
552
  collect,
@@ -484,14 +554,9 @@ const add = _ref4 => {
484
554
  dataList,
485
555
  cb,
486
556
  processCb
487
- } = _ref4;
557
+ } = _ref3;
488
558
  processCb('start', 0, 0, 0);
489
- const pkValue = [],
490
- total = dataList.length,
491
- {
492
- page,
493
- present
494
- } = getPageAndPresent(dataList.length);
559
+ const pkValue = [];
495
560
  /*
496
561
  進行數據格式轉換。將單行數據格式轉換為[{
497
562
  data:[{label:String,value:Any],
@@ -544,7 +609,7 @@ const add = _ref4 => {
544
609
 
545
610
  exports.add = add;
546
611
 
547
- const doSubmit = _ref5 => {
612
+ const doSubmit = _ref4 => {
548
613
  let {
549
614
  host,
550
615
  collect,
@@ -553,7 +618,7 @@ const doSubmit = _ref5 => {
553
618
  request,
554
619
  cb,
555
620
  processCb
556
- } = _ref5;
621
+ } = _ref4;
557
622
 
558
623
  let index = 0,
559
624
  _page,
@@ -565,14 +630,14 @@ const doSubmit = _ref5 => {
565
630
 
566
631
  const total = dataList.length,
567
632
  {
568
- page,
569
- present
633
+ pageList,
634
+ presentList
570
635
  } = getPageAndPresent(total),
571
636
  submit = () => {
572
- _page = page[index];
637
+ _page = pageList[index];
573
638
  _from = _page.from;
574
639
  _to = total > _page.to ? _page.to : total;
575
- _present = present[index];
640
+ _present = presentList[index];
576
641
  processCb('begin', _present, _from, _to);
577
642
  _dataList = dataList.splice(0, _to - _from);
578
643
  request({
@@ -25,6 +25,12 @@ var _serverEnums = require("../config/serverEnums");
25
25
 
26
26
  var _remove = require("../crud/remove");
27
27
 
28
+ var _extension = _interopRequireDefault(require("../define/collect/extension"));
29
+
30
+ var _errorTip = _interopRequireDefault(require("../../common/model/errorTip"));
31
+
32
+ var _delayTip = _interopRequireDefault(require("../../common/model/delayTip"));
33
+
28
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
35
 
30
36
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -113,8 +119,12 @@ class QueryAbleTable extends _react.default.Component {
113
119
  _defineProperty(this, "handleQuery", params => {
114
120
  const {
115
121
  collect,
116
- collectId
122
+ collectId,
123
+ extension
117
124
  } = this,
125
+ {
126
+ pipe
127
+ } = extension,
118
128
  _this = this,
119
129
  {
120
130
  host,
@@ -142,45 +152,16 @@ class QueryAbleTable extends _react.default.Component {
142
152
  collectId,
143
153
  search,
144
154
  sorter,
145
- page
146
- }).then(this.handleResult) : (0, _request.listQueryWithClassDes)({
155
+ page,
156
+ pipe
157
+ }).then(this.handleResult(params)) : (0, _request.listQueryWithClassDes)({
147
158
  host,
148
159
  collect,
149
160
  search,
150
161
  sorter,
151
- page
152
- }).then(this.handleResult);
153
- });
154
-
155
- _defineProperty(this, "handleResult", res => {
156
- const {
157
- onResult
158
- } = this.props;
159
-
160
- if (res && 0 < res.code) {
161
- const result = {
162
- data: res.result,
163
- page: res.page,
164
- total: res.total,
165
- search: res.search,
166
- sorter: res.sorter
167
- };
168
- this.setState({
169
- loading: false,
170
- result
171
- });
172
- onResult && onResult(_objectSpread({
173
- suc: true
174
- }, result));
175
- } else {
176
- QueryAbleTable.errTip(res && res.msg ? res.msg : '網絡故障,請稍後再試!', '服務器請求錯誤!');
177
- this.setState({
178
- loading: false
179
- });
180
- onResult && onResult({
181
- suc: false
182
- });
183
- }
162
+ page,
163
+ pipe
164
+ }).then(this.handleResult(params));
184
165
  });
185
166
 
186
167
  _defineProperty(this, "handleExcel", () => {});
@@ -256,6 +237,7 @@ class QueryAbleTable extends _react.default.Component {
256
237
  } else {
257
238
  if (_collect) {
258
239
  this.collect = _collect;
240
+ this.extension = new _extension.default(_collect.extension);
259
241
  this.initState = InitState.PreView;
260
242
  } else {
261
243
  this.initState = InitState.UnCollect;
@@ -296,6 +278,7 @@ class QueryAbleTable extends _react.default.Component {
296
278
  if (res && 0 < res.code) {
297
279
  if (res.data) {
298
280
  _this.collect = res.data;
281
+ _this.extension = new _extension.default(res.data.extension);
299
282
  _this.initState = InitState.InitComplete;
300
283
 
301
284
  _this.setState({
@@ -332,6 +315,63 @@ class QueryAbleTable extends _react.default.Component {
332
315
  */
333
316
 
334
317
 
318
+ /**
319
+ * 進行搜索
320
+ * @param params.search
321
+ * @param params.sorter
322
+ * @param params.page
323
+ */
324
+ handleResult(params) {
325
+ const _this = this;
326
+ /**
327
+ * 搜索结果
328
+ * @param res
329
+ */
330
+
331
+
332
+ return res => {
333
+ const {
334
+ onResult
335
+ } = this.props;
336
+
337
+ if (res && 0 < res.code) {
338
+ const result = {
339
+ data: res.result,
340
+ page: res.page,
341
+ total: res.total,
342
+ search: res.search,
343
+ sorter: res.sorter
344
+ };
345
+ this.setState({
346
+ loading: false,
347
+ result
348
+ });
349
+ onResult && onResult(_objectSpread({
350
+ suc: true
351
+ }, result));
352
+ } else if (res && -100 === res.code) {
353
+ this.setState({
354
+ loading: false
355
+ });
356
+ (0, _delayTip.default)("查詢隊列已滿", res.msg, '自動查詢', 20, () => {
357
+ _this.handleQuery(params);
358
+ });
359
+ } else {
360
+ QueryAbleTable.errTip(res && res.msg ? res.msg : '網絡故障,請稍後再試!', '服務器請求錯誤!');
361
+ this.setState({
362
+ loading: false
363
+ });
364
+ onResult && onResult({
365
+ suc: false
366
+ });
367
+ }
368
+ };
369
+ }
370
+ /**
371
+ * 处理点击Excel按钮
372
+ */
373
+
374
+
335
375
  getId() {
336
376
  return this.id;
337
377
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uepay-mesh",
3
- "version": "4.0.12",
3
+ "version": "4.0.13",
4
4
  "description": "数据中心数据集设计工具前端",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -44,6 +44,6 @@
44
44
  "node-sass": "^4.13.0",
45
45
  "react": "^16.12.0",
46
46
  "react-dom": "^16.12.0",
47
- "uepay-ops2": "4.0.7"
47
+ "uepay-ops2": "4.0.8"
48
48
  }
49
49
  }