TreeMap.vue 815 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <b-overlay :show="loading" class="h-100 position-absolute">
  3. <node-map
  4. v-if="!loading"
  5. v-bind="mapData"
  6. :show-id="true"
  7. v-on="$listeners"
  8. />
  9. </b-overlay>
  10. </template>
  11. <script>
  12. import NodeMap from '@/components/NodeMap'
  13. import { toManyManyData } from '@/helpers/d3Data'
  14. export default {
  15. name: 'TreeMap',
  16. components: {
  17. NodeMap
  18. },
  19. props: {
  20. id: { type: Number, default: 1 }
  21. },
  22. data () {
  23. return {
  24. loading: true,
  25. depth: 3,
  26. mapData: { nodes: null, links: null }
  27. }
  28. },
  29. created () {
  30. const { id, depth } = this
  31. this.$store.dispatch('GET_TREE_WITH_DEPTH', { id, depth }).then((data) => {
  32. this.mapData = toManyManyData(data)
  33. this.loading = false
  34. })
  35. }
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. </style>