<template>
  <div class="editDialog">
    <el-dialog 
      :visible.sync="dialogFormVisible" 
      :before-close="cancelRegister" 
      :top="top"
      size="tiny">

      <el-tree 
        class="radioTree"
        :data="treeData" 
        :props="defaultProps" 
        :expand-on-click-node="false" 
        :highlight-current="true"
        node-key="id"
        :default-expanded-keys="[1]"
        @node-click="handleNodeClick">
      </el-tree>

      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelRegister">取 消</el-button>
        <el-button type="primary" @click="dialogSure">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import Api from '@/api/index.js'

  export default{ 
    name: 'RadioTreeDialog',
    props: {
      top: { 
        type: String,
        default: '7%'
      }
    },
    data(){ 
      return { 
        dialogFormVisible: true,

        treeData: [],

        show:true,
        data: [],
        defaultProps: {
          children: 'childrens',
          label: 'text'
        },
        id:''
      }
    },
    mounted() {
      this.browse()
    },
    methods:{
      //浏览
      browse(){ 
        //目录树
        Api.getDirectoryService()
        .then(data => {
          if(data.status === 0) {
            this.treeData = data.results;
          }else {
            this.$message({
              type: 'error',
              message: '获取数据失败'
            });
          }
        }).catch(res => {
          this.$message({
            type: 'error',
            message: '请求数据失败'
          })
        })
        this.catalogOnoff = true
      }, 
      //取消目录树
      cancelRegister(){ 

      },
      //树点击
      handleNodeClick(){ 

      },
      //确定
      dialogSure(){ 

      }
    }
  }
</script>

<style lang="scss">
  
</style>