ls-pro-common 1.0.63 → 1.0.65
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 +80 -10
- package/dist/common.js +1 -1
- package/dist/common.min.css +80 -10
- package/dist/common.min.js +1 -1
- package/es/components/DtlLayout.js +16 -8
- package/es/components/common.less +88 -0
- package/es/hooks/useSingle/index.d.ts +2 -0
- package/es/hooks/useSingle/index.js +25 -13
- package/es/http/index.js +96 -184
- package/es/utils/index.d.ts +11 -0
- package/es/utils/index.js +36 -1
- package/lib/components/DtlLayout.js +15 -7
- package/lib/components/common.less +88 -0
- package/lib/hooks/useSingle/index.d.ts +2 -0
- package/lib/hooks/useSingle/index.js +25 -13
- package/lib/http/index.js +95 -182
- package/lib/utils/index.d.ts +11 -0
- package/lib/utils/index.js +54 -5
- package/package.json +4 -5
package/es/utils/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "antd/es/spin/style";
|
|
2
|
+
import _Spin from "antd/es/spin";
|
|
1
3
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
4
|
import "antd/es/modal/style";
|
|
3
5
|
import _Modal from "antd/es/modal";
|
|
@@ -5,6 +7,7 @@ import "antd/es/message/style";
|
|
|
5
7
|
import _message from "antd/es/message";
|
|
6
8
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
7
9
|
import React from "react";
|
|
10
|
+
import ReactDOM from 'react-dom';
|
|
8
11
|
import { QuestionCircleOutlined } from '@ant-design/icons';
|
|
9
12
|
import { dateFormat, toGatewayUrl } from 'ls-pro-table';
|
|
10
13
|
import { httpPost } from '../http';
|
|
@@ -271,7 +274,7 @@ export var reLogin = function reLogin() {
|
|
|
271
274
|
maskClosable: false,
|
|
272
275
|
afterClose: function afterClose() {
|
|
273
276
|
timeout = false;
|
|
274
|
-
location.href = location.pathname === '/' ? '/login' : '/login?redirect=' +
|
|
277
|
+
location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
275
278
|
}
|
|
276
279
|
});
|
|
277
280
|
};
|
|
@@ -669,4 +672,36 @@ export var deepClone = function deepClone(obj) {
|
|
|
669
672
|
}
|
|
670
673
|
|
|
671
674
|
return target;
|
|
675
|
+
};
|
|
676
|
+
/**
|
|
677
|
+
* 在主工程中打开模块
|
|
678
|
+
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data:参数}
|
|
679
|
+
*/
|
|
680
|
+
|
|
681
|
+
export var openPageInMain = function openPageInMain(option) {
|
|
682
|
+
var win = top || window;
|
|
683
|
+
win.postMessage({
|
|
684
|
+
type: 'openPage',
|
|
685
|
+
param: option
|
|
686
|
+
});
|
|
687
|
+
};
|
|
688
|
+
export var showLoading = function showLoading() {
|
|
689
|
+
var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '处理中...';
|
|
690
|
+
var loading = document.getElementById('myloading');
|
|
691
|
+
if (loading) return;
|
|
692
|
+
var loadWrapper = document.createElement('div');
|
|
693
|
+
loadWrapper.setAttribute("id", "myloading");
|
|
694
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(_Spin, {
|
|
695
|
+
tip: text
|
|
696
|
+
}), loadWrapper);
|
|
697
|
+
document.body.appendChild(loadWrapper);
|
|
698
|
+
};
|
|
699
|
+
export var exitLoading = function exitLoading() {
|
|
700
|
+
var loading = document.getElementById('myloading');
|
|
701
|
+
|
|
702
|
+
if (loading) {
|
|
703
|
+
var _loading$parentNode;
|
|
704
|
+
|
|
705
|
+
(_loading$parentNode = loading.parentNode) === null || _loading$parentNode === void 0 ? void 0 : _loading$parentNode.removeChild(loading);
|
|
706
|
+
}
|
|
672
707
|
};
|
|
@@ -69,13 +69,15 @@ function DtlLayout(props) {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
var btns = (0, _react.useMemo)(function () {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
// const b = [
|
|
73
|
+
// <Button
|
|
74
|
+
// key="btnBack"
|
|
75
|
+
// onClick={() => props.onExit(false)}
|
|
76
|
+
// icon={<ArrowLeftOutlined />}>
|
|
77
|
+
// {btnExitText}
|
|
78
|
+
// </Button>
|
|
79
|
+
// ]
|
|
80
|
+
var b = []; // 有新增或更改权限且未审核,开放出保存按钮
|
|
79
81
|
|
|
80
82
|
if ((checkRight(2) || checkRight(4)) && !isAudit()) {
|
|
81
83
|
b.unshift( /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
@@ -116,6 +118,12 @@ function DtlLayout(props) {
|
|
|
116
118
|
className: (0, _classnames.default)('dtl-header', headerClass),
|
|
117
119
|
style: headerStyle
|
|
118
120
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
121
|
+
className: "dtl-back"
|
|
122
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.LeftOutlined, {
|
|
123
|
+
onClick: function onClick() {
|
|
124
|
+
return props.onExit(false);
|
|
125
|
+
}
|
|
126
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
119
127
|
className: "dtl-title"
|
|
120
128
|
}, dtlTitle), /*#__PURE__*/_react.default.createElement("div", {
|
|
121
129
|
className: "dtl-btns"
|
|
@@ -39,6 +39,52 @@ body {
|
|
|
39
39
|
--ant-info-color : #4997E6;
|
|
40
40
|
--ant-info-color-deprecated-bg : #f0faff;
|
|
41
41
|
--ant-info-color-deprecated-border : #ccebff;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// --ant-primary-color : #3973F6;
|
|
49
|
+
// --ant-primary-color-hover : #6397ff;
|
|
50
|
+
// --ant-primary-color-active : #2552cf;
|
|
51
|
+
// --ant-primary-color-outline : rgba(57, 115, 246, 0.2);
|
|
52
|
+
// --ant-primary-1 : #f0f7ff;
|
|
53
|
+
// --ant-primary-2 : #deecff;
|
|
54
|
+
// --ant-primary-3 : #b5d3ff;
|
|
55
|
+
// --ant-primary-4 : #8cb6ff;
|
|
56
|
+
// --ant-primary-5 : #6397ff;
|
|
57
|
+
// --ant-primary-6 : #3973F6;
|
|
58
|
+
// --ant-primary-7 : #2552cf;
|
|
59
|
+
// --ant-primary-color-deprecated-pure : #e4ecfe;
|
|
60
|
+
// --ant-primary-color-deprecated-l-35 : #e4ecfe;
|
|
61
|
+
// --ant-primary-color-deprecated-l-20 : #9bb8fa;
|
|
62
|
+
// --ant-primary-color-deprecated-t-20 : #618ff8;
|
|
63
|
+
// --ant-primary-color-deprecated-t-50 : #9cb9fb;
|
|
64
|
+
// --ant-primary-color-deprecated-f-12 : rgba(57, 115, 246, 0.12);
|
|
65
|
+
// --ant-primary-color-active-deprecated-f-30: rgba(240, 247, 255, 0.3);
|
|
66
|
+
// --ant-primary-color-active-deprecated-d-02: #e6f2ff;
|
|
67
|
+
// --ant-success-color : #52c41a;
|
|
68
|
+
// --ant-success-color-hover : #73d13d;
|
|
69
|
+
// --ant-success-color-active : #389e0d;
|
|
70
|
+
// --ant-success-color-outline : rgba(82, 196, 26, 0.2);
|
|
71
|
+
// --ant-success-color-deprecated-bg : #f6ffed;
|
|
72
|
+
// --ant-success-color-deprecated-border : #b7eb8f;
|
|
73
|
+
// --ant-error-color : #ff4d4f;
|
|
74
|
+
// --ant-error-color-hover : #ff7875;
|
|
75
|
+
// --ant-error-color-active : #d9363e;
|
|
76
|
+
// --ant-error-color-outline : rgba(255, 77, 79, 0.2);
|
|
77
|
+
// --ant-error-color-deprecated-bg : #fff2f0;
|
|
78
|
+
// --ant-error-color-deprecated-border : #ffccc7;
|
|
79
|
+
// --ant-warning-color : #faad14;
|
|
80
|
+
// --ant-warning-color-hover : #ffc53d;
|
|
81
|
+
// --ant-warning-color-active : #d48806;
|
|
82
|
+
// --ant-warning-color-outline : rgba(250, 173, 20, 0.2);
|
|
83
|
+
// --ant-warning-color-deprecated-bg : #fffbe6;
|
|
84
|
+
// --ant-warning-color-deprecated-border : #ffe58f;
|
|
85
|
+
// --ant-info-color : #3973F6;
|
|
86
|
+
// --ant-info-color-deprecated-bg : #f0f7ff;
|
|
87
|
+
// --ant-info-color-deprecated-border : #b5d3ff;
|
|
42
88
|
}
|
|
43
89
|
|
|
44
90
|
.dtl-layout {
|
|
@@ -58,6 +104,22 @@ body {
|
|
|
58
104
|
padding : 5px 14px;
|
|
59
105
|
border-bottom: 1px solid #f0f0f0;
|
|
60
106
|
|
|
107
|
+
.dtl-back {
|
|
108
|
+
display : flex;
|
|
109
|
+
align-items : center;
|
|
110
|
+
padding-right: 5px;
|
|
111
|
+
|
|
112
|
+
>span {
|
|
113
|
+
padding : 3px;
|
|
114
|
+
border-radius: 2px;
|
|
115
|
+
|
|
116
|
+
&:hover {
|
|
117
|
+
background: var(--ant-primary-2);
|
|
118
|
+
color : var(--ant-primary-color)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
61
123
|
.dtl-title {
|
|
62
124
|
font-size: 14pt;
|
|
63
125
|
}
|
|
@@ -131,6 +193,25 @@ body {
|
|
|
131
193
|
background : #fff;
|
|
132
194
|
}
|
|
133
195
|
|
|
196
|
+
#myloading {
|
|
197
|
+
position : fixed;
|
|
198
|
+
top : 0;
|
|
199
|
+
left : 0;
|
|
200
|
+
bottom : 0;
|
|
201
|
+
right : 0;
|
|
202
|
+
z-index : 9999;
|
|
203
|
+
display : flex;
|
|
204
|
+
align-items : center;
|
|
205
|
+
background-color: rgba(226, 227, 231, 0.9);
|
|
206
|
+
justify-content : center;
|
|
207
|
+
|
|
208
|
+
.load-text {
|
|
209
|
+
padding : 4px 20px;
|
|
210
|
+
background-color: #fff;
|
|
211
|
+
border-radius : 4px;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
134
215
|
.ant-btn {
|
|
135
216
|
border-radius: 4px;
|
|
136
217
|
border-color : var(--ant-primary-color);
|
|
@@ -215,4 +296,11 @@ a:hover {
|
|
|
215
296
|
max-height: calc(100vh - 180px);
|
|
216
297
|
overflow-y: auto;
|
|
217
298
|
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
.ant-btn {
|
|
303
|
+
height : 28px;
|
|
304
|
+
line-height: 1.2;
|
|
305
|
+
padding : 2px 15px;
|
|
218
306
|
}
|
|
@@ -8,6 +8,8 @@ export declare type SingleParamType = {
|
|
|
8
8
|
initItem?: any;
|
|
9
9
|
statusField?: string;
|
|
10
10
|
auditStatus?: number;
|
|
11
|
+
totalFields?: string[];
|
|
12
|
+
customTotal?: (param: Record<string, any>) => Promise<any>;
|
|
11
13
|
beforeLoad?: (param: Record<string, any>) => Promise<boolean>;
|
|
12
14
|
beforeRemove?: (rows: any[]) => Promise<any>;
|
|
13
15
|
beforeAudit?: (rows: any[]) => Promise<any>;
|
|
@@ -33,7 +33,7 @@ var _http = require("../../http");
|
|
|
33
33
|
|
|
34
34
|
var _usePermission2 = _interopRequireDefault(require("../usePermission"));
|
|
35
35
|
|
|
36
|
-
var _excluded = ["current", "pageSize"];
|
|
36
|
+
var _excluded = ["current", "pageSize", "sumProperties"];
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* 单表基本增删改查 hooks
|
|
@@ -60,6 +60,7 @@ function useSingle(inParam) {
|
|
|
60
60
|
initItem = inParam.initItem,
|
|
61
61
|
statusField = inParam.statusField,
|
|
62
62
|
auditStatus = inParam.auditStatus,
|
|
63
|
+
totalFields = inParam.totalFields,
|
|
63
64
|
beforeAudit = inParam.beforeAudit,
|
|
64
65
|
beforeLoad = inParam.beforeLoad,
|
|
65
66
|
beforeRemove = inParam.beforeRemove,
|
|
@@ -69,7 +70,8 @@ function useSingle(inParam) {
|
|
|
69
70
|
afterRemove = inParam.afterRemove,
|
|
70
71
|
afterSave = inParam.afterSave,
|
|
71
72
|
afterAudit = inParam.afterAudit,
|
|
72
|
-
btnStatus = inParam.btnStatus
|
|
73
|
+
btnStatus = inParam.btnStatus,
|
|
74
|
+
customTotal = inParam.customTotal;
|
|
73
75
|
/** @name 选中行数据 */
|
|
74
76
|
|
|
75
77
|
var _useState = (0, _react.useState)([]),
|
|
@@ -526,18 +528,23 @@ function useSingle(inParam) {
|
|
|
526
528
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(params, sort, filter) {
|
|
527
529
|
var _tableRef$current, _tableRef$current$cle;
|
|
528
530
|
|
|
529
|
-
var current, pageSize, rest, param, key, _key, sortArr, _key2, result;
|
|
531
|
+
var current, pageSize, sumProperties, rest, param, key, _key, sortArr, _key2, result;
|
|
530
532
|
|
|
531
533
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
532
534
|
while (1) {
|
|
533
535
|
switch (_context6.prev = _context6.next) {
|
|
534
536
|
case 0:
|
|
535
|
-
current = params.current, pageSize = params.pageSize, rest = (0, _objectWithoutProperties2.default)(params, _excluded);
|
|
537
|
+
current = params.current, pageSize = params.pageSize, sumProperties = params.sumProperties, rest = (0, _objectWithoutProperties2.default)(params, _excluded);
|
|
536
538
|
param = {}; // 分页
|
|
537
539
|
|
|
538
540
|
if (current) {
|
|
539
541
|
param.page = current;
|
|
540
542
|
param.pageSize = pageSize;
|
|
543
|
+
} // 合计
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
if (sumProperties) {
|
|
547
|
+
param.sumProperties = sumProperties;
|
|
541
548
|
} // 处理查询条件
|
|
542
549
|
|
|
543
550
|
|
|
@@ -581,20 +588,20 @@ function useSingle(inParam) {
|
|
|
581
588
|
_context6.t0 = beforeLoad;
|
|
582
589
|
|
|
583
590
|
if (!_context6.t0) {
|
|
584
|
-
_context6.next =
|
|
591
|
+
_context6.next = 16;
|
|
585
592
|
break;
|
|
586
593
|
}
|
|
587
594
|
|
|
588
|
-
_context6.next =
|
|
595
|
+
_context6.next = 14;
|
|
589
596
|
return beforeLoad(param);
|
|
590
597
|
|
|
591
|
-
case
|
|
598
|
+
case 14:
|
|
592
599
|
_context6.t1 = _context6.sent;
|
|
593
600
|
_context6.t0 = _context6.t1 === false;
|
|
594
601
|
|
|
595
|
-
case
|
|
602
|
+
case 16:
|
|
596
603
|
if (!_context6.t0) {
|
|
597
|
-
_context6.next =
|
|
604
|
+
_context6.next = 18;
|
|
598
605
|
break;
|
|
599
606
|
}
|
|
600
607
|
|
|
@@ -604,17 +611,22 @@ function useSingle(inParam) {
|
|
|
604
611
|
total: 0
|
|
605
612
|
});
|
|
606
613
|
|
|
607
|
-
case
|
|
608
|
-
_context6.next =
|
|
614
|
+
case 18:
|
|
615
|
+
_context6.next = 20;
|
|
609
616
|
return service.load(param);
|
|
610
617
|
|
|
611
|
-
case
|
|
618
|
+
case 20:
|
|
612
619
|
result = _context6.sent;
|
|
613
620
|
result.data = result.rows || [];
|
|
614
621
|
result.success = true;
|
|
622
|
+
|
|
623
|
+
if (sumProperties) {
|
|
624
|
+
result.data = result.footer;
|
|
625
|
+
}
|
|
626
|
+
|
|
615
627
|
return _context6.abrupt("return", result);
|
|
616
628
|
|
|
617
|
-
case
|
|
629
|
+
case 25:
|
|
618
630
|
case "end":
|
|
619
631
|
return _context6.stop();
|
|
620
632
|
}
|