ls-pro-common 3.1.20 → 3.1.22
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.d.ts +1 -1
- package/es/hooks/usePermission/index.js +19 -1
- package/es/http/index.d.ts +1 -0
- package/es/http/index.js +6 -0
- package/es/utils/index.d.ts +6 -4
- package/es/utils/index.js +1 -1
- package/lib/components/InputTable.d.ts +1 -1
- package/lib/hooks/usePermission/index.js +19 -1
- package/lib/http/index.d.ts +1 -0
- package/lib/http/index.js +6 -0
- package/lib/utils/index.d.ts +6 -4
- package/lib/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -94,7 +94,7 @@ declare const InputTable: React.ForwardRefExoticComponent<{
|
|
|
94
94
|
/** @name 填充其它表单项目配置 */
|
|
95
95
|
fillMap?: Record<string, string> | undefined;
|
|
96
96
|
/** @name 输入后检查数据的触发方式,默认为entry回车触发 */
|
|
97
|
-
triggerCheck?: "none" | "
|
|
97
|
+
triggerCheck?: "none" | "blur" | "entry" | undefined;
|
|
98
98
|
/** @name 每次展示面板时都加载数据,接合 tableConfig里的 manualRequest 一起使用 */
|
|
99
99
|
loadOnShow?: boolean | undefined;
|
|
100
100
|
placement?: TooltipPlacement | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo, useCallback, useEffect } from 'react';
|
|
2
2
|
import { useLocation } from 'react-router-dom';
|
|
3
|
-
import { getUrlQuery, getResourceProps, getCache, getLoginName, getCookie, setCookie } from '../../utils';
|
|
3
|
+
import { getUrlQuery, getResourceProps, getCache, getLoginName, getCookie, setCookie, setCache } from '../../utils';
|
|
4
4
|
function usePermission() {
|
|
5
5
|
var routeLocation = useLocation();
|
|
6
6
|
/** @name 资源ID */
|
|
@@ -45,6 +45,24 @@ function usePermission() {
|
|
|
45
45
|
if (getUrlQuery('token') && !getCookie('token')) {
|
|
46
46
|
setCookie('token', getUrlQuery('token'));
|
|
47
47
|
}
|
|
48
|
+
//从外部系统转token和用户进来。
|
|
49
|
+
var handleMessage = function handleMessage(e) {
|
|
50
|
+
if (e.data.type === 'FROM_OTHER_SYSTEM') {
|
|
51
|
+
var _e$data = e.data,
|
|
52
|
+
token = _e$data.token,
|
|
53
|
+
user = _e$data.user;
|
|
54
|
+
if (token && !getCookie('token')) {
|
|
55
|
+
setCookie('token', token);
|
|
56
|
+
}
|
|
57
|
+
if (user && !getCache('user')) {
|
|
58
|
+
setCache('user', user);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
window.addEventListener('message', handleMessage);
|
|
63
|
+
return function () {
|
|
64
|
+
window.removeEventListener('message', handleMessage);
|
|
65
|
+
};
|
|
48
66
|
}, []);
|
|
49
67
|
return {
|
|
50
68
|
resourceId: resourceId,
|
package/es/http/index.d.ts
CHANGED
|
@@ -70,4 +70,5 @@ export declare function getDict(dictCodes: string, showValue?: boolean, needGate
|
|
|
70
70
|
* @returns
|
|
71
71
|
*/
|
|
72
72
|
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<any>;
|
|
73
|
+
export declare const checkResourceRight: (ids: string[]) => Promise<any>;
|
|
73
74
|
export default request;
|
package/es/http/index.js
CHANGED
|
@@ -469,4 +469,10 @@ function _fetchOptions() {
|
|
|
469
469
|
}));
|
|
470
470
|
return _fetchOptions.apply(this, arguments);
|
|
471
471
|
}
|
|
472
|
+
export var checkResourceRight = function checkResourceRight(ids) {
|
|
473
|
+
var url = '/lesoon/lesoon-petrel-permission-api/sysUserRole/selectResourceIds';
|
|
474
|
+
return httpPost(url, {
|
|
475
|
+
resourceIds: ids
|
|
476
|
+
}, true, false);
|
|
477
|
+
};
|
|
472
478
|
export default request;
|
package/es/utils/index.d.ts
CHANGED
|
@@ -194,13 +194,15 @@ export declare const deepClone: (obj: any) => any;
|
|
|
194
194
|
/**
|
|
195
195
|
* 在主工程中打开模块
|
|
196
196
|
*
|
|
197
|
-
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data
|
|
197
|
+
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data:参数,moduleName:模块名称}
|
|
198
198
|
*/
|
|
199
199
|
export declare const openPageInMain: (option: {
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
[key: string]: any;
|
|
201
|
+
path?: string | undefined;
|
|
202
|
+
resourceId?: string | undefined;
|
|
202
203
|
data?: any;
|
|
203
|
-
ifRefreshTarget?: boolean;
|
|
204
|
+
ifRefreshTarget?: boolean | undefined;
|
|
205
|
+
moduleName?: string | undefined;
|
|
204
206
|
}) => void;
|
|
205
207
|
/** 处理主题 */
|
|
206
208
|
export declare const handleTheme: () => void;
|
package/es/utils/index.js
CHANGED
|
@@ -429,7 +429,7 @@ export var deepClone = function deepClone(obj) {
|
|
|
429
429
|
/**
|
|
430
430
|
* 在主工程中打开模块
|
|
431
431
|
*
|
|
432
|
-
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data
|
|
432
|
+
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data:参数,moduleName:模块名称}
|
|
433
433
|
*/
|
|
434
434
|
export var openPageInMain = function openPageInMain(option) {
|
|
435
435
|
var win = top || window;
|
|
@@ -94,7 +94,7 @@ declare const InputTable: React.ForwardRefExoticComponent<{
|
|
|
94
94
|
/** @name 填充其它表单项目配置 */
|
|
95
95
|
fillMap?: Record<string, string> | undefined;
|
|
96
96
|
/** @name 输入后检查数据的触发方式,默认为entry回车触发 */
|
|
97
|
-
triggerCheck?: "none" | "
|
|
97
|
+
triggerCheck?: "none" | "blur" | "entry" | undefined;
|
|
98
98
|
/** @name 每次展示面板时都加载数据,接合 tableConfig里的 manualRequest 一起使用 */
|
|
99
99
|
loadOnShow?: boolean | undefined;
|
|
100
100
|
placement?: TooltipPlacement | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo, useCallback, useEffect } from 'react';
|
|
2
2
|
import { useLocation } from 'react-router-dom';
|
|
3
|
-
import { getUrlQuery, getResourceProps, getCache, getLoginName, getCookie, setCookie } from '../../utils';
|
|
3
|
+
import { getUrlQuery, getResourceProps, getCache, getLoginName, getCookie, setCookie, setCache } from '../../utils';
|
|
4
4
|
function usePermission() {
|
|
5
5
|
var routeLocation = useLocation();
|
|
6
6
|
/** @name 资源ID */
|
|
@@ -45,6 +45,24 @@ function usePermission() {
|
|
|
45
45
|
if (getUrlQuery('token') && !getCookie('token')) {
|
|
46
46
|
setCookie('token', getUrlQuery('token'));
|
|
47
47
|
}
|
|
48
|
+
//从外部系统转token和用户进来。
|
|
49
|
+
var handleMessage = function handleMessage(e) {
|
|
50
|
+
if (e.data.type === 'FROM_OTHER_SYSTEM') {
|
|
51
|
+
var _e$data = e.data,
|
|
52
|
+
token = _e$data.token,
|
|
53
|
+
user = _e$data.user;
|
|
54
|
+
if (token && !getCookie('token')) {
|
|
55
|
+
setCookie('token', token);
|
|
56
|
+
}
|
|
57
|
+
if (user && !getCache('user')) {
|
|
58
|
+
setCache('user', user);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
window.addEventListener('message', handleMessage);
|
|
63
|
+
return function () {
|
|
64
|
+
window.removeEventListener('message', handleMessage);
|
|
65
|
+
};
|
|
48
66
|
}, []);
|
|
49
67
|
return {
|
|
50
68
|
resourceId: resourceId,
|
package/lib/http/index.d.ts
CHANGED
|
@@ -70,4 +70,5 @@ export declare function getDict(dictCodes: string, showValue?: boolean, needGate
|
|
|
70
70
|
* @returns
|
|
71
71
|
*/
|
|
72
72
|
export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean, timeout?: number, isGet?: boolean, valueIsNumber?: boolean): Promise<any>;
|
|
73
|
+
export declare const checkResourceRight: (ids: string[]) => Promise<any>;
|
|
73
74
|
export default request;
|
package/lib/http/index.js
CHANGED
|
@@ -469,4 +469,10 @@ function _fetchOptions() {
|
|
|
469
469
|
}));
|
|
470
470
|
return _fetchOptions.apply(this, arguments);
|
|
471
471
|
}
|
|
472
|
+
export var checkResourceRight = function checkResourceRight(ids) {
|
|
473
|
+
var url = '/lesoon/lesoon-petrel-permission-api/sysUserRole/selectResourceIds';
|
|
474
|
+
return httpPost(url, {
|
|
475
|
+
resourceIds: ids
|
|
476
|
+
}, true, false);
|
|
477
|
+
};
|
|
472
478
|
export default request;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -194,13 +194,15 @@ export declare const deepClone: (obj: any) => any;
|
|
|
194
194
|
/**
|
|
195
195
|
* 在主工程中打开模块
|
|
196
196
|
*
|
|
197
|
-
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data
|
|
197
|
+
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data:参数,moduleName:模块名称}
|
|
198
198
|
*/
|
|
199
199
|
export declare const openPageInMain: (option: {
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
[key: string]: any;
|
|
201
|
+
path?: string | undefined;
|
|
202
|
+
resourceId?: string | undefined;
|
|
202
203
|
data?: any;
|
|
203
|
-
ifRefreshTarget?: boolean;
|
|
204
|
+
ifRefreshTarget?: boolean | undefined;
|
|
205
|
+
moduleName?: string | undefined;
|
|
204
206
|
}) => void;
|
|
205
207
|
/** 处理主题 */
|
|
206
208
|
export declare const handleTheme: () => void;
|
package/lib/utils/index.js
CHANGED
|
@@ -429,7 +429,7 @@ export var deepClone = function deepClone(obj) {
|
|
|
429
429
|
/**
|
|
430
430
|
* 在主工程中打开模块
|
|
431
431
|
*
|
|
432
|
-
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data
|
|
432
|
+
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data:参数,moduleName:模块名称}
|
|
433
433
|
*/
|
|
434
434
|
export var openPageInMain = function openPageInMain(option) {
|
|
435
435
|
var win = top || window;
|