navRight.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div>
  3. <div class="nav-right">
  4. <el-menu
  5. :collapse="true"
  6. style="background: none"
  7. text-color="#fff"
  8. active-text-color="#fff"
  9. class="el-menu-vertical-demo"
  10. >
  11. <el-menu-item
  12. :index="String(index + 10)"
  13. v-for="(item, index) in menuApp"
  14. :key="index"
  15. @click="handelMenuAppClick(item, 'app')"
  16. >
  17. <img
  18. width="20"
  19. :src="require(`@/assets/icons/${item.systemappid}.svg`)"
  20. alt=""
  21. />
  22. <span slot="title">{{ item.meta.title }}</span>
  23. </el-menu-item>
  24. </el-menu>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. menuApp: [],
  33. modules: [],
  34. system: [],
  35. };
  36. },
  37. methods: {
  38. // 查询右侧应用授权
  39. async query_userauth() {
  40. const res = await this.$api.requested({
  41. classname: "sysmanage.develop.userauthforweb.userauth",
  42. method: "query_userauth",
  43. content: {
  44. place: 2,
  45. },
  46. });
  47. console.log("res", res);
  48. if (res.code == 1) {
  49. this.system = res.data;
  50. this.modules = [];
  51. res.data.map((e) => {
  52. this.modules = [...this.modules, ...e.modules];
  53. });
  54. this.modules.map((e) => {
  55. this.menuApp = [...this.menuApp, ...e.apps];
  56. });
  57. }
  58. },
  59. handelMenuAppClick(app, type) {
  60. this.$store.dispatch("changeDetailDrawer", false);
  61. let at_modules = this.modules.filter((e) => {
  62. if (e.systemmoduleid === app.systemmoduleid) return e;
  63. })[0];
  64. let at_app = app;
  65. sessionStorage.setItem("active_modules", JSON.stringify(at_modules));
  66. const link = () => {
  67. this.$router.push({ path: app.path });
  68. };
  69. this.$store.dispatch("setActiveApp", {
  70. name: app.name,
  71. app: at_app,
  72. val: "",
  73. link,
  74. });
  75. this.$router.push({ path: app.path });
  76. },
  77. },
  78. mounted() {
  79. this.query_userauth();
  80. },
  81. };
  82. </script>
  83. <style>
  84. </style>
  85. <style scoped>
  86. .nav-right {
  87. position: fixed;
  88. right: 0;
  89. top: 0;
  90. height: 100%;
  91. background: rgba(0, 0, 0, 0.3);
  92. z-index: 2000;
  93. z-index: 2003;
  94. }
  95. </style>