<template>
  <view  >
	  <view class="meter-statistic-node" >
		  
    <tree-node  v-for="(item,i) in meterList"
	  :ref="'tree-node'+i" @switchBtn="switchBtn"
	   @query="query" :role="role" :level="meterList.length==1?0:1" :showPark="showPark"
	 :key="i" :node="item" :childInfo="childInfo" :rootnode="item" ></tree-node>
	  </view>
  </view>
</template>
 
<script>
import TreeNode from './tree-node.vue';
 
export default {
  components: {
    TreeNode
  },
  props: {
  	meterList:{
			type: Array,
			default() {
				return [];
			}
	},
	childInfo: Object, //公司属性
  	elderStatus: false,
	role:false,
	showPark:false,
  },
  methods:{
	  switchBtn(node,key){
			
				this.$emit('switchBtn',node,key)
				
	},
	  toggle(){
		  // for(var i in this.meterList){
			 // this.$nextTick(()=>{
				//  this.$refs['tree-node'+i].toggle()
				 
			 // })
			  
		  // }
		 
		  
	  },
	  query(item){
	  		   this.$emit('query',item)
	  },
  },
  data() {
    return {
      treeData: {
        name: 'Root',
        children: [
          {
            name: 'Child 1',
            children: [
              { name: 'Grandchild 1.1' },
              { name: 'Grandchild 1.2' }
            ]
          },
          {
            name: 'Child 2',
            children: [
              { name: 'Grandchild 2.1' },
              { name: 'Grandchild 2.2' }
            ]
          }
        ]
      }
    };
  }
};
</script>
<style   lang="scss" scoped>
	.meter-statistic-node {
			//margin-top: 32rpx;
			//padding-top: 12rpx;
			padding-bottom: 20px;
			margin: 0 32rpx;
			 background-color: #fcfafa;
		 }
</style>