ls-pro-common 1.0.56 → 1.0.59
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/dist/common.js +1 -1
- package/dist/common.min.js +1 -1
- package/es/hooks/useSingle/index.js +5 -5
- package/es/http/index.js +10 -4
- package/es/utils/index.d.ts +7 -1
- package/es/utils/index.js +28 -1
- package/lib/hooks/useSingle/index.js +4 -4
- package/lib/http/index.js +10 -4
- package/lib/utils/index.d.ts +7 -1
- package/lib/utils/index.js +33 -3
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
8
8
|
var _excluded = ["current", "pageSize"];
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { useState, useRef, useMemo, useCallback } from 'react';
|
|
11
|
-
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined,
|
|
11
|
+
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined, AuditOutlined } from '@ant-design/icons';
|
|
12
12
|
import { showConfirm, showWarn, showSuccess, showError } from '../../utils';
|
|
13
13
|
import { httpPost } from '../../http';
|
|
14
14
|
import usePermission from '../usePermission';
|
|
@@ -582,7 +582,7 @@ function useSingle(inParam) {
|
|
|
582
582
|
|
|
583
583
|
case 19:
|
|
584
584
|
result = _context6.sent;
|
|
585
|
-
result.data = result.rows;
|
|
585
|
+
result.data = result.rows || [];
|
|
586
586
|
result.success = true;
|
|
587
587
|
return _context6.abrupt("return", result);
|
|
588
588
|
|
|
@@ -629,7 +629,7 @@ function useSingle(inParam) {
|
|
|
629
629
|
case 6:
|
|
630
630
|
_context7.prev = 6;
|
|
631
631
|
_context7.next = 9;
|
|
632
|
-
return httpPost(url, param);
|
|
632
|
+
return httpPost(url, param, true, false);
|
|
633
633
|
|
|
634
634
|
case 9:
|
|
635
635
|
result = _context7.sent;
|
|
@@ -740,7 +740,7 @@ function useSingle(inParam) {
|
|
|
740
740
|
return onAudit(null);
|
|
741
741
|
},
|
|
742
742
|
disabled: btnDisabled('audit'),
|
|
743
|
-
icon: /*#__PURE__*/React.createElement(
|
|
743
|
+
icon: /*#__PURE__*/React.createElement(AuditOutlined, null)
|
|
744
744
|
}, "\u5BA1\u6838") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) && checkRight(128) ? /*#__PURE__*/React.createElement(_Button, {
|
|
745
745
|
key: "import",
|
|
746
746
|
onClick: function onClick() {
|
|
@@ -760,7 +760,7 @@ function useSingle(inParam) {
|
|
|
760
760
|
disabled: btnDisabled('export'),
|
|
761
761
|
icon: /*#__PURE__*/React.createElement(ExportOutlined, null)
|
|
762
762
|
}, "\u5BFC\u51FA") : false].filter(function (o) {
|
|
763
|
-
return
|
|
763
|
+
return Boolean;
|
|
764
764
|
});
|
|
765
765
|
}, [selectedRows]);
|
|
766
766
|
return {
|
package/es/http/index.js
CHANGED
|
@@ -40,7 +40,7 @@ request.interceptors.request.use(function (url, options) {
|
|
|
40
40
|
|
|
41
41
|
request.interceptors.response.use( /*#__PURE__*/function () {
|
|
42
42
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response, options) {
|
|
43
|
-
var noMsg, _data$flag, data, _data$
|
|
43
|
+
var noMsg, _data$flag, _data$flag2, data, _data$flag3, _data$flag4, _data$flag5, _data, retCode, retMsg, status;
|
|
44
44
|
|
|
45
45
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
46
46
|
while (1) {
|
|
@@ -59,7 +59,13 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
59
59
|
|
|
60
60
|
case 5:
|
|
61
61
|
data = _context.sent;
|
|
62
|
-
|
|
62
|
+
|
|
63
|
+
if (((_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode) === 'timeout' || ((_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retCode) === '4011') {
|
|
64
|
+
reLogin();
|
|
65
|
+
} else {
|
|
66
|
+
showError(options.url + ((_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.retMsg));
|
|
67
|
+
}
|
|
68
|
+
|
|
63
69
|
_context.next = 12;
|
|
64
70
|
break;
|
|
65
71
|
|
|
@@ -83,8 +89,8 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
83
89
|
|
|
84
90
|
case 17:
|
|
85
91
|
_data = _context.sent;
|
|
86
|
-
retCode = (_data === null || _data === void 0 ? void 0 : (_data$
|
|
87
|
-
retMsg = ((_data$
|
|
92
|
+
retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag4 = _data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.retCode) || '0';
|
|
93
|
+
retMsg = ((_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retMsg) || '访问接口出错';
|
|
88
94
|
status = (getUrlQuery('apiStatus') || '0').split(',');
|
|
89
95
|
|
|
90
96
|
if (retCode && !status.includes(retCode)) {
|
package/es/utils/index.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export declare const reLogin: () => void;
|
|
|
107
107
|
* @param endSuffix
|
|
108
108
|
* @returns
|
|
109
109
|
*/
|
|
110
|
-
export declare const rangeToSearch: (values: any, startField: string, endField: string, endSuffix?: string) => any;
|
|
110
|
+
export declare const rangeToSearch: (values: any, startField: string, endField: string, endSuffix?: string, startSuffex?: string) => any;
|
|
111
111
|
/** @name 状态列表 */
|
|
112
112
|
export declare const statusList: {
|
|
113
113
|
value: number;
|
|
@@ -174,3 +174,9 @@ export declare const getLoginName: () => string | undefined;
|
|
|
174
174
|
export declare const getCompanyId: () => string | undefined;
|
|
175
175
|
/** @name 微前端原生路径 */
|
|
176
176
|
export declare const appPath: (path?: string) => any;
|
|
177
|
+
/**
|
|
178
|
+
* 深度复制对象
|
|
179
|
+
* @param obj
|
|
180
|
+
* @returns
|
|
181
|
+
*/
|
|
182
|
+
export declare const deepClone: (obj: any) => any;
|
package/es/utils/index.js
CHANGED
|
@@ -260,8 +260,9 @@ export var reLogin = function reLogin() {
|
|
|
260
260
|
|
|
261
261
|
export var rangeToSearch = function rangeToSearch(values, startField, endField) {
|
|
262
262
|
var endSuffix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
263
|
+
var startSuffex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|
|
263
264
|
var data = {};
|
|
264
|
-
Array.isArray(values) && values[0] && (data[startField] = values[0]);
|
|
265
|
+
Array.isArray(values) && values[0] && (data[startField] = values[0] + startSuffex);
|
|
265
266
|
Array.isArray(values) && values[1] && (data[endField] = values[1] + endSuffix);
|
|
266
267
|
return data;
|
|
267
268
|
};
|
|
@@ -476,4 +477,30 @@ export var appPath = function appPath() {
|
|
|
476
477
|
}
|
|
477
478
|
|
|
478
479
|
return path ? path : './';
|
|
480
|
+
};
|
|
481
|
+
/**
|
|
482
|
+
* 深度复制对象
|
|
483
|
+
* @param obj
|
|
484
|
+
* @returns
|
|
485
|
+
*/
|
|
486
|
+
|
|
487
|
+
export var deepClone = function deepClone(obj) {
|
|
488
|
+
var otype = Object.prototype.toString.call(obj);
|
|
489
|
+
var target = obj;
|
|
490
|
+
|
|
491
|
+
if (otype === '[object Array]') {
|
|
492
|
+
target = [];
|
|
493
|
+
|
|
494
|
+
for (var i = 0; i < obj.length; i++) {
|
|
495
|
+
target.push(deepClone(obj[i]));
|
|
496
|
+
}
|
|
497
|
+
} else if (otype === '[object Object]') {
|
|
498
|
+
target = {};
|
|
499
|
+
|
|
500
|
+
for (var key in obj) {
|
|
501
|
+
target[key] = deepClone(obj[key]);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
return target;
|
|
479
506
|
};
|
|
@@ -603,7 +603,7 @@ function useSingle(inParam) {
|
|
|
603
603
|
|
|
604
604
|
case 19:
|
|
605
605
|
result = _context6.sent;
|
|
606
|
-
result.data = result.rows;
|
|
606
|
+
result.data = result.rows || [];
|
|
607
607
|
result.success = true;
|
|
608
608
|
return _context6.abrupt("return", result);
|
|
609
609
|
|
|
@@ -650,7 +650,7 @@ function useSingle(inParam) {
|
|
|
650
650
|
case 6:
|
|
651
651
|
_context7.prev = 6;
|
|
652
652
|
_context7.next = 9;
|
|
653
|
-
return (0, _http.httpPost)(url, param);
|
|
653
|
+
return (0, _http.httpPost)(url, param, true, false);
|
|
654
654
|
|
|
655
655
|
case 9:
|
|
656
656
|
result = _context7.sent;
|
|
@@ -761,7 +761,7 @@ function useSingle(inParam) {
|
|
|
761
761
|
return onAudit(null);
|
|
762
762
|
},
|
|
763
763
|
disabled: btnDisabled('audit'),
|
|
764
|
-
icon: /*#__PURE__*/_react.default.createElement(_icons.
|
|
764
|
+
icon: /*#__PURE__*/_react.default.createElement(_icons.AuditOutlined, null)
|
|
765
765
|
}, "\u5BA1\u6838") : false, (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) && checkRight(128) ? /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
766
766
|
key: "import",
|
|
767
767
|
onClick: function onClick() {
|
|
@@ -781,7 +781,7 @@ function useSingle(inParam) {
|
|
|
781
781
|
disabled: btnDisabled('export'),
|
|
782
782
|
icon: /*#__PURE__*/_react.default.createElement(_icons.ExportOutlined, null)
|
|
783
783
|
}, "\u5BFC\u51FA") : false].filter(function (o) {
|
|
784
|
-
return
|
|
784
|
+
return Boolean;
|
|
785
785
|
});
|
|
786
786
|
}, [selectedRows]);
|
|
787
787
|
return {
|
package/lib/http/index.js
CHANGED
|
@@ -59,7 +59,7 @@ request.interceptors.request.use(function (url, options) {
|
|
|
59
59
|
|
|
60
60
|
request.interceptors.response.use( /*#__PURE__*/function () {
|
|
61
61
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response, options) {
|
|
62
|
-
var noMsg, _data$flag, data, _data$
|
|
62
|
+
var noMsg, _data$flag, _data$flag2, data, _data$flag3, _data$flag4, _data$flag5, _data, retCode, retMsg, status;
|
|
63
63
|
|
|
64
64
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
65
65
|
while (1) {
|
|
@@ -78,7 +78,13 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
78
78
|
|
|
79
79
|
case 5:
|
|
80
80
|
data = _context.sent;
|
|
81
|
-
|
|
81
|
+
|
|
82
|
+
if (((_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode) === 'timeout' || ((_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retCode) === '4011') {
|
|
83
|
+
(0, _utils.reLogin)();
|
|
84
|
+
} else {
|
|
85
|
+
(0, _utils.showError)(options.url + ((_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.retMsg));
|
|
86
|
+
}
|
|
87
|
+
|
|
82
88
|
_context.next = 12;
|
|
83
89
|
break;
|
|
84
90
|
|
|
@@ -102,8 +108,8 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
102
108
|
|
|
103
109
|
case 17:
|
|
104
110
|
_data = _context.sent;
|
|
105
|
-
retCode = (_data === null || _data === void 0 ? void 0 : (_data$
|
|
106
|
-
retMsg = ((_data$
|
|
111
|
+
retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag4 = _data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.retCode) || '0';
|
|
112
|
+
retMsg = ((_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retMsg) || '访问接口出错';
|
|
107
113
|
status = ((0, _utils.getUrlQuery)('apiStatus') || '0').split(',');
|
|
108
114
|
|
|
109
115
|
if (retCode && !status.includes(retCode)) {
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export declare const reLogin: () => void;
|
|
|
107
107
|
* @param endSuffix
|
|
108
108
|
* @returns
|
|
109
109
|
*/
|
|
110
|
-
export declare const rangeToSearch: (values: any, startField: string, endField: string, endSuffix?: string) => any;
|
|
110
|
+
export declare const rangeToSearch: (values: any, startField: string, endField: string, endSuffix?: string, startSuffex?: string) => any;
|
|
111
111
|
/** @name 状态列表 */
|
|
112
112
|
export declare const statusList: {
|
|
113
113
|
value: number;
|
|
@@ -174,3 +174,9 @@ export declare const getLoginName: () => string | undefined;
|
|
|
174
174
|
export declare const getCompanyId: () => string | undefined;
|
|
175
175
|
/** @name 微前端原生路径 */
|
|
176
176
|
export declare const appPath: (path?: string) => any;
|
|
177
|
+
/**
|
|
178
|
+
* 深度复制对象
|
|
179
|
+
* @param obj
|
|
180
|
+
* @returns
|
|
181
|
+
*/
|
|
182
|
+
export declare const deepClone: (obj: any) => any;
|
package/lib/utils/index.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "dateFormat", {
|
|
|
12
12
|
return _lsProTable.dateFormat;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
exports.getLoginName = exports.getCookie = exports.getCompanyId = exports.getCache = exports.formatMoney = exports.formatDate = void 0;
|
|
15
|
+
exports.getLoginName = exports.getCookie = exports.getCompanyId = exports.getCache = exports.formatMoney = exports.formatDate = exports.deepClone = void 0;
|
|
16
16
|
Object.defineProperty(exports, "getResourceProps", {
|
|
17
17
|
enumerable: true,
|
|
18
18
|
get: function get() {
|
|
@@ -361,8 +361,9 @@ exports.reLogin = reLogin;
|
|
|
361
361
|
|
|
362
362
|
var rangeToSearch = function rangeToSearch(values, startField, endField) {
|
|
363
363
|
var endSuffix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
364
|
+
var startSuffex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|
|
364
365
|
var data = {};
|
|
365
|
-
Array.isArray(values) && values[0] && (data[startField] = values[0]);
|
|
366
|
+
Array.isArray(values) && values[0] && (data[startField] = values[0] + startSuffex);
|
|
366
367
|
Array.isArray(values) && values[1] && (data[endField] = values[1] + endSuffix);
|
|
367
368
|
return data;
|
|
368
369
|
};
|
|
@@ -605,5 +606,34 @@ var appPath = function appPath() {
|
|
|
605
606
|
|
|
606
607
|
return path ? path : './';
|
|
607
608
|
};
|
|
609
|
+
/**
|
|
610
|
+
* 深度复制对象
|
|
611
|
+
* @param obj
|
|
612
|
+
* @returns
|
|
613
|
+
*/
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
exports.appPath = appPath;
|
|
617
|
+
|
|
618
|
+
var deepClone = function deepClone(obj) {
|
|
619
|
+
var otype = Object.prototype.toString.call(obj);
|
|
620
|
+
var target = obj;
|
|
621
|
+
|
|
622
|
+
if (otype === '[object Array]') {
|
|
623
|
+
target = [];
|
|
624
|
+
|
|
625
|
+
for (var i = 0; i < obj.length; i++) {
|
|
626
|
+
target.push(deepClone(obj[i]));
|
|
627
|
+
}
|
|
628
|
+
} else if (otype === '[object Object]') {
|
|
629
|
+
target = {};
|
|
630
|
+
|
|
631
|
+
for (var key in obj) {
|
|
632
|
+
target[key] = deepClone(obj[key]);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
return target;
|
|
637
|
+
};
|
|
608
638
|
|
|
609
|
-
exports.
|
|
639
|
+
exports.deepClone = deepClone;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ls-pro-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.59",
|
|
4
4
|
"description": "ls-pro-common",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antd",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@ant-design/icons": "^4.3.0",
|
|
31
|
-
"ls-pro-table": "2.62.
|
|
31
|
+
"ls-pro-table": "2.62.44",
|
|
32
32
|
"ls-pro-form": "1.52.29",
|
|
33
33
|
"@babel/runtime": "^7.16.3",
|
|
34
34
|
"classnames": "^2.2.6",
|