@indfnd/common 1.0.89 → 1.0.90
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/CHANGELOG.md +12 -0
- package/dist/ind-common.es.js +67 -30
- package/dist/ind-common.umd.cjs +48 -48
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.90](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.89...v1.0.90) (2025-02-06)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 给IndTree增加api ([1ef72f3](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/1ef72f39d4ecda9c79ad6f3b07c4a3b8025a749c))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* router组织路由修改 ([c982f4e](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/c982f4e28370c7aabcdad9a0062ba12c35e04b6a))
|
|
16
|
+
|
|
5
17
|
### [1.0.89](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.88...v1.0.89) (2025-01-23)
|
|
6
18
|
|
|
7
19
|
|
package/dist/ind-common.es.js
CHANGED
|
@@ -5460,7 +5460,7 @@ var lodash = { exports: {} };
|
|
|
5460
5460
|
})(lodash, lodash.exports);
|
|
5461
5461
|
var _ = lodash.exports;
|
|
5462
5462
|
const name$1 = "@indfnd/common";
|
|
5463
|
-
const version = "1.0.
|
|
5463
|
+
const version = "1.0.89";
|
|
5464
5464
|
const author = "huxuetong";
|
|
5465
5465
|
const publishConfig = {
|
|
5466
5466
|
registry: "https://registry.npmjs.org/"
|
|
@@ -67442,7 +67442,7 @@ var routerPlugin = {
|
|
|
67442
67442
|
install(Vue2, { router, store: store2 }) {
|
|
67443
67443
|
Vue2.prototype.$backToMenu = function() {
|
|
67444
67444
|
console.log("trigger $backToMenu");
|
|
67445
|
-
if (
|
|
67445
|
+
if (top == self) {
|
|
67446
67446
|
const breadCrumbList = store2.state.app.breadCrumbList;
|
|
67447
67447
|
store2.commit("closeTag", {
|
|
67448
67448
|
$router: router,
|
|
@@ -67558,9 +67558,37 @@ const PERMISSION_TYPE = {
|
|
|
67558
67558
|
function isMenuPermissionType(type) {
|
|
67559
67559
|
return [PERMISSION_TYPE.DIRECTORY, PERMISSION_TYPE.MENU].includes(type);
|
|
67560
67560
|
}
|
|
67561
|
+
function getPermissionType(type) {
|
|
67562
|
+
return Object.keys(PERMISSION_TYPE).find((key) => PERMISSION_TYPE[key] === type);
|
|
67563
|
+
}
|
|
67561
67564
|
function filterMicroPermissionList(microType, permissionList = []) {
|
|
67562
67565
|
return permissionList;
|
|
67563
67566
|
}
|
|
67567
|
+
function permission2Router(list, microType) {
|
|
67568
|
+
if (!list) {
|
|
67569
|
+
return [];
|
|
67570
|
+
}
|
|
67571
|
+
let tempList = [];
|
|
67572
|
+
for (const item2 of list) {
|
|
67573
|
+
tempList.push({
|
|
67574
|
+
path: dealRoutePath(item2.uri, microType),
|
|
67575
|
+
name: item2.permissionValue,
|
|
67576
|
+
meta: {
|
|
67577
|
+
appId: item2.appId,
|
|
67578
|
+
permissionId: item2.permissionId,
|
|
67579
|
+
title: item2.label,
|
|
67580
|
+
icon: item2.icon,
|
|
67581
|
+
crumbs: [
|
|
67582
|
+
{ icon: item2.icon, name: item2.permissionValue, title: item2.label, type: item2.type }
|
|
67583
|
+
],
|
|
67584
|
+
activeName: item2.permissionValue,
|
|
67585
|
+
data: item2
|
|
67586
|
+
},
|
|
67587
|
+
component: item2.permissionValue
|
|
67588
|
+
});
|
|
67589
|
+
}
|
|
67590
|
+
return tempList;
|
|
67591
|
+
}
|
|
67564
67592
|
function listToMenuTree({ list, menuTree, pageNode, parentId, crumbs, root, microType }) {
|
|
67565
67593
|
if (!list)
|
|
67566
67594
|
return;
|
|
@@ -67661,29 +67689,6 @@ function generatorMenuTree(permissionList = []) {
|
|
|
67661
67689
|
});
|
|
67662
67690
|
return menuTree;
|
|
67663
67691
|
}
|
|
67664
|
-
function generatorDynamicRouter(permissionList = [], microType) {
|
|
67665
|
-
const menuTree = [];
|
|
67666
|
-
const pageNode = {
|
|
67667
|
-
path: "/page",
|
|
67668
|
-
name: "page",
|
|
67669
|
-
meta: { hideInMenu: true, notCache: true },
|
|
67670
|
-
component: "EmptyLayoutNotCache",
|
|
67671
|
-
children: []
|
|
67672
|
-
};
|
|
67673
|
-
listToMenuTree({
|
|
67674
|
-
list: permissionList,
|
|
67675
|
-
menuTree,
|
|
67676
|
-
pageNode,
|
|
67677
|
-
parentId: "0",
|
|
67678
|
-
crumbs: [],
|
|
67679
|
-
root: true,
|
|
67680
|
-
microType
|
|
67681
|
-
});
|
|
67682
|
-
if (pageNode.children.length) {
|
|
67683
|
-
menuTree.push(pageNode);
|
|
67684
|
-
}
|
|
67685
|
-
return generator(menuTree);
|
|
67686
|
-
}
|
|
67687
67692
|
function generator(menuData = []) {
|
|
67688
67693
|
for (let item2 of menuData) {
|
|
67689
67694
|
if (item2.component) {
|
|
@@ -67705,20 +67710,51 @@ function generator(menuData = []) {
|
|
|
67705
67710
|
}
|
|
67706
67711
|
return menuData;
|
|
67707
67712
|
}
|
|
67708
|
-
async function renderRoutes({
|
|
67713
|
+
async function renderRoutes({
|
|
67714
|
+
router,
|
|
67715
|
+
store: store2,
|
|
67716
|
+
microType,
|
|
67717
|
+
allowPermissionList,
|
|
67718
|
+
routerOptionsBak,
|
|
67719
|
+
to
|
|
67720
|
+
}) {
|
|
67721
|
+
var _a;
|
|
67709
67722
|
store2.dispatch("getIndexInfo");
|
|
67710
67723
|
await store2.dispatch("getUserInfo");
|
|
67711
67724
|
await store2.dispatch("getAppListData");
|
|
67712
67725
|
const permissionData = await store2.dispatch("getPermissionData");
|
|
67713
67726
|
router.options = _.cloneDeep(routerOptionsBak);
|
|
67714
67727
|
const microPermissionData = filterMicroPermissionList(microType, permissionData);
|
|
67715
|
-
const
|
|
67716
|
-
|
|
67728
|
+
const tempPerList = microPermissionData.filter((item2) => item2.uri.includes(to.path));
|
|
67729
|
+
const perType = getPermissionType(tempPerList[0].type || "");
|
|
67730
|
+
let dynamicRouters = [];
|
|
67731
|
+
dynamicRouters.push({
|
|
67732
|
+
path: "/page",
|
|
67733
|
+
name: "page",
|
|
67734
|
+
meta: { hideInMenu: true, notCache: true },
|
|
67735
|
+
component: "EmptyLayoutNotCache",
|
|
67736
|
+
children: []
|
|
67737
|
+
});
|
|
67738
|
+
if (perType == "PAGE") {
|
|
67739
|
+
dynamicRouters[dynamicRouters.length - 1].children = dynamicRouters[dynamicRouters.length - 1].children.concat(tempPerList);
|
|
67740
|
+
}
|
|
67741
|
+
if (perType == "MENU") {
|
|
67742
|
+
const tempPerId = ((_a = tempPerList[0]) == null ? void 0 : _a.permissionId) || "";
|
|
67743
|
+
const tempChildren = microPermissionData.filter((item2) => item2.pid == tempPerId);
|
|
67744
|
+
dynamicRouters.unshift(...permission2Router(tempPerList, microType));
|
|
67745
|
+
dynamicRouters[dynamicRouters.length - 1].children = permission2Router(
|
|
67746
|
+
dynamicRouters[dynamicRouters.length - 1].children.concat(tempChildren),
|
|
67747
|
+
microType
|
|
67748
|
+
);
|
|
67749
|
+
}
|
|
67750
|
+
console.log("dynamicROuters111", dynamicRouters);
|
|
67717
67751
|
const rootRoute2 = router.options.routes.find((item2) => item2.path === "/");
|
|
67718
|
-
|
|
67752
|
+
const dynamicRouters1 = generator(dynamicRouters);
|
|
67753
|
+
for (const item2 of dynamicRouters1) {
|
|
67719
67754
|
router.addRoute(rootRoute2.name, item2);
|
|
67720
67755
|
rootRoute2.children.push(item2);
|
|
67721
67756
|
}
|
|
67757
|
+
console.log("router after render", router);
|
|
67722
67758
|
const microAllowPermissionList = filterMicroPermissionList(microType, allowPermissionList);
|
|
67723
67759
|
const needAddRoutes = microAllowPermissionList.filter((permission2) => {
|
|
67724
67760
|
return router.options.routes.findIndex((route) => permission2.name === route.name) === -1;
|
|
@@ -67808,7 +67844,8 @@ function addRouterGuards({ router, store: store2, microType, allowPermissionList
|
|
|
67808
67844
|
store: store2,
|
|
67809
67845
|
microType,
|
|
67810
67846
|
allowPermissionList,
|
|
67811
|
-
routerOptionsBak
|
|
67847
|
+
routerOptionsBak,
|
|
67848
|
+
to
|
|
67812
67849
|
});
|
|
67813
67850
|
next({ ...to, replace: true });
|
|
67814
67851
|
} catch (error) {
|