SystemManagement.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div class="system_management">
  3. <el-container>
  4. <Aside
  5. v-bind="{
  6. showMenuIndex: showMenuIndex,
  7. menuList: menuList,
  8. handleMenuSelect: handleMenuSelect,
  9. }"
  10. ></Aside>
  11. <el-main>
  12. <UserManagement v-if="showIndex == '1'"></UserManagement>
  13. <AuthorityManagement v-if="showIndex == '2'"></AuthorityManagement>
  14. </el-main>
  15. </el-container>
  16. </div>
  17. </template>
  18. <script>
  19. export default {
  20. props: {
  21. permission: {
  22. type: Number,
  23. },
  24. },
  25. data() {
  26. return {
  27. menuList: null,
  28. showIndex: "-1",
  29. showMenuIndex: "-1",
  30. };
  31. },
  32. components: {
  33. Aside: () => import("@/components/Currency/Aside.vue"),
  34. UserManagement: () =>
  35. import("@/components/SystemManagement/UserManagement.vue"),
  36. AuthorityManagement: () =>
  37. import("@/components/SystemManagement/AuthorityManagement.vue"),
  38. },
  39. created() {
  40. let that = this;
  41. this.menuList =
  42. this.$store.getters.getMenuListTotal.filter(function (item) {
  43. return item.permission == that.permission
  44. })[0].children ;
  45. if (this.menuList.length == 0) return;
  46. t("", this.menuList);
  47. function t(beforeindex, arr) {
  48. if (beforeindex == "") {
  49. beforeindex = arr[0].index;
  50. } else {
  51. beforeindex = beforeindex + "-" + arr[0].index;
  52. }
  53. if (arr[0].children) {
  54. t(beforeindex, arr[0].children);
  55. } else {
  56. that.showIndex = beforeindex;
  57. that.showMenuIndex = beforeindex;
  58. }
  59. }
  60. },
  61. methods: {
  62. handleMenuSelect(index) {
  63. this.showIndex = index;
  64. },
  65. },
  66. };
  67. </script>
  68. <style lang="less" scoped>
  69. .system_management {
  70. height: 100%;
  71. width: 100%;
  72. .el-container {
  73. height: 100%;
  74. .el-main {
  75. padding: 0 0;
  76. margin-left: 20px;
  77. }
  78. }
  79. }
  80. </style>