后台 工时页面 爆红处理
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
<el-table-column label="id" align="center" prop="id" />
|
<el-table-column label="id" align="center" prop="id" />
|
||||||
<el-table-column label="员工名" align="center" prop="userId" >
|
<el-table-column label="员工名" align="center" prop="userId" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{cpUserList.find(t=>t.id == scope.row.userId).name}}</span>
|
<span>{{userConvert(scope.row.userId)}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="项目名" align="center" prop="projectId" >
|
<el-table-column label="项目名" align="center" prop="projectId" >
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务名" align="center" prop="taskId" >
|
<el-table-column label="任务名" align="center" prop="taskId" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{taskList.find(t=>t.id == scope.row.taskId).name}}</span>
|
<span>{{taskConvert(scope.row.taskId)}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="工时" align="center" prop="hour" />
|
<el-table-column label="工时" align="center" prop="hour" />
|
||||||
@@ -94,10 +94,10 @@
|
|||||||
<el-option
|
<el-option
|
||||||
v-for="item in selectTaskList"
|
v-for="item in selectTaskList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.taskName +'/'+ item.taskMsg"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
@change="chooseTask">
|
@change="chooseTask">
|
||||||
{{item.name}}
|
{{item.taskName +"/"+ item.taskMsg}}
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -129,6 +129,7 @@ import { createWorkHour, updateWorkHour, deleteWorkHour, getWorkHour, getWorkHou
|
|||||||
import { getProjectPage} from "@/api/farm/project";
|
import { getProjectPage} from "@/api/farm/project";
|
||||||
import { getTaskPage} from "@/api/farm/task";
|
import { getTaskPage} from "@/api/farm/task";
|
||||||
import { getCpUserPage} from "@/api/system/cpUser"
|
import { getCpUserPage} from "@/api/system/cpUser"
|
||||||
|
import { getTaskCatePage} from "@/api/farm/taskCate"
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -172,24 +173,31 @@ export default {
|
|||||||
taskList:[],
|
taskList:[],
|
||||||
selectTaskList:[],
|
selectTaskList:[],
|
||||||
cpUserList:[],
|
cpUserList:[],
|
||||||
selectCpUserList:[]
|
selectCpUserList:[],
|
||||||
|
taskCateList:[]
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getProjectPageList();
|
this.getTaskCateList();
|
||||||
this.getTaskPageList();
|
|
||||||
this.getCpUserPageList();
|
|
||||||
this.getList();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getTaskCateList(){
|
||||||
|
getTaskCatePage({
|
||||||
|
pageNo : 1,
|
||||||
|
pageSize : 100
|
||||||
|
}).then(res =>{
|
||||||
|
this.taskCateList = res.data.list;
|
||||||
|
this.getProjectPageList();
|
||||||
|
})
|
||||||
|
},
|
||||||
getProjectPageList(){
|
getProjectPageList(){
|
||||||
getProjectPage({
|
getProjectPage({
|
||||||
pageNo:1,
|
pageNo:1,
|
||||||
pageSize:100
|
pageSize:100
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.projectList = res.data.list;
|
this.projectList = res.data.list;
|
||||||
|
this.getTaskPageList();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getTaskPageList(){
|
getTaskPageList(){
|
||||||
@@ -198,6 +206,7 @@ export default {
|
|||||||
pageSize:100
|
pageSize:100
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.taskList = res.data.list;
|
this.taskList = res.data.list;
|
||||||
|
this.getCpUserPageList();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCpUserPageList(){
|
getCpUserPageList(){
|
||||||
@@ -206,6 +215,7 @@ export default {
|
|||||||
pageSize:400
|
pageSize:400
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.cpUserList = res.data.list;
|
this.cpUserList = res.data.list;
|
||||||
|
this.getList()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
@@ -354,26 +364,38 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
chooseTask(row){
|
chooseTask(row){
|
||||||
this.form.userId = undefined;
|
this.form.userId = undefined;
|
||||||
this.selectCpUserList = [];
|
this.selectCpUserList = [];
|
||||||
let arr = this.selectTaskList.filter(t => t.id == row)
|
let arr = this.selectTaskList.filter(t => t.id == row)[0];
|
||||||
let userIdArr = [];
|
let userIdList = [];
|
||||||
arr.forEach(item =>{
|
userIdList.push(arr.mainPerson);
|
||||||
userIdArr = JSON.parse(item.executorPerson);
|
arr.executorPerson.forEach(exe =>{
|
||||||
userIdArr.push(item.mainPerson);
|
userIdList.push(exe);
|
||||||
})
|
})
|
||||||
let userArr = [];
|
|
||||||
userIdArr.forEach(item =>{
|
let userList = [];
|
||||||
this.cpUserList.forEach(u =>{
|
this.cpUserList.forEach(user =>{
|
||||||
if(u.id == item){
|
userIdList.forEach(id =>{
|
||||||
userArr.push(u);
|
if(user.id == id){
|
||||||
|
userList.push(user);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
let mapp = new Set(userArr);
|
|
||||||
|
let mapp = new Set(userList);
|
||||||
let quchong = Array.from(mapp);
|
let quchong = Array.from(mapp);
|
||||||
this.selectCpUserList = quchong;
|
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;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user