<template>
  <span> {{ name }}</span>
</template>

<script>
import { tgList } from '@/api/adviser.js'

export default {
  name: 'AdviserSelect',
  props: {
    value: {
      type: [String, Number],
      default: ''
    },
    deptId: {
      type: [String, Number],
      default: undefined
    }
  },
  data() {
    return {
      options: []
    }
  },
  computed: {
    name() {
      for (let i = 0; i < this.options.length; i++) {
        if (this.value === this.options[i].id) {
          return this.options[i].name
        }
      }
      return ''
    }
  },
  mounted() {
    tgList({
      current: 1,
      size: 9999,
      status: 3,
      userType: 1,
      deptId: this.deptId
    }).then(res => {
      this.options = res.data.list
    })
  }
}
</script>
