Browse Source

后台任务只能选中项目里面的成员

master
zhanyunjiu 3 years ago
parent
commit
2051aff6c1
  1. 39
      src/views/farm/task/index.vue

39
src/views/farm/task/index.vue

@ -181,7 +181,7 @@
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目选择" prop="projectId">
<el-select v-model="form.projectId" placeholder="请选择" @change="changeProject">
@ -191,15 +191,15 @@
</el-select>
</el-form-item>
<el-form-item label="负责人" prop="mainPerson">
<el-select v-model="form.mainPerson" filterable placeholder="请选择">
<el-option v-for="item in cpUserList" :key="item.id" :label="item.name" :value="item.id">
<el-select v-model="form.mainPerson" filterable placeholder="请选择项目">
<el-option v-for="item in selectCpUserList" :key="item.id" :label="item.name" :value="item.id">
{{ item.name }}
</el-option>
</el-select>
</el-form-item>
<el-form-item label="执行人" prop="executorPerson">
<el-select v-model="form.executorPerson" filterable multiple placeholder="请选择">
<el-option v-for="item in cpUserList" :key="item.id" :label="item.name" :value="item.id">
<el-select v-model="form.executorPerson" filterable multiple placeholder="请选择项目">
<el-option v-for="item in selectCpUserList" :key="item.id" :label="item.name" :value="item.id">
{{ item.name }}
</el-option>
</el-select>
@ -361,6 +361,8 @@ export default {
cpUserList: [],
executorPerson: [],
selectCpUserList: [], // id
taskCateAllList: [], //
taskCateList: [], //
@ -485,7 +487,6 @@ export default {
pageNo: 1,
pageSize: 10,
}).then(res => {
console.log(111111111, res.data.list);
this.resourceList = res.data.list;
this.twoRescoure();
this.getList();
@ -590,9 +591,12 @@ export default {
this.assemArea();
const id = row.id;
getTask(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改农场任务";
this.form = response.data;
this.open = true;
this.title = "修改农场任务";
let project = this.projectList.filter(project => project.id == response.data.projectId)[0];
this.changeCpUser(project);
this.selectCropList = this.cropList.filter(crop => crop.id == project.cropId);
});
},
/** 提交按钮 */
@ -722,7 +726,24 @@ export default {
this.form.cropId = null;
this.selectCropList = this.cropList.filter(crop => crop.id == project.cropId);
//
this.selectCpUserList = [];
this.form.mainPerson = null;
this.form.executorPerson = null;
this.changeCpUser(project);
},
changeCpUser(project){
project.members.forEach(member =>{
this.cpUserList.forEach(user =>{
if(member == user.id){
this.selectCpUserList.push(user);
}
})
})
}
}
};
</script>

Loading…
Cancel
Save