ls-pro-common 1.0.64 → 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 +88 -173
- 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 +87 -172
- package/lib/utils/index.d.ts +11 -0
- package/lib/utils/index.js +54 -5
- package/package.json +3 -3
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
|
}
|
package/lib/http/index.js
CHANGED
|
@@ -56,6 +56,12 @@ request.interceptors.request.use(function (url, options) {
|
|
|
56
56
|
options.headers["storeNo"] = storeNo;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
var tag = (0, _utils.getCookie)('x-asm-prefer-tag');
|
|
60
|
+
|
|
61
|
+
if (tag) {
|
|
62
|
+
options.headers['x-asm-prefer-tag'] = tag;
|
|
63
|
+
}
|
|
64
|
+
|
|
59
65
|
url = url.replace('noToken=1', '').replace('&&', '&').replace('?&', '?');
|
|
60
66
|
var param = {
|
|
61
67
|
resCode: (0, _utils.getUrlQuery)('resCode') || (0, _utils.getUrlQuery)('resourceId') || (0, _utils.getResourceProps)('resourceId'),
|
|
@@ -152,6 +158,50 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
152
158
|
return _ref.apply(this, arguments);
|
|
153
159
|
};
|
|
154
160
|
}());
|
|
161
|
+
|
|
162
|
+
function ajax(url) {
|
|
163
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
164
|
+
var type = arguments.length > 2 ? arguments[2] : undefined;
|
|
165
|
+
var needGateWay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
166
|
+
var isJson = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
167
|
+
|
|
168
|
+
if (needGateWay) {
|
|
169
|
+
url = (0, _utils.toGatewayUrl)(url);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
var loadText = (0, _utils.getUrlQuery)('_loading', url);
|
|
173
|
+
|
|
174
|
+
if (loadText) {
|
|
175
|
+
(0, _utils.showLoading)(loadText);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (type === 'get') {
|
|
179
|
+
return request.get(url, {
|
|
180
|
+
params: params
|
|
181
|
+
}).finally(function () {
|
|
182
|
+
return (0, _utils.exitLoading)();
|
|
183
|
+
});
|
|
184
|
+
} else if (type === 'delete') {
|
|
185
|
+
return request.delete(url, {
|
|
186
|
+
data: params
|
|
187
|
+
}).finally(function () {
|
|
188
|
+
return (0, _utils.exitLoading)();
|
|
189
|
+
});
|
|
190
|
+
} else if (type === 'put') {
|
|
191
|
+
return request.put(url, {
|
|
192
|
+
data: params
|
|
193
|
+
}).finally(function () {
|
|
194
|
+
return (0, _utils.exitLoading)();
|
|
195
|
+
});
|
|
196
|
+
} else {
|
|
197
|
+
return request.post(url, {
|
|
198
|
+
data: params,
|
|
199
|
+
requestType: isJson ? 'json' : 'form'
|
|
200
|
+
}).finally(function () {
|
|
201
|
+
return (0, _utils.exitLoading)();
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
155
205
|
/**
|
|
156
206
|
* get请求
|
|
157
207
|
* @param url 接口
|
|
@@ -160,8 +210,11 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
160
210
|
* @returns Promise<ApiResponse>
|
|
161
211
|
*/
|
|
162
212
|
|
|
163
|
-
|
|
164
|
-
|
|
213
|
+
|
|
214
|
+
function httpGet(url) {
|
|
215
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
216
|
+
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
217
|
+
return ajax(url, params, 'get', needGateWay);
|
|
165
218
|
}
|
|
166
219
|
/**
|
|
167
220
|
* post请求
|
|
@@ -173,38 +226,11 @@ function httpGet(_x3) {
|
|
|
173
226
|
*/
|
|
174
227
|
|
|
175
228
|
|
|
176
|
-
function
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
182
|
-
while (1) {
|
|
183
|
-
switch (_context2.prev = _context2.next) {
|
|
184
|
-
case 0:
|
|
185
|
-
params = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
186
|
-
needGateWay = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : true;
|
|
187
|
-
|
|
188
|
-
if (needGateWay) {
|
|
189
|
-
url = (0, _utils.toGatewayUrl)(url);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return _context2.abrupt("return", request.get(url, {
|
|
193
|
-
params: params
|
|
194
|
-
}));
|
|
195
|
-
|
|
196
|
-
case 4:
|
|
197
|
-
case "end":
|
|
198
|
-
return _context2.stop();
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}, _callee2);
|
|
202
|
-
}));
|
|
203
|
-
return _httpGet.apply(this, arguments);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function httpPost(_x4) {
|
|
207
|
-
return _httpPost.apply(this, arguments);
|
|
229
|
+
function httpPost(url) {
|
|
230
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
231
|
+
var isJson = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
232
|
+
var needGateWay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
233
|
+
return ajax(url, data, 'post', needGateWay, isJson);
|
|
208
234
|
}
|
|
209
235
|
/**
|
|
210
236
|
* put 请求
|
|
@@ -215,41 +241,10 @@ function httpPost(_x4) {
|
|
|
215
241
|
*/
|
|
216
242
|
|
|
217
243
|
|
|
218
|
-
function
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
needGateWay,
|
|
223
|
-
_args3 = arguments;
|
|
224
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
225
|
-
while (1) {
|
|
226
|
-
switch (_context3.prev = _context3.next) {
|
|
227
|
-
case 0:
|
|
228
|
-
data = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
229
|
-
isJson = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : true;
|
|
230
|
-
needGateWay = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : true;
|
|
231
|
-
|
|
232
|
-
if (needGateWay) {
|
|
233
|
-
url = (0, _utils.toGatewayUrl)(url);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return _context3.abrupt("return", request.post(url, {
|
|
237
|
-
data: data,
|
|
238
|
-
requestType: isJson ? 'json' : 'form'
|
|
239
|
-
}));
|
|
240
|
-
|
|
241
|
-
case 5:
|
|
242
|
-
case "end":
|
|
243
|
-
return _context3.stop();
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}, _callee3);
|
|
247
|
-
}));
|
|
248
|
-
return _httpPost.apply(this, arguments);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
function httpPut(_x5) {
|
|
252
|
-
return _httpPut.apply(this, arguments);
|
|
244
|
+
function httpPut(url) {
|
|
245
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
246
|
+
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
247
|
+
return ajax(url, data, 'put', needGateWay);
|
|
253
248
|
}
|
|
254
249
|
/**
|
|
255
250
|
* delete 请求
|
|
@@ -260,38 +255,9 @@ function httpPut(_x5) {
|
|
|
260
255
|
*/
|
|
261
256
|
|
|
262
257
|
|
|
263
|
-
function
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
needGateWay,
|
|
267
|
-
_args4 = arguments;
|
|
268
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
269
|
-
while (1) {
|
|
270
|
-
switch (_context4.prev = _context4.next) {
|
|
271
|
-
case 0:
|
|
272
|
-
data = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
273
|
-
needGateWay = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : true;
|
|
274
|
-
|
|
275
|
-
if (needGateWay) {
|
|
276
|
-
url = (0, _utils.toGatewayUrl)(url);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
return _context4.abrupt("return", request.put(url, {
|
|
280
|
-
data: data
|
|
281
|
-
}));
|
|
282
|
-
|
|
283
|
-
case 4:
|
|
284
|
-
case "end":
|
|
285
|
-
return _context4.stop();
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}, _callee4);
|
|
289
|
-
}));
|
|
290
|
-
return _httpPut.apply(this, arguments);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
function httpDelete(_x6, _x7) {
|
|
294
|
-
return _httpDelete.apply(this, arguments);
|
|
258
|
+
function httpDelete(url, data) {
|
|
259
|
+
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
260
|
+
return ajax(url, data, 'delete', needGateWay);
|
|
295
261
|
}
|
|
296
262
|
/**
|
|
297
263
|
* 读取数据字典
|
|
@@ -301,36 +267,14 @@ function httpDelete(_x6, _x7) {
|
|
|
301
267
|
*/
|
|
302
268
|
|
|
303
269
|
|
|
304
|
-
function
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
needGateWay = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : true;
|
|
313
|
-
|
|
314
|
-
if (needGateWay) {
|
|
315
|
-
url = (0, _utils.toGatewayUrl)(url);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
return _context5.abrupt("return", request.delete(url, {
|
|
319
|
-
data: data
|
|
320
|
-
}));
|
|
321
|
-
|
|
322
|
-
case 3:
|
|
323
|
-
case "end":
|
|
324
|
-
return _context5.stop();
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}, _callee5);
|
|
328
|
-
}));
|
|
329
|
-
return _httpDelete.apply(this, arguments);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function getDict(_x8) {
|
|
333
|
-
return _getDict.apply(this, arguments);
|
|
270
|
+
function getDict(dictCode) {
|
|
271
|
+
var showValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
272
|
+
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
273
|
+
var api = '/lesoon-integration/sysDictDtl/listByProperties';
|
|
274
|
+
var param = {
|
|
275
|
+
dictCode: dictCode
|
|
276
|
+
};
|
|
277
|
+
return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay);
|
|
334
278
|
}
|
|
335
279
|
/**
|
|
336
280
|
* 加载下拉框的数据源
|
|
@@ -344,60 +288,31 @@ function getDict(_x8) {
|
|
|
344
288
|
*/
|
|
345
289
|
|
|
346
290
|
|
|
347
|
-
function
|
|
348
|
-
_getDict = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(dictCode) {
|
|
349
|
-
var showValue,
|
|
350
|
-
needGateWay,
|
|
351
|
-
api,
|
|
352
|
-
param,
|
|
353
|
-
_args6 = arguments;
|
|
354
|
-
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
355
|
-
while (1) {
|
|
356
|
-
switch (_context6.prev = _context6.next) {
|
|
357
|
-
case 0:
|
|
358
|
-
showValue = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : true;
|
|
359
|
-
needGateWay = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : true;
|
|
360
|
-
api = '/lesoon-integration/sysDictDtl/listByProperties';
|
|
361
|
-
param = {
|
|
362
|
-
dictCode: dictCode
|
|
363
|
-
};
|
|
364
|
-
return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay));
|
|
365
|
-
|
|
366
|
-
case 5:
|
|
367
|
-
case "end":
|
|
368
|
-
return _context6.stop();
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}, _callee6);
|
|
372
|
-
}));
|
|
373
|
-
return _getDict.apply(this, arguments);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
function fetchOptions(_x9, _x10, _x11, _x12) {
|
|
291
|
+
function fetchOptions(_x3, _x4, _x5, _x6) {
|
|
377
292
|
return _fetchOptions.apply(this, arguments);
|
|
378
293
|
}
|
|
379
294
|
|
|
380
295
|
function _fetchOptions() {
|
|
381
|
-
_fetchOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
296
|
+
_fetchOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url, param, valueField, labelField) {
|
|
382
297
|
var showValue,
|
|
383
298
|
needGateWay,
|
|
384
299
|
_yield$httpGet,
|
|
385
300
|
_yield$httpGet$rows,
|
|
386
301
|
rows,
|
|
387
302
|
data,
|
|
388
|
-
|
|
303
|
+
_args2 = arguments;
|
|
389
304
|
|
|
390
|
-
return _regenerator.default.wrap(function
|
|
305
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
391
306
|
while (1) {
|
|
392
|
-
switch (
|
|
307
|
+
switch (_context2.prev = _context2.next) {
|
|
393
308
|
case 0:
|
|
394
|
-
showValue =
|
|
395
|
-
needGateWay =
|
|
396
|
-
|
|
309
|
+
showValue = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : true;
|
|
310
|
+
needGateWay = _args2.length > 5 && _args2[5] !== undefined ? _args2[5] : true;
|
|
311
|
+
_context2.next = 4;
|
|
397
312
|
return httpGet(url, param, needGateWay);
|
|
398
313
|
|
|
399
314
|
case 4:
|
|
400
|
-
_yield$httpGet =
|
|
315
|
+
_yield$httpGet = _context2.sent;
|
|
401
316
|
_yield$httpGet$rows = _yield$httpGet.rows;
|
|
402
317
|
rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
|
|
403
318
|
data = (rows || []).map(function (o) {
|
|
@@ -408,14 +323,14 @@ function _fetchOptions() {
|
|
|
408
323
|
status: o.status
|
|
409
324
|
};
|
|
410
325
|
});
|
|
411
|
-
return
|
|
326
|
+
return _context2.abrupt("return", data);
|
|
412
327
|
|
|
413
328
|
case 9:
|
|
414
329
|
case "end":
|
|
415
|
-
return
|
|
330
|
+
return _context2.stop();
|
|
416
331
|
}
|
|
417
332
|
}
|
|
418
|
-
},
|
|
333
|
+
}, _callee2);
|
|
419
334
|
}));
|
|
420
335
|
return _fetchOptions.apply(this, arguments);
|
|
421
336
|
}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -235,3 +235,14 @@ export declare const appPath: (path?: string) => any;
|
|
|
235
235
|
* @returns
|
|
236
236
|
*/
|
|
237
237
|
export declare const deepClone: (obj: any) => any;
|
|
238
|
+
/**
|
|
239
|
+
* 在主工程中打开模块
|
|
240
|
+
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data:参数}
|
|
241
|
+
*/
|
|
242
|
+
export declare const openPageInMain: (option: {
|
|
243
|
+
path?: string;
|
|
244
|
+
resourceId?: string;
|
|
245
|
+
data?: any;
|
|
246
|
+
}) => void;
|
|
247
|
+
export declare const showLoading: (text?: string) => void;
|
|
248
|
+
export declare const exitLoading: () => void;
|