@indfnd/common 1.0.93 → 1.0.95

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 CHANGED
@@ -2,6 +2,23 @@
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.95](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.94...v1.0.95) (2025-02-08)
6
+
7
+ ### [1.0.94](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.93...v1.0.94) (2025-02-08)
8
+
9
+
10
+ ### Features
11
+
12
+ * 路由跳转优化 ([93a4352](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/93a4352165b2d266f91c77d40eaa97defee93bc3))
13
+ * 路由优化升级 ([78512ca](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/78512ca46d8755edd8f9d9646ba0fe3736e70008))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * 路由表调试 ([0b3760d](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/0b3760d588d8533965e3162cf7b56980e70e181d))
19
+ * ag 单元格tab抓取 ([dd5bf14](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/dd5bf14211b8bb203b8f627f061ece91f3c5003e))
20
+ * router组织路由修改 ([d0f30e5](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/d0f30e5ce31aa8eb0d11d26b42f605f7d381930f))
21
+
5
22
  ### [1.0.93](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.92...v1.0.93) (2025-02-06)
6
23
 
7
24
  ### [1.0.92](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v1.0.91...v1.0.92) (2025-02-06)
@@ -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.92";
5463
+ const version = "1.0.94";
5464
5464
  const author = "huxuetong";
5465
5465
  const publishConfig = {
5466
5466
  registry: "https://registry.npmjs.org/"
@@ -51472,14 +51472,22 @@ const __vue2_script$1d = {
51472
51472
  },
51473
51473
  on: {
51474
51474
  "on-enter": () => {
51475
+ console.log("gridapi i s", window.gridApi);
51475
51476
  let nextRowIndex = node.rowIndex + 1;
51476
51477
  window.gridApi.ensureIndexVisible(nextRowIndex);
51477
51478
  window.gridApi.ensureColumnVisible(column);
51478
51479
  setTimeout(() => {
51479
- window.gridApi.gridBodyCtrl.rowRenderer.rowCtrlsByRowIndex[nextRowIndex].centerGui.element.getElementsByTagName("input")[1].focus();
51480
+ window.gridApi.gridBodyCtrl.rowRenderer.rowCtrlsByRowIndex[nextRowIndex].centerGui.element.getElementsByTagName("input")[0].focus();
51480
51481
  }, 0);
51481
51482
  },
51482
- "on-keypress": () => {
51483
+ "on-keydown": (event) => {
51484
+ console.log("event keydown", event, node);
51485
+ if (event.key == "Tab") {
51486
+ event.preventDefault();
51487
+ }
51488
+ },
51489
+ "on-keypress": (event) => {
51490
+ console.log("event keypress", event);
51483
51491
  },
51484
51492
  "on-blur": (event) => {
51485
51493
  let v = event.target.value;
@@ -59812,7 +59820,7 @@ var render$E = function() {
59812
59820
  var _vm = this;
59813
59821
  var _h = _vm.$createElement;
59814
59822
  var _c = _vm._self._c || _h;
59815
- return _c("KeepAlive", { attrs: { "include": _vm.cacheList, "exclude": _vm.notCacheName } }, [_c("RouterView", { ref: "child" })], 1);
59823
+ return _c("KeepAlive", { attrs: { "exclude": _vm.notCacheName } }, [_c("RouterView", { ref: "child" })], 1);
59816
59824
  };
59817
59825
  var staticRenderFns$E = [];
59818
59826
  const __vue2_script$F = {
@@ -67479,7 +67487,7 @@ const rootRoute = {
67479
67487
  name: config.rootRouteName,
67480
67488
  path: "/",
67481
67489
  redirect: "/home",
67482
- component: BasicLayout,
67490
+ component: top == self ? BasicLayout : EmptyLayout,
67483
67491
  meta: {
67484
67492
  hideInMenu: true,
67485
67493
  notCache: true
@@ -67575,6 +67583,7 @@ function filterMicroPermissionList(microType, permissionList = []) {
67575
67583
  return permissionList;
67576
67584
  }
67577
67585
  function permission2Router(list, microType) {
67586
+ console.log("permission2Router params", list, microType);
67578
67587
  if (!list) {
67579
67588
  return [];
67580
67589
  }
@@ -67582,6 +67591,7 @@ function permission2Router(list, microType) {
67582
67591
  for (const item2 of list) {
67583
67592
  tempList.push({
67584
67593
  path: dealRoutePath(item2.uri, microType),
67594
+ uri: item2.uri,
67585
67595
  name: item2.permissionValue,
67586
67596
  meta: {
67587
67597
  appId: item2.appId,
@@ -67597,6 +67607,7 @@ function permission2Router(list, microType) {
67597
67607
  component: item2.permissionValue
67598
67608
  });
67599
67609
  }
67610
+ console.log("permission2Router result", tempList);
67600
67611
  return tempList;
67601
67612
  }
67602
67613
  function listToMenuTree({ list, menuTree, pageNode, parentId, crumbs, root, microType }) {
@@ -67699,6 +67710,29 @@ function generatorMenuTree(permissionList = []) {
67699
67710
  });
67700
67711
  return menuTree;
67701
67712
  }
67713
+ function generatorDynamicRouter(permissionList = [], microType) {
67714
+ const menuTree = [];
67715
+ const pageNode = {
67716
+ path: "/page",
67717
+ name: "page",
67718
+ meta: { hideInMenu: true, notCache: true },
67719
+ component: "EmptyLayoutNotCache",
67720
+ children: []
67721
+ };
67722
+ listToMenuTree({
67723
+ list: permissionList,
67724
+ menuTree,
67725
+ pageNode,
67726
+ parentId: "0",
67727
+ crumbs: [],
67728
+ root: true,
67729
+ microType
67730
+ });
67731
+ if (pageNode.children.length) {
67732
+ menuTree.push(pageNode);
67733
+ }
67734
+ return generator(menuTree);
67735
+ }
67702
67736
  function generator(menuData = []) {
67703
67737
  for (let item2 of menuData) {
67704
67738
  if (item2.component) {
@@ -67720,6 +67754,27 @@ function generator(menuData = []) {
67720
67754
  }
67721
67755
  return menuData;
67722
67756
  }
67757
+ function generatorRouteByPermission(item2) {
67758
+ if (window.loadComponentHandler) {
67759
+ item2.component = window.loadComponentHandler(item2.path, item2.name) || NotFound;
67760
+ } else {
67761
+ console.error(`\u627E\u4E0D\u5230\u7EC4\u4EF6\u5B9A\u4E49:${item2.component},\u8BF7\u6392\u67E5\u8D44\u6E90\u8DEF\u5F84\u914D\u7F6E\u662F\u5426\u6B63\u786E`);
67762
+ item2.component = NotFound;
67763
+ }
67764
+ return item2;
67765
+ }
67766
+ const isAdded = (router, route) => {
67767
+ var _a, _b;
67768
+ let rlt = router.resolve(route);
67769
+ return !!((_b = (_a = rlt == null ? void 0 : rlt.resolved) == null ? void 0 : _a.matched) == null ? void 0 : _b.length);
67770
+ };
67771
+ const pageRoute = {
67772
+ path: "/page",
67773
+ name: "page",
67774
+ meta: { hideInMenu: true, notCache: true },
67775
+ component: EmptyLayout,
67776
+ children: []
67777
+ };
67723
67778
  async function renderRoutes({
67724
67779
  router,
67725
67780
  store: store2,
@@ -67728,54 +67783,68 @@ async function renderRoutes({
67728
67783
  routerOptionsBak,
67729
67784
  to
67730
67785
  }) {
67731
- var _a;
67732
- store2.dispatch("getIndexInfo");
67733
- await store2.dispatch("getUserInfo");
67734
- await store2.dispatch("getAppListData");
67735
- const permissionData = await store2.dispatch("getPermissionData");
67736
- router.options = _.cloneDeep(routerOptionsBak);
67737
- const microPermissionData = filterMicroPermissionList(microType, permissionData);
67738
- const tempPerList = microPermissionData.filter((item2) => item2.uri.includes(to.path));
67739
- const perType = getPermissionType(tempPerList[0].type || "");
67740
- let dynamicRouters = [];
67741
- dynamicRouters.push({
67742
- path: "/page",
67743
- name: "page",
67744
- meta: { hideInMenu: true, notCache: true },
67745
- component: "EmptyLayoutNotCache",
67746
- children: []
67747
- });
67748
- if (perType == "PAGE") {
67749
- dynamicRouters[dynamicRouters.length - 1].children = dynamicRouters[dynamicRouters.length - 1].children.concat(tempPerList);
67786
+ console.log("wtf is to", to);
67787
+ let isInitilaze = !store2.state.user.userName;
67788
+ if (isAdded(router, to) && !isInitilaze) {
67789
+ return;
67750
67790
  }
67751
- if (perType == "MENU") {
67752
- const tempPerId = ((_a = tempPerList[0]) == null ? void 0 : _a.permissionId) || "";
67753
- const tempChildren = microPermissionData.filter((item2) => item2.pid == tempPerId);
67754
- dynamicRouters.unshift(...permission2Router(tempPerList, microType));
67755
- dynamicRouters[dynamicRouters.length - 1].children = permission2Router(
67756
- dynamicRouters[dynamicRouters.length - 1].children.concat(tempChildren),
67757
- microType
67758
- );
67791
+ if (isInitilaze) {
67792
+ store2.dispatch("getIndexInfo");
67793
+ await store2.dispatch("getUserInfo");
67794
+ await store2.dispatch("getAppListData");
67795
+ await store2.dispatch("getPermissionData");
67796
+ router.options = _.cloneDeep(routerOptionsBak);
67759
67797
  }
67760
- console.log("dynamicROuters111", dynamicRouters);
67761
- const rootRoute2 = router.options.routes.find((item2) => item2.path === "/");
67762
- const dynamicRouters1 = generator(dynamicRouters);
67763
- for (const item2 of dynamicRouters1) {
67764
- router.addRoute(rootRoute2.name, item2);
67765
- rootRoute2.children.push(item2);
67798
+ const permissionData = getPermissionCache();
67799
+ const microPermissionData = filterMicroPermissionList(microType, permissionData);
67800
+ if (top == self) {
67801
+ let dynamicRouters = generatorDynamicRouter(microPermissionData, microType);
67802
+ const rootRoute2 = router.options.routes.find((item2) => item2.path === "/");
67803
+ for (const item2 of dynamicRouters) {
67804
+ router.addRoute(rootRoute2.name, item2);
67805
+ rootRoute2.children.push(item2);
67806
+ }
67807
+ } else {
67808
+ const rootRoute2 = router.options.routes.find((item2) => item2.path === "/");
67809
+ if (isInitilaze) {
67810
+ router.addRoute(rootRoute2.name, pageRoute);
67811
+ rootRoute2.children.push(pageRoute);
67812
+ }
67813
+ if (!isAdded(router, to)) {
67814
+ let tempPer = microPermissionData.find((item2) => {
67815
+ return item2.permissionValue == to.name;
67816
+ });
67817
+ if (!tempPer) {
67818
+ tempPer = microPermissionData.find((item2) => {
67819
+ return item2.uri.endsWith(to.path);
67820
+ });
67821
+ }
67822
+ const perType = getPermissionType(tempPer.type || "");
67823
+ let tmpRoute = generatorRouteByPermission(permission2Router([tempPer], microType)[0]);
67824
+ if (perType == "PAGE") {
67825
+ router.addRoute(pageRoute.name, tmpRoute);
67826
+ pageRoute.children.push(tmpRoute);
67827
+ }
67828
+ if (perType == "MENU") {
67829
+ router.addRoute(rootRoute2.name, tmpRoute);
67830
+ rootRoute2.children.push(tmpRoute);
67831
+ }
67832
+ }
67766
67833
  }
67767
67834
  console.log("router after render", router);
67768
- const microAllowPermissionList = filterMicroPermissionList(microType, allowPermissionList);
67769
- const needAddRoutes = microAllowPermissionList.filter((permission2) => {
67770
- return router.options.routes.findIndex((route) => permission2.name === route.name) === -1;
67771
- });
67772
- needAddRoutes.forEach((item2) => {
67773
- item2.component = item2.name;
67774
- item2.meta = { hideInMenu: true, title: item2.label, activeName: item2.name };
67775
- });
67776
- const dynamicDetailRouters = generator(needAddRoutes);
67777
- for (const item2 of dynamicDetailRouters) {
67778
- router.addRoute(config.rootRouteName, item2);
67835
+ if (isInitilaze) {
67836
+ const microAllowPermissionList = filterMicroPermissionList(microType, allowPermissionList);
67837
+ const needAddRoutes = microAllowPermissionList.filter((permission2) => {
67838
+ return router.options.routes.findIndex((route) => permission2.name === route.name) === -1;
67839
+ });
67840
+ needAddRoutes.forEach((item2) => {
67841
+ item2.component = item2.name;
67842
+ item2.meta = { hideInMenu: true, title: item2.label, activeName: item2.name };
67843
+ });
67844
+ const dynamicDetailRouters = generator(needAddRoutes);
67845
+ for (const item2 of dynamicDetailRouters) {
67846
+ router.addRoute(config.rootRouteName, item2);
67847
+ }
67779
67848
  }
67780
67849
  }
67781
67850
  function addRouterGuards({ router, store: store2, microType, allowPermissionList }) {
@@ -67825,6 +67894,7 @@ function addRouterGuards({ router, store: store2, microType, allowPermissionList
67825
67894
  return false;
67826
67895
  };
67827
67896
  router.beforeEach(async (to, from, next) => {
67897
+ console.log("guard to is", to);
67828
67898
  LoadingBar.start();
67829
67899
  let token = getToken();
67830
67900
  let search = location.search;
@@ -67842,11 +67912,12 @@ function addRouterGuards({ router, store: store2, microType, allowPermissionList
67842
67912
  sessionStorage.setItem("sso_token", ssoToken);
67843
67913
  }
67844
67914
  }
67915
+ let isInitilaze = !store2.state.user.userName;
67845
67916
  if (!token && to.name !== LOGIN_PAGE_NAME) {
67846
67917
  next({ name: LOGIN_PAGE_NAME });
67847
67918
  } else if (to.name === LOGIN_PAGE_NAME) {
67848
67919
  next();
67849
- } else if (!store2.state.user.userName) {
67920
+ } else if (isInitilaze || top !== self) {
67850
67921
  Spin.show();
67851
67922
  try {
67852
67923
  await renderRoutes({
@@ -67857,7 +67928,17 @@ function addRouterGuards({ router, store: store2, microType, allowPermissionList
67857
67928
  routerOptionsBak,
67858
67929
  to
67859
67930
  });
67860
- next({ ...to, replace: true });
67931
+ if (isInitilaze || !to.path || to.path == "/") {
67932
+ if (to.name && to.path == "/") {
67933
+ console.log("guard next to is", { name: to.name, replace: true });
67934
+ next({ name: to.name });
67935
+ } else {
67936
+ console.log("guard next to is", to);
67937
+ next({ ...to });
67938
+ }
67939
+ } else {
67940
+ next();
67941
+ }
67861
67942
  } catch (error) {
67862
67943
  next({ name: LOGIN_PAGE_NAME });
67863
67944
  }