<template>
     <el-table
      :data="userList"
      style="width: 100%">
      <el-table-column
        prop="nickName"
        label="用户"
        width="180">
      </el-table-column>
      <el-table-column
        prop="depId"
        label="部门"
        :formatter="findDep"
        width="180">
      </el-table-column>
    </el-table>
 <!-- <div>
用户管理
 </div> -->
</template>
<script scoped>
export default {
  data () {
    return {
           userList:[],
           depList:[]
    }
  },
  created () {
      
      this.$fetch('manageBase/dept/select').then((response)=>{
          this.depList = response.data
      });
      this.$fetch('manageBase/user/list',1, 10).then((response)=>{
        console.log(response)
        this.userList = response.data.list
      })
  },
  methods: {
      findDep(row, column){
          console.log(row);
          if(row.depId){
            console.log(row.depId)
            this.depList.forEach((item)=>{
              console.log(item.code)
              console.log(row.depId)
               if(item.code == row.depId){
                  return item.name
               }else{
                 return ''
               }
            })
          } else {
            return ''
          }
      }
  }, 
}
</script>
<style scope>
  
</style>


