人员绩效表排序调整

v1.2.0
‘wangjiuyun 2025-01-23 11:40:23 +08:00
parent 6160798087
commit 5327adc0ea
1 changed files with 41 additions and 18 deletions

View File

@ -52,8 +52,8 @@
tableHeight="495px" tableHeight="495px"
@sortChange="sortChange" @sortChange="sortChange"
:default-sort="{ :default-sort="{
prop:'score', prop: 'score',
order:null, order: 'descending',
}" }"
> >
<template slot="operation" slot-scope="{ row }"> <template slot="operation" slot-scope="{ row }">
@ -76,6 +76,7 @@ import { taskApi } from "@/utils/api";
import { deptTreeSelect } from "@/api/system/user"; import { deptTreeSelect } from "@/api/system/user";
export default { export default {
name: "UserScore",
components: { components: {
CustomTable, CustomTable,
SelectUser, SelectUser,
@ -87,7 +88,7 @@ export default {
searchForm: { searchForm: {
userIdList: [], userIdList: [],
userName: "", userName: "",
isAsc: "", isAsc: "desc",
}, },
columns: [ columns: [
{ prop: "userName", label: "考核人员" }, { prop: "userName", label: "考核人员" },
@ -101,7 +102,7 @@ export default {
return row.score; return row.score;
} else if (row.examineStatus == 1) { } else if (row.examineStatus == 1) {
return row.manageScore; return row.manageScore;
} else if(row.examineStatusSelf == 1){ } else if (row.examineStatusSelf == 1) {
return row.selfScore; return row.selfScore;
} }
}, },
@ -150,6 +151,8 @@ export default {
this.searchForm[key] = ""; this.searchForm[key] = "";
}); });
this.$refs.treeRef.setCurrentKey(null); this.$refs.treeRef.setCurrentKey(null);
this.searchForm.isAsc = "desc"
this.initSort()
// this.searchForm.taskId = this.taskList[0]?.id; // this.searchForm.taskId = this.taskList[0]?.id;
this.getTaskUserList(); this.getTaskUserList();
@ -172,22 +175,27 @@ export default {
query: { taskId: row.taskId, examineId: row.id, score }, query: { taskId: row.taskId, examineId: row.id, score },
}); });
}, },
getTaskUserList() { getTaskUserList(init) {
if (!this.taskId) return; if (!this.taskId) return;
taskApi taskApi
.getTaskUserList({ .getTaskUserList({
...this.searchForm, ...this.searchForm,
taskId: this.taskId, taskId: this.taskId,
sortFiled :'all', sortFiled: "all",
pageNum: this.pageNum, pageNum: this.pageNum,
pageSize: this.pageSize, pageSize: this.pageSize,
}) })
.then((res) => { .then((res) => {
this.tableData = res.rows; this.tableData = res.rows;
this.total = res.total; this.total = res.total;
if (init === 1) {
this.$nextTick(() => {
this.initSort();
});
}
}); });
}, },
getTaskList() { getTaskList(init) {
taskApi taskApi
.getTaskList({ .getTaskList({
pageNum: 1, pageNum: 1,
@ -196,7 +204,7 @@ export default {
.then((res) => { .then((res) => {
this.taskList = res.rows; this.taskList = res.rows;
this.taskId = res.rows[0]?.id; this.taskId = res.rows[0]?.id;
this.getTaskUserList(); this.getTaskUserList(init);
}); });
}, },
handleSizeChange(size) { handleSizeChange(size) {
@ -214,25 +222,40 @@ export default {
}); });
}, },
sortChange({ order }) { sortChange({ order }) {
let ele=document.getElementsByClassName('is-sortable')[0] let ele = document.getElementsByClassName("is-sortable")[0];
let className=ele.getAttribute('class') let className = ele.getAttribute("class");
if(order == "descending"){ if (order == "descending") {
ele.setAttribute('class',className.replace('ascending','')+' descending') ele.setAttribute(
}else if(order == "ascending"){ "class",
ele.setAttribute('class',className.replace('descending','')+' ascending') className.replace("ascending", "") + " descending"
}else{ );
ele.setAttribute('class',className.replace('ascending','').replace('descending','')) } else if (order == "ascending") {
ele.setAttribute(
"class",
className.replace("descending", "") + " ascending"
);
} else {
ele.setAttribute(
"class",
className.replace("ascending", "").replace("descending", "")
);
} }
this.searchForm.isAsc = this.searchForm.isAsc =
order == "descending" ? "desc" : order == "ascending" ? "asc" : ""; order == "descending" ? "desc" : order == "ascending" ? "asc" : "";
this.getTaskUserList(); this.getTaskUserList();
}, },
initSort() {
let ele = document.getElementsByClassName("is-sortable")[0];
if(!ele) return
let className = ele.getAttribute("class");
ele.setAttribute("class", className.replace("ascending", "") + " descending");
},
}, },
mounted() { mounted() {
this.getDeptTree(); this.getDeptTree();
this.getTaskList(); this.getTaskList(1);
}, },
}; };
</script> </script>