<!-- 机构选择下拉框 -->
<template>
  <ele-tree-select
    ref="tree"
    clearable
    :value="value || ''"
    :data="data"
    label-key="name"
    value-key="id"
    default-expand-all
    :placeholder="placeholder"
    @input="updateValue"
  />
</template>

<script>
  export default {
    props: {
      // 选中的数据(v-model)
      value: [Number,String],
      // 提示信息
      placeholder: {
        type: String,
        default: '请选择机构'
      },
      // 机构数据
      data: Array
    },
    methods: {
      /* 更新选中数据 */
      updateValue(value) {
        this.$emit('input', value);

        let nodesInfo = []
         nodesInfo = this.$refs['tree'].getHalfCheckedKeys()
        nodesInfo.push(value)
        this.$emit('checkedKeys', nodesInfo)

      }
    }
  };
</script>
