班组长修改

This commit is contained in:
zzyuan 2024-08-19 13:49:47 +08:00
parent eaf0e47060
commit d37fc87240
1 changed files with 27 additions and 12 deletions

View File

@ -274,7 +274,7 @@
<el-table-column label="电话" align="center" prop="phone" /> <el-table-column label="电话" align="center" prop="phone" />
<el-table-column label="操作" align="center" > <el-table-column label="操作" align="center" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" @click="delUser(scope.row)">删除</el-button> <el-button size="mini" type="text" @click="delUser(scope.row)" v-if="scope.row.isLeader!=0">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -385,6 +385,7 @@
// //
form: {}, form: {},
teamUserList:[],//- teamUserList:[],//-
leaderData:{},//-
chosenUser:[],//- chosenUser:[],//-
peopleDataList:[],//- peopleDataList:[],//-
peopleList:[],//- peopleList:[],//-
@ -424,7 +425,7 @@
// //
getPersonList(){ getPersonList(){
let param = { let param = {
type:1,//1. 2. 3. 4. type:4,//1. 2. 3. 4.
roleCode: this.$store.getters.roleCode, roleCode: this.$store.getters.roleCode,
departId: this.$store.getters.departId, departId: this.$store.getters.departId,
teamId: this.$store.getters.teamId, teamId: this.$store.getters.teamId,
@ -440,8 +441,21 @@
if(item.id==val){ if(item.id==val){
this.form.teamLeader = item.name; this.form.teamLeader = item.name;
this.form.leaderPhone = item.phone; this.form.leaderPhone = item.phone;
this.leaderData=item;
} }
}) })
this.leaderData.isLeader=0;//01
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() { getList() {
@ -594,17 +608,10 @@
}, },
//- //-
submitPeople(){ submitPeople(){
// let arrs=[...this.chosenUser,...this.teamUserList]; // console.log(this.teamUserList)
// //id // console.log(this.chosenUser)
// let map=new Map();
// for(let item of arrs){
// if(!map.has(item.id)){
// map.set(item.id,item)
// }
// }
// let newArr=[...map.values()];
this.teamUserList = this.chosenUser; this.teamUserList = this.chosenUser;
this.teamUserList.unshift(this.leaderData)
this.openPeople = false; this.openPeople = false;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@ -620,10 +627,18 @@
const teamId = row.teamId const teamId = row.teamId
getTeamInfo({id:teamId}).then(response => { getTeamInfo({id:teamId}).then(response => {
this.form = response.data; 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.$set(this.form,'proId',response.data.proId+'')
this.checkList = response.data.checkList; this.checkList = response.data.checkList;
// this.$set(this.form,'sex',response.data.sex+'') // this.$set(this.form,'sex',response.data.sex+'')
this.teamUserList = response.data.checkList.slice(); this.teamUserList = response.data.checkList.slice();
this.teamUserList.unshift(this.leaderData)
this.open = true; this.open = true;
this.title = "修改班组"; this.title = "修改班组";
}); });