DataTable.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <el-container :class="'data_table'">
  3. <el-aside width="200px">
  4. <el-menu ref="menu" class="first_menu">
  5. <el-submenu
  6. v-for="(item, index) in list"
  7. :key="index"
  8. :index="index + ''"
  9. :class="'index' + index + ''"
  10. >
  11. <template slot="title">
  12. <span>{{ item.name }}</span>
  13. </template>
  14. <div class="second_menu">
  15. <el-menu-item
  16. v-for="(item_1, index_1) in item.models"
  17. :key="index + '-' + index_1"
  18. :index="index + '-' + index_1"
  19. @click="jumpMetadataList(item_1)"
  20. :title="item_1.title"
  21. >{{ item_1.title }}</el-menu-item
  22. >
  23. </div>
  24. </el-submenu>
  25. </el-menu>
  26. </el-aside>
  27. <el-main>
  28. <MetadataListContainer
  29. v-if="listContainerIsShow"
  30. v-bind="{ type: index, params: params }"
  31. ></MetadataListContainer>
  32. </el-main>
  33. </el-container>
  34. </template>
  35. <script>
  36. export default {
  37. components: {
  38. MetadataListContainer: () => import("./MetadataListContainer.vue"),
  39. },
  40. props: {
  41. index: {
  42. type: Number,
  43. },
  44. },
  45. data() {
  46. return {
  47. list: null,
  48. params: null,
  49. listContainerIsShow: false,
  50. geometryType: {
  51. Point: 0,
  52. LineString: 1,
  53. Polyline: 1,
  54. MultiPolyline: 1,
  55. MultiLineString: 1,
  56. Polygon: 2,
  57. MultiPolygon: 2,
  58. },
  59. };
  60. },
  61. methods: {
  62. jumpMetadataList(item) {
  63. this.listContainerIsShow = true;
  64. this.params = {
  65. modelId: item.id,
  66. geotype: this.geometryType[item.geometryType],
  67. };
  68. },
  69. },
  70. computed: {
  71. layerData() {
  72. return this.$store.state.layerList;
  73. },
  74. },
  75. watch: {
  76. layerData: {
  77. immediate: true,
  78. handler(newVal, oldName) {
  79. this.list = newVal;
  80. },
  81. },
  82. index(newVal, oldVal) {
  83. let that = this;
  84. this.listContainerIsShow = false;
  85. this.list.map(function (item, index) {
  86. that.$refs.menu.close(index + "");
  87. });
  88. this.param = null;
  89. },
  90. },
  91. };
  92. </script>
  93. <style lang="less" scoped>
  94. // .data_table {
  95. // // padding-left: 20px;
  96. // }
  97. .el-main {
  98. padding: 0 0;
  99. }
  100. .el-aside {
  101. background: #ffffff;
  102. .el-menu {
  103. border-right: 0px;
  104. }
  105. .first_menu {
  106. width: 100% !important;
  107. }
  108. .first_menu,
  109. .second_menu {
  110. background: transparent;
  111. /deep/ .el-submenu__title {
  112. font-size: 16px;
  113. font-weight: bold;
  114. color: #000000;
  115. text-align: left;
  116. text-indent: 40px;
  117. line-height: 51px;
  118. .el-submenu__icon-arrow {
  119. text-indent: 0px;
  120. }
  121. }
  122. .el-submenu {
  123. text-align: center;
  124. line-height: 60px;
  125. margin: 10px 10px;
  126. margin-left: 0px;
  127. &:first-child {
  128. border-top-right-radius: 4px;
  129. }
  130. }
  131. .el-submenu /deep/ .el-menu {
  132. background: transparent;
  133. }
  134. /deep/ .el-menu-item {
  135. font-size: 16px;
  136. padding-left: 40px !important;
  137. padding-right: 20px !important;
  138. color: #000000;
  139. background: transparent;
  140. text-align: left;
  141. overflow: hidden;
  142. text-overflow: ellipsis;
  143. }
  144. /deep/ .el-menu-item:hover,
  145. /deep/ .el-menu-item.is-active {
  146. color: #409eff;
  147. background-color: #ecf5ff;
  148. }
  149. }
  150. .second_menu {
  151. /deep/ i {
  152. float: right;
  153. font-size: 12px;
  154. color: #ffffff;
  155. position: absolute;
  156. top: 50%;
  157. right: 20px;
  158. margin-top: -7px;
  159. }
  160. }
  161. .index0 /deep/.el-submenu__title {
  162. background: url(~@/assets/images/layer/1.png) no-repeat 20px center;
  163. }
  164. .index1 /deep/.el-submenu__title {
  165. background: url(~@/assets/images/layer/2.png) no-repeat 20px center;
  166. }
  167. .index2 /deep/.el-submenu__title {
  168. background: url(~@/assets/images/layer/3.png) no-repeat 20px center;
  169. }
  170. .index3 /deep/.el-submenu__title {
  171. background: url(~@/assets/images/layer/4.png) no-repeat 20px center;
  172. }
  173. .index4 /deep/.el-submenu__title {
  174. background: url(~@/assets/images/layer/5.png) no-repeat 20px center;
  175. }
  176. }
  177. </style>