ls-pro-common 3.0.77 → 3.0.80
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 +19 -2
- package/dist/common.js +1 -1
- package/dist/common.min.css +19 -2
- package/dist/common.min.js +1 -1
- package/es/components/ImageSelector.js +1 -6
- package/es/components/InputTable.js +3 -2
- package/es/components/ViewOffice.d.ts +12 -0
- package/es/components/ViewOffice.js +74 -0
- package/es/components/antd-custom.less +3 -0
- package/es/components/common.less +11 -0
- package/es/http/index.d.ts +11 -5
- package/es/http/index.js +25 -13
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/typing.d.ts +12 -12
- package/es/utils/index.js +3 -18
- package/lib/components/ImageSelector.js +1 -6
- package/lib/components/InputTable.js +3 -2
- package/lib/components/ViewOffice.d.ts +12 -0
- package/lib/components/ViewOffice.js +74 -0
- package/lib/components/antd-custom.less +3 -0
- package/lib/components/common.less +11 -0
- package/lib/http/index.d.ts +11 -5
- package/lib/http/index.js +25 -13
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/typing.d.ts +12 -12
- package/lib/utils/index.js +3 -18
- package/package.json +1 -1
package/lib/http/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare const request: import("umi-request").RequestMethod<false>;
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Get请求
|
|
4
|
+
*
|
|
4
5
|
* @param url 接口
|
|
5
6
|
* @param params 参数{key:value}
|
|
6
7
|
* @param needGateWay 是否需要网关 默认为true
|
|
@@ -8,16 +9,18 @@ declare const request: import("umi-request").RequestMethod<false>;
|
|
|
8
9
|
*/
|
|
9
10
|
export declare function httpGet(url: string, params?: Record<string, any>, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Post请求
|
|
13
|
+
*
|
|
12
14
|
* @param url 接口
|
|
13
15
|
* @param data 参数{key:value}
|
|
14
|
-
* @param isJson
|
|
16
|
+
* @param isJson Json请求还是form请求,默认为json请求
|
|
15
17
|
* @param needGateWay 是否需要网关 默认为true
|
|
16
18
|
* @returns Promise<ApiResponse>
|
|
17
19
|
*/
|
|
18
20
|
export declare function httpPost(url: string, data?: Record<string, any>, isJson?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* Put 请求
|
|
23
|
+
*
|
|
21
24
|
* @param url 接口
|
|
22
25
|
* @param data 参数{key:value}
|
|
23
26
|
* @param needGateWay 是否需要网关 默认为true
|
|
@@ -25,7 +28,8 @@ export declare function httpPost(url: string, data?: Record<string, any>, isJson
|
|
|
25
28
|
*/
|
|
26
29
|
export declare function httpPut(url: string, data?: Record<string, any>, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
27
30
|
/**
|
|
28
|
-
*
|
|
31
|
+
* Delete 请求
|
|
32
|
+
*
|
|
29
33
|
* @param url 接口
|
|
30
34
|
* @param data 参数[]
|
|
31
35
|
* @param needGateWay 是否需要网关 默认为true
|
|
@@ -34,6 +38,7 @@ export declare function httpPut(url: string, data?: Record<string, any>, needGat
|
|
|
34
38
|
export declare function httpDelete(url: string, data: any, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
35
39
|
/**
|
|
36
40
|
* 读取数据字典
|
|
41
|
+
*
|
|
37
42
|
* @param dictCode 字典编码
|
|
38
43
|
* @param needGateWay 是否需要网关 默认为true
|
|
39
44
|
* @returns Promise<Record<string,string>>
|
|
@@ -41,6 +46,7 @@ export declare function httpDelete(url: string, data: any, needGateWay?: boolean
|
|
|
41
46
|
export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean, timeout?: number): Promise<any>;
|
|
42
47
|
/**
|
|
43
48
|
* 加载下拉框的数据源
|
|
49
|
+
*
|
|
44
50
|
* @param url 后端接口
|
|
45
51
|
* @param param 请求参数
|
|
46
52
|
* @param valueField 值字段
|
package/lib/http/index.js
CHANGED
|
@@ -15,31 +15,37 @@ var httpStatus = {
|
|
|
15
15
|
};
|
|
16
16
|
/** 请求拦截器,统一添加token */
|
|
17
17
|
request.interceptors.request.use(function (url, options) {
|
|
18
|
-
var token = getCookie(
|
|
18
|
+
var token = getCookie('token');
|
|
19
19
|
options.headers = options.headers || {};
|
|
20
20
|
// 处理 token
|
|
21
21
|
if (token && url.indexOf('noToken=1') === -1) {
|
|
22
|
+
// @ts-ignore
|
|
22
23
|
options.headers['token'] = token;
|
|
23
24
|
}
|
|
24
25
|
// 处理门店
|
|
25
26
|
var shopNo = getCache('shopNo', true) || getCache('shopNo');
|
|
26
27
|
if (shopNo) {
|
|
27
|
-
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
options.headers['shopNo'] = shopNo;
|
|
28
30
|
}
|
|
29
31
|
// 处理门店
|
|
30
32
|
var shopCode = getCache('shopCode', true) || getCache('shopCode');
|
|
31
33
|
if (shopCode) {
|
|
32
|
-
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
options.headers['shopCode'] = shopCode;
|
|
33
36
|
}
|
|
34
37
|
// 处理仓库
|
|
35
38
|
var storeNo = getCache('storeNo', true) || getCache('storeNo');
|
|
36
39
|
if (storeNo) {
|
|
37
|
-
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
options.headers['storeNo'] = storeNo;
|
|
38
42
|
}
|
|
39
43
|
var tag = getCookie('x-asm-prefer-tag');
|
|
40
44
|
if (tag) {
|
|
41
|
-
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
options.headers['x-asm-prefer-tag'] = tag; //灰度发版标识
|
|
42
47
|
}
|
|
48
|
+
|
|
43
49
|
url = url.replace('&noToken=1', '').replace('noToken=1', '');
|
|
44
50
|
var param = {
|
|
45
51
|
resCode: getUrlQuery('resCode', url) || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId'),
|
|
@@ -78,7 +84,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
78
84
|
retMsg = (_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retMsg;
|
|
79
85
|
faultCode = (_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.faultCode;
|
|
80
86
|
if ((retCode === 'timeout' || retCode === '4011') && !isMobile) {
|
|
81
|
-
if (!getCookie(
|
|
87
|
+
if (!getCookie('token')) {
|
|
82
88
|
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
83
89
|
} else {
|
|
84
90
|
reLogin();
|
|
@@ -122,12 +128,12 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
122
128
|
_data = _context.sent;
|
|
123
129
|
_retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag4 = _data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.retCode) || '0';
|
|
124
130
|
_retMsg = ((_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retMsg) || '请求的服务出错';
|
|
125
|
-
status = (getUrlQuery('apiStatus') || '0').split(',');
|
|
131
|
+
status = (getUrlQuery('apiStatus', options.url) || '0').split(',');
|
|
126
132
|
requestId = (_data$flag6 = _data.flag) === null || _data$flag6 === void 0 ? void 0 : _data$flag6.requestId;
|
|
127
133
|
_faultCode = (_data$flag7 = _data.flag) === null || _data$flag7 === void 0 ? void 0 : _data$flag7.faultCode;
|
|
128
134
|
if (_retCode && !status.includes(_retCode)) {
|
|
129
135
|
if ((_retCode === 'timeout' || _retCode === '4011') && !isMobile) {
|
|
130
|
-
if (!getCookie(
|
|
136
|
+
if (!getCookie('token')) {
|
|
131
137
|
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
132
138
|
} else {
|
|
133
139
|
reLogin();
|
|
@@ -200,7 +206,8 @@ function ajax(url) {
|
|
|
200
206
|
}
|
|
201
207
|
}
|
|
202
208
|
/**
|
|
203
|
-
*
|
|
209
|
+
* Get请求
|
|
210
|
+
*
|
|
204
211
|
* @param url 接口
|
|
205
212
|
* @param params 参数{key:value}
|
|
206
213
|
* @param needGateWay 是否需要网关 默认为true
|
|
@@ -213,10 +220,11 @@ export function httpGet(url) {
|
|
|
213
220
|
return ajax(url, params, 'get', needGateWay, true, timeout);
|
|
214
221
|
}
|
|
215
222
|
/**
|
|
216
|
-
*
|
|
223
|
+
* Post请求
|
|
224
|
+
*
|
|
217
225
|
* @param url 接口
|
|
218
226
|
* @param data 参数{key:value}
|
|
219
|
-
* @param isJson
|
|
227
|
+
* @param isJson Json请求还是form请求,默认为json请求
|
|
220
228
|
* @param needGateWay 是否需要网关 默认为true
|
|
221
229
|
* @returns Promise<ApiResponse>
|
|
222
230
|
*/
|
|
@@ -228,7 +236,8 @@ export function httpPost(url) {
|
|
|
228
236
|
return ajax(url, data, 'post', needGateWay, isJson, timeout);
|
|
229
237
|
}
|
|
230
238
|
/**
|
|
231
|
-
*
|
|
239
|
+
* Put 请求
|
|
240
|
+
*
|
|
232
241
|
* @param url 接口
|
|
233
242
|
* @param data 参数{key:value}
|
|
234
243
|
* @param needGateWay 是否需要网关 默认为true
|
|
@@ -241,7 +250,8 @@ export function httpPut(url) {
|
|
|
241
250
|
return ajax(url, data, 'put', needGateWay, true, timeout);
|
|
242
251
|
}
|
|
243
252
|
/**
|
|
244
|
-
*
|
|
253
|
+
* Delete 请求
|
|
254
|
+
*
|
|
245
255
|
* @param url 接口
|
|
246
256
|
* @param data 参数[]
|
|
247
257
|
* @param needGateWay 是否需要网关 默认为true
|
|
@@ -254,6 +264,7 @@ export function httpDelete(url, data) {
|
|
|
254
264
|
}
|
|
255
265
|
/**
|
|
256
266
|
* 读取数据字典
|
|
267
|
+
*
|
|
257
268
|
* @param dictCode 字典编码
|
|
258
269
|
* @param needGateWay 是否需要网关 默认为true
|
|
259
270
|
* @returns Promise<Record<string,string>>
|
|
@@ -270,6 +281,7 @@ export function getDict(dictCode) {
|
|
|
270
281
|
}
|
|
271
282
|
/**
|
|
272
283
|
* 加载下拉框的数据源
|
|
284
|
+
*
|
|
273
285
|
* @param url 后端接口
|
|
274
286
|
* @param param 请求参数
|
|
275
287
|
* @param valueField 值字段
|
package/lib/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import IconQuestion from './components/IconQuestion';
|
|
|
16
16
|
import IconBell from './components/IconBell';
|
|
17
17
|
import IconSearch from './components/IconSearch';
|
|
18
18
|
import TagCheck from './components/TagCheck';
|
|
19
|
+
import ViewOffice from './components/ViewOffice';
|
|
19
20
|
import BaseService from './service/BaseService';
|
|
20
21
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
21
22
|
import * as utils from './utils';
|
|
@@ -32,4 +33,4 @@ import type { DtlLyaoutProps } from './components/DtlLayout';
|
|
|
32
33
|
import type { DescritionCardProps } from './components/DescritionCard';
|
|
33
34
|
import type { PermissionProps } from './components/Permission';
|
|
34
35
|
export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps, DescritionCardProps, PermissionProps, };
|
|
35
|
-
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue, };
|
|
36
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue, };
|
package/lib/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import IconQuestion from './components/IconQuestion';
|
|
|
16
16
|
import IconBell from './components/IconBell';
|
|
17
17
|
import IconSearch from './components/IconSearch';
|
|
18
18
|
import TagCheck from './components/TagCheck';
|
|
19
|
+
import ViewOffice from './components/ViewOffice';
|
|
19
20
|
import BaseService from './service/BaseService';
|
|
20
21
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
21
22
|
import * as utils from './utils';
|
|
@@ -26,4 +27,4 @@ import usePermission from './hooks/usePermission';
|
|
|
26
27
|
import useGetState from './hooks/useGetState';
|
|
27
28
|
import { useFilterLocal } from './hooks/useFilterBack';
|
|
28
29
|
import useQueue from './hooks/useQueue';
|
|
29
|
-
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue };
|
|
30
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, ViewOffice, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState, useFilterLocal, useQueue };
|
package/lib/typing.d.ts
CHANGED
|
@@ -25,29 +25,29 @@ export declare type TableToolbar = {
|
|
|
25
25
|
};
|
|
26
26
|
/** 基础模块接口类型 */
|
|
27
27
|
export declare type BaseApiType = {
|
|
28
|
-
|
|
28
|
+
/** 加载数据api */
|
|
29
29
|
load?: string;
|
|
30
|
-
|
|
30
|
+
/** 新增数据api */
|
|
31
31
|
add?: string;
|
|
32
|
-
|
|
32
|
+
/** 更改数据api,如果跟新增接口一样,可不指定 */
|
|
33
33
|
edit?: string;
|
|
34
|
-
|
|
34
|
+
/** 删除数据api */
|
|
35
35
|
delete?: string;
|
|
36
|
-
|
|
36
|
+
/** 主从一起保存方法,新增,现改,删除共用一个接口 */
|
|
37
37
|
mstDtl?: string;
|
|
38
|
-
|
|
38
|
+
/** 导入数据api */
|
|
39
39
|
import?: string;
|
|
40
|
-
|
|
40
|
+
/** 导出数据api,如果跟加载数据api一致,可不指定 */
|
|
41
41
|
export?: string;
|
|
42
42
|
/** 审核接口 */
|
|
43
43
|
audit?: string;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
/** 请求后端接口方法 */
|
|
46
46
|
export declare type MethodType = {
|
|
47
|
-
|
|
48
|
-
get
|
|
47
|
+
/** 加载数据对应的方法,默认为get, 如果请求参数太长时,后端可能会改为post */
|
|
48
|
+
get?: 'get' | 'post';
|
|
49
49
|
/** 更改数据的请求方法,默认为 put, 也可以是post,根据后端接口而定 */
|
|
50
|
-
edit
|
|
50
|
+
edit?: 'put' | 'post';
|
|
51
51
|
/** 删除数据的请求方法,默认为delete, 也可以是post,根据后端接口而定 */
|
|
52
|
-
delete
|
|
52
|
+
delete?: 'delete' | 'post';
|
|
53
53
|
};
|
package/lib/utils/index.js
CHANGED
|
@@ -461,16 +461,11 @@ export var showAlert = function showAlert(text) {
|
|
|
461
461
|
var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
|
|
462
462
|
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
|
|
463
463
|
var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
464
|
-
var win = top || window;
|
|
465
|
-
//@ts-ignore
|
|
466
|
-
if (!win.lsAppList || !!document.fullscreenElement) {
|
|
467
|
-
win = window;
|
|
468
|
-
}
|
|
469
464
|
return new Promise(function (resolve, reject) {
|
|
470
465
|
_Modal[type](_objectSpread({
|
|
471
466
|
content: text,
|
|
472
467
|
title: title,
|
|
473
|
-
getContainer: getFullScreenElement() ||
|
|
468
|
+
getContainer: getFullScreenElement() || document.body,
|
|
474
469
|
onOk: function onOk() {
|
|
475
470
|
resolve(true);
|
|
476
471
|
},
|
|
@@ -492,11 +487,6 @@ export var exitAlert = function exitAlert() {
|
|
|
492
487
|
export var showConfirm = function showConfirm(text) {
|
|
493
488
|
var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
|
|
494
489
|
return new Promise(function (resolve, reject) {
|
|
495
|
-
var win = top || window;
|
|
496
|
-
//@ts-ignore
|
|
497
|
-
if (!win.lsAppList || !!document.fullscreenElement) {
|
|
498
|
-
win = window;
|
|
499
|
-
}
|
|
500
490
|
_Modal.confirm({
|
|
501
491
|
title: title,
|
|
502
492
|
content: text,
|
|
@@ -506,7 +496,7 @@ export var showConfirm = function showConfirm(text) {
|
|
|
506
496
|
cancelButtonProps: {
|
|
507
497
|
className: 'ant-btn-gray'
|
|
508
498
|
},
|
|
509
|
-
getContainer: getFullScreenElement() ||
|
|
499
|
+
getContainer: getFullScreenElement() || document.body,
|
|
510
500
|
onOk: function onOk() {
|
|
511
501
|
resolve(true);
|
|
512
502
|
},
|
|
@@ -525,16 +515,11 @@ var timeout = false;
|
|
|
525
515
|
export var reLogin = function reLogin() {
|
|
526
516
|
if (timeout) return;
|
|
527
517
|
timeout = true;
|
|
528
|
-
var win = top || window;
|
|
529
|
-
//@ts-ignore
|
|
530
|
-
if (!win.lsAppList || !!document.fullscreenElement) {
|
|
531
|
-
win = window;
|
|
532
|
-
}
|
|
533
518
|
_Modal.warning({
|
|
534
519
|
title: '登录状态已过期,请重新登录',
|
|
535
520
|
okText: '重新登录',
|
|
536
521
|
maskClosable: false,
|
|
537
|
-
getContainer: getFullScreenElement() ||
|
|
522
|
+
getContainer: getFullScreenElement() || document.body,
|
|
538
523
|
afterClose: function afterClose() {
|
|
539
524
|
timeout = false;
|
|
540
525
|
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|