#set($ui_widgets = [])
#macro(ui_print_vue $parent)
  #if($parent.shape == 'ui-panel')
    <$parent.data.type v-bind="pages.widgets.$parent.data.id">
    #foreach($child in $parent.children)
      #ui_print_vue(${child})
    #end
    </$parent.data.type>
  #else
  <$parent.data.type v-bind="pages.widgets.$parent.data.id" @action="onWidgetAction($parent.data.id.props.dataset, $event)" :data="data"/>
  #end
  $ui_widgets.add($parent.data)
#end

<template>
  <div class="mainBody">
    #ui_print_vue($page.graph)
  </div>
</template>

<script>
import '@/components/widget'

export default {
  data () {
    return {
      page: {
        widgets: {
        #foreach($widget in $ui_widgets)
          $widget.id: $vmTool.json($widget.props),
        #end
        },
        datasets: {
        #foreach( $key in $page.datasets.keySet())
          $key: $vmTool.json($page.datasets.get($key)),
        #end
        }
      },
    }
  },
  mounted() {
    this.params = {
      pageId: '$pageId',
      dataId: this.$route.query.dataId,
      parentDataId: this.$route.query.parentId
    };

    // 读取master数据集的数据
  #foreach( $key in $page.datasets.keySet())
    #set($dataset=$page.datasets.get($key))
    #if($dataset.tableType == 1)
      this.loadDataset(this.page.datasets.$key);
    #end
  #end
  },
}

</script>
<style lang="scss" scoped>
.mainBody {
  height: 100%;
}
</style>
