ls-pro-common 3.1.58 → 3.1.59
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.js +1 -1
- package/dist/common.min.js +1 -1
- package/es/components/InputTable.js +12 -14
- package/es/http/ajax.d.ts +73 -0
- package/es/http/ajax.js +611 -0
- package/es/http/bizAjax.d.ts +34 -0
- package/es/http/bizAjax.js +120 -0
- package/es/http/index.d.ts +5 -125
- package/es/http/index.js +5 -974
- package/es/http/mdmRequest.js +1 -1
- package/es/http/upload.d.ts +24 -0
- package/es/http/upload.js +252 -0
- package/es/http/uploadByChunk.d.ts +37 -0
- package/es/http/uploadByChunk.js +385 -0
- package/lib/components/InputTable.js +12 -14
- package/lib/http/ajax.d.ts +73 -0
- package/lib/http/ajax.js +611 -0
- package/lib/http/bizAjax.d.ts +34 -0
- package/lib/http/bizAjax.js +120 -0
- package/lib/http/index.d.ts +5 -125
- package/lib/http/index.js +5 -974
- package/lib/http/mdmRequest.js +1 -1
- package/lib/http/upload.d.ts +24 -0
- package/lib/http/upload.js +252 -0
- package/lib/http/uploadByChunk.d.ts +37 -0
- package/lib/http/uploadByChunk.js +385 -0
- package/package.json +1 -1
|
@@ -182,7 +182,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
182
182
|
*/
|
|
183
183
|
var loadData = /*#__PURE__*/function () {
|
|
184
184
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
185
|
-
var current, pageSize, restParams, _selectRowRef$current, _rows, data, _tableRef$
|
|
185
|
+
var current, pageSize, restParams, _selectRowRef$current, _rows, data, _tableRef$current3, _tableRef$current3$cl, beforeParam, result, rows, formValue, val, _selectRowRef$current2, arr, pageSelectedRows;
|
|
186
186
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
187
187
|
while (1) switch (_context.prev = _context.next) {
|
|
188
188
|
case 0:
|
|
@@ -199,8 +199,9 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
199
199
|
})));
|
|
200
200
|
setSelectedKeys(Array.from(new Set(selectedKeys)));
|
|
201
201
|
requestIdleCallback(function () {
|
|
202
|
-
var _tableRef$current, _tableRef$current$
|
|
203
|
-
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$
|
|
202
|
+
var _tableRef$current, _tableRef$current$onS, _tableRef$current2, _tableRef$current2$re;
|
|
203
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$onS = _tableRef$current.onSelectedRows) === null || _tableRef$current$onS === void 0 ? void 0 : _tableRef$current$onS.call(_tableRef$current, _rows);
|
|
204
|
+
(_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$re = _tableRef$current2.reload) === null || _tableRef$current2$re === void 0 ? void 0 : _tableRef$current2$re.call(_tableRef$current2);
|
|
204
205
|
});
|
|
205
206
|
return _context.abrupt("return", {
|
|
206
207
|
data: _rows,
|
|
@@ -223,7 +224,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
223
224
|
}
|
|
224
225
|
if (!keepSelect) {
|
|
225
226
|
selectRowRef.current = [];
|
|
226
|
-
(_tableRef$
|
|
227
|
+
(_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);
|
|
227
228
|
}
|
|
228
229
|
if (!beforeLoad) {
|
|
229
230
|
_context.next = 18;
|
|
@@ -299,11 +300,9 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
299
300
|
* 如果初始有值时,调用此方法初始化名称
|
|
300
301
|
*
|
|
301
302
|
* @param val
|
|
302
|
-
* @param updateTxt
|
|
303
303
|
* @returns
|
|
304
304
|
*/
|
|
305
305
|
var initName = function initName(val) {
|
|
306
|
-
var updateTxt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
307
306
|
if (!val) return;
|
|
308
307
|
// 当返回值列不在表格配置中不查询,因为有可能会导致查询别名问题报错。
|
|
309
308
|
var valueColumn = columns.find(function (o) {
|
|
@@ -325,7 +324,6 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
325
324
|
param[fieldName] = val;
|
|
326
325
|
loadData(param).then(function (result) {
|
|
327
326
|
initRows.current = result.data;
|
|
328
|
-
if (!updateTxt) return;
|
|
329
327
|
var rows = (result.data || []).filter(function (o) {
|
|
330
328
|
return o;
|
|
331
329
|
});
|
|
@@ -355,7 +353,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
355
353
|
initName(val);
|
|
356
354
|
}
|
|
357
355
|
} else if (multiple) {
|
|
358
|
-
initName(val
|
|
356
|
+
initName(val);
|
|
359
357
|
}
|
|
360
358
|
}
|
|
361
359
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -408,10 +406,10 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
408
406
|
}
|
|
409
407
|
};
|
|
410
408
|
var handleClear = function handleClear() {
|
|
411
|
-
var _tableRef$
|
|
409
|
+
var _tableRef$current4, _tableRef$current4$cl;
|
|
412
410
|
selectRowRef.current = [];
|
|
413
411
|
setSelectedKeys([]);
|
|
414
|
-
(_tableRef$
|
|
412
|
+
(_tableRef$current4 = tableRef.current) === null || _tableRef$current4 === void 0 ? void 0 : (_tableRef$current4$cl = _tableRef$current4.clearSelected) === null || _tableRef$current4$cl === void 0 ? void 0 : _tableRef$current4$cl.call(_tableRef$current4);
|
|
415
413
|
setText('');
|
|
416
414
|
var formValue = getFormValue();
|
|
417
415
|
if (!formValue) return;
|
|
@@ -471,15 +469,15 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
471
469
|
});
|
|
472
470
|
useEffect(function () {
|
|
473
471
|
if (!text && multiple) {
|
|
474
|
-
var _tableRef$
|
|
472
|
+
var _tableRef$current5, _tableRef$current5$cl;
|
|
475
473
|
selectRowRef.current = [];
|
|
476
|
-
(_tableRef$
|
|
474
|
+
(_tableRef$current5 = tableRef.current) === null || _tableRef$current5 === void 0 ? void 0 : (_tableRef$current5$cl = _tableRef$current5.clearSelected) === null || _tableRef$current5$cl === void 0 ? void 0 : _tableRef$current5$cl.call(_tableRef$current5);
|
|
477
475
|
}
|
|
478
476
|
}, [text, multiple]);
|
|
479
477
|
useEffect(function () {
|
|
480
478
|
if (visible && loadOnShow) {
|
|
481
|
-
var _tableRef$
|
|
482
|
-
(_tableRef$
|
|
479
|
+
var _tableRef$current6, _tableRef$current6$re;
|
|
480
|
+
(_tableRef$current6 = tableRef.current) === null || _tableRef$current6 === void 0 ? void 0 : (_tableRef$current6$re = _tableRef$current6.reload) === null || _tableRef$current6$re === void 0 ? void 0 : _tableRef$current6$re.call(_tableRef$current6);
|
|
483
481
|
}
|
|
484
482
|
}, [visible, loadOnShow]);
|
|
485
483
|
// 处理有值时,可清空
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export declare const TIMEOUT = 60000;
|
|
2
|
+
export declare const request: import("umi-request").RequestMethod<false>;
|
|
3
|
+
export declare const httpStatus: any;
|
|
4
|
+
export declare const ajaxHeader: Record<string, any>;
|
|
5
|
+
/**
|
|
6
|
+
* 判断URL是否跨域
|
|
7
|
+
*
|
|
8
|
+
* @param url 需要判断的URL
|
|
9
|
+
* @returns 如果是跨域返回true,否则返回false
|
|
10
|
+
*/
|
|
11
|
+
export declare const isCrossDomain: (url: string) => boolean;
|
|
12
|
+
export declare function ajax(url: string, params: Record<string, any> | undefined, type: string, needGateWay?: boolean, isJson?: boolean, timeout?: number): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Get请求
|
|
15
|
+
*
|
|
16
|
+
* @param url 接口
|
|
17
|
+
* @param params 参数{key:value}
|
|
18
|
+
* @param needGateWay 是否需要网关 默认为true
|
|
19
|
+
* @returns Promise<ApiResponse>
|
|
20
|
+
*/
|
|
21
|
+
export declare function httpGet(url: string, params?: Record<string, any>, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Post请求
|
|
24
|
+
*
|
|
25
|
+
* @param url 接口
|
|
26
|
+
* @param data 参数{key:value}
|
|
27
|
+
* @param isJson Json请求还是form请求,默认为json请求
|
|
28
|
+
* @param needGateWay 是否需要网关 默认为true
|
|
29
|
+
* @returns Promise<ApiResponse>
|
|
30
|
+
*/
|
|
31
|
+
export declare function httpPost(url: string, data?: Record<string, any>, isJson?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Put 请求
|
|
34
|
+
*
|
|
35
|
+
* @param url 接口
|
|
36
|
+
* @param data 参数{key:value}
|
|
37
|
+
* @param needGateWay 是否需要网关 默认为true
|
|
38
|
+
* @returns Promise<ApiResponse>
|
|
39
|
+
*/
|
|
40
|
+
export declare function httpPut(url: string, data?: Record<string, any>, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete 请求
|
|
43
|
+
*
|
|
44
|
+
* @param url 接口
|
|
45
|
+
* @param data 参数[]
|
|
46
|
+
* @param needGateWay 是否需要网关 默认为true
|
|
47
|
+
* @returns Promise<ApiResponse>
|
|
48
|
+
*/
|
|
49
|
+
export declare function httpDelete(url: string, data: any, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
50
|
+
/**
|
|
51
|
+
* 分批获取数据,当一次性取大于2000条,且是第一页时,分多次去取,避免一次性取太多数据导致后端工程压力过大
|
|
52
|
+
*
|
|
53
|
+
* 注意:如果pageSize小于等于2000,或不是取第一页数据时,直接使用普通请求
|
|
54
|
+
*
|
|
55
|
+
* @param url
|
|
56
|
+
* @param params
|
|
57
|
+
* @param needGateWay
|
|
58
|
+
* @param timeout
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
export declare const httpBatchGet: (url: string, params?: Record<string, any>, needGateWay?: boolean, timeout?: number) => Promise<any>;
|
|
62
|
+
/**
|
|
63
|
+
* 分批获取数据,当一次性取大于2000条,且是第一页时,分多次去取,避免一次性取太多数据导致后端工程压力过大
|
|
64
|
+
*
|
|
65
|
+
* 注意:如果pageSize小于等于2000,或不是取第一页数据时,直接使用普通请求
|
|
66
|
+
*
|
|
67
|
+
* @param url
|
|
68
|
+
* @param params
|
|
69
|
+
* @param needGateWay
|
|
70
|
+
* @param timeout
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
export declare const httpBatchPost: (url: string, params?: Record<string, any>, needGateWay?: boolean, timeout?: number) => Promise<any>;
|