ls-pro-common 3.1.57 → 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.css +3887 -2605
- package/dist/common.js +1 -1
- package/dist/common.min.css +3887 -2605
- package/dist/common.min.js +1 -1
- package/es/components/ImageSelector.js +3 -2
- 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/es/utils/pasteUpload.d.ts +13 -13
- package/es/utils/pasteUpload.js +31 -29
- package/lib/components/ImageSelector.js +3 -2
- 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/lib/utils/pasteUpload.d.ts +13 -13
- package/lib/utils/pasteUpload.js +31 -29
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { TIMEOUT, httpBatchGet, httpBatchPost, httpPost } from './ajax';
|
|
5
|
+
/**
|
|
6
|
+
* 读取数据字典
|
|
7
|
+
*
|
|
8
|
+
* @param dictCode 字典编码
|
|
9
|
+
* @param showValue 是否显示值
|
|
10
|
+
* @param needGateWay 是否需要网关 默认为true
|
|
11
|
+
* @param timeout 超时时间,默认60000毫秒
|
|
12
|
+
* @param isGet 是否Get请求
|
|
13
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
14
|
+
* @returns Promise<Record<string,string>[]>
|
|
15
|
+
*/
|
|
16
|
+
export function getDict(dictCodes) {
|
|
17
|
+
var showValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
18
|
+
var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
19
|
+
var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : TIMEOUT;
|
|
20
|
+
var isGet = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
21
|
+
var valueIsNumber = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
22
|
+
var api = '/lesoon-petrel-integration-api/sysDictDtl/listByProperties';
|
|
23
|
+
var param = {
|
|
24
|
+
dictCodes: (dictCodes || '').split(',')
|
|
25
|
+
};
|
|
26
|
+
return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay, timeout, isGet, valueIsNumber);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 加载下拉框的数据源
|
|
30
|
+
*
|
|
31
|
+
* @param url 后端接口
|
|
32
|
+
* @param param 请求参数
|
|
33
|
+
* @param valueField 值字段
|
|
34
|
+
* @param labelField 显示字段
|
|
35
|
+
* @param showValue 显示值
|
|
36
|
+
* @param needGateWay 是否需要网关 默认为true
|
|
37
|
+
* @param timeout
|
|
38
|
+
* @param isGet = true 是否get请求,默认true
|
|
39
|
+
* @param valueIsNumber 返回值是否为数字,默认false
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
export function fetchOptions(_x, _x2, _x3, _x4) {
|
|
43
|
+
return _fetchOptions.apply(this, arguments);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 获取用户资源Id对应的权限值
|
|
47
|
+
*
|
|
48
|
+
* @param ids 资源id
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
function _fetchOptions() {
|
|
52
|
+
_fetchOptions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, param, valueField, labelField) {
|
|
53
|
+
var showValue,
|
|
54
|
+
needGateWay,
|
|
55
|
+
timeout,
|
|
56
|
+
isGet,
|
|
57
|
+
valueIsNumber,
|
|
58
|
+
rows,
|
|
59
|
+
data,
|
|
60
|
+
_args = arguments;
|
|
61
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
|
+
while (1) switch (_context.prev = _context.next) {
|
|
63
|
+
case 0:
|
|
64
|
+
showValue = _args.length > 4 && _args[4] !== undefined ? _args[4] : true;
|
|
65
|
+
needGateWay = _args.length > 5 && _args[5] !== undefined ? _args[5] : true;
|
|
66
|
+
timeout = _args.length > 6 && _args[6] !== undefined ? _args[6] : TIMEOUT;
|
|
67
|
+
isGet = _args.length > 7 && _args[7] !== undefined ? _args[7] : true;
|
|
68
|
+
valueIsNumber = _args.length > 8 && _args[8] !== undefined ? _args[8] : false;
|
|
69
|
+
if (!isGet) {
|
|
70
|
+
_context.next = 14;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
_context.next = 8;
|
|
74
|
+
return httpBatchGet(url, param, needGateWay, timeout);
|
|
75
|
+
case 8:
|
|
76
|
+
_context.t0 = _context.sent.rows;
|
|
77
|
+
if (_context.t0) {
|
|
78
|
+
_context.next = 11;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
_context.t0 = [];
|
|
82
|
+
case 11:
|
|
83
|
+
rows = _context.t0;
|
|
84
|
+
_context.next = 20;
|
|
85
|
+
break;
|
|
86
|
+
case 14:
|
|
87
|
+
_context.next = 16;
|
|
88
|
+
return httpBatchPost(url, param, needGateWay, timeout);
|
|
89
|
+
case 16:
|
|
90
|
+
_context.t1 = _context.sent.rows;
|
|
91
|
+
if (_context.t1) {
|
|
92
|
+
_context.next = 19;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
_context.t1 = [];
|
|
96
|
+
case 19:
|
|
97
|
+
rows = _context.t1;
|
|
98
|
+
case 20:
|
|
99
|
+
data = (rows || []).map(function (o) {
|
|
100
|
+
return _objectSpread(_objectSpread({}, o), {}, {
|
|
101
|
+
value: valueIsNumber && !isNaN(o[valueField]) ? Number(o[valueField]) : o[valueField],
|
|
102
|
+
text: o[labelField],
|
|
103
|
+
label: (showValue ? o[valueField] + '→' : '') + o[labelField]
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return _context.abrupt("return", data);
|
|
107
|
+
case 22:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context.stop();
|
|
110
|
+
}
|
|
111
|
+
}, _callee);
|
|
112
|
+
}));
|
|
113
|
+
return _fetchOptions.apply(this, arguments);
|
|
114
|
+
}
|
|
115
|
+
export var getResourceRight = function getResourceRight(ids) {
|
|
116
|
+
var url = '/lesoon/lesoon-petrel-permission-api/sysUserRole/selectResourceIds';
|
|
117
|
+
return httpPost(url, {
|
|
118
|
+
resourceIds: ids
|
|
119
|
+
}, true, false);
|
|
120
|
+
};
|
package/es/http/index.d.ts
CHANGED
|
@@ -1,126 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @returns 如果是跨域返回true,否则返回false
|
|
7
|
-
*/
|
|
8
|
-
export declare const isCrossDomain: (url: string) => boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Get请求
|
|
11
|
-
*
|
|
12
|
-
* @param url 接口
|
|
13
|
-
* @param params 参数{key:value}
|
|
14
|
-
* @param needGateWay 是否需要网关 默认为true
|
|
15
|
-
* @returns Promise<ApiResponse>
|
|
16
|
-
*/
|
|
17
|
-
export declare function httpGet(url: string, params?: Record<string, any>, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
18
|
-
/**
|
|
19
|
-
* Post请求
|
|
20
|
-
*
|
|
21
|
-
* @param url 接口
|
|
22
|
-
* @param data 参数{key:value}
|
|
23
|
-
* @param isJson Json请求还是form请求,默认为json请求
|
|
24
|
-
* @param needGateWay 是否需要网关 默认为true
|
|
25
|
-
* @returns Promise<ApiResponse>
|
|
26
|
-
*/
|
|
27
|
-
export declare function httpPost(url: string, data?: Record<string, any>, isJson?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
28
|
-
/**
|
|
29
|
-
* Put 请求
|
|
30
|
-
*
|
|
31
|
-
* @param url 接口
|
|
32
|
-
* @param data 参数{key:value}
|
|
33
|
-
* @param needGateWay 是否需要网关 默认为true
|
|
34
|
-
* @returns Promise<ApiResponse>
|
|
35
|
-
*/
|
|
36
|
-
export declare function httpPut(url: string, data?: Record<string, any>, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
37
|
-
/**
|
|
38
|
-
* Delete 请求
|
|
39
|
-
*
|
|
40
|
-
* @param url 接口
|
|
41
|
-
* @param data 参数[]
|
|
42
|
-
* @param needGateWay 是否需要网关 默认为true
|
|
43
|
-
* @returns Promise<ApiResponse>
|
|
44
|
-
*/
|
|
45
|
-
export declare function httpDelete(url: string, data: any, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
46
|
-
/** 上传文件进度回调 */
|
|
47
|
-
export interface UploadProgressCallback {
|
|
48
|
-
(progress: number): void;
|
|
49
|
-
}
|
|
50
|
-
/** 上传文件返回值 */
|
|
51
|
-
export interface UploadResult {
|
|
52
|
-
promise: Promise<any>;
|
|
53
|
-
cancel: () => void;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* 上传文件,因fetch不支持进度回调,使用XMLHttpRequest实现上传文件
|
|
57
|
-
*
|
|
58
|
-
* @param url 上传接口地址
|
|
59
|
-
* @param file 要上传的文件
|
|
60
|
-
* @param params 附加其它参数 {key:value}
|
|
61
|
-
* @param labelName 对应后端接口的文件字段名,默认为 'file'
|
|
62
|
-
* @param needGateWay 是否需要网关,默认为 true,如果url里已包含网关,则不需要网关
|
|
63
|
-
* @param onProgress 进度回调函数,参数为 0-100 的进度百分比
|
|
64
|
-
* @param useDownloadDomain 是否使用下载域名来上传,默认为 false
|
|
65
|
-
* @returns 返回包含 promise 和 cancel 方法的对象
|
|
66
|
-
*/
|
|
67
|
-
export declare const httpUpload: (url: string, file: File, params?: Record<string, any>, labelName?: string, needGateWay?: boolean, onProgress?: UploadProgressCallback | undefined, useDownloadDomain?: boolean) => UploadResult;
|
|
68
|
-
/**
|
|
69
|
-
* 分批获取数据,当一次性取大于2000条,且是第一页时,分多次去取,避免一次性取太多数据导致后端工程压力过大
|
|
70
|
-
*
|
|
71
|
-
* 注意:如果pageSize小于等于2000,或不是取第一页数据时,直接使用普通请求
|
|
72
|
-
*
|
|
73
|
-
* @param url
|
|
74
|
-
* @param params
|
|
75
|
-
* @param needGateWay
|
|
76
|
-
* @param timeout
|
|
77
|
-
* @returns
|
|
78
|
-
*/
|
|
79
|
-
export declare const httpBatchGet: (url: string, params?: Record<string, any>, needGateWay?: boolean, timeout?: number) => Promise<any>;
|
|
80
|
-
/**
|
|
81
|
-
* 分批获取数据,当一次性取大于2000条,且是第一页时,分多次去取,避免一次性取太多数据导致后端工程压力过大
|
|
82
|
-
*
|
|
83
|
-
* 注意:如果pageSize小于等于2000,或不是取第一页数据时,直接使用普通请求
|
|
84
|
-
*
|
|
85
|
-
* @param url
|
|
86
|
-
* @param params
|
|
87
|
-
* @param needGateWay
|
|
88
|
-
* @param timeout
|
|
89
|
-
* @returns
|
|
90
|
-
*/
|
|
91
|
-
export declare const httpBatchPost: (url: string, params?: Record<string, any>, needGateWay?: boolean, timeout?: number) => Promise<any>;
|
|
92
|
-
/**
|
|
93
|
-
* 读取数据字典
|
|
94
|
-
*
|
|
95
|
-
* @param dictCode 字典编码
|
|
96
|
-
* @param showValue 是否显示值
|
|
97
|
-
* @param needGateWay 是否需要网关 默认为true
|
|
98
|
-
* @param timeout 超时时间,默认60000毫秒
|
|
99
|
-
* @param isGet 是否Get请求
|
|
100
|
-
* @param valueIsNumber 返回值是否为数字,默认false
|
|
101
|
-
* @returns Promise<Record<string,string>[]>
|
|
102
|
-
*/
|
|
103
|
-
export declare function getDict(dictCodes: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<any>;
|
|
104
|
-
/**
|
|
105
|
-
* 加载下拉框的数据源
|
|
106
|
-
*
|
|
107
|
-
* @param url 后端接口
|
|
108
|
-
* @param param 请求参数
|
|
109
|
-
* @param valueField 值字段
|
|
110
|
-
* @param labelField 显示字段
|
|
111
|
-
* @param showValue 显示值
|
|
112
|
-
* @param needGateWay 是否需要网关 默认为true
|
|
113
|
-
* @param timeout
|
|
114
|
-
* @param isGet = true 是否get请求,默认true
|
|
115
|
-
* @param valueIsNumber 返回值是否为数字,默认false
|
|
116
|
-
* @returns
|
|
117
|
-
*/
|
|
118
|
-
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<any>;
|
|
119
|
-
/**
|
|
120
|
-
* 获取用户资源Id对应的权限值
|
|
121
|
-
*
|
|
122
|
-
* @param ids 资源id
|
|
123
|
-
* @returns
|
|
124
|
-
*/
|
|
125
|
-
export declare const getResourceRight: (ids: string[]) => Promise<any>;
|
|
1
|
+
import { request } from './ajax';
|
|
2
|
+
export * from './ajax';
|
|
3
|
+
export * from './bizAjax';
|
|
4
|
+
export * from './upload';
|
|
5
|
+
export * from './uploadByChunk';
|
|
126
6
|
export default request;
|