@bit-sun/business-component 4.0.0-alpha.3 → 4.0.2
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/.editorconfig +16 -0
- package/.fatherrc.ts +5 -0
- package/.gitlab-ci.yml +179 -0
- package/.prettierignore +7 -0
- package/.prettierrc +11 -0
- package/.umirc.ts +74 -0
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +1 -1
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +1 -1
- package/dist/components/Business/columnSettingTable/index.d.ts +1 -0
- package/dist/components/Common/ParagraphCopier/index.d.ts +8 -0
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +3 -0
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.d.ts +2 -0
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1901 -639
- package/dist/index.js +1903 -636
- package/dist/utils/requestUtils.d.ts +1 -0
- package/dist/utils/utils.d.ts +3 -0
- package/docs/index.md +21 -0
- package/package.json +9 -14
- package/src/assets/32.svg +28 -0
- package/src/assets/addIcon.svg +18 -0
- package/src/assets/allfunc.svg +28 -0
- package/src/assets/arrowRight.svg +25 -0
- package/src/assets/arrow_top.png +0 -0
- package/src/assets/arrow_top.svg +18 -0
- package/src/assets/btn-delete.svg +30 -0
- package/src/assets/btn-edit.svg +20 -0
- package/src/assets/btn-more.svg +18 -0
- package/src/assets/btn-submit.svg +20 -0
- package/src/assets/caidan.svg +12 -0
- package/src/assets/close.svg +26 -0
- package/src/assets/closeicon.png +0 -0
- package/src/assets/drag.svg +17 -0
- package/src/assets/exportFail.svg +38 -0
- package/src/assets/exportProcessing.svg +29 -0
- package/src/assets/exportSuccess.svg +35 -0
- package/src/assets/exportlogo.png +0 -0
- package/src/assets/fixed-left-active.svg +12 -0
- package/src/assets/fixed-left.svg +16 -0
- package/src/assets/fixed-right-active.svg +12 -0
- package/src/assets/fixed-right.svg +16 -0
- package/src/assets/guanbi.svg +16 -0
- package/src/assets/icon-quanping.svg +16 -0
- package/src/assets/icon-shezhi.svg +18 -0
- package/src/assets/label_icon_bottom.svg +26 -0
- package/src/assets/list-no-img.svg +22 -0
- package/src/assets/morentouxiang-32.svg +24 -0
- package/src/assets/right.png +0 -0
- package/src/assets/scanning.svg +25 -0
- package/src/assets/upExport.svg +23 -0
- package/src/assets/xinglan-icon-out.png +0 -0
- package/src/common/ENUM.ts +41 -0
- package/src/components/Business/AddSelectBusiness/index.md +398 -0
- package/src/components/Business/AddSelectBusiness/index.tsx +1116 -0
- package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +112 -0
- package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -0
- package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.less +0 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.tsx +193 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +10 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +38 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +243 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +385 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +286 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +75 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +171 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +65 -0
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +154 -0
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +73 -0
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +163 -0
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -0
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -0
- package/src/components/Business/BsLayouts/Components/RightContent/i18n.ts +9 -0
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +172 -0
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +161 -0
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +76 -0
- package/src/components/Business/BsLayouts/index.less +80 -0
- package/src/components/Business/BsLayouts/index.tsx +1602 -0
- package/src/components/Business/BsLayouts/service.ts +11 -0
- package/src/components/Business/BsLayouts/utils.tsx +205 -0
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +566 -0
- package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +5 -0
- package/src/components/Business/BsSulaQueryTable/index.less +228 -0
- package/src/components/Business/BsSulaQueryTable/index.tsx +817 -0
- package/src/components/Business/BsSulaQueryTable/setting.tsx +937 -0
- package/src/components/Business/BsSulaQueryTable/utils.less +65 -0
- package/src/components/Business/BsSulaQueryTable/utils.tsx +709 -0
- package/src/components/Business/CommodityEntry/index.md +84 -0
- package/src/components/Business/CommodityEntry/index.tsx +82 -0
- package/src/components/Business/CommonAlert/index.less +0 -0
- package/src/components/Business/CommonAlert/index.tsx +23 -0
- package/src/components/Business/CommonGuideWrapper/index.less +156 -0
- package/src/components/Business/CommonGuideWrapper/index.md +61 -0
- package/src/components/Business/CommonGuideWrapper/index.tsx +108 -0
- package/src/components/Business/DetailPageWrapper/index.less +89 -0
- package/src/components/Business/DetailPageWrapper/index.tsx +306 -0
- package/src/components/Business/DetailPageWrapper/utils.tsx +166 -0
- package/src/components/Business/HomePageWrapper/index.less +36 -0
- package/src/components/Business/HomePageWrapper/index.md +45 -0
- package/src/components/Business/HomePageWrapper/index.tsx +130 -0
- package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +823 -0
- package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +206 -0
- package/src/components/Business/JsonQueryTable/components/Formula.tsx +205 -0
- package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -0
- package/src/components/Business/JsonQueryTable/configButton/index.js +20 -0
- package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -0
- package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -0
- package/src/components/Business/JsonQueryTable/configTree/index.js +82 -0
- package/src/components/Business/JsonQueryTable/configTree/index.less +44 -0
- package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -0
- package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -0
- package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -0
- package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -0
- package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -0
- package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -0
- package/src/components/Business/JsonQueryTable/function.ts +62 -0
- package/src/components/Business/JsonQueryTable/index.less +17 -0
- package/src/components/Business/JsonQueryTable/index.md +328 -0
- package/src/components/Business/JsonQueryTable/index.tsx +534 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -0
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -0
- package/src/components/Business/JsonQueryTable/static.ts +450 -0
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +2207 -0
- package/src/components/Business/SearchSelect/common.ts +134 -0
- package/src/components/Business/SearchSelect/index.md +1570 -0
- package/src/components/Business/SearchSelect/index.tsx +55 -0
- package/src/components/Business/SearchSelect/utils.ts +125 -0
- package/src/components/Business/StateFlow/index.less +131 -0
- package/src/components/Business/StateFlow/index.md +60 -0
- package/src/components/Business/StateFlow/index.tsx +30 -0
- package/src/components/Business/TreeSearchSelect/index.md +239 -0
- package/src/components/Business/TreeSearchSelect/index.tsx +33 -0
- package/src/components/Business/TreeSearchSelect/utils.ts +115 -0
- package/src/components/Business/columnSettingTable/columnSetting.tsx +869 -0
- package/src/components/Business/columnSettingTable/index.less +253 -0
- package/src/components/Business/columnSettingTable/index.md +373 -0
- package/src/components/Business/columnSettingTable/index.tsx +235 -0
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +232 -0
- package/src/components/Business/columnSettingTable/utils.tsx +88 -0
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -0
- package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -0
- package/src/components/Business/moreTreeTable/index.less +100 -0
- package/src/components/Business/moreTreeTable/index.md +448 -0
- package/src/components/Business/moreTreeTable/index.tsx +387 -0
- package/src/components/Business/moreTreeTable/utils.ts +127 -0
- package/src/components/Common/ExtendedCollapse/ExtendedPanel.tsx +51 -0
- package/src/components/Common/ExtendedCollapse/index.less +33 -0
- package/src/components/Common/ExtendedCollapse/index.md +136 -0
- package/src/components/Common/ExtendedCollapse/index.tsx +25 -0
- package/src/components/Common/ParagraphCopier/index.md +81 -0
- package/src/components/Common/ParagraphCopier/index.tsx +56 -0
- package/src/components/Common/Section/index.md +120 -0
- package/src/components/Common/Section/index.module.less +16 -0
- package/src/components/Common/Section/index.tsx +70 -0
- package/src/components/Functional/AccessWrapper/index.tsx +34 -0
- package/src/components/Functional/AddSelect/helps.ts +81 -0
- package/src/components/Functional/AddSelect/index.less +367 -0
- package/src/components/Functional/AddSelect/index.md +155 -0
- package/src/components/Functional/AddSelect/index.tsx +1072 -0
- package/src/components/Functional/AuthButton/index.tsx +15 -0
- package/src/components/Functional/BillEntry/index.less +371 -0
- package/src/components/Functional/BillEntry/index.md +39 -0
- package/src/components/Functional/BillEntry/index.tsx +771 -0
- package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -0
- package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -0
- package/src/components/Functional/BsAntdSula/index.ts +2 -0
- package/src/components/Functional/DataImport/index.less +63 -0
- package/src/components/Functional/DataImport/index.md +44 -0
- package/src/components/Functional/DataImport/index.tsx +782 -0
- package/src/components/Functional/DataValidation/index.less +63 -0
- package/src/components/Functional/DataValidation/index.md +52 -0
- package/src/components/Functional/DataValidation/index.tsx +788 -0
- package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -0
- package/src/components/Functional/EllipsisTooltip/index.js +36 -0
- package/src/components/Functional/EllipsisTooltip/index.md +30 -0
- package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -0
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +65 -0
- package/src/components/Functional/QueryMutipleInput/index.less +37 -0
- package/src/components/Functional/QueryMutipleInput/index.md +33 -0
- package/src/components/Functional/QueryMutipleInput/index.tsx +129 -0
- package/src/components/Functional/SearchSelect/index.less +121 -0
- package/src/components/Functional/SearchSelect/index.md +141 -0
- package/src/components/Functional/SearchSelect/index.tsx +1041 -0
- package/src/components/Functional/SearchSelect/utils.ts +3 -0
- package/src/components/Functional/TreeSearchSelect/index.md +47 -0
- package/src/components/Functional/TreeSearchSelect/index.tsx +224 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.tsx +358 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/function.js +255 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.tsx +58 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.tsx +129 -0
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -0
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -0
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +743 -0
- package/src/components/Solution/RuleComponent/index.d.ts +29 -0
- package/src/components/Solution/RuleComponent/index.js +1614 -0
- package/src/components/Solution/RuleComponent/index.less +247 -0
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -0
- package/src/components/Solution/RuleComponent/ruleFiled.js +2587 -0
- package/src/components/Solution/RuleComponent/services.ts +13 -0
- package/src/components/Solution/RuleComponent/util.js +143 -0
- package/src/components/Solution/RuleSetter/RuleInstance.tsx +6 -0
- package/src/components/Solution/RuleSetter/baseRule.tsx +394 -0
- package/src/components/Solution/RuleSetter/function.ts +437 -0
- package/src/components/Solution/RuleSetter/index.less +221 -0
- package/src/components/Solution/RuleSetter/index.tsx +208 -0
- package/src/components/Solution/RuleSetter/service.js +276 -0
- package/src/index.ts +46 -0
- package/src/plugin/TableColumnSetting/index.less +247 -0
- package/src/plugin/TableColumnSetting/index.md +50 -0
- package/src/plugin/TableColumnSetting/index.tsx +725 -0
- package/src/plugin/TableColumnSetting/utils.ts +19 -0
- package/src/styles/bsDefault.less +32 -12
- package/src/utils/CheckOneUser/index.md +39 -0
- package/src/utils/CheckOneUser/index.ts +52 -0
- package/src/utils/CustomLoginInfo.ts +55 -0
- package/src/utils/LocalstorageUtils.ts +134 -0
- package/src/utils/TableUtils.less +52 -0
- package/src/utils/TableUtils.tsx +691 -0
- package/src/utils/auth.ts +39 -0
- package/src/utils/businessUtils.ts +434 -0
- package/src/utils/checkUtils.ts +39 -0
- package/src/utils/constant.ts +38 -0
- package/src/utils/enumConfig.ts +17 -0
- package/src/utils/getFormMode.js +12 -0
- package/src/utils/index.ts +19 -0
- package/src/utils/request.ts +53 -0
- package/src/utils/requestUtils.ts +197 -0
- package/src/utils/serialize.js +7 -0
- package/src/utils/utils.ts +267 -0
- package/src/utils/xlsxUtil.tsx +146 -0
- package/tsconfig.json +29 -0
- package/typings.d.ts +5 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
3
|
+
import memoizeOne from 'memoize-one';
|
|
4
|
+
import { getMenuAuthDataKey } from '@/utils/LocalstorageUtils'
|
|
5
|
+
import { history } from 'umi';
|
|
6
|
+
import { shouldUseAuth } from '@/utils';
|
|
7
|
+
|
|
8
|
+
const cache = {};
|
|
9
|
+
const cacheLimit = 10000;
|
|
10
|
+
let cacheCount = 0;
|
|
11
|
+
|
|
12
|
+
function compilePath(path, options, pathToRegexp) {
|
|
13
|
+
const cacheKey = `${options.end}${options.strict}${options.sensitive}`;
|
|
14
|
+
const pathCache = cache[cacheKey] || (cache[cacheKey] = {});
|
|
15
|
+
|
|
16
|
+
if (pathCache[path]) return pathCache[path];
|
|
17
|
+
|
|
18
|
+
const keys = [];
|
|
19
|
+
const regexp = pathToRegexp(path, keys, options);
|
|
20
|
+
const result = { regexp, keys };
|
|
21
|
+
|
|
22
|
+
if (cacheCount < cacheLimit) {
|
|
23
|
+
pathCache[path] = result;
|
|
24
|
+
// eslint-disable-next-line no-plusplus
|
|
25
|
+
cacheCount++;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Public API for matching a URL pathname to a path.
|
|
33
|
+
*/
|
|
34
|
+
export const matchPath = (pathname, options = {}, pathToRegexp) => {
|
|
35
|
+
if (typeof options === 'string' || Array.isArray(options)) {
|
|
36
|
+
// eslint-disable-next-line no-param-reassign
|
|
37
|
+
options = { path: options };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const { path, exact = false, strict = false, sensitive = false } = options;
|
|
41
|
+
|
|
42
|
+
const paths = [].concat(path);
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line no-shadow
|
|
45
|
+
return paths.reduce((matched, path) => {
|
|
46
|
+
if (!path && path !== '') return null;
|
|
47
|
+
if (matched) return matched;
|
|
48
|
+
|
|
49
|
+
const { regexp, keys } = compilePath(path, {
|
|
50
|
+
end: exact,
|
|
51
|
+
strict,
|
|
52
|
+
sensitive,
|
|
53
|
+
}, pathToRegexp);
|
|
54
|
+
const match = regexp.exec(pathname);
|
|
55
|
+
|
|
56
|
+
if (!match) return null;
|
|
57
|
+
|
|
58
|
+
const [url, ...values] = match;
|
|
59
|
+
const isExact = pathname === url;
|
|
60
|
+
|
|
61
|
+
if (exact && !isExact) return null;
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
path, // the path used to match
|
|
65
|
+
url: path === '/' && url === '' ? '/' : url, // the matched portion of the URL
|
|
66
|
+
isExact, // whether or not we matched exactly
|
|
67
|
+
params: keys.reduce((memo, key, index) => {
|
|
68
|
+
// eslint-disable-next-line no-param-reassign
|
|
69
|
+
memo[key.name] = values[index];
|
|
70
|
+
return memo;
|
|
71
|
+
}, {}),
|
|
72
|
+
};
|
|
73
|
+
}, null);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
export const searchMenuData = (router: any, name?: any, callBack) => {
|
|
78
|
+
if (!name) {
|
|
79
|
+
callBack([]);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const btnAuth = JSON.parse(
|
|
83
|
+
localStorage.getItem(getMenuAuthDataKey()) || '[]',
|
|
84
|
+
);
|
|
85
|
+
const resultList: any = [];
|
|
86
|
+
const newRouter = cloneDeep(router);
|
|
87
|
+
const deep = (router: any) => {
|
|
88
|
+
if (router && Array.isArray(router)) {
|
|
89
|
+
router.forEach((item) => {
|
|
90
|
+
if (item.children && Array.isArray(item.children)) {
|
|
91
|
+
deep(item.children);
|
|
92
|
+
} else if (
|
|
93
|
+
!item.hideInMenu &&
|
|
94
|
+
(name ? item.name.indexOf(name) !== -1 : true) &&
|
|
95
|
+
btnAuth.find((d: any) => d === item.code)
|
|
96
|
+
) {
|
|
97
|
+
resultList.push({
|
|
98
|
+
...item,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
// } else if ((name ? router.name.indexOf(name) !== -1 : true) && btnAuth.find((d: any) => d.code === router.code)) {
|
|
103
|
+
} else if (
|
|
104
|
+
(name ? router.name.indexOf(name) !== -1 : true) &&
|
|
105
|
+
btnAuth.find((d: any) => d === router.code)
|
|
106
|
+
) {
|
|
107
|
+
resultList.push({
|
|
108
|
+
...router,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
deep(newRouter);
|
|
113
|
+
callBack([...resultList]);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const setMenuTreeData = (routesData: Array<any>) => {
|
|
117
|
+
const authButton = localStorage.getItem(getMenuAuthDataKey())
|
|
118
|
+
? JSON.parse(localStorage.getItem(getMenuAuthDataKey()) as string)
|
|
119
|
+
: [];
|
|
120
|
+
for (let i = routesData.length - 1; i >= 0; i--) {
|
|
121
|
+
if (routesData[i].hideInMenu) {
|
|
122
|
+
routesData.splice(i, 1);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (
|
|
126
|
+
shouldUseAuth() &&
|
|
127
|
+
routesData[i].code &&
|
|
128
|
+
authButton.every((item) => {
|
|
129
|
+
return routesData[i].code != item;
|
|
130
|
+
})
|
|
131
|
+
) {
|
|
132
|
+
routesData.splice(i, 1);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (routesData[i].children) {
|
|
136
|
+
setMenuTreeData(routesData[i].children);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const setLoginOutPath = () => {
|
|
142
|
+
if (window.__POWERED_BY_WUJIE__) {
|
|
143
|
+
window.$wujie?.props.goToLogin();
|
|
144
|
+
} else {
|
|
145
|
+
history.push({
|
|
146
|
+
pathname: '/user/login'
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const getBreadcrumbNameMap = (menuData) => {
|
|
152
|
+
const routerMap = {};
|
|
153
|
+
|
|
154
|
+
const flattenMenuData = (data) => {
|
|
155
|
+
data.forEach((menuItem) => {
|
|
156
|
+
if (menuItem.children) {
|
|
157
|
+
flattenMenuData(menuItem.children);
|
|
158
|
+
}
|
|
159
|
+
// Reduce memory usage
|
|
160
|
+
routerMap[menuItem.path] = menuItem;
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
flattenMenuData(menuData);
|
|
164
|
+
return routerMap;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const ergodicMenuRoutes = (routes) => {
|
|
168
|
+
const codeArray = [];
|
|
169
|
+
|
|
170
|
+
function ergodicRoutes(routesParam) {
|
|
171
|
+
routesParam.forEach((element) => {
|
|
172
|
+
// element.code &&
|
|
173
|
+
if (element.hideInMenu) {
|
|
174
|
+
codeArray.push(element);
|
|
175
|
+
}
|
|
176
|
+
if (element.routes) {
|
|
177
|
+
ergodicRoutes(element.routes);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
ergodicRoutes(routes);
|
|
183
|
+
|
|
184
|
+
return codeArray;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const encodeUrlQuery = (pathStr: any) => {
|
|
188
|
+
let newPathStr='';
|
|
189
|
+
if (pathStr.indexOf('#') > -1) {
|
|
190
|
+
let index = pathStr.indexOf('?');
|
|
191
|
+
let str1 = pathStr.substr(0, index+1);
|
|
192
|
+
let str2 = pathStr.substr(index+1, pathStr.length - index -1);
|
|
193
|
+
let queryArr = str2.split('&');
|
|
194
|
+
let newArr = queryArr.map(item => {
|
|
195
|
+
let index = item.indexOf('=');
|
|
196
|
+
let s1 = item.substr(0, index);
|
|
197
|
+
let s2 = item.substr(index+1, item.length - index -1);
|
|
198
|
+
return `${s1}=${encodeURIComponent(s2)}`;
|
|
199
|
+
})
|
|
200
|
+
newPathStr = `${str1}${newArr.join('&')}`;
|
|
201
|
+
} else {
|
|
202
|
+
newPathStr = pathStr;
|
|
203
|
+
}
|
|
204
|
+
return newPathStr;
|
|
205
|
+
}
|