ls-pro-common 1.0.64 → 1.0.66
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
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import { extend } from 'umi-request';
|
|
4
|
-
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分钟
|
|
5
5
|
|
|
6
6
|
var request = extend({
|
|
7
7
|
timeout: 60000
|
|
@@ -37,6 +37,12 @@ request.interceptors.request.use(function (url, options) {
|
|
|
37
37
|
options.headers["storeNo"] = storeNo;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
var tag = getCookie('x-asm-prefer-tag');
|
|
41
|
+
|
|
42
|
+
if (tag) {
|
|
43
|
+
options.headers['x-asm-prefer-tag'] = tag;
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
url = url.replace('noToken=1', '').replace('&&', '&').replace('?&', '?');
|
|
41
47
|
var param = {
|
|
42
48
|
resCode: getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId'),
|
|
@@ -133,6 +139,50 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
133
139
|
return _ref.apply(this, arguments);
|
|
134
140
|
};
|
|
135
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
|
+
}
|
|
136
186
|
/**
|
|
137
187
|
* get请求
|
|
138
188
|
* @param url 接口
|
|
@@ -141,8 +191,11 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
141
191
|
* @returns Promise<ApiResponse>
|
|
142
192
|
*/
|
|
143
193
|
|
|
144
|
-
|
|
145
|
-
|
|
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);
|
|
146
199
|
}
|
|
147
200
|
/**
|
|
148
201
|
* post请求
|
|
@@ -153,38 +206,11 @@ export function httpGet(_x3) {
|
|
|
153
206
|
* @returns Promise<ApiResponse>
|
|
154
207
|
*/
|
|
155
208
|
|
|
156
|
-
function
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
162
|
-
while (1) {
|
|
163
|
-
switch (_context2.prev = _context2.next) {
|
|
164
|
-
case 0:
|
|
165
|
-
params = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
166
|
-
needGateWay = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : true;
|
|
167
|
-
|
|
168
|
-
if (needGateWay) {
|
|
169
|
-
url = toGatewayUrl(url);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return _context2.abrupt("return", request.get(url, {
|
|
173
|
-
params: params
|
|
174
|
-
}));
|
|
175
|
-
|
|
176
|
-
case 4:
|
|
177
|
-
case "end":
|
|
178
|
-
return _context2.stop();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}, _callee2);
|
|
182
|
-
}));
|
|
183
|
-
return _httpGet.apply(this, arguments);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export function httpPost(_x4) {
|
|
187
|
-
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);
|
|
188
214
|
}
|
|
189
215
|
/**
|
|
190
216
|
* put 请求
|
|
@@ -194,41 +220,10 @@ export function httpPost(_x4) {
|
|
|
194
220
|
* @returns Promise<ApiResponse>
|
|
195
221
|
*/
|
|
196
222
|
|
|
197
|
-
function
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
needGateWay,
|
|
202
|
-
_args3 = arguments;
|
|
203
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
204
|
-
while (1) {
|
|
205
|
-
switch (_context3.prev = _context3.next) {
|
|
206
|
-
case 0:
|
|
207
|
-
data = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
208
|
-
isJson = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : true;
|
|
209
|
-
needGateWay = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : true;
|
|
210
|
-
|
|
211
|
-
if (needGateWay) {
|
|
212
|
-
url = toGatewayUrl(url);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return _context3.abrupt("return", request.post(url, {
|
|
216
|
-
data: data,
|
|
217
|
-
requestType: isJson ? 'json' : 'form'
|
|
218
|
-
}));
|
|
219
|
-
|
|
220
|
-
case 5:
|
|
221
|
-
case "end":
|
|
222
|
-
return _context3.stop();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}, _callee3);
|
|
226
|
-
}));
|
|
227
|
-
return _httpPost.apply(this, arguments);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export function httpPut(_x5) {
|
|
231
|
-
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);
|
|
232
227
|
}
|
|
233
228
|
/**
|
|
234
229
|
* delete 请求
|
|
@@ -238,38 +233,9 @@ export function httpPut(_x5) {
|
|
|
238
233
|
* @returns Promise<ApiResponse>
|
|
239
234
|
*/
|
|
240
235
|
|
|
241
|
-
function
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
needGateWay,
|
|
245
|
-
_args4 = arguments;
|
|
246
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
247
|
-
while (1) {
|
|
248
|
-
switch (_context4.prev = _context4.next) {
|
|
249
|
-
case 0:
|
|
250
|
-
data = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
251
|
-
needGateWay = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : true;
|
|
252
|
-
|
|
253
|
-
if (needGateWay) {
|
|
254
|
-
url = toGatewayUrl(url);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return _context4.abrupt("return", request.put(url, {
|
|
258
|
-
data: data
|
|
259
|
-
}));
|
|
260
|
-
|
|
261
|
-
case 4:
|
|
262
|
-
case "end":
|
|
263
|
-
return _context4.stop();
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}, _callee4);
|
|
267
|
-
}));
|
|
268
|
-
return _httpPut.apply(this, arguments);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export function httpDelete(_x6, _x7) {
|
|
272
|
-
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);
|
|
273
239
|
}
|
|
274
240
|
/**
|
|
275
241
|
* 读取数据字典
|
|
@@ -278,36 +244,14 @@ export function httpDelete(_x6, _x7) {
|
|
|
278
244
|
* @returns Promise<Record<string,string>>
|
|
279
245
|
*/
|
|
280
246
|
|
|
281
|
-
function
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
needGateWay = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : true;
|
|
290
|
-
|
|
291
|
-
if (needGateWay) {
|
|
292
|
-
url = toGatewayUrl(url);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return _context5.abrupt("return", request.delete(url, {
|
|
296
|
-
data: data
|
|
297
|
-
}));
|
|
298
|
-
|
|
299
|
-
case 3:
|
|
300
|
-
case "end":
|
|
301
|
-
return _context5.stop();
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}, _callee5);
|
|
305
|
-
}));
|
|
306
|
-
return _httpDelete.apply(this, arguments);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
export function getDict(_x8) {
|
|
310
|
-
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);
|
|
311
255
|
}
|
|
312
256
|
/**
|
|
313
257
|
* 加载下拉框的数据源
|
|
@@ -320,60 +264,31 @@ export function getDict(_x8) {
|
|
|
320
264
|
* @returns
|
|
321
265
|
*/
|
|
322
266
|
|
|
323
|
-
function
|
|
324
|
-
_getDict = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(dictCode) {
|
|
325
|
-
var showValue,
|
|
326
|
-
needGateWay,
|
|
327
|
-
api,
|
|
328
|
-
param,
|
|
329
|
-
_args6 = arguments;
|
|
330
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
331
|
-
while (1) {
|
|
332
|
-
switch (_context6.prev = _context6.next) {
|
|
333
|
-
case 0:
|
|
334
|
-
showValue = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : true;
|
|
335
|
-
needGateWay = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : true;
|
|
336
|
-
api = '/lesoon-integration/sysDictDtl/listByProperties';
|
|
337
|
-
param = {
|
|
338
|
-
dictCode: dictCode
|
|
339
|
-
};
|
|
340
|
-
return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay));
|
|
341
|
-
|
|
342
|
-
case 5:
|
|
343
|
-
case "end":
|
|
344
|
-
return _context6.stop();
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}, _callee6);
|
|
348
|
-
}));
|
|
349
|
-
return _getDict.apply(this, arguments);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
export function fetchOptions(_x9, _x10, _x11, _x12) {
|
|
267
|
+
export function fetchOptions(_x3, _x4, _x5, _x6) {
|
|
353
268
|
return _fetchOptions.apply(this, arguments);
|
|
354
269
|
}
|
|
355
270
|
|
|
356
271
|
function _fetchOptions() {
|
|
357
|
-
_fetchOptions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
272
|
+
_fetchOptions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url, param, valueField, labelField) {
|
|
358
273
|
var showValue,
|
|
359
274
|
needGateWay,
|
|
360
275
|
_yield$httpGet,
|
|
361
276
|
_yield$httpGet$rows,
|
|
362
277
|
rows,
|
|
363
278
|
data,
|
|
364
|
-
|
|
279
|
+
_args2 = arguments;
|
|
365
280
|
|
|
366
|
-
return _regeneratorRuntime.wrap(function
|
|
281
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
367
282
|
while (1) {
|
|
368
|
-
switch (
|
|
283
|
+
switch (_context2.prev = _context2.next) {
|
|
369
284
|
case 0:
|
|
370
|
-
showValue =
|
|
371
|
-
needGateWay =
|
|
372
|
-
|
|
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;
|
|
373
288
|
return httpGet(url, param, needGateWay);
|
|
374
289
|
|
|
375
290
|
case 4:
|
|
376
|
-
_yield$httpGet =
|
|
291
|
+
_yield$httpGet = _context2.sent;
|
|
377
292
|
_yield$httpGet$rows = _yield$httpGet.rows;
|
|
378
293
|
rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
|
|
379
294
|
data = (rows || []).map(function (o) {
|
|
@@ -384,14 +299,14 @@ function _fetchOptions() {
|
|
|
384
299
|
status: o.status
|
|
385
300
|
};
|
|
386
301
|
});
|
|
387
|
-
return
|
|
302
|
+
return _context2.abrupt("return", data);
|
|
388
303
|
|
|
389
304
|
case 9:
|
|
390
305
|
case "end":
|
|
391
|
-
return
|
|
306
|
+
return _context2.stop();
|
|
392
307
|
}
|
|
393
308
|
}
|
|
394
|
-
},
|
|
309
|
+
}, _callee2);
|
|
395
310
|
}));
|
|
396
311
|
return _fetchOptions.apply(this, arguments);
|
|
397
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;
|