orgTree.vue 798 Bytes
<template>
  <el-dialog
    custom-class="party-dialog"
    title="选择级别"
    :visible.sync="dialogVisible"
    width="600px"
  >
    <el-tree
      ref="tree"
      :data="treeData"
      node-key="id"
      highlight-current
      :props="defaultProps"
      @node-click="handleNodeClick"
    >
    </el-tree>
  </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      dialogVisible: false,
      defaultProps: {
        children: "children",
        label: "name",
      },
    };
  },
  props: {
    treeData: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  methods: {
    handleNodeClick(data) {
      this.$emit('selected', data)
      this.dialogVisible = false
    },
  },
};
</script>
<style lang="less" scoped>
</style>