/*
 * @Description: 
 * @Author: ymz
 * @Date: 2021-12-13 10:15:19
 * @LastEditTime: 2021-12-16 14:25:36
 * @LastEditors: ymz
 * @Reference: 
 */
import { dissolveTeam} from '@/api/teamManagement/index'
export default {
  data(){
    return {
      addShow:false,
      importatShow:false,
      type:0,
      editId:'',
      page:{
        currentPage: 1,
        total: 0,
        pageSize: 10
      },
    }
  },
  methods:{
    dissolution(info){
      this.$confirm('团队即将解散，解散后将无法找到该团队及其团队成员！', '解散团队', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        console.log('a');
        this.dissolveTeam(info.id)
      }).catch(() => {
        console.log('b');
        this.$message({
          type: 'info',
          message: '已取消解散'
        });
      })
    },
    // 解散
   async dissolveTeam(id){
    let res = await dissolveTeam(id)
    if(res.data.code === 0){
      this.$message.success('解散成功')
      this.getTeamList()
    }
    },

    // 添加
    addTeam(){
      this.type = 0
      this.editId = ''
      this.addShow = true
    },

          // 编辑
    edit(info){
      this.addShow = true
      this.type = 1
      this.editId = info.id
    },
    // 改变页数
    sizeChange(val){
      this.page.pageSize = val
      this.getTeamList()
    },
    currentChange(val){
      this.page.currentPage = val
      this.getTeamList()
    },
    // 初始化页码
    initPage(){
      this.$set(this.page,'currentPage',1)
      this.$set(this.page,'total',0)
      this.$set(this.page,'pageSize',10)
      this.data = []
    },
    // 添加编辑成功
    Success(type){
      if(type === 0){
        this.initPage()
      }
     this.getTeamList()
    },

      // 添加
    importFile(info){
      this.importatShow = true
      this.teamId = info.id
    }
  },
}