ls-pro-common 3.1.20 → 3.1.21
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/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/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;
|
|
@@ -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;
|