ls-pro-common 1.1.2 → 1.1.3
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.css +1 -2
- package/dist/common.js +1 -1
- package/dist/common.js.LICENSE.txt +9 -0
- package/dist/common.min.css +1 -2
- package/dist/common.min.js +1 -1
- package/dist/common.min.js.LICENSE.txt +9 -0
- package/es/components/Permission.d.ts +6 -0
- package/es/components/Permission.js +10 -0
- package/es/hooks/useDtl/index.d.ts +2 -2
- package/es/hooks/useDtl/index.js +26 -20
- package/es/hooks/useSingle/index.d.ts +3 -3
- package/es/hooks/useSingle/index.js +31 -25
- package/es/http/index.js +18 -12
- package/es/index.d.ts +4 -2
- package/es/index.js +2 -1
- package/es/utils/index.d.ts +9 -22
- package/es/utils/index.js +52 -71
- package/lib/components/Permission.d.ts +6 -0
- package/lib/components/Permission.js +18 -0
- package/lib/hooks/useDtl/index.d.ts +2 -2
- package/lib/hooks/useDtl/index.js +26 -20
- package/lib/hooks/useSingle/index.d.ts +3 -3
- package/lib/hooks/useSingle/index.js +31 -25
- package/lib/http/index.js +18 -12
- package/lib/index.d.ts +4 -2
- package/lib/index.js +7 -0
- package/lib/utils/index.d.ts +9 -22
- package/lib/utils/index.js +73 -82
- package/package.json +2 -2
|
@@ -21,6 +21,15 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
21
21
|
|
|
22
22
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @license
|
|
26
|
+
* Lodash <https://lodash.com/>
|
|
27
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
28
|
+
* Released under MIT license <https://lodash.com/license>
|
|
29
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
30
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
31
|
+
*/
|
|
32
|
+
|
|
24
33
|
/** @license React v16.13.1
|
|
25
34
|
* react-is.production.min.js
|
|
26
35
|
*
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import usePermission from "../hooks/usePermission";
|
|
3
|
+
var Permission = function Permission(_ref) {
|
|
4
|
+
var children = _ref.children,
|
|
5
|
+
rightValue = _ref.rightValue;
|
|
6
|
+
var _usePermission = usePermission(),
|
|
7
|
+
checkRight = _usePermission.checkRight;
|
|
8
|
+
return checkRight(rightValue) ? /*#__PURE__*/React.createElement(React.Fragment, null, children) : null;
|
|
9
|
+
};
|
|
10
|
+
export default Permission;
|
|
@@ -19,8 +19,8 @@ export declare type DtlParamType = SingleParamType & {
|
|
|
19
19
|
billType?: string;
|
|
20
20
|
/**@name 动态编码规则字段,主从表一起保存传参 */
|
|
21
21
|
codeRuleDynamicField?: string;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/** 是否查询历史数据,通过主表查询面板用户受控组件传入 */
|
|
23
|
+
ifHistory?: 0 | 1;
|
|
24
24
|
};
|
|
25
25
|
declare function useDtl(dtlParam: DtlParamType): {
|
|
26
26
|
formRef: import("react").MutableRefObject<ProFormInstance<any> | undefined>;
|
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -33,8 +33,8 @@ function useDtl(dtlParam) {
|
|
|
33
33
|
btnStatus = dtlParam.btnStatus,
|
|
34
34
|
beforeAudit = dtlParam.beforeAudit,
|
|
35
35
|
afterAudit = dtlParam.afterAudit,
|
|
36
|
-
_dtlParam$
|
|
37
|
-
|
|
36
|
+
_dtlParam$ifHistory = dtlParam.ifHistory,
|
|
37
|
+
ifHistory = _dtlParam$ifHistory === void 0 ? 0 : _dtlParam$ifHistory;
|
|
38
38
|
var _usePermission = usePermission(),
|
|
39
39
|
canAdd = _usePermission.canAdd,
|
|
40
40
|
canEdit = _usePermission.canEdit,
|
|
@@ -648,8 +648,8 @@ function useDtl(dtlParam) {
|
|
|
648
648
|
}
|
|
649
649
|
setSelectedRows([]);
|
|
650
650
|
(_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$cl = _tableRef$current3.clearSelected) === null || _tableRef$current3$cl === void 0 ? void 0 : _tableRef$current3$cl.call(_tableRef$current3);
|
|
651
|
-
if (
|
|
652
|
-
param.
|
|
651
|
+
if (ifHistory === 1) {
|
|
652
|
+
param.ifHistory = 1;
|
|
653
653
|
}
|
|
654
654
|
_context8.t0 = beforeLoad;
|
|
655
655
|
if (!_context8.t0) {
|
|
@@ -696,8 +696,8 @@ function useDtl(dtlParam) {
|
|
|
696
696
|
}();
|
|
697
697
|
var onExportDtl = /*#__PURE__*/function () {
|
|
698
698
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url, param) {
|
|
699
|
-
var _param$exportColumns;
|
|
700
|
-
var _result$flag6, result, _result$flag7, _result$flag8;
|
|
699
|
+
var _param$exportColumns, _param$searchData;
|
|
700
|
+
var searchArr, _result$flag6, result, _result$flag7, _result$flag8;
|
|
701
701
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
702
702
|
while (1) switch (_context9.prev = _context9.next) {
|
|
703
703
|
case 0:
|
|
@@ -715,40 +715,46 @@ function useDtl(dtlParam) {
|
|
|
715
715
|
showWarn('请配置业务接口 bizApi 属性');
|
|
716
716
|
return _context9.abrupt("return", false);
|
|
717
717
|
case 6:
|
|
718
|
-
|
|
719
|
-
|
|
718
|
+
// 处理导出历史数据传参
|
|
719
|
+
if (ifHistory && !param.searchData || !((_param$searchData = param.searchData) === null || _param$searchData === void 0 ? void 0 : _param$searchData.includes('ifHistory=1'))) {
|
|
720
|
+
searchArr = (param.searchData || '').split('&');
|
|
721
|
+
searchArr.push('ifHistory=1');
|
|
722
|
+
param.searchData = searchArr.join('&');
|
|
723
|
+
}
|
|
724
|
+
_context9.prev = 7;
|
|
725
|
+
_context9.next = 10;
|
|
720
726
|
return httpPost(url, param);
|
|
721
|
-
case
|
|
727
|
+
case 10:
|
|
722
728
|
result = _context9.sent;
|
|
723
729
|
if (!(result.data && typeof result.data === 'string')) {
|
|
724
|
-
_context9.next =
|
|
730
|
+
_context9.next = 14;
|
|
725
731
|
break;
|
|
726
732
|
}
|
|
727
733
|
window.open(result.data);
|
|
728
734
|
return _context9.abrupt("return", true);
|
|
729
|
-
case
|
|
735
|
+
case 14:
|
|
730
736
|
if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
|
|
731
|
-
_context9.next =
|
|
737
|
+
_context9.next = 19;
|
|
732
738
|
break;
|
|
733
739
|
}
|
|
734
740
|
showSuccess(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出成功');
|
|
735
741
|
return _context9.abrupt("return", true);
|
|
736
|
-
case
|
|
742
|
+
case 19:
|
|
737
743
|
showError(((_result$flag8 = result.flag) === null || _result$flag8 === void 0 ? void 0 : _result$flag8.retMsg) || '导出失败,请联系系统管理员');
|
|
738
744
|
return _context9.abrupt("return", false);
|
|
739
|
-
case
|
|
740
|
-
_context9.next =
|
|
745
|
+
case 21:
|
|
746
|
+
_context9.next = 27;
|
|
741
747
|
break;
|
|
742
|
-
case
|
|
743
|
-
_context9.prev =
|
|
744
|
-
_context9.t0 = _context9["catch"](
|
|
748
|
+
case 23:
|
|
749
|
+
_context9.prev = 23;
|
|
750
|
+
_context9.t0 = _context9["catch"](7);
|
|
745
751
|
showError(_context9.t0.message);
|
|
746
752
|
return _context9.abrupt("return", false);
|
|
747
|
-
case
|
|
753
|
+
case 27:
|
|
748
754
|
case "end":
|
|
749
755
|
return _context9.stop();
|
|
750
756
|
}
|
|
751
|
-
}, _callee9, null, [[
|
|
757
|
+
}, _callee9, null, [[7, 23]]);
|
|
752
758
|
}));
|
|
753
759
|
return function onExportDtl(_x6, _x7) {
|
|
754
760
|
return _ref9.apply(this, arguments);
|
|
@@ -40,7 +40,7 @@ declare function useSingle(inParam: SingleParamType): {
|
|
|
40
40
|
setEditItem: import("react").Dispatch<any>;
|
|
41
41
|
onRemove: (row: any) => void;
|
|
42
42
|
onSave: (formData: any) => Promise<boolean>;
|
|
43
|
-
onLoad: (params: Record<string, any>, sort: Record<string, any>, filter: Record<string, any
|
|
43
|
+
onLoad: (params: Record<string, any>, sort: Record<string, any>, filter: Record<string, any>, isHistory: any) => Promise<any>;
|
|
44
44
|
onAdd: (item: any) => Promise<void>;
|
|
45
45
|
onEdit: (item: any) => Promise<void>;
|
|
46
46
|
onExport: (url: string, param: exportParam) => Promise<boolean>;
|
|
@@ -49,7 +49,7 @@ declare function useSingle(inParam: SingleParamType): {
|
|
|
49
49
|
checkRight: (val: number) => boolean;
|
|
50
50
|
loginName: string | undefined;
|
|
51
51
|
isAudit: (row?: any) => boolean;
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
ifHistory: 0 | 1;
|
|
53
|
+
setIfHistory: import("react").Dispatch<import("react").SetStateAction<0 | 1>>;
|
|
54
54
|
};
|
|
55
55
|
export default useSingle;
|
|
@@ -70,8 +70,8 @@ function useSingle(inParam) {
|
|
|
70
70
|
/**@name 查看历史数据 */
|
|
71
71
|
var _useState7 = useState(0),
|
|
72
72
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
ifHistory = _useState8[0],
|
|
74
|
+
setIfHistory = _useState8[1];
|
|
75
75
|
/** 判断是否已审核,只有传入审核状态和状态字段才进行判断 */
|
|
76
76
|
var isAudit = useCallback(function () {
|
|
77
77
|
var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
@@ -402,7 +402,7 @@ function useSingle(inParam) {
|
|
|
402
402
|
}();
|
|
403
403
|
/** 加载数据方法 */
|
|
404
404
|
var onLoad = /*#__PURE__*/function () {
|
|
405
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(params, sort, filter) {
|
|
405
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(params, sort, filter, isHistory) {
|
|
406
406
|
var _tableRef$current, _tableRef$current$cle;
|
|
407
407
|
var current, pageSize, sumProperties, rest, param, key, k, sortArr, _key, result;
|
|
408
408
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
@@ -448,8 +448,8 @@ function useSingle(inParam) {
|
|
|
448
448
|
}
|
|
449
449
|
param.sort = sortArr.join(',');
|
|
450
450
|
}
|
|
451
|
-
if (
|
|
452
|
-
param.
|
|
451
|
+
if (ifHistory || isHistory) {
|
|
452
|
+
param.ifHistory = 1;
|
|
453
453
|
}
|
|
454
454
|
setSelectedRows([]);
|
|
455
455
|
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$cle = _tableRef$current.clearSelected) === null || _tableRef$current$cle === void 0 ? void 0 : _tableRef$current$cle.call(_tableRef$current);
|
|
@@ -493,14 +493,14 @@ function useSingle(inParam) {
|
|
|
493
493
|
}
|
|
494
494
|
}, _callee6);
|
|
495
495
|
}));
|
|
496
|
-
return function onLoad(_x5, _x6, _x7) {
|
|
496
|
+
return function onLoad(_x5, _x6, _x7, _x8) {
|
|
497
497
|
return _ref6.apply(this, arguments);
|
|
498
498
|
};
|
|
499
499
|
}();
|
|
500
500
|
var onExport = /*#__PURE__*/function () {
|
|
501
501
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(url, param) {
|
|
502
|
-
var _param$exportColumns;
|
|
503
|
-
var _result$flag4, result, _result$flag5, _result$flag6;
|
|
502
|
+
var _param$exportColumns, _param$searchData;
|
|
503
|
+
var searchArr, _result$flag4, result, _result$flag5, _result$flag6;
|
|
504
504
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
505
505
|
while (1) switch (_context7.prev = _context7.next) {
|
|
506
506
|
case 0:
|
|
@@ -518,43 +518,49 @@ function useSingle(inParam) {
|
|
|
518
518
|
showWarn('请配置业务接口 bizApi 属性');
|
|
519
519
|
return _context7.abrupt("return", false);
|
|
520
520
|
case 6:
|
|
521
|
-
|
|
522
|
-
|
|
521
|
+
// 处理导出历史数据传参,如果组件里没有传入参数,hooks再处理一次
|
|
522
|
+
if (ifHistory && !param.searchData || !((_param$searchData = param.searchData) === null || _param$searchData === void 0 ? void 0 : _param$searchData.includes('ifHistory=1'))) {
|
|
523
|
+
searchArr = (param.searchData || '').split('&');
|
|
524
|
+
searchArr.push('ifHistory=1');
|
|
525
|
+
param.searchData = searchArr.join('&');
|
|
526
|
+
}
|
|
527
|
+
_context7.prev = 7;
|
|
528
|
+
_context7.next = 10;
|
|
523
529
|
return httpPost(url, param, true, false);
|
|
524
|
-
case
|
|
530
|
+
case 10:
|
|
525
531
|
result = _context7.sent;
|
|
526
532
|
if (!(result.data && typeof result.data === 'string')) {
|
|
527
|
-
_context7.next =
|
|
533
|
+
_context7.next = 14;
|
|
528
534
|
break;
|
|
529
535
|
}
|
|
530
536
|
window.open(result.data);
|
|
531
537
|
return _context7.abrupt("return", true);
|
|
532
|
-
case
|
|
538
|
+
case 14:
|
|
533
539
|
if (!(((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
|
|
534
|
-
_context7.next =
|
|
540
|
+
_context7.next = 19;
|
|
535
541
|
break;
|
|
536
542
|
}
|
|
537
543
|
showSuccess(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retMsg) || '导出成功');
|
|
538
544
|
return _context7.abrupt("return", true);
|
|
539
|
-
case
|
|
545
|
+
case 19:
|
|
540
546
|
showError(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retMsg) || '导出失败,请联系系统管理员');
|
|
541
547
|
return _context7.abrupt("return", false);
|
|
542
|
-
case
|
|
543
|
-
_context7.next =
|
|
548
|
+
case 21:
|
|
549
|
+
_context7.next = 28;
|
|
544
550
|
break;
|
|
545
|
-
case
|
|
546
|
-
_context7.prev =
|
|
547
|
-
_context7.t0 = _context7["catch"](
|
|
551
|
+
case 23:
|
|
552
|
+
_context7.prev = 23;
|
|
553
|
+
_context7.t0 = _context7["catch"](7);
|
|
548
554
|
console.log(_context7.t0);
|
|
549
555
|
showError(_context7.t0.message);
|
|
550
556
|
return _context7.abrupt("return", false);
|
|
551
|
-
case
|
|
557
|
+
case 28:
|
|
552
558
|
case "end":
|
|
553
559
|
return _context7.stop();
|
|
554
560
|
}
|
|
555
|
-
}, _callee7, null, [[
|
|
561
|
+
}, _callee7, null, [[7, 23]]);
|
|
556
562
|
}));
|
|
557
|
-
return function onExport(
|
|
563
|
+
return function onExport(_x9, _x10) {
|
|
558
564
|
return _ref7.apply(this, arguments);
|
|
559
565
|
};
|
|
560
566
|
}();
|
|
@@ -648,8 +654,8 @@ function useSingle(inParam) {
|
|
|
648
654
|
checkRight: checkRight,
|
|
649
655
|
loginName: loginName,
|
|
650
656
|
isAudit: isAudit,
|
|
651
|
-
|
|
652
|
-
|
|
657
|
+
ifHistory: ifHistory,
|
|
658
|
+
setIfHistory: setIfHistory
|
|
653
659
|
};
|
|
654
660
|
}
|
|
655
661
|
;
|
package/es/http/index.js
CHANGED
|
@@ -7,11 +7,11 @@ var request = extend({
|
|
|
7
7
|
timeout: 60000
|
|
8
8
|
});
|
|
9
9
|
var httpStatus = {
|
|
10
|
-
404: '
|
|
11
|
-
429: '
|
|
12
|
-
502: '
|
|
13
|
-
503: '
|
|
14
|
-
504: '
|
|
10
|
+
404: '请求的服务不存在',
|
|
11
|
+
429: '请求的服务繁忙',
|
|
12
|
+
502: '请求的服务网关出错',
|
|
13
|
+
503: '请求的服务器异常',
|
|
14
|
+
504: '请求服务超时'
|
|
15
15
|
};
|
|
16
16
|
/** 请求拦截器,统一添加token */
|
|
17
17
|
request.interceptors.request.use(function (url, options) {
|
|
@@ -57,7 +57,7 @@ request.interceptors.request.use(function (url, options) {
|
|
|
57
57
|
/** 请求返回拦截器,统一处理业务异常 */
|
|
58
58
|
request.interceptors.response.use( /*#__PURE__*/function () {
|
|
59
59
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response, options) {
|
|
60
|
-
var noMsg, _data$flag, _data$flag2, _data$flag3, _data$flag4, data, retCode, retMsg, requestId, faultCode, text, _data$flag5, _data$flag6, _data$flag7, _data$flag8, _data, _retCode, _retMsg, status, _requestId, _faultCode;
|
|
60
|
+
var noMsg, _data$flag, _data$flag2, _data$flag3, _data$flag4, data, retCode, retMsg, requestId, faultCode, text, _text, _data$flag5, _data$flag6, _data$flag7, _data$flag8, _data, _retCode, _retMsg, status, _requestId, _faultCode;
|
|
61
61
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
62
|
while (1) switch (_context.prev = _context.next) {
|
|
63
63
|
case 0:
|
|
@@ -81,7 +81,13 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
81
81
|
if (faultCode) {
|
|
82
82
|
httpError(retMsg, retCode, faultCode, options.url);
|
|
83
83
|
} else {
|
|
84
|
-
|
|
84
|
+
text = httpStatus[response.status];
|
|
85
|
+
if (response.status === 503 && response.statusText === 'no healthy upstream') {
|
|
86
|
+
text = '请求的服务未启动';
|
|
87
|
+
} else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
|
|
88
|
+
text = '请求的服务被限流';
|
|
89
|
+
}
|
|
90
|
+
showError(text || retMsg);
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
_context.next = 18;
|
|
@@ -89,13 +95,13 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
89
95
|
case 13:
|
|
90
96
|
_context.prev = 13;
|
|
91
97
|
_context.t0 = _context["catch"](2);
|
|
92
|
-
|
|
98
|
+
_text = httpStatus[response.status];
|
|
93
99
|
if (response.status === 503 && response.statusText === 'no healthy upstream') {
|
|
94
|
-
|
|
100
|
+
_text = '请求的服务未启动';
|
|
95
101
|
} else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
|
|
96
|
-
|
|
102
|
+
_text = '请求的服务被限流';
|
|
97
103
|
}
|
|
98
|
-
showError(
|
|
104
|
+
showError(_text || _context.t0.message || response.statusText);
|
|
99
105
|
case 18:
|
|
100
106
|
_context.next = 30;
|
|
101
107
|
break;
|
|
@@ -109,7 +115,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
109
115
|
case 23:
|
|
110
116
|
_data = _context.sent;
|
|
111
117
|
_retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retCode) || '0';
|
|
112
|
-
_retMsg = ((_data$flag6 = _data.flag) === null || _data$flag6 === void 0 ? void 0 : _data$flag6.retMsg) || '
|
|
118
|
+
_retMsg = ((_data$flag6 = _data.flag) === null || _data$flag6 === void 0 ? void 0 : _data$flag6.retMsg) || '请求的服务出错';
|
|
113
119
|
status = (getUrlQuery('apiStatus') || '0').split(',');
|
|
114
120
|
_requestId = (_data$flag7 = _data.flag) === null || _data$flag7 === void 0 ? void 0 : _data$flag7.requestId;
|
|
115
121
|
_faultCode = (_data$flag8 = _data.flag) === null || _data$flag8 === void 0 ? void 0 : _data$flag8.faultCode;
|
package/es/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import InputMultiLine from './components/InputMultiLine';
|
|
|
8
8
|
import AreaCascader from './components/AreaCascader';
|
|
9
9
|
import AreaCascaderPanel from './components/AreaCascaderPanel';
|
|
10
10
|
import DescritionCard from './components/DescritionCard';
|
|
11
|
+
import Permission from './components/Permission';
|
|
11
12
|
import BaseService from './service/BaseService';
|
|
12
13
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
13
14
|
import * as utils from './utils';
|
|
@@ -19,5 +20,6 @@ import usePermission from './hooks/usePermission';
|
|
|
19
20
|
import type { ApiResponse, TableToolbar, BaseApiType, MethodType } from './typing';
|
|
20
21
|
import type { DtlLyaoutProps } from './components/DtlLayout';
|
|
21
22
|
import type { DescritionCardProps } from './components/DescritionCard';
|
|
22
|
-
|
|
23
|
-
export {
|
|
23
|
+
import type { PermissionProps } from './components/Permission';
|
|
24
|
+
export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps, DescritionCardProps, PermissionProps };
|
|
25
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission };
|
package/es/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import InputMultiLine from './components/InputMultiLine';
|
|
|
8
8
|
import AreaCascader from './components/AreaCascader';
|
|
9
9
|
import AreaCascaderPanel from './components/AreaCascaderPanel';
|
|
10
10
|
import DescritionCard from './components/DescritionCard';
|
|
11
|
+
import Permission from './components/Permission';
|
|
11
12
|
import BaseService from './service/BaseService';
|
|
12
13
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
13
14
|
import * as utils from './utils';
|
|
@@ -15,4 +16,4 @@ import * as utils from './utils';
|
|
|
15
16
|
import useSingle from './hooks/useSingle';
|
|
16
17
|
import useDtl from './hooks/useDtl';
|
|
17
18
|
import usePermission from './hooks/usePermission';
|
|
18
|
-
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission };
|
|
19
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission };
|
package/es/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ModalFuncProps } from 'antd';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
export { throttle, debounce } from 'lodash';
|
|
4
5
|
export { getUrlQuery, setUrlQuery, toGatewayUrl, dateFormat, getResourceProps } from 'ls-pro-table';
|
|
5
6
|
/**
|
|
6
7
|
* 设置文档title
|
|
@@ -26,13 +27,14 @@ export declare const today: () => string;
|
|
|
26
27
|
*/
|
|
27
28
|
export declare const now: () => string;
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
+
* 时间加减
|
|
31
|
+
* @param dt 原始时间,传 null 为当前时间
|
|
30
32
|
* @param addDay 添加添数,可为负数
|
|
31
33
|
* @param addMonth 添加月数,可为负数
|
|
32
34
|
* @param addYear 添加年数,可以负责
|
|
33
|
-
* @returns YYYY-MM-DD
|
|
35
|
+
* @returns YYYY-MM-DD hh:mm:ss
|
|
34
36
|
*/
|
|
35
|
-
export declare const
|
|
37
|
+
export declare const dateAdd: (dt: Date | null, addDay: number, addMonth?: number, addYear?: number) => string;
|
|
36
38
|
/**
|
|
37
39
|
* 当前时间加减
|
|
38
40
|
* @param addDay 添加添数,可为负数
|
|
@@ -42,14 +44,13 @@ export declare const todayAdd: (addDay: number, addMonth?: number, addYear?: num
|
|
|
42
44
|
*/
|
|
43
45
|
export declare const nowAdd: (addDay: number, addMonth?: number, addYear?: number) => string;
|
|
44
46
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @param dt 原始时间,传 null 为当前时间
|
|
47
|
+
* 当前日期加减
|
|
47
48
|
* @param addDay 添加添数,可为负数
|
|
48
49
|
* @param addMonth 添加月数,可为负数
|
|
49
50
|
* @param addYear 添加年数,可以负责
|
|
50
|
-
* @returns YYYY-MM-DD
|
|
51
|
+
* @returns YYYY-MM-DD
|
|
51
52
|
*/
|
|
52
|
-
export declare const
|
|
53
|
+
export declare const todayAdd: (addDay: number, addMonth?: number, addYear?: number) => string;
|
|
53
54
|
/**
|
|
54
55
|
* 千位符格式化数值
|
|
55
56
|
* @param num 数值
|
|
@@ -75,6 +76,7 @@ export declare const setCookie: (key: string, value: string | number, day?: numb
|
|
|
75
76
|
* @returns
|
|
76
77
|
*/
|
|
77
78
|
export declare const isLogin: () => boolean;
|
|
79
|
+
export declare const getFullScreenElement: () => any;
|
|
78
80
|
/**
|
|
79
81
|
* 设置本地缓存
|
|
80
82
|
* @param { String } key 关键字
|
|
@@ -101,7 +103,6 @@ export declare const showError: (text: string) => void;
|
|
|
101
103
|
export declare const showWarn: (text: string) => void;
|
|
102
104
|
/** @name 显示成功 */
|
|
103
105
|
export declare const showSuccess: (text: string) => void;
|
|
104
|
-
export declare const getFullScreenElement: () => any;
|
|
105
106
|
/**
|
|
106
107
|
* 弹框提示
|
|
107
108
|
* @param text 提示信息
|
|
@@ -165,20 +166,6 @@ export declare const treeFind: (list: any[], key: string, val: any, children?: s
|
|
|
165
166
|
* @returns 返回已处理好的表头[{dataIndex:sizeTypeNo,title:'国标码',width:120,children[...]},{dataIndex:'f1',...}...]
|
|
166
167
|
*/
|
|
167
168
|
export declare const handleSizeCols: (orgSizeHeader: any[], typeWidth?: number, sizeWidth?: number) => any[];
|
|
168
|
-
/**
|
|
169
|
-
* 函数防抖, 限定的时间内多次操作只执行最后一次
|
|
170
|
-
* @param fn 函数
|
|
171
|
-
* @param delay 限时
|
|
172
|
-
* @returns function
|
|
173
|
-
*/
|
|
174
|
-
export declare const debounce: (fn: Function, delay?: number) => () => void;
|
|
175
|
-
/**
|
|
176
|
-
* 函数节流,限时内只触发一次函数
|
|
177
|
-
* @param fn 函数
|
|
178
|
-
* @param delay 限时
|
|
179
|
-
* @returns function
|
|
180
|
-
*/
|
|
181
|
-
export declare const throttle: (fn: Function, delay?: number) => (...args: any[]) => void;
|
|
182
169
|
/**
|
|
183
170
|
* 绑定事件
|
|
184
171
|
* @param eventName 事件名
|
package/es/utils/index.js
CHANGED
|
@@ -7,12 +7,12 @@ import _Modal from "antd/es/modal";
|
|
|
7
7
|
import "antd/es/message/style";
|
|
8
8
|
import _message from "antd/es/message";
|
|
9
9
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
10
|
-
var _this = this;
|
|
11
10
|
import ReactDOM from 'react-dom';
|
|
12
11
|
import { QuestionCircleOutlined } from '@ant-design/icons';
|
|
13
12
|
import { dateFormat, toGatewayUrl } from 'ls-pro-table';
|
|
14
13
|
import { httpPost } from '../http';
|
|
15
14
|
import React from 'react';
|
|
15
|
+
export { throttle, debounce } from 'lodash';
|
|
16
16
|
export { getUrlQuery, setUrlQuery, toGatewayUrl, dateFormat, getResourceProps } from 'ls-pro-table';
|
|
17
17
|
/**
|
|
18
18
|
* 设置文档title
|
|
@@ -44,30 +44,6 @@ export var today = function today() {
|
|
|
44
44
|
export var now = function now() {
|
|
45
45
|
return dateFormat(null, true);
|
|
46
46
|
};
|
|
47
|
-
/**
|
|
48
|
-
* 当前日期加减
|
|
49
|
-
* @param addDay 添加添数,可为负数
|
|
50
|
-
* @param addMonth 添加月数,可为负数
|
|
51
|
-
* @param addYear 添加年数,可以负责
|
|
52
|
-
* @returns YYYY-MM-DD
|
|
53
|
-
*/
|
|
54
|
-
export var todayAdd = function todayAdd(addDay) {
|
|
55
|
-
var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
56
|
-
var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
57
|
-
return nowAdd(addDay, addMonth, addYear).split(' ')[0];
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* 当前时间加减
|
|
61
|
-
* @param addDay 添加添数,可为负数
|
|
62
|
-
* @param addMonth 添加月数,可为负数
|
|
63
|
-
* @param addYear 添加年数,可以负责
|
|
64
|
-
* @returns YYYY-MM-DD hh:mm:ss
|
|
65
|
-
*/
|
|
66
|
-
export var nowAdd = function nowAdd(addDay) {
|
|
67
|
-
var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
68
|
-
var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
69
|
-
return dateAdd(null, addDay, addMonth, addYear);
|
|
70
|
-
};
|
|
71
47
|
/**
|
|
72
48
|
* 时间加减
|
|
73
49
|
* @param dt 原始时间,传 null 为当前时间
|
|
@@ -93,6 +69,30 @@ export var dateAdd = function dateAdd(dt, addDay) {
|
|
|
93
69
|
}
|
|
94
70
|
return dateFormat(dt, true);
|
|
95
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* 当前时间加减
|
|
74
|
+
* @param addDay 添加添数,可为负数
|
|
75
|
+
* @param addMonth 添加月数,可为负数
|
|
76
|
+
* @param addYear 添加年数,可以负责
|
|
77
|
+
* @returns YYYY-MM-DD hh:mm:ss
|
|
78
|
+
*/
|
|
79
|
+
export var nowAdd = function nowAdd(addDay) {
|
|
80
|
+
var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
81
|
+
var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
82
|
+
return dateAdd(null, addDay, addMonth, addYear);
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* 当前日期加减
|
|
86
|
+
* @param addDay 添加添数,可为负数
|
|
87
|
+
* @param addMonth 添加月数,可为负数
|
|
88
|
+
* @param addYear 添加年数,可以负责
|
|
89
|
+
* @returns YYYY-MM-DD
|
|
90
|
+
*/
|
|
91
|
+
export var todayAdd = function todayAdd(addDay) {
|
|
92
|
+
var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
93
|
+
var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
94
|
+
return nowAdd(addDay, addMonth, addYear).split(' ')[0];
|
|
95
|
+
};
|
|
96
96
|
/**
|
|
97
97
|
* 千位符格式化数值
|
|
98
98
|
* @param num 数值
|
|
@@ -119,8 +119,8 @@ export var formatMoney = function formatMoney(num) {
|
|
|
119
119
|
* @returns
|
|
120
120
|
*/
|
|
121
121
|
export var getCookie = function getCookie(name) {
|
|
122
|
-
var arr
|
|
123
|
-
|
|
122
|
+
var arr;
|
|
123
|
+
var reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
|
|
124
124
|
if (arr = document.cookie.match(reg)) return arr[2];else return null;
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
@@ -154,6 +154,10 @@ export var setCookie = function setCookie(key, value) {
|
|
|
154
154
|
export var isLogin = function isLogin() {
|
|
155
155
|
return !!getCookie('online');
|
|
156
156
|
};
|
|
157
|
+
export var getFullScreenElement = function getFullScreenElement() {
|
|
158
|
+
//@ts-ignore
|
|
159
|
+
return document.fullscreenElement || document.mozFullScreenElement || document.msFullScreenElement || document.webkitFullscreenElement || undefined;
|
|
160
|
+
};
|
|
157
161
|
/**
|
|
158
162
|
* 设置本地缓存
|
|
159
163
|
* @param { String } key 关键字
|
|
@@ -165,7 +169,11 @@ export var setCache = function setCache(key, data) {
|
|
|
165
169
|
if (_typeof(data) === 'object') {
|
|
166
170
|
data = JSON.stringify(data);
|
|
167
171
|
}
|
|
168
|
-
|
|
172
|
+
if (session) {
|
|
173
|
+
sessionStorage.setItem(key, data);
|
|
174
|
+
} else {
|
|
175
|
+
localStorage.setItem(key, data);
|
|
176
|
+
}
|
|
169
177
|
};
|
|
170
178
|
/**
|
|
171
179
|
* 读取本地缓存
|
|
@@ -189,9 +197,17 @@ export var getCache = function getCache(key) {
|
|
|
189
197
|
export var clearCache = function clearCache(key) {
|
|
190
198
|
var session = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
191
199
|
if (key) {
|
|
192
|
-
|
|
200
|
+
if (session) {
|
|
201
|
+
sessionStorage.removeItem(key);
|
|
202
|
+
} else {
|
|
203
|
+
localStorage.removeItem(key);
|
|
204
|
+
}
|
|
193
205
|
} else {
|
|
194
|
-
|
|
206
|
+
if (session) {
|
|
207
|
+
sessionStorage.clear();
|
|
208
|
+
} else {
|
|
209
|
+
localStorage.clear();
|
|
210
|
+
}
|
|
195
211
|
}
|
|
196
212
|
};
|
|
197
213
|
_message.config({
|
|
@@ -224,10 +240,6 @@ export var showSuccess = function showSuccess(text) {
|
|
|
224
240
|
}
|
|
225
241
|
});
|
|
226
242
|
};
|
|
227
|
-
export var getFullScreenElement = function getFullScreenElement() {
|
|
228
|
-
//@ts-ignore
|
|
229
|
-
return document.fullscreenElement || document.mozFullScreenElement || document.msFullScreenElement || document.webkitFullscreenElement || undefined;
|
|
230
|
-
};
|
|
231
243
|
/**
|
|
232
244
|
* 弹框提示
|
|
233
245
|
* @param text 提示信息
|
|
@@ -312,8 +324,12 @@ export var rangeToSearch = function rangeToSearch(values, startField, endField)
|
|
|
312
324
|
var endSuffix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
313
325
|
var startSuffex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|
|
314
326
|
var data = {};
|
|
315
|
-
Array.isArray(values) && values[0]
|
|
316
|
-
|
|
327
|
+
if (Array.isArray(values) && values[0]) {
|
|
328
|
+
data[startField] = values[0] + startSuffex;
|
|
329
|
+
}
|
|
330
|
+
if (Array.isArray(values) && values[1]) {
|
|
331
|
+
data[endField] = values[1] + endSuffix;
|
|
332
|
+
}
|
|
317
333
|
return data;
|
|
318
334
|
};
|
|
319
335
|
/** @name 状态列表 */
|
|
@@ -466,41 +482,6 @@ export var handleSizeCols = function handleSizeCols(orgSizeHeader) {
|
|
|
466
482
|
});
|
|
467
483
|
return headers;
|
|
468
484
|
};
|
|
469
|
-
/**
|
|
470
|
-
* 函数防抖, 限定的时间内多次操作只执行最后一次
|
|
471
|
-
* @param fn 函数
|
|
472
|
-
* @param delay 限时
|
|
473
|
-
* @returns function
|
|
474
|
-
*/
|
|
475
|
-
export var debounce = function debounce(fn) {
|
|
476
|
-
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
477
|
-
var t = null;
|
|
478
|
-
return function () {
|
|
479
|
-
clearTimeout(t);
|
|
480
|
-
t = setTimeout(fn, delay);
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
/**
|
|
484
|
-
* 函数节流,限时内只触发一次函数
|
|
485
|
-
* @param fn 函数
|
|
486
|
-
* @param delay 限时
|
|
487
|
-
* @returns function
|
|
488
|
-
*/
|
|
489
|
-
export var throttle = function throttle(fn) {
|
|
490
|
-
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
491
|
-
var t = Date.now();
|
|
492
|
-
return function () {
|
|
493
|
-
var me = _this;
|
|
494
|
-
var now = Date.now();
|
|
495
|
-
if (now - t > delay) {
|
|
496
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
497
|
-
args[_key] = arguments[_key];
|
|
498
|
-
}
|
|
499
|
-
fn.apply(me, args);
|
|
500
|
-
t = now;
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
|
-
};
|
|
504
485
|
/**
|
|
505
486
|
* 绑定事件
|
|
506
487
|
* @param eventName 事件名
|