rolesSetting.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <script>
  2. import Vue from 'vue'
  3. export default Vue.extend({
  4. name: "rolesSetting",
  5. data() {
  6. return {
  7. menuList:[],
  8. menuRouter: [],
  9. }
  10. },
  11. mounted() {
  12. this.getRouter()
  13. },
  14. methods: {
  15. getRouter() {
  16. this.menuRouter = this.$router.options.routes[0].children
  17. }
  18. }
  19. })
  20. </script>
  21. <template>
  22. <div class="main-box">
  23. <div class="list-cont">
  24. <div class="head">
  25. <el-input prefix-icon="el-icon-search" placeholder="搜索观众姓名/手机号/邮箱" class="input"></el-input>
  26. <el-button icon="el-icon-plus" type="primary">新增角色</el-button>
  27. </div>
  28. <div class="body">
  29. <el-table height="100%" class="table">
  30. <el-table-column
  31. label="角色名称">
  32. </el-table-column>
  33. <el-table-column
  34. label="创建日期">
  35. </el-table-column>
  36. <el-table-column
  37. label="操作">
  38. </el-table-column>
  39. </el-table>
  40. </div>
  41. <div class="foot">
  42. <el-pagination
  43. background
  44. :page-size="100"
  45. layout="total, prev, pager, next"
  46. :total="1000">
  47. </el-pagination>
  48. </div>
  49. </div>
  50. <div class="menu-list">
  51. <div class="save">
  52. <el-button type="primary">保存</el-button>
  53. </div>
  54. <div class="scroll">
  55. <div class="menu">
  56. <template v-for="(item,index) in menuRouter">
  57. <div class="menu-item">
  58. <div class="name">
  59. <span :class="item.meta.icon">{{item.meta.title}}</span>
  60. <el-switch class="switch"></el-switch>
  61. </div>
  62. <div class="children" v-if="item.meta.func">
  63. <div class="menu-item" v-for="(func,index) in item.meta.func">
  64. <div class="name">
  65. <span>{{func.name}}</span>
  66. <el-switch class="switch"></el-switch>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="children" v-if="item.children">
  71. <div class="menu-item" v-for="(child,index) in item.children">
  72. <div class="name">
  73. <span :class="child.meta.icon">{{child.meta.title}}</span>
  74. <el-switch class="switch"></el-switch>
  75. </div>
  76. <div class="children" v-if="child.meta.func">
  77. <div class="menu-item" v-for="(func,index) in child.meta.func">
  78. <div class="name">
  79. <span>{{func.name}}</span>
  80. <el-switch class="switch"></el-switch>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="hr"></div>
  88. </template>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </template>
  94. <style scoped lang="scss">
  95. @use '@/styles/variables.scss' as *;
  96. .main-box{
  97. overflow: hidden;
  98. padding: 0 !important;
  99. height: 100%;
  100. width: 100%;
  101. display: grid;
  102. grid-template-columns: 1fr 420px;
  103. .list-cont,.menu-list{
  104. height: 100%;
  105. width: 100%;
  106. position: relative;
  107. }
  108. .menu-list{
  109. position: relative;
  110. .save{
  111. display: flex;
  112. justify-content: flex-end;
  113. padding: 16px;
  114. background: #F9FAFB;
  115. }
  116. .scroll{
  117. background: #F9FAFB;
  118. border-radius: 0 16px 16px 0;
  119. padding: 16px;
  120. overflow: hidden;
  121. overflow-y: auto;
  122. position: absolute;
  123. bottom: 0;
  124. left: 0;
  125. width: 100%;
  126. height: calc(100% - 64px);
  127. }
  128. .menu{
  129. padding: 8px;
  130. background: white;
  131. border-radius: 8px;
  132. box-shadow: 0 0 8px 0 #00000018;
  133. width: 100%;
  134. .hr:not(:last-child){
  135. width: calc(100% - 16px);
  136. margin: 8px;
  137. border-bottom: 1px solid #d8dde4;
  138. }
  139. .menu-item{
  140. border-radius: 8px;
  141. cursor: default;
  142. border-right: 2px solid transparent;
  143. padding: 10px 0 10px 16px;
  144. .switch{
  145. margin-right: 16px;
  146. }
  147. .name{
  148. color: $menuText;
  149. font-size: 17px;
  150. display: flex;
  151. justify-content: space-between;
  152. span{
  153. &::before{
  154. margin-right: 8px
  155. }
  156. }
  157. }
  158. .children{
  159. margin-top: 10px;
  160. }
  161. &:hover{
  162. background: $menuHover;
  163. border-left-color: #ffffff88;
  164. border-top-color: #ffffff88;
  165. border-bottom-color: #2563EB11;
  166. border-right-color: #2563EB11;
  167. }
  168. }
  169. }
  170. }
  171. .list-cont{
  172. z-index: 2;
  173. box-shadow: 0 0 4px 0 #00000022;
  174. padding: 16px;
  175. display: grid;
  176. grid-template-rows: auto 1fr auto;
  177. grid-gap: 24px;
  178. .head{
  179. display: flex;
  180. .input{
  181. width: 50%;
  182. margin-right: auto;
  183. }
  184. }
  185. .body{
  186. height: 100%;
  187. position: relative;
  188. .table{
  189. width: 100%;
  190. height: 100%;
  191. position: absolute;
  192. top: 0;
  193. left: 0;
  194. }
  195. }
  196. .foot{
  197. .el-pagination{
  198. display: flex;
  199. .el-pagination__total{
  200. margin-right: auto;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. </style>