From e19cd654c14f000d7f77b2d23e016429678b1e58 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 20 四月 2026 16:36:12 +0800
Subject: [PATCH] 用户管理表格支持拖拽排序
---
src/views/performance/competency/index.vue | 37 +++++++++++++++++++++++++++++++------
1 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/src/views/performance/competency/index.vue b/src/views/performance/competency/index.vue
index defb703..e5476d5 100644
--- a/src/views/performance/competency/index.vue
+++ b/src/views/performance/competency/index.vue
@@ -46,6 +46,7 @@
</el-form-item>
</el-form>
<el-table
+ ref="competencyTable"
v-if="refreshTable"
v-loading="loading"
:data="recordList"
@@ -127,12 +128,12 @@
levelDictList:[],
tableHeight:0,
downloadLoading:false,
- postList:[]
+ postList:[],
+ layoutTimer: null
};
},
created() {
this.getLevelDict()
- this.getTableHeader();
this.getList();
this.getPostList()
this.$nextTick(()=>{
@@ -141,11 +142,29 @@
},
mounted() {
window.addEventListener("resize", this.getTableHeight);
+ this.scheduleTableLayout()
},
beforeDestroy() {
window.removeEventListener("resize", this.getTableHeight);
+ if (this.layoutTimer) {
+ clearTimeout(this.layoutTimer)
+ this.layoutTimer = null
+ }
},
methods: {
+ scheduleTableLayout() {
+ if (this.layoutTimer) {
+ clearTimeout(this.layoutTimer)
+ }
+ this.layoutTimer = setTimeout(() => {
+ this.$nextTick(() => {
+ const table = this.$refs.competencyTable
+ if (table && typeof table.doLayout === 'function') {
+ table.doLayout()
+ }
+ })
+ }, 0)
+ },
getPostList(){
optionSelect().then(res=>{
if(res.code===200){
@@ -171,6 +190,7 @@
const innerHeight = window.innerHeight;
const otherHeight = 50+46+40+51;
this.tableHeight = innerHeight - otherHeight;
+ this.scheduleTableLayout()
},
changeSkillLevel(row, itemId){
const configObj = {...row[itemId]}
@@ -196,20 +216,25 @@
getTableHeader() {
listConfig({ isEnable: true }).then((response) => {
this.tableHeaderList = this.handleTree(response.data, "id");
+ this.scheduleTableLayout()
});
},
/** 鏌ヨ鍒楄〃 */
getList() {
this.loading = true
- this.getTableHeader();
- getPageList(this.queryParams).then(res=>{
- if(res.code===200){
- this.recordList = res.data
+ Promise.all([
+ listConfig({ isEnable: true }),
+ getPageList(this.queryParams)
+ ]).then(([headerRes, listRes]) => {
+ this.tableHeaderList = this.handleTree(headerRes.data, "id");
+ if(listRes.code===200){
+ this.recordList = listRes.data
}
}).catch(error=>{
console.log(error)
}).finally(() => {
this.loading = false;
+ this.scheduleTableLayout()
});
},
/** 鎼滅储鎸夐挳鎿嶄綔 */
--
Gitblit v1.9.3