@bit-sun/business-component 3.0.0-alpha.34 → 3.0.0-alpha.35
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/index.esm.js +24 -9
- package/dist/index.js +26 -8
- package/dist/utils/LocalstorageUtils.d.ts +5 -0
- package/package.json +1 -1
- package/src/components/Business/DetailPageWrapper/index.tsx +2 -4
- package/src/components/Business/HomePageWrapper/index.tsx +8 -8
- package/src/utils/LocalstorageUtils.ts +23 -5
- package/src/utils/businessUtils.ts +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -698,20 +698,34 @@ function handleUserPhone() {
|
|
|
698
698
|
function getCurrentTargetBgId() {
|
|
699
699
|
return localStorage.getItem('target_bg_id');
|
|
700
700
|
}
|
|
701
|
-
|
|
702
|
-
|
|
701
|
+
/******* 公用localstorage存取 开始 *****/
|
|
702
|
+
// 获取存储的最终key--加前缀是为了解决命名空间重复覆盖问题 【适用:主应用、子应用单独使用】
|
|
703
|
+
var getLastKey = function getLastKey(prefix, key) {
|
|
704
|
+
return prefix ? "".concat(prefix, ":").concat(key) : "".concat(key);
|
|
705
|
+
};
|
|
706
|
+
// 存储/获取key 函数---如果没有channel,则使用主应用所属的业务应用编码作为前缀 【适用:主应用、子应用结合使用】
|
|
707
|
+
var getLocalStorageSaveKey = function getLocalStorageSaveKey(key, channel) {
|
|
703
708
|
var prefix = channel;
|
|
704
709
|
// 传入channel 则使用传入的channel 作为前缀,一般存储key使用
|
|
705
710
|
// 否则使用下面页面路径处理后的变量为前缀,一般获取key使用
|
|
706
711
|
if (!channel) {
|
|
707
712
|
var _window$top, _window$top$location;
|
|
708
713
|
var channelPlat = (_window$top = window.top) === null || _window$top === void 0 ? void 0 : (_window$top$location = _window$top.location) === null || _window$top$location === void 0 ? void 0 : _window$top$location.pathname;
|
|
709
|
-
var defaultPrefix = 'CONFIG_PC';
|
|
710
714
|
var mapping = ENUM.MAIN_AUTH_MAPPING;
|
|
711
|
-
prefix = channelPlat && (mapping === null || mapping === void 0 ? void 0 : mapping[channelPlat])
|
|
715
|
+
prefix = channelPlat && (mapping === null || mapping === void 0 ? void 0 : mapping[channelPlat]);
|
|
712
716
|
}
|
|
713
|
-
|
|
717
|
+
// 兼容旧版本
|
|
718
|
+
return getLastKey(prefix, key);
|
|
719
|
+
};
|
|
720
|
+
// 按钮资源权限集合 存储/获取key 函数
|
|
721
|
+
var getMenuAuthDataKey = function getMenuAuthDataKey(channel) {
|
|
722
|
+
return getLocalStorageSaveKey(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES, channel);
|
|
723
|
+
};
|
|
724
|
+
// 权限过滤后的菜单数据 存储/获取key 函数
|
|
725
|
+
var getLimitMenuDataKey = function getLimitMenuDataKey(channel) {
|
|
726
|
+
return getLocalStorageSaveKey(ENUM.BROWSER_CACHE.LIMIT_MENU_DATA, channel);
|
|
714
727
|
};
|
|
728
|
+
/******* 公用localstorage结束 *****/
|
|
715
729
|
|
|
716
730
|
var resposne$1 = JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.USER_INFO) || '{}');
|
|
717
731
|
//--------赢家项目登录信息---------
|
|
@@ -2174,7 +2188,8 @@ var handleJudgeAuthButtons = function handleJudgeAuthButtons(buttonCodeArray, is
|
|
|
2174
2188
|
var authButton = localStorage.getItem(getMenuAuthDataKey()) ? JSON.parse(localStorage.getItem(getMenuAuthDataKey())) : [];
|
|
2175
2189
|
buttonCodeArray.forEach(function (item, index) {
|
|
2176
2190
|
if (!authButton.filter(function (itemInner) {
|
|
2177
|
-
|
|
2191
|
+
var _item$indexOf;
|
|
2192
|
+
return (item === null || item === void 0 ? void 0 : (_item$indexOf = item.indexOf) === null || _item$indexOf === void 0 ? void 0 : _item$indexOf.call(item, itemInner)) >= 0;
|
|
2178
2193
|
}).length) {
|
|
2179
2194
|
if (buttonCodeArray.length > 1) {
|
|
2180
2195
|
// @ts-ignore
|
|
@@ -13488,7 +13503,7 @@ var DetailWrapper = /*#__PURE__*/React$1.memo(function (_ref) {
|
|
|
13488
13503
|
var basePath = window.top == window ? '' : "/".concat(itemPath);
|
|
13489
13504
|
var menuRoutes = window.top == window ? ((_routes$find = routes.find(function (item) {
|
|
13490
13505
|
return item.path === '/';
|
|
13491
|
-
})) === null || _routes$find === void 0 ? void 0 : _routes$find.routes) || [] : JSON.parse(localStorage.getItem(
|
|
13506
|
+
})) === null || _routes$find === void 0 ? void 0 : _routes$find.routes) || [] : JSON.parse(localStorage.getItem(getLimitMenuDataKey()) || '[]');
|
|
13492
13507
|
var breadcrumbNameMap = getMainCrumbNameMap(memoizeOneFormatter(menuRoutes, ''));
|
|
13493
13508
|
var matchParamsPath = function matchParamsPath(pathname, breadcrumbNameMap) {
|
|
13494
13509
|
var pathKey = Object.keys(breadcrumbNameMap).find(function (key) {
|
|
@@ -13704,7 +13719,7 @@ var HeaderWrapper = /*#__PURE__*/React$1.memo(function (_ref) {
|
|
|
13704
13719
|
var basePath = window.top == window ? '' : "/".concat(itemPath);
|
|
13705
13720
|
var menuRoutes = window.top == window ? ((_routes$find = routes.find(function (item) {
|
|
13706
13721
|
return item.path === '/';
|
|
13707
|
-
})) === null || _routes$find === void 0 ? void 0 : _routes$find.routes) || [] : JSON.parse(localStorage.getItem(
|
|
13722
|
+
})) === null || _routes$find === void 0 ? void 0 : _routes$find.routes) || [] : JSON.parse(localStorage.getItem(getLimitMenuDataKey()) || '[]');
|
|
13708
13723
|
var breadcrumbNameMap = getMainCrumbNameMap(memoizeOneFormatter(menuRoutes, ''));
|
|
13709
13724
|
var matchParamsPath = function matchParamsPath(pathname, breadcrumbNameMap) {
|
|
13710
13725
|
var pathKey = Object.keys(breadcrumbNameMap).find(function (key) {
|
|
@@ -34232,4 +34247,4 @@ var index$8 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
34232
34247
|
})));
|
|
34233
34248
|
});
|
|
34234
34249
|
|
|
34235
|
-
export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, BillEntry, BsCascader, index$6 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$2 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, DataImport, DataValidation, index$4 as DetailPageWrapper, EllipsisTooltip, ExportIcon, GuideWrapper, HandleTotalCount, index$5 as HomePageWrapper, JsonQueryTable, index$7 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, index$8 as RuleSetter, SearchSelect, index$3 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, createUniqID, downloadExcel, ergodicMenuRoutes, formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth, getJoinDictionaryText, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble, handleTextDoubleOrId, handleTextLineFeed, handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip, handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, memoizeOneFormatter, noEmptyArr, paramsControl, precisionQuantity, randomString, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, socketFunctions, sulaTableRenderTooltip, tableColumnsImage, textIcon, updateGuanDate, userColumns, userInfoCard, uuid };
|
|
34250
|
+
export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, BillEntry, BsCascader, index$6 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$2 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, DataImport, DataValidation, index$4 as DetailPageWrapper, EllipsisTooltip, ExportIcon, GuideWrapper, HandleTotalCount, index$5 as HomePageWrapper, JsonQueryTable, index$7 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, index$8 as RuleSetter, SearchSelect, index$3 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, createUniqID, downloadExcel, ergodicMenuRoutes, formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble, handleTextDoubleOrId, handleTextLineFeed, handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip, handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, memoizeOneFormatter, noEmptyArr, paramsControl, precisionQuantity, randomString, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, socketFunctions, sulaTableRenderTooltip, tableColumnsImage, textIcon, updateGuanDate, userColumns, userInfoCard, uuid };
|
package/dist/index.js
CHANGED
|
@@ -720,20 +720,34 @@ function handleUserPhone() {
|
|
|
720
720
|
function getCurrentTargetBgId() {
|
|
721
721
|
return localStorage.getItem('target_bg_id');
|
|
722
722
|
}
|
|
723
|
-
|
|
724
|
-
|
|
723
|
+
/******* 公用localstorage存取 开始 *****/
|
|
724
|
+
// 获取存储的最终key--加前缀是为了解决命名空间重复覆盖问题 【适用:主应用、子应用单独使用】
|
|
725
|
+
var getLastKey = function getLastKey(prefix, key) {
|
|
726
|
+
return prefix ? "".concat(prefix, ":").concat(key) : "".concat(key);
|
|
727
|
+
};
|
|
728
|
+
// 存储/获取key 函数---如果没有channel,则使用主应用所属的业务应用编码作为前缀 【适用:主应用、子应用结合使用】
|
|
729
|
+
var getLocalStorageSaveKey = function getLocalStorageSaveKey(key, channel) {
|
|
725
730
|
var prefix = channel;
|
|
726
731
|
// 传入channel 则使用传入的channel 作为前缀,一般存储key使用
|
|
727
732
|
// 否则使用下面页面路径处理后的变量为前缀,一般获取key使用
|
|
728
733
|
if (!channel) {
|
|
729
734
|
var _window$top, _window$top$location;
|
|
730
735
|
var channelPlat = (_window$top = window.top) === null || _window$top === void 0 ? void 0 : (_window$top$location = _window$top.location) === null || _window$top$location === void 0 ? void 0 : _window$top$location.pathname;
|
|
731
|
-
var defaultPrefix = 'CONFIG_PC';
|
|
732
736
|
var mapping = ENUM.MAIN_AUTH_MAPPING;
|
|
733
|
-
prefix = channelPlat && (mapping === null || mapping === void 0 ? void 0 : mapping[channelPlat])
|
|
737
|
+
prefix = channelPlat && (mapping === null || mapping === void 0 ? void 0 : mapping[channelPlat]);
|
|
734
738
|
}
|
|
735
|
-
|
|
739
|
+
// 兼容旧版本
|
|
740
|
+
return getLastKey(prefix, key);
|
|
741
|
+
};
|
|
742
|
+
// 按钮资源权限集合 存储/获取key 函数
|
|
743
|
+
var getMenuAuthDataKey = function getMenuAuthDataKey(channel) {
|
|
744
|
+
return getLocalStorageSaveKey(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES, channel);
|
|
745
|
+
};
|
|
746
|
+
// 权限过滤后的菜单数据 存储/获取key 函数
|
|
747
|
+
var getLimitMenuDataKey = function getLimitMenuDataKey(channel) {
|
|
748
|
+
return getLocalStorageSaveKey(ENUM.BROWSER_CACHE.LIMIT_MENU_DATA, channel);
|
|
736
749
|
};
|
|
750
|
+
/******* 公用localstorage结束 *****/
|
|
737
751
|
|
|
738
752
|
var resposne$1 = JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.USER_INFO) || '{}');
|
|
739
753
|
//--------赢家项目登录信息---------
|
|
@@ -2196,7 +2210,8 @@ var handleJudgeAuthButtons = function handleJudgeAuthButtons(buttonCodeArray, is
|
|
|
2196
2210
|
var authButton = localStorage.getItem(getMenuAuthDataKey()) ? JSON.parse(localStorage.getItem(getMenuAuthDataKey())) : [];
|
|
2197
2211
|
buttonCodeArray.forEach(function (item, index) {
|
|
2198
2212
|
if (!authButton.filter(function (itemInner) {
|
|
2199
|
-
|
|
2213
|
+
var _item$indexOf;
|
|
2214
|
+
return (item === null || item === void 0 ? void 0 : (_item$indexOf = item.indexOf) === null || _item$indexOf === void 0 ? void 0 : _item$indexOf.call(item, itemInner)) >= 0;
|
|
2200
2215
|
}).length) {
|
|
2201
2216
|
if (buttonCodeArray.length > 1) {
|
|
2202
2217
|
// @ts-ignore
|
|
@@ -13510,7 +13525,7 @@ var DetailWrapper = /*#__PURE__*/React__default['default'].memo(function (_ref)
|
|
|
13510
13525
|
var basePath = window.top == window ? '' : "/".concat(itemPath);
|
|
13511
13526
|
var menuRoutes = window.top == window ? ((_routes$find = routes.find(function (item) {
|
|
13512
13527
|
return item.path === '/';
|
|
13513
|
-
})) === null || _routes$find === void 0 ? void 0 : _routes$find.routes) || [] : JSON.parse(localStorage.getItem(
|
|
13528
|
+
})) === null || _routes$find === void 0 ? void 0 : _routes$find.routes) || [] : JSON.parse(localStorage.getItem(getLimitMenuDataKey()) || '[]');
|
|
13514
13529
|
var breadcrumbNameMap = getMainCrumbNameMap(memoizeOneFormatter(menuRoutes, ''));
|
|
13515
13530
|
var matchParamsPath = function matchParamsPath(pathname, breadcrumbNameMap) {
|
|
13516
13531
|
var pathKey = Object.keys(breadcrumbNameMap).find(function (key) {
|
|
@@ -13726,7 +13741,7 @@ var HeaderWrapper = /*#__PURE__*/React__default['default'].memo(function (_ref)
|
|
|
13726
13741
|
var basePath = window.top == window ? '' : "/".concat(itemPath);
|
|
13727
13742
|
var menuRoutes = window.top == window ? ((_routes$find = routes.find(function (item) {
|
|
13728
13743
|
return item.path === '/';
|
|
13729
|
-
})) === null || _routes$find === void 0 ? void 0 : _routes$find.routes) || [] : JSON.parse(localStorage.getItem(
|
|
13744
|
+
})) === null || _routes$find === void 0 ? void 0 : _routes$find.routes) || [] : JSON.parse(localStorage.getItem(getLimitMenuDataKey()) || '[]');
|
|
13730
13745
|
var breadcrumbNameMap = getMainCrumbNameMap(memoizeOneFormatter(menuRoutes, ''));
|
|
13731
13746
|
var matchParamsPath = function matchParamsPath(pathname, breadcrumbNameMap) {
|
|
13732
13747
|
var pathKey = Object.keys(breadcrumbNameMap).find(function (key) {
|
|
@@ -34305,6 +34320,9 @@ exports.getEmployeeCode = getEmployeeCode;
|
|
|
34305
34320
|
exports.getEmployeeId = getEmployeeId;
|
|
34306
34321
|
exports.getItemDefaultWidth = getItemDefaultWidth;
|
|
34307
34322
|
exports.getJoinDictionaryText = getJoinDictionaryText;
|
|
34323
|
+
exports.getLastKey = getLastKey;
|
|
34324
|
+
exports.getLimitMenuDataKey = getLimitMenuDataKey;
|
|
34325
|
+
exports.getLocalStorageSaveKey = getLocalStorageSaveKey;
|
|
34308
34326
|
exports.getMenuAuthDataKey = getMenuAuthDataKey;
|
|
34309
34327
|
exports.getSessionId = getSessionId;
|
|
34310
34328
|
exports.getSkuImg = getSkuImg;
|
|
@@ -15,4 +15,9 @@ export declare function getAccountID(): any;
|
|
|
15
15
|
export declare function getUserName(): any;
|
|
16
16
|
export declare function handleUserPhone(): any;
|
|
17
17
|
export declare function getCurrentTargetBgId(): string | null;
|
|
18
|
+
/******* 公用localstorage存取 开始 *****/
|
|
19
|
+
export declare const getLastKey: (prefix: any, key: string) => string;
|
|
20
|
+
export declare const getLocalStorageSaveKey: (key: string, channel?: string) => string;
|
|
18
21
|
export declare const getMenuAuthDataKey: (channel?: string) => string;
|
|
22
|
+
export declare const getLimitMenuDataKey: (channel?: string) => string;
|
|
23
|
+
/******* 公用localstorage结束 *****/
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ import CommonAlert from '../CommonAlert';
|
|
|
17
17
|
import ENUM from '@/utils/enumConfig';
|
|
18
18
|
import { debounce } from 'lodash';
|
|
19
19
|
import { useSize } from 'ahooks';
|
|
20
|
-
import { getMenuAuthDataKey } from '@/utils/LocalstorageUtils';
|
|
20
|
+
import { getMenuAuthDataKey, getLimitMenuDataKey } from '@/utils/LocalstorageUtils';
|
|
21
21
|
|
|
22
22
|
interface actionItem {
|
|
23
23
|
type?: string;
|
|
@@ -78,9 +78,7 @@ const DetailWrapper = React.memo(
|
|
|
78
78
|
const menuRoutes =
|
|
79
79
|
window.top == window
|
|
80
80
|
? routes.find((item) => item.path === '/')?.routes || []
|
|
81
|
-
: JSON.parse(
|
|
82
|
-
localStorage.getItem(ENUM.BROWSER_CACHE.LIMIT_MENU_DATA) || '[]',
|
|
83
|
-
);
|
|
81
|
+
: JSON.parse(localStorage.getItem(getLimitMenuDataKey()) || '[]');
|
|
84
82
|
|
|
85
83
|
const breadcrumbNameMap = getMainCrumbNameMap(
|
|
86
84
|
memoizeOneFormatter(menuRoutes, ''),
|
|
@@ -6,7 +6,7 @@ import { Breadcrumb, Space } from 'antd';
|
|
|
6
6
|
import './index.less';
|
|
7
7
|
import { useLocation, formatMessage } from 'umi';
|
|
8
8
|
import CommonAlert from '../CommonAlert';
|
|
9
|
-
import
|
|
9
|
+
import { getLimitMenuDataKey } from '@/utils/LocalstorageUtils'
|
|
10
10
|
|
|
11
11
|
export default (props: any) => {
|
|
12
12
|
const { pathname } = useLocation();
|
|
@@ -15,11 +15,11 @@ export default (props: any) => {
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<div id={id} className={'home_page_wrapper'}>
|
|
18
|
-
<HeaderWrapper
|
|
18
|
+
<HeaderWrapper
|
|
19
19
|
pathname={pathname}
|
|
20
20
|
{
|
|
21
21
|
...restProps
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
23
|
/>
|
|
24
24
|
{props.children}
|
|
25
25
|
</div>
|
|
@@ -27,9 +27,9 @@ export default (props: any) => {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const HeaderWrapper = React.memo(
|
|
30
|
-
({
|
|
31
|
-
pathname,
|
|
32
|
-
routes=[],
|
|
30
|
+
({
|
|
31
|
+
pathname,
|
|
32
|
+
routes=[],
|
|
33
33
|
itemPath,
|
|
34
34
|
alertProps,
|
|
35
35
|
extra,
|
|
@@ -41,7 +41,7 @@ const HeaderWrapper = React.memo(
|
|
|
41
41
|
const menuRoutes =
|
|
42
42
|
window.top == window
|
|
43
43
|
? routes.find((item) => item.path === '/')?.routes || []
|
|
44
|
-
: JSON.parse(localStorage.getItem(
|
|
44
|
+
: JSON.parse(localStorage.getItem(getLimitMenuDataKey()) || '[]');
|
|
45
45
|
|
|
46
46
|
const breadcrumbNameMap = getMainCrumbNameMap(
|
|
47
47
|
memoizeOneFormatter(menuRoutes, ''),
|
|
@@ -133,7 +133,7 @@ const HeaderWrapper = React.memo(
|
|
|
133
133
|
</Breadcrumb>
|
|
134
134
|
</div>
|
|
135
135
|
{
|
|
136
|
-
extra ?
|
|
136
|
+
extra ?
|
|
137
137
|
<Space>
|
|
138
138
|
{
|
|
139
139
|
extra
|
|
@@ -94,18 +94,36 @@ export function getCurrentTargetBgId() {
|
|
|
94
94
|
return localStorage.getItem('target_bg_id');
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
/******* 公用localstorage存取 开始 *****/
|
|
98
|
+
|
|
99
|
+
// 获取存储的最终key--加前缀是为了解决命名空间重复覆盖问题 【适用:主应用、子应用单独使用】
|
|
100
|
+
export const getLastKey = (prefix: any,key: string) => {
|
|
101
|
+
return prefix ? `${prefix}:${key}` : `${key}`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 存储/获取key 函数---如果没有channel,则使用主应用所属的业务应用编码作为前缀 【适用:主应用、子应用结合使用】
|
|
105
|
+
export const getLocalStorageSaveKey = (key: string,channel?: string) => {
|
|
99
106
|
let prefix = channel
|
|
100
107
|
|
|
101
108
|
// 传入channel 则使用传入的channel 作为前缀,一般存储key使用
|
|
102
109
|
// 否则使用下面页面路径处理后的变量为前缀,一般获取key使用
|
|
103
110
|
if(!channel) {
|
|
104
111
|
const channelPlat: string | undefined = window.top?.location?.pathname
|
|
105
|
-
const defaultPrefix = 'CONFIG_PC';
|
|
106
112
|
const mapping: any = ENUM.MAIN_AUTH_MAPPING;
|
|
107
|
-
prefix = channelPlat && mapping?.[channelPlat]
|
|
113
|
+
prefix = channelPlat && mapping?.[channelPlat]
|
|
108
114
|
}
|
|
109
115
|
|
|
110
|
-
|
|
116
|
+
// 兼容旧版本
|
|
117
|
+
return getLastKey(prefix,key);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 按钮资源权限集合 存储/获取key 函数
|
|
121
|
+
export const getMenuAuthDataKey = (channel?: string) => {
|
|
122
|
+
return getLocalStorageSaveKey(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES, channel)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 权限过滤后的菜单数据 存储/获取key 函数
|
|
126
|
+
export const getLimitMenuDataKey = (channel?: string) => {
|
|
127
|
+
return getLocalStorageSaveKey(ENUM.BROWSER_CACHE.LIMIT_MENU_DATA, channel)
|
|
111
128
|
}
|
|
129
|
+
/******* 公用localstorage结束 *****/
|
|
@@ -232,7 +232,7 @@ const handleJudgeAuthButtons = (buttonCodeArray: any[], isAccess?: boolean) => {
|
|
|
232
232
|
: [];
|
|
233
233
|
buttonCodeArray.forEach((item: any, index: number) => {
|
|
234
234
|
if (
|
|
235
|
-
!authButton.filter((itemInner: any) => item
|
|
235
|
+
!authButton.filter((itemInner: any) => item?.indexOf?.(itemInner) >= 0)
|
|
236
236
|
.length
|
|
237
237
|
) {
|
|
238
238
|
if (buttonCodeArray.length > 1) {
|