diff --git a/src/views/base/team/index.vue b/src/views/base/team/index.vue index c2dc11a..82e927a 100644 --- a/src/views/base/team/index.vue +++ b/src/views/base/team/index.vue @@ -274,7 +274,7 @@ @@ -385,6 +385,7 @@ // 表单参数 form: {}, teamUserList:[],//新增编辑弹窗-班组成员 + leaderData:{},//新增编辑弹窗-班组长 chosenUser:[],//人员列表右侧-选中人员 peopleDataList:[],//接口获取-所有人员列表 peopleList:[],//人员列表左侧-表格渲染 @@ -424,7 +425,7 @@ // 获取人员列表 getPersonList(){ let param = { - type:1,//1.全部人员 2.未分配人员 3.已分配人员 4.班组长 + type:4,//1.全部人员 2.未分配人员 3.已分配人员 4.班组长 roleCode: this.$store.getters.roleCode, departId: this.$store.getters.departId, teamId: this.$store.getters.teamId, @@ -440,8 +441,21 @@ if(item.id==val){ this.form.teamLeader = item.name; this.form.leaderPhone = item.phone; + this.leaderData=item; } }) + this.leaderData.isLeader=0;//是否班组长,0是1否 + if(this.teamUserList.length==0){ + this.teamUserList.push(this.leaderData) + }else{ + var index = this.teamUserList.findIndex(uItem => {return uItem.isLeader == 0}) + if(index>-1){ + this.teamUserList.splice(index,1) + this.teamUserList.unshift(this.leaderData) + }else{ + this.teamUserList.unshift(this.leaderData) + } + } }, /** 查询班组列表 */ getList() { @@ -594,17 +608,10 @@ }, //选择人员弹窗-确认 submitPeople(){ - // let arrs=[...this.chosenUser,...this.teamUserList]; - // //根据id去重 - // let map=new Map(); - // for(let item of arrs){ - // if(!map.has(item.id)){ - // map.set(item.id,item) - // } - // } - // let newArr=[...map.values()]; + // console.log(this.teamUserList) + // console.log(this.chosenUser) this.teamUserList = this.chosenUser; - + this.teamUserList.unshift(this.leaderData) this.openPeople = false; }, /** 新增按钮操作 */ @@ -620,10 +627,18 @@ const teamId = row.teamId getTeamInfo({id:teamId}).then(response => { this.form = response.data; + this.personList.forEach(item=>{ + if(item.id==this.form.teamLeaderId){ + this.leaderData=item; + this.leaderData.isLeader=0; + } + }) + this.$set(this.form,'proId',response.data.proId+'') this.checkList = response.data.checkList; // this.$set(this.form,'sex',response.data.sex+'') this.teamUserList = response.data.checkList.slice(); + this.teamUserList.unshift(this.leaderData) this.open = true; this.title = "修改班组"; });