This commit is contained in:
宋伟佳
2021-11-30 10:33:26 +08:00
parent c31ce50bf3
commit a2c4aa9309
@@ -421,7 +421,6 @@ export default {
},
//批量分发按钮
choiceZRRS(row, type, index) {
console.log(row);
this.selectedId = row.id || row.standId;
this.type = type;
if (type === 1) {
@@ -429,13 +428,20 @@ export default {
this.nodeList = [];
this.zrIndex = index;
this.zrType = type;
this.nodeList.push(row);
if (row.workPeopleId) {
this.nodeList = row.workPeopleId.split(",");
}else{
this.nodeList.push(row);
}
this.modalshowflag = true;
} else if (type === 2) {
// 批量
if (this.selectList.length > 0) {
this.zrType = type;
this.nodeList = [];
if (row.workPeopleId) {
this.nodeList = row.workPeopleId.split(",");
}
this.modalshowflag = true;
this.drawerTitle = "批量选择责任人";
} else {
@@ -461,6 +467,75 @@ export default {
}
},
checkedRole(data) {
console.log(data);
var idList = "";
var nameList = "";
data.forEach(item => {
if (nameList.length > 0) {
nameList += ",";
idList += ",";
}
idList += item.id;
nameList += item.name;
});
//单选操作
if (this.type === 1) {
this.dataList.forEach(item => {
if(item.standId === this.selectedId){
item.workPeople = nameList || '请选择责任人'
item.workPeopleId = idList;
}
if (item.children) {
item.children.forEach(items => {
if (items.id === this.selectedId) {
items.workPeople = nameList;
items.workPeopleId = idList;
// this.$set(items,'workPeople',data[0].name)
//this.$set(items,'workPeopleId',data[0].id)
}
});
}
});
this.dataList = JSON.parse(JSON.stringify(this.dataList));
} else if (this.type === 2) {
this.selectList.forEach(item => {
this.dataList.map(items => {
if (item.standId === items.standId) {
items.workPeople = nameList || '请选择责任人'
items.workPeopleId = idList;
// this.$message.warning('您只能针对条款进行分发')
}
if (items.children) {
items.children.map(childrenItem => {
if (childrenItem.id === item.id) {
childrenItem.workPeople = nameList;
childrenItem.workPeopleId = idList;
}
});
}
});
});
this.dataList = JSON.parse(JSON.stringify(this.dataList));
} else if (this.type === 3) {
// console.log("529",this.workPeopleList)
for (let i = 0; i < this.workPeopleList.children.length; i++) {
this.workPeopleList.children[i].workPeople = data[0].name;
this.workPeopleList.children[i].workPeopleId = data[0].id;
// console.log(row.children[i].id)
// console.log(row.children[i].workPeople)
}
// items.children.map(childrenItem => {
//
// childrenItem.workPeople = data[0].name;
// childrenItem.workPeopleId = data[0].id;
// })
}
this.modalshowflag = false;
},
setChildren(children, type) {
// 编辑多个子层级
children.map(j => {
@@ -541,74 +616,6 @@ export default {
this.roleRow = this.$refs.tree.getCheckedNodes()[0];
}
},
checkedRole(data) {
var idList = "";
var nameList = "";
data.forEach(item => {
if (nameList.length > 0) {
nameList += ",";
idList += ",";
}
idList += item.id;
nameList += item.name;
});
//单选操作
if (this.type === 1) {
this.dataList.forEach(item => {
if(item.standId === this.selectedId){
item.workPeople = nameList;
item.workPeopleId = idList;
}
if (item.children) {
item.children.forEach(items => {
if (items.id === this.selectedId) {
items.workPeople = nameList;
items.workPeopleId = idList;
// this.$set(items,'workPeople',data[0].name)
//this.$set(items,'workPeopleId',data[0].id)
}
});
}
});
this.dataList = JSON.parse(JSON.stringify(this.dataList));
} else if (this.type === 2) {
this.selectList.forEach(item => {
this.dataList.map(items => {
if (item.standId === items.standId) {
items.workPeople = nameList;
items.workPeopleId = idList;
// this.$message.warning('您只能针对条款进行分发')
}
if (items.children) {
items.children.map(childrenItem => {
if (childrenItem.id === item.id) {
childrenItem.workPeople = nameList;
childrenItem.workPeopleId = idList;
}
});
}
});
});
this.dataList = JSON.parse(JSON.stringify(this.dataList));
} else if (this.type === 3) {
// console.log("529",this.workPeopleList)
for (let i = 0; i < this.workPeopleList.children.length; i++) {
this.workPeopleList.children[i].workPeople = data[0].name;
this.workPeopleList.children[i].workPeopleId = data[0].id;
// console.log(row.children[i].id)
// console.log(row.children[i].workPeople)
}
// items.children.map(childrenItem => {
//
// childrenItem.workPeople = data[0].name;
// childrenItem.workPeopleId = data[0].id;
// })
}
this.modalshowflag = false;
},
cancleUserInfo() {
this.modalshowflag = false;
}