13404089107
2025-06-26 e1951f3e3f35f583ea55795175412d2ac2ec8e92
Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory
3个文件已修改
75 ■■■■■ 已修改文件
culture/src/router/index.js 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/store/index.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/login/index.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/router/index.js
@@ -42,6 +42,7 @@
    meta: {
        title: "中台",
        middleground: true,
        privilege:'middleground'
        // hide: true,
    },
    component: () => import("../views/middleground"),
@@ -50,6 +51,7 @@
    path: "/projectList",
    meta: {
      title: "项目组管理",
      privilege:'projectList'
    },
    component: Layouts,
    children: [
@@ -58,6 +60,7 @@
        name: "ProjectList",
        meta: {
          title: "菌种库项目组管理",
          privilege:'projectList_list'
        },
        component: () => import("../views/projectList"),
      },
@@ -95,6 +98,7 @@
    path: "/system",
    meta: {
      title: "系统管理",
       privilege:'system'
    },
    component: Layouts,
    children: [
@@ -103,6 +107,7 @@
        name: "User",
        meta: {
          title: "人员管理",
           privilege:'system_user'
        },
        component: () => import("../views/system/user"),
      },
@@ -111,6 +116,7 @@
        name: "Role",
        meta: {
          title: "角色管理",
           privilege:'system_role'
        },
        component: () => import("../views/system/role"),
      },
@@ -145,6 +151,7 @@
        path: "operation-log",
        meta: {
          title: "操作日志",
           privilege:'system_operation-log'
        },
        component: () => import("../views/system/operation-log"),
      },
@@ -155,6 +162,7 @@
    component: Layouts,
    meta: {
      title: "菌种库",
      privilege:'strain'
    },
    children: [
      {
@@ -162,6 +170,7 @@
        component: Parent,
        meta: {
          title: "菌种库管理",
          privilege:'strain_library'
        },
        children: [
          {
@@ -169,6 +178,7 @@
            name: "StrainLibraryManage",
            meta: {
              title: "原始细胞库",
              privilege:'strain_library_strain_library_manage'
            },
            component: () =>
              import("../views/strain-library/strain-library-manage"),
@@ -210,6 +220,7 @@
            name: "MainCellLibrary",
            meta: {
              title: "主细胞库",
              privilege:'strain_library_main_cell_library'
            },
            component: () =>
              import("../views/strain-library/main-cell-library"),
@@ -239,6 +250,7 @@
            name: "ProductionCellLibrary",
            meta: {
              title: "生产细胞库",
              privilege:'strain_library_production_cell_library'
            },
            component: () =>
              import("../views/strain-library/production-cell-library"),
@@ -270,6 +282,7 @@
        name: "PedigreeChart",
        meta: {
          title: "菌种传代生产谱系图",
          privilege:'strain_pedigree_vhart'
        },
        component: () => import("../views/pedigree-chart"),
      },
@@ -323,6 +336,7 @@
        name: "BreedingRecord",
        meta: {
          title: "菌种选育保藏记录",
          privilege:'strain_breeding_record'
        },
        component: () => import("../views/strain-library/breeding-record"),
      },
@@ -357,6 +371,7 @@
        path: "validation",
        meta: {
          title: "菌种验证数据资料",
          privilege:'strain_validation'
        },
        component: Parent,
        children: [
@@ -365,6 +380,7 @@
            name: "PrimitiveCell",
            meta: {
              title: "原始细胞库资料",
              privilege:'strain_validation_primitive_cell'
            },
            component: () =>
              import(
@@ -412,6 +428,7 @@
            name: "ChiefCell",
            meta: {
              title: "主细胞库资料",
              privilege:'strain_validation_chief_cell'
            },
            component: () =>
              import("../views/strain-library/validation/chief-cell"),
@@ -457,6 +474,7 @@
    component: Layouts,
    meta: {
      title: "菌种报告库",
      privilege:'strainReportLibrary'
    },
    children: [
      {
@@ -464,6 +482,7 @@
        meta: {
          title: "报告库一",
          keepAlive: true,
          privilege:'strainReportLibrary_reportLibraryOne'
        },
        component: () =>
          import("../views/strainReportLibrary/reportLibraryOne/index.vue"),
@@ -493,6 +512,7 @@
        meta: {
          title: "报告库二",
          keepAlive: true,
          privilege:'strainReportLibrary_reportLibraryTwo'
        },
        component: () =>
          import("../views/strainReportLibrary/reportLibraryOneTWO/index.vue"),
@@ -522,6 +542,7 @@
        meta: {
          title: "报告库三",
          keepAlive: true,
          privilege:'strainReportLibrary_reportLibraryThree'
        },
        component: () =>
          import(
@@ -553,6 +574,7 @@
        meta: {
          title: "报告库四",
          keepAlive: true,
          privilege:'strainReportLibrary_reportLibraryFour'
        },
        component: () =>
          import("../views/strainReportLibrary/reportLibraryOneFour/index.vue"),
@@ -584,12 +606,14 @@
    component: Layouts,
    meta: {
      title: "菌种库操作评定",
      privilege:'strainOperationAssessment'
    },
    children: [
      {
        path: "list",
        meta: {
          title: "评定列表",
          privilege:'strainOperationAssessment_list'
        },
        component: () =>
          import("../views/strainOperationAssessment/index.vue"),
@@ -601,12 +625,14 @@
    component: Layouts,
    meta: {
      title: "菌种报告评定",
      privilege:'deliveryAssessment'
    },
    children: [
      {
        path: "projectTeamIntegral",
        meta: {
          title: "菌种项目组评定表",
          privilege:'deliveryAssessment_projectTeamIntegral'
        },
        component: () =>
          import("../views/deliveryAssessment/projectTeamIntegral"),
@@ -654,12 +680,28 @@
  }
  // 判断是否拥有要跳转菜单权限
  let menus = store.state.menus;
  if (
    to.meta.hasOwnProperty("privilege") &&
    !menus.includes(to.meta.privilege)
  ) {
    return;
  // let menus = store.state.menus;
  // if (
  //   to.meta.hasOwnProperty("privilege") &&
  //   !menus.includes(to.meta.privilege)
  // ) {
  //   return;
  // }
  let flatMenus = store.state.flatMenus
  if (!flatMenus || flatMenus.length === 0) {
      // 刷新后从sessionStorage恢复
      const menus = JSON.parse(sessionStorage.getItem('menus') || '[]')
      const flat = JSON.parse(sessionStorage.getItem('flatMenus') || '[]')
      store.commit('SET_MENUS', menus)
      store.commit('SET_FLAT_MENUS', flat)
      flatMenus = flat
  }
  if (to.meta && to.meta.privilege) {
      if (!flatMenus.includes(to.meta.privilege)) {
          next('/403') // 无权限跳转403
          return
      }
  }
  // 设置标签列表
culture/src/store/index.js
@@ -37,6 +37,9 @@
    SET_MENUS(state, data) {
      state.menus = data;
    },
    SET_FLAT_MENUS(state, data) {
      state.flatMenus = data;
    },
    SET_KEEPALIVELIST(state, data) {
      state.keepAliveList = data;
      sessionStorage.setItem('keepAliveList', JSON.stringify(data));
@@ -53,6 +56,9 @@
    setMenus({ commit }, data) {
      commit('SET_MENUS', data);
    },
    setFlatMenus({ commit }, data) {
      commit('SET_FLAT_MENUS', data);
    },
    setKeepAliveList({ commit }, data) {
      commit('SET_KEEPALIVELIST', data);
    },
culture/src/views/login/index.vue
@@ -96,9 +96,24 @@
        this.$message.warning('请输入密码')
        return
      }
      function flattenMenus(menus) {
        let result = []
        menus.forEach(menu => {
          if (menu.path) result.push(menu.path)
          if (menu.children && menu.children.length) {
            result = result.concat(flattenMenus(menu.children))
          }
        })
        return result
      }
      loginReq(this.loginForm).then(res => {
        sessionStorage.setItem('token', res.token)
        sessionStorage.setItem('userInfo', JSON.stringify(res.userInfo.user))
        sessionStorage.setItem('menus', JSON.stringify(res.menus))
        const flatMenus = flattenMenus(res.menus)
        sessionStorage.setItem('flatMenus', JSON.stringify(flatMenus))
        this.$store.commit('SET_MENUS', res.menus)
        this.$store.commit('SET_FLAT_MENUS', flatMenus)
        this.$router.replace('/middleground')
      })
    }