index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div class="application-setting-wrap">
  3. <div class="left-tab-box">
  4. <ul>
  5. <li
  6. v-for="tab in tabList"
  7. :key="tab.path"
  8. :class="{'tab-active': tab.active,'tab-style':true}"
  9. @click="openTab(tab)"
  10. >
  11. <icon-svg
  12. :name="tab.img"
  13. class="tabIconStyle"
  14. />
  15. <span>{{ tab.name }}</span>
  16. </li>
  17. </ul>
  18. </div>
  19. <el-scrollbar class="scroll-box">
  20. <div class="inner-router-view-wrap">
  21. <router-view v-if="isRresh" />
  22. </div>
  23. </el-scrollbar>
  24. </div>
  25. </template>
  26. <script>
  27. import Icon from 'data-room-ui/assets/images/dataSourceIcon/export'
  28. import IconSvg from 'data-room-ui/SvgIcon'
  29. export default {
  30. name: 'DataSourceManagement',
  31. components: {
  32. IconSvg
  33. },
  34. provide () {
  35. return {
  36. refresh: this.refresh
  37. }
  38. },
  39. data () {
  40. return {
  41. // appIcon: Icon.getNameList(),
  42. isRresh: true,
  43. activeTabName: '',
  44. currentPermission: 1,
  45. tabList: [
  46. {
  47. active: false,
  48. name: '数据源管理',
  49. path: window?.routers?.dataSourceUrl,
  50. // permissionRequire: 0
  51. img: Icon.getNameList()[0]
  52. },
  53. {
  54. active: false,
  55. name: '数据集管理',
  56. path: window?.routers?.dataSetUrl,
  57. // permissionRequire: 9
  58. img: Icon.getNameList()[1]
  59. }
  60. ]
  61. }
  62. },
  63. watch: {
  64. },
  65. created () {
  66. this.tabList[0].path = window?.BS_CONFIG?.routers?.dataSourceUrl || '/data-sources/data-source-sets'
  67. this.tabList[1].path = window?.BS_CONFIG?.routers?.dataSetUrl || '/data-sources/data-set-configuration'
  68. },
  69. mounted () {
  70. this.openTab(this.tabList[0])
  71. },
  72. methods: {
  73. refresh () {
  74. this.isRresh = false
  75. this.$nextTick(() => {
  76. this.isRresh = true
  77. })
  78. },
  79. openTab (tab) {
  80. this.$router.push({
  81. path: tab.path
  82. })
  83. this.tabList.forEach((item) => {
  84. if (item.path !== tab.path) {
  85. item.active = false
  86. } else {
  87. item.active = true
  88. }
  89. })
  90. },
  91. setActiveTab (route) {
  92. this.$router.push({
  93. path: route.path
  94. })
  95. this.tabList.forEach((tab) => {
  96. if (tab.path === route.path) {
  97. tab.active = true
  98. } else {
  99. tab.active = false
  100. }
  101. })
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .application-setting-wrap {
  108. display: flex;
  109. height: calc(100vh - 40px);
  110. overflow-y: hidden;
  111. background: #f5f7fa;
  112. .left-tab-box {
  113. background: #fff;
  114. width: 290px;
  115. ul {
  116. padding-left: 0;
  117. li {
  118. display: flex;
  119. align-items: center;
  120. height: 40px;
  121. line-height: 40px;
  122. cursor: pointer;
  123. padding-left: 20px;
  124. margin: 5px 0;
  125. img {
  126. width: 20px;
  127. vertical-align: middle;
  128. margin-right: 10px;
  129. }
  130. &:hover {
  131. background-color: #007aff10;
  132. }
  133. }
  134. }
  135. .tab-active {
  136. background-color: #007aff10;
  137. &:before {
  138. content: "";
  139. height: 40px;
  140. line-height: 40px;
  141. position: absolute;
  142. left: 0;
  143. border-left: 4px solid var(--bs-el-color-primary);
  144. }
  145. }
  146. ::v-deep .el-tabs__item {
  147. text-align: left;
  148. width: 290px;
  149. }
  150. ::v-deep .el-tabs__nav-wrap::after {
  151. background-color: #fff !important;
  152. }
  153. }
  154. .scroll-box {
  155. width: calc(100% - 300px);
  156. overflow-y: auto;
  157. overflow-x: hidden;
  158. margin: 16px;
  159. background: #fff;
  160. }
  161. .inner-router-view-wrap {
  162. width: 100%;
  163. height: 100%;
  164. box-sizing: border-box;
  165. }
  166. ::v-deep.el-scrollbar__view{
  167. height: 100%;
  168. .inner-router-view-wrap{
  169. height: 100%;
  170. .bs-table-box{
  171. height: calc(100vh - 205px);
  172. .el-table{
  173. height: 100%;
  174. }
  175. }
  176. }
  177. }
  178. .tabIconStyle{
  179. width: 18px;
  180. height: 18px;
  181. margin-right: 20px;
  182. }
  183. }
  184. </style>