<template>
  <div>
    <div>
      <select-user
        v-for="(item, key) in list"
        :key="key"
        :name="key"
        :item="item"
        :subjectsById="subjectsById"
      />
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="$listeners.close">取 消</el-button>
      <!-- <el-button @click="submitEducation" type="primary">确 定</el-button> -->
    </span>
  </div>
</template>
<script>
import { array2object } from '@/helpers/utils'
import { employeeLevelDetail } from '../api'
import selectUser from './select-user'
export default {
  props: ['detail'],
  components: {
    'select-user': selectUser
  },
  data() {
    return {
      list: []
    }
  },
  computed: {
    subjectsById() {
      return array2object(this.selects.subjects, 'id')
    }
  },
  mounted() {
    this.$store.dispatch('setSubjects')
    this.FetchDetail()
  },
  methods: {
    async FetchDetail() {
      try {
        const res = await employeeLevelDetail({
          userId: this.detail.id
        })
        this.list = res.data
      } catch (error) {}
    }
  }
};
</script>
<style lang="less" scoped>
</style>
