人员绩效表排序调整

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

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