选择责任人框

This commit is contained in:
宋伟佳
2021-08-13 23:03:56 +08:00
parent 19078cffdc
commit 1217719f7a
@@ -44,7 +44,7 @@
</process-title>
<div class="tableTitle">
<div class="tableButton">
<el-button plain class="common-button-primary" size="mini" @click="batchOperation">批量分发责任人</el-button>
<el-button plain class="common-button-primary" size="mini" @click="choiceZRRS('', 2, '')">批量分发责任人</el-button>
</div>
</div>
<el-table
@@ -94,11 +94,16 @@
>
</el-table-column>
<el-table-column label="责任人" prop="workPeople" align="center">
<template slot-scope="scope">
<div :class="{'fileClass': !scope.row.workPeople}">
{{ scope.row.workPeople ? scope.row.workPeople : "" }}
</div>
<template slot-scope="scope" v-if="scope.row.workPeople">
<el-input v-model="scope.row.workPeopleId" style="display: none;" />
<el-input v-model="scope.row.workPeople" placeholder="请选择分发责任人"
@click.native="choiceZRRS(scope.row, 1, scope.$index)" />
</template>
<!-- <template slot-scope="scope">-->
<!-- <div :class="{'fileClass': !scope.row.workPeople}">-->
<!-- {{ scope.row.workPeople ? scope.row.workPeople : "" }}-->
<!-- </div>-->
<!-- </template>-->
</el-table-column>
</el-table>
</div>
@@ -253,7 +258,8 @@ export default {
detailData: [], //流程历史数据
userId: this.$store.getters.userInfo.userId,
taskIds: this.$route.query.taskIds,
pId: this.$route.query.prcId
pId: this.$route.query.prcId,
selectedId:'',
};
},
methods: {
@@ -316,7 +322,6 @@ export default {
taskIds: this.taskIds,
pId: this.pId
}).then(res => {
console.log(res.mesg);
if (res) {
const processForm = JSON.parse(res.mesg);
this.getFormFieldList(processForm);
@@ -408,20 +413,32 @@ export default {
}, e => {
});
},
//批量分发按钮
batchOperation(id) {
if (this.selectList.length === 0) {
this.$message.warning("请至少选择一条数据进行批量分发");
} else {
//批量分发按钮
choiceZRRS(row, type, index) {
this.selectedId=row.id
this.type = type;
if (type === 1) {
this.drawerTitle = "选择责任人";
this.nodeList = [];
this.nodeList.push(id);
this.zrIndex = index;
this.zrType = type;
this.nodeList.push(row);
this.modalshowflag = true;
} else if (type === 2) {
// 批量
if (this.selectList.length > 0) {
this.zrType = type;
this.nodeList = [];
this.modalshowflag = true;
this.drawerTitle = "批量选择责任人";
} else {
this.$message.warning("请选择要分发的数据");
}
}
},
//标准表格选择框改变
selectStandChange(data) {
this.selectList = data;
console.log(this.selectList);
},
getTree() {
this.$http.get("SarInstitution/institution/institutionAndUser", {}, {}, res => {
@@ -438,47 +455,40 @@ export default {
}
},
checkedRole(data) {
console.log(data[0].name);
// 选取负责人时的操作
let deposit = new Map();
let mis2 = new Map();
this.selectList.forEach(item => {
item.workPeople = data[0].name;
item.workPeopleId = data[0].id;
if (item.children) {
item.children.forEach(items => {
deposit.set(items.standId, items);
});
}
mis2.set(item.standId, item);
});
this.dataList.forEach((item, index) => {
if (mis2.get(item.standId)) {
if (item.children) {
item.children.forEach(i => {
i.workPeopleId = undefined;
i.workPeople = undefined;
});
} else {
const newItem = JSON.parse(JSON.stringify(item));
newItem.workPeopleId = data[0].id;
newItem.workPeople = data[0].name;
this.$set(this.dataList, index, newItem);
//单选操作
if (this.type === 1) {
this.dataList.forEach(item => {
if(item.children){
item.children.forEach(items => {
if(items.id === this.selectedId){
items.workPeople = data[0].name
items.workPeopleId = data[0].id
// this.$set(items,'workPeople',data[0].name)
//this.$set(items,'workPeopleId',data[0].id)
}
})
}
} else {
if (item.children) {
item.children.forEach((items, childIndex) => {
if (deposit.get(items.standId)) {
const childItems = JSON.parse(JSON.stringify(items));
childItems.workPeopleId = deposit.get(items.standId).workPeopleId;
childItems.workPeople = deposit.get(items.standId).workPeople;
this.$set(this.dataList[index].children, childIndex, childItems);
}
});
}
}
});
this.$refs.myTable.clearSelection();
})
this.dataList = JSON.parse(JSON.stringify(this.dataList))
} else if (this.type === 2) {
this.selectList.forEach(item =>{
this.dataList.map(items=>{
if(item.id==items.id){
items.workPeople = data[0].name
items.workPeopleId = data[0].id
}
if(items.children.length){
items.children.map(childrenItem=>{
if(childrenItem.id==item.id){
childrenItem.workPeople = data[0].name
childrenItem.workPeopleId = data[0].id
}
})
}
})
})
this.dataList = JSON.parse(JSON.stringify(this.dataList))
}
this.modalshowflag = false;
},
cancleUserInfo() {