fix: 修复table固定列错位的问题

This commit is contained in:
CaptainB 2022-03-25 14:23:18 +08:00 committed by 刘瑞斌
parent f8b6aa07ca
commit f4ceed2771
3 changed files with 16 additions and 13 deletions

View File

@ -1,5 +1,5 @@
<template>
<div v-if="tableActive">
<div>
<el-table
border
class="test-content adjust-table ms-table"
@ -164,7 +164,6 @@ export default {
selectDataCounts: 0,
selectRows: new Set(),
selectIds: [],
tableActive: true,
// hasBatchTipShow: false,
defaultSort: {}
};
@ -407,7 +406,7 @@ export default {
},
doLayout() {
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout(), 200);
setTimeout(this.$refs.table.doLayout, 200);
}
},
filter(filters) {
@ -480,9 +479,8 @@ export default {
this.$refs.table.toggleRowSelection();
},
reloadTable() {
this.tableActive = false;
this.$nextTick(() => {
this.tableActive = true;
this.doLayout();
});
},
addPaddingColClass({column}) {
@ -552,4 +550,5 @@ export default {
.disable-hover >>> tr:hover>td{
background-color: #ffffff !important;
}
</style>

View File

@ -429,4 +429,9 @@ export default {
.test-content {
width: 100%;
}
/deep/ .el-table__fixed-body-wrapper {
top: 47px !important; /* 不同表格top值不一样 */
}
</style>

View File

@ -357,10 +357,7 @@ export default {
});
},
initTableHeader() {
this.result.loading = true;
this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, []);
this.result.loading = false;
setTimeout(this.$refs.table.reloadTable, 200);
},
customHeader() {
const list = deepClone(this.tableLabel);
@ -383,16 +380,14 @@ export default {
this.condition.nodeIds = this.selectNodeIds;
if (this.reviewId) {
getTestReviewTestCase(this.currentPage, this.pageSize, this.condition, (data) => {
this.result = getTestReviewTestCase(this.currentPage, this.pageSize, this.condition, (data) => {
this.total = data.itemCount;
this.tableData = data.listObject;
});
}
setTimeout(this.$refs.table.reloadTable, 200);
},
getNexPageData() {
getTestReviewTestCase(this.currentPage * this.pageSize + 1, 1, this.condition, (data) => {
this.result = getTestReviewTestCase(this.currentPage * this.pageSize + 1, 1, this.condition, (data) => {
if (data.listObject && data.listObject.length > 0) {
this.nextPageData = {
name: data.listObject[0].name
@ -405,7 +400,7 @@ export default {
getPreData() {
//
if (this.currentPage > 1 && this.tableData.length === 1) {
getTestReviewTestCase((this.currentPage - 1) * this.pageSize, 1, this.condition, (data) => {
this.result = getTestReviewTestCase((this.currentPage - 1) * this.pageSize, 1, this.condition, (data) => {
if (data.listObject && data.listObject.length > 0) {
this.prePageData = {
name: data.listObject[0].name
@ -554,5 +549,9 @@ export default {
.ms-table-header {
margin-bottom: 10px;
}
/deep/ .el-table__fixed-body-wrapper {
top: 49px !important; /* 不同表格top值不一样 */
}
</style>