diff --git a/src/views/farm/workHour/index.vue b/src/views/farm/workHour/index.vue
index f8ffec5..1431c07 100644
--- a/src/views/farm/workHour/index.vue
+++ b/src/views/farm/workHour/index.vue
@@ -43,7 +43,7 @@
- {{cpUserList.find(t=>t.id == scope.row.userId).name}}
+ {{userConvert(scope.row.userId)}}
@@ -53,7 +53,7 @@
- {{taskList.find(t=>t.id == scope.row.taskId).name}}
+ {{taskConvert(scope.row.taskId)}}
@@ -94,10 +94,10 @@
- {{item.name}}
+ {{item.taskName +"/"+ item.taskMsg}}
@@ -129,6 +129,7 @@ import { createWorkHour, updateWorkHour, deleteWorkHour, getWorkHour, getWorkHou
import { getProjectPage} from "@/api/farm/project";
import { getTaskPage} from "@/api/farm/task";
import { getCpUserPage} from "@/api/system/cpUser"
+import { getTaskCatePage} from "@/api/farm/taskCate"
export default {
@@ -172,24 +173,31 @@ export default {
taskList:[],
selectTaskList:[],
cpUserList:[],
- selectCpUserList:[]
-
+ selectCpUserList:[],
+ taskCateList:[]
};
},
created() {
- this.getProjectPageList();
- this.getTaskPageList();
- this.getCpUserPageList();
- this.getList();
+ this.getTaskCateList();
},
methods: {
+ getTaskCateList(){
+ getTaskCatePage({
+ pageNo : 1,
+ pageSize : 100
+ }).then(res =>{
+ this.taskCateList = res.data.list;
+ this.getProjectPageList();
+ })
+ },
getProjectPageList(){
getProjectPage({
pageNo:1,
pageSize:100
}).then(res => {
this.projectList = res.data.list;
+ this.getTaskPageList();
})
},
getTaskPageList(){
@@ -198,6 +206,7 @@ export default {
pageSize:100
}).then(res => {
this.taskList = res.data.list;
+ this.getCpUserPageList();
})
},
getCpUserPageList(){
@@ -206,6 +215,7 @@ export default {
pageSize:400
}).then(res => {
this.cpUserList = res.data.list;
+ this.getList()
})
},
/** 查询列表 */
@@ -354,26 +364,38 @@ export default {
},
chooseTask(row){
- this.form.userId = undefined;
- this.selectCpUserList = [];
- let arr = this.selectTaskList.filter(t => t.id == row)
- let userIdArr = [];
- arr.forEach(item =>{
- userIdArr = JSON.parse(item.executorPerson);
- userIdArr.push(item.mainPerson);
- })
- let userArr = [];
- userIdArr.forEach(item =>{
- this.cpUserList.forEach(u =>{
- if(u.id == item){
- userArr.push(u);
+ this.form.userId = undefined;
+ this.selectCpUserList = [];
+ let arr = this.selectTaskList.filter(t => t.id == row)[0];
+ let userIdList = [];
+ userIdList.push(arr.mainPerson);
+ arr.executorPerson.forEach(exe =>{
+ userIdList.push(exe);
+ })
+
+ let userList = [];
+ this.cpUserList.forEach(user =>{
+ userIdList.forEach(id =>{
+ if(user.id == id){
+ userList.push(user);
}
})
})
- let mapp = new Set(userArr);
+
+ let mapp = new Set(userList);
let quchong = Array.from(mapp);
this.selectCpUserList = quchong;
- }
+ },
+
+ userConvert(userId){
+ return this.cpUserList.filter(user => user.id == userId)[0].name;
+ },
+ taskConvert(taskId){
+ let task = this.taskList.filter(item => item.id == taskId)[0];
+ let cate = this.taskCateList.filter(cate => cate.id == task.taskCateId)[0].name;
+ let cateName = this.taskCateList.filter(cate => cate.id == task.taskCateName)[0].name;
+ return cate +"/"+ cateName;
+ },
}
};