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
|
@@ -2,7 +2,7 @@ import "antd/es/button/style";
|
|
|
2
2
|
import _Button from "antd/es/button";
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
import {
|
|
5
|
+
import { LeftOutlined, SaveOutlined, AuditOutlined } from '@ant-design/icons';
|
|
6
6
|
import './common.less';
|
|
7
7
|
import usePermission from '../hooks/usePermission';
|
|
8
8
|
|
|
@@ -52,13 +52,15 @@ function DtlLayout(props) {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
var btns = useMemo(function () {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
// const b = [
|
|
56
|
+
// <Button
|
|
57
|
+
// key="btnBack"
|
|
58
|
+
// onClick={() => props.onExit(false)}
|
|
59
|
+
// icon={<ArrowLeftOutlined />}>
|
|
60
|
+
// {btnExitText}
|
|
61
|
+
// </Button>
|
|
62
|
+
// ]
|
|
63
|
+
var b = []; // 有新增或更改权限且未审核,开放出保存按钮
|
|
62
64
|
|
|
63
65
|
if ((checkRight(2) || checkRight(4)) && !isAudit()) {
|
|
64
66
|
b.unshift( /*#__PURE__*/React.createElement(_Button, {
|
|
@@ -99,6 +101,12 @@ function DtlLayout(props) {
|
|
|
99
101
|
className: classNames('dtl-header', headerClass),
|
|
100
102
|
style: headerStyle
|
|
101
103
|
}, /*#__PURE__*/React.createElement("div", {
|
|
104
|
+
className: "dtl-back"
|
|
105
|
+
}, /*#__PURE__*/React.createElement(LeftOutlined, {
|
|
106
|
+
onClick: function onClick() {
|
|
107
|
+
return props.onExit(false);
|
|
108
|
+
}
|
|
109
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
102
110
|
className: "dtl-title"
|
|
103
111
|
}, dtlTitle), /*#__PURE__*/React.createElement("div", {
|
|
104
112
|
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>;
|
|
@@ -5,7 +5,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
5
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
|
-
var _excluded = ["current", "pageSize"];
|
|
8
|
+
var _excluded = ["current", "pageSize", "sumProperties"];
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { useState, useRef, useMemo, useCallback } from 'react';
|
|
11
11
|
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined, AuditOutlined } from '@ant-design/icons';
|
|
@@ -38,6 +38,7 @@ function useSingle(inParam) {
|
|
|
38
38
|
initItem = inParam.initItem,
|
|
39
39
|
statusField = inParam.statusField,
|
|
40
40
|
auditStatus = inParam.auditStatus,
|
|
41
|
+
totalFields = inParam.totalFields,
|
|
41
42
|
beforeAudit = inParam.beforeAudit,
|
|
42
43
|
beforeLoad = inParam.beforeLoad,
|
|
43
44
|
beforeRemove = inParam.beforeRemove,
|
|
@@ -47,7 +48,8 @@ function useSingle(inParam) {
|
|
|
47
48
|
afterRemove = inParam.afterRemove,
|
|
48
49
|
afterSave = inParam.afterSave,
|
|
49
50
|
afterAudit = inParam.afterAudit,
|
|
50
|
-
btnStatus = inParam.btnStatus
|
|
51
|
+
btnStatus = inParam.btnStatus,
|
|
52
|
+
customTotal = inParam.customTotal;
|
|
51
53
|
/** @name 选中行数据 */
|
|
52
54
|
|
|
53
55
|
var _useState = useState([]),
|
|
@@ -505,18 +507,23 @@ function useSingle(inParam) {
|
|
|
505
507
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(params, sort, filter) {
|
|
506
508
|
var _tableRef$current, _tableRef$current$cle;
|
|
507
509
|
|
|
508
|
-
var current, pageSize, rest, param, key, _key, sortArr, _key2, result;
|
|
510
|
+
var current, pageSize, sumProperties, rest, param, key, _key, sortArr, _key2, result;
|
|
509
511
|
|
|
510
512
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
511
513
|
while (1) {
|
|
512
514
|
switch (_context6.prev = _context6.next) {
|
|
513
515
|
case 0:
|
|
514
|
-
current = params.current, pageSize = params.pageSize, rest = _objectWithoutProperties(params, _excluded);
|
|
516
|
+
current = params.current, pageSize = params.pageSize, sumProperties = params.sumProperties, rest = _objectWithoutProperties(params, _excluded);
|
|
515
517
|
param = {}; // 分页
|
|
516
518
|
|
|
517
519
|
if (current) {
|
|
518
520
|
param.page = current;
|
|
519
521
|
param.pageSize = pageSize;
|
|
522
|
+
} // 合计
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
if (sumProperties) {
|
|
526
|
+
param.sumProperties = sumProperties;
|
|
520
527
|
} // 处理查询条件
|
|
521
528
|
|
|
522
529
|
|
|
@@ -560,20 +567,20 @@ function useSingle(inParam) {
|
|
|
560
567
|
_context6.t0 = beforeLoad;
|
|
561
568
|
|
|
562
569
|
if (!_context6.t0) {
|
|
563
|
-
_context6.next =
|
|
570
|
+
_context6.next = 16;
|
|
564
571
|
break;
|
|
565
572
|
}
|
|
566
573
|
|
|
567
|
-
_context6.next =
|
|
574
|
+
_context6.next = 14;
|
|
568
575
|
return beforeLoad(param);
|
|
569
576
|
|
|
570
|
-
case
|
|
577
|
+
case 14:
|
|
571
578
|
_context6.t1 = _context6.sent;
|
|
572
579
|
_context6.t0 = _context6.t1 === false;
|
|
573
580
|
|
|
574
|
-
case
|
|
581
|
+
case 16:
|
|
575
582
|
if (!_context6.t0) {
|
|
576
|
-
_context6.next =
|
|
583
|
+
_context6.next = 18;
|
|
577
584
|
break;
|
|
578
585
|
}
|
|
579
586
|
|
|
@@ -583,17 +590,22 @@ function useSingle(inParam) {
|
|
|
583
590
|
total: 0
|
|
584
591
|
});
|
|
585
592
|
|
|
586
|
-
case
|
|
587
|
-
_context6.next =
|
|
593
|
+
case 18:
|
|
594
|
+
_context6.next = 20;
|
|
588
595
|
return service.load(param);
|
|
589
596
|
|
|
590
|
-
case
|
|
597
|
+
case 20:
|
|
591
598
|
result = _context6.sent;
|
|
592
599
|
result.data = result.rows || [];
|
|
593
600
|
result.success = true;
|
|
601
|
+
|
|
602
|
+
if (sumProperties) {
|
|
603
|
+
result.data = result.footer;
|
|
604
|
+
}
|
|
605
|
+
|
|
594
606
|
return _context6.abrupt("return", result);
|
|
595
607
|
|
|
596
|
-
case
|
|
608
|
+
case 25:
|
|
597
609
|
case "end":
|
|
598
610
|
return _context6.stop();
|
|
599
611
|
}
|
package/es/http/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
3
|
import { extend } from 'umi-request';
|
|
5
|
-
import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, toGatewayUrl, reLogin } from '../utils'; //默认超时时间为1分钟
|
|
4
|
+
import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, toGatewayUrl, reLogin, showLoading, exitLoading } from '../utils'; //默认超时时间为1分钟
|
|
6
5
|
|
|
7
6
|
var request = extend({
|
|
8
7
|
timeout: 60000
|
|
@@ -11,34 +10,37 @@ var request = extend({
|
|
|
11
10
|
|
|
12
11
|
request.interceptors.request.use(function (url, options) {
|
|
13
12
|
var token = getCookie("token");
|
|
14
|
-
|
|
15
|
-
var opts = _objectSpread({}, options);
|
|
16
|
-
|
|
17
|
-
opts.headers = opts.headers || {}; // 处理 token
|
|
13
|
+
options.headers = options.headers || {}; // 处理 token
|
|
18
14
|
|
|
19
15
|
if (token && url.indexOf('noToken=1') === -1) {
|
|
20
|
-
|
|
16
|
+
options.headers["token"] = token;
|
|
21
17
|
} // 处理门店
|
|
22
18
|
|
|
23
19
|
|
|
24
20
|
var shopNo = getCache('shopNo', true) || getCache('shopNo');
|
|
25
21
|
|
|
26
22
|
if (shopNo) {
|
|
27
|
-
|
|
23
|
+
options.headers["shopNo"] = shopNo;
|
|
28
24
|
} // 处理门店
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
var shopCode = getCache('shopCode', true) || getCache('shopCode');
|
|
32
28
|
|
|
33
29
|
if (shopCode) {
|
|
34
|
-
|
|
30
|
+
options.headers["shopCode"] = shopCode;
|
|
35
31
|
} // 处理仓库
|
|
36
32
|
|
|
37
33
|
|
|
38
34
|
var storeNo = getCache('storeNo', true) || getCache('storeNo');
|
|
39
35
|
|
|
40
36
|
if (storeNo) {
|
|
41
|
-
|
|
37
|
+
options.headers["storeNo"] = storeNo;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var tag = getCookie('x-asm-prefer-tag');
|
|
41
|
+
|
|
42
|
+
if (tag) {
|
|
43
|
+
options.headers['x-asm-prefer-tag'] = tag;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
url = url.replace('noToken=1', '').replace('&&', '&').replace('?&', '?');
|
|
@@ -51,9 +53,10 @@ request.interceptors.request.use(function (url, options) {
|
|
|
51
53
|
delete param.resCode;
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
url = setUrlQuery(url, param);
|
|
54
57
|
return {
|
|
55
|
-
url:
|
|
56
|
-
options:
|
|
58
|
+
url: url,
|
|
59
|
+
options: options
|
|
57
60
|
};
|
|
58
61
|
});
|
|
59
62
|
/** 请求返回拦截器,统一处理业务异常 */
|
|
@@ -136,6 +139,50 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
136
139
|
return _ref.apply(this, arguments);
|
|
137
140
|
};
|
|
138
141
|
}());
|
|
142
|
+
|
|
143
|
+
function ajax(url) {
|
|
144
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
145
|
+
var type = arguments.length > 2 ? arguments[2] : undefined;
|
|
146
|
+
var needGateWay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
147
|
+
var isJson = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
148
|
+
|
|
149
|
+
if (needGateWay) {
|
|
150
|
+
url = toGatewayUrl(url);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
var loadText = getUrlQuery('_loading', url);
|
|
154
|
+
|
|
155
|
+
if (loadText) {
|
|
156
|
+
showLoading(loadText);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (type === 'get') {
|
|
160
|
+
return request.get(url, {
|
|
161
|
+
params: params
|
|
162
|
+
}).finally(function () {
|
|
163
|
+
return exitLoading();
|
|
164
|
+
});
|
|
165
|
+
} else if (type === 'delete') {
|
|
166
|
+
return request.delete(url, {
|
|
167
|
+
data: params
|
|
168
|
+
}).finally(function () {
|
|
169
|
+
return exitLoading();
|
|
170
|
+
});
|
|
171
|
+
} else if (type === 'put') {
|
|
172
|
+
return request.put(url, {
|
|
173
|
+
data: params
|
|
174
|
+
}).finally(function () {
|
|
175
|
+
return exitLoading();
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
return request.post(url, {
|
|
179
|
+
data: params,
|
|
180
|
+
requestType: isJson ? 'json' : 'form'
|
|
181
|
+
}).finally(function () {
|
|
182
|
+
return exitLoading();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
139
186
|
/**
|
|
140
187
|
* get请求
|
|
141
188
|
* @param url 接口
|
|
@@ -144,8 +191,11 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
144
191
|
* @returns Promise<ApiResponse>
|
|
145
192
|
*/
|
|
146
193
|
|
|
147
|
-
|
|
148
|
-
|
|
194
|
+
|
|
195
|
+
export function httpGet(url) {
|
|
196
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
197
|
+
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
198
|
+
return ajax(url, params, 'get', needGateWay);
|
|
149
199
|
}
|
|
150
200
|
/**
|
|
151
201
|
* post请求
|
|
@@ -156,38 +206,11 @@ export function httpGet(_x3) {
|
|
|
156
206
|
* @returns Promise<ApiResponse>
|
|
157
207
|
*/
|
|
158
208
|
|
|
159
|
-
function
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
165
|
-
while (1) {
|
|
166
|
-
switch (_context2.prev = _context2.next) {
|
|
167
|
-
case 0:
|
|
168
|
-
params = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
169
|
-
needGateWay = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : true;
|
|
170
|
-
|
|
171
|
-
if (needGateWay) {
|
|
172
|
-
url = toGatewayUrl(url);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return _context2.abrupt("return", request.get(url, {
|
|
176
|
-
params: params
|
|
177
|
-
}));
|
|
178
|
-
|
|
179
|
-
case 4:
|
|
180
|
-
case "end":
|
|
181
|
-
return _context2.stop();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}, _callee2);
|
|
185
|
-
}));
|
|
186
|
-
return _httpGet.apply(this, arguments);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export function httpPost(_x4) {
|
|
190
|
-
return _httpPost.apply(this, arguments);
|
|
209
|
+
export function httpPost(url) {
|
|
210
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
211
|
+
var isJson = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
212
|
+
var needGateWay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
213
|
+
return ajax(url, data, 'post', needGateWay, isJson);
|
|
191
214
|
}
|
|
192
215
|
/**
|
|
193
216
|
* put 请求
|
|
@@ -197,41 +220,10 @@ export function httpPost(_x4) {
|
|
|
197
220
|
* @returns Promise<ApiResponse>
|
|
198
221
|
*/
|
|
199
222
|
|
|
200
|
-
function
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
needGateWay,
|
|
205
|
-
_args3 = arguments;
|
|
206
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
207
|
-
while (1) {
|
|
208
|
-
switch (_context3.prev = _context3.next) {
|
|
209
|
-
case 0:
|
|
210
|
-
data = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
211
|
-
isJson = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : true;
|
|
212
|
-
needGateWay = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : true;
|
|
213
|
-
|
|
214
|
-
if (needGateWay) {
|
|
215
|
-
url = toGatewayUrl(url);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return _context3.abrupt("return", request.post(url, {
|
|
219
|
-
data: data,
|
|
220
|
-
requestType: isJson ? 'json' : 'form'
|
|
221
|
-
}));
|
|
222
|
-
|
|
223
|
-
case 5:
|
|
224
|
-
case "end":
|
|
225
|
-
return _context3.stop();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}, _callee3);
|
|
229
|
-
}));
|
|
230
|
-
return _httpPost.apply(this, arguments);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export function httpPut(_x5) {
|
|
234
|
-
return _httpPut.apply(this, arguments);
|
|
223
|
+
export function httpPut(url) {
|
|
224
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
225
|
+
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
226
|
+
return ajax(url, data, 'put', needGateWay);
|
|
235
227
|
}
|
|
236
228
|
/**
|
|
237
229
|
* delete 请求
|
|
@@ -241,38 +233,9 @@ export function httpPut(_x5) {
|
|
|
241
233
|
* @returns Promise<ApiResponse>
|
|
242
234
|
*/
|
|
243
235
|
|
|
244
|
-
function
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
needGateWay,
|
|
248
|
-
_args4 = arguments;
|
|
249
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
250
|
-
while (1) {
|
|
251
|
-
switch (_context4.prev = _context4.next) {
|
|
252
|
-
case 0:
|
|
253
|
-
data = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
254
|
-
needGateWay = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : true;
|
|
255
|
-
|
|
256
|
-
if (needGateWay) {
|
|
257
|
-
url = toGatewayUrl(url);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return _context4.abrupt("return", request.put(url, {
|
|
261
|
-
data: data
|
|
262
|
-
}));
|
|
263
|
-
|
|
264
|
-
case 4:
|
|
265
|
-
case "end":
|
|
266
|
-
return _context4.stop();
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}, _callee4);
|
|
270
|
-
}));
|
|
271
|
-
return _httpPut.apply(this, arguments);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
export function httpDelete(_x6, _x7) {
|
|
275
|
-
return _httpDelete.apply(this, arguments);
|
|
236
|
+
export function httpDelete(url, data) {
|
|
237
|
+
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
238
|
+
return ajax(url, data, 'delete', needGateWay);
|
|
276
239
|
}
|
|
277
240
|
/**
|
|
278
241
|
* 读取数据字典
|
|
@@ -281,36 +244,14 @@ export function httpDelete(_x6, _x7) {
|
|
|
281
244
|
* @returns Promise<Record<string,string>>
|
|
282
245
|
*/
|
|
283
246
|
|
|
284
|
-
function
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
needGateWay = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : true;
|
|
293
|
-
|
|
294
|
-
if (needGateWay) {
|
|
295
|
-
url = toGatewayUrl(url);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
return _context5.abrupt("return", request.delete(url, {
|
|
299
|
-
data: data
|
|
300
|
-
}));
|
|
301
|
-
|
|
302
|
-
case 3:
|
|
303
|
-
case "end":
|
|
304
|
-
return _context5.stop();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}, _callee5);
|
|
308
|
-
}));
|
|
309
|
-
return _httpDelete.apply(this, arguments);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
export function getDict(_x8) {
|
|
313
|
-
return _getDict.apply(this, arguments);
|
|
247
|
+
export function getDict(dictCode) {
|
|
248
|
+
var showValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
249
|
+
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
250
|
+
var api = '/lesoon-integration/sysDictDtl/listByProperties';
|
|
251
|
+
var param = {
|
|
252
|
+
dictCode: dictCode
|
|
253
|
+
};
|
|
254
|
+
return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay);
|
|
314
255
|
}
|
|
315
256
|
/**
|
|
316
257
|
* 加载下拉框的数据源
|
|
@@ -323,60 +264,31 @@ export function getDict(_x8) {
|
|
|
323
264
|
* @returns
|
|
324
265
|
*/
|
|
325
266
|
|
|
326
|
-
function
|
|
327
|
-
_getDict = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(dictCode) {
|
|
328
|
-
var showValue,
|
|
329
|
-
needGateWay,
|
|
330
|
-
api,
|
|
331
|
-
param,
|
|
332
|
-
_args6 = arguments;
|
|
333
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
334
|
-
while (1) {
|
|
335
|
-
switch (_context6.prev = _context6.next) {
|
|
336
|
-
case 0:
|
|
337
|
-
showValue = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : true;
|
|
338
|
-
needGateWay = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : true;
|
|
339
|
-
api = '/lesoon-integration/sysDictDtl/listByProperties';
|
|
340
|
-
param = {
|
|
341
|
-
dictCode: dictCode
|
|
342
|
-
};
|
|
343
|
-
return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay));
|
|
344
|
-
|
|
345
|
-
case 5:
|
|
346
|
-
case "end":
|
|
347
|
-
return _context6.stop();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}, _callee6);
|
|
351
|
-
}));
|
|
352
|
-
return _getDict.apply(this, arguments);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
export function fetchOptions(_x9, _x10, _x11, _x12) {
|
|
267
|
+
export function fetchOptions(_x3, _x4, _x5, _x6) {
|
|
356
268
|
return _fetchOptions.apply(this, arguments);
|
|
357
269
|
}
|
|
358
270
|
|
|
359
271
|
function _fetchOptions() {
|
|
360
|
-
_fetchOptions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
272
|
+
_fetchOptions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url, param, valueField, labelField) {
|
|
361
273
|
var showValue,
|
|
362
274
|
needGateWay,
|
|
363
275
|
_yield$httpGet,
|
|
364
276
|
_yield$httpGet$rows,
|
|
365
277
|
rows,
|
|
366
278
|
data,
|
|
367
|
-
|
|
279
|
+
_args2 = arguments;
|
|
368
280
|
|
|
369
|
-
return _regeneratorRuntime.wrap(function
|
|
281
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
370
282
|
while (1) {
|
|
371
|
-
switch (
|
|
283
|
+
switch (_context2.prev = _context2.next) {
|
|
372
284
|
case 0:
|
|
373
|
-
showValue =
|
|
374
|
-
needGateWay =
|
|
375
|
-
|
|
285
|
+
showValue = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : true;
|
|
286
|
+
needGateWay = _args2.length > 5 && _args2[5] !== undefined ? _args2[5] : true;
|
|
287
|
+
_context2.next = 4;
|
|
376
288
|
return httpGet(url, param, needGateWay);
|
|
377
289
|
|
|
378
290
|
case 4:
|
|
379
|
-
_yield$httpGet =
|
|
291
|
+
_yield$httpGet = _context2.sent;
|
|
380
292
|
_yield$httpGet$rows = _yield$httpGet.rows;
|
|
381
293
|
rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
|
|
382
294
|
data = (rows || []).map(function (o) {
|
|
@@ -387,14 +299,14 @@ function _fetchOptions() {
|
|
|
387
299
|
status: o.status
|
|
388
300
|
};
|
|
389
301
|
});
|
|
390
|
-
return
|
|
302
|
+
return _context2.abrupt("return", data);
|
|
391
303
|
|
|
392
304
|
case 9:
|
|
393
305
|
case "end":
|
|
394
|
-
return
|
|
306
|
+
return _context2.stop();
|
|
395
307
|
}
|
|
396
308
|
}
|
|
397
|
-
},
|
|
309
|
+
}, _callee2);
|
|
398
310
|
}));
|
|
399
311
|
return _fetchOptions.apply(this, arguments);
|
|
400
312
|
}
|
package/es/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;
|