orgTree.vue 798 Bytes
Newer Older
xulili's avatar
xulili committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
<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>