fix: 尝试修复表格固定列之后错乱的问题

This commit is contained in:
Captain.B 2021-03-29 10:56:14 +08:00
parent fd34e063ff
commit c5e977b091
5 changed files with 671 additions and 656 deletions

View File

@ -69,7 +69,8 @@
<el-table-column v-if="item.id == 'tags'" prop="tags" min-width="120px"
:label="$t('api_test.automation.tag')" :key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" :show-tooltip="true" tooltip style="margin-left: 0px; margin-right: 2px"/>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" :show-tooltip="true"
tooltip style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
<el-table-column v-if="item.id == 'userId'" prop="userId" min-width="120px"
@ -160,38 +161,39 @@
</template>
<script>
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../common/components/MsTag";
import {downloadFile, getUUID, strMapToObj} from "@/common/js/utils";
import MsApiReportDetail from "../report/ApiReportDetail";
import MsTableMoreBtn from "./TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
import MsTestPlanList from "./testplan/TestPlanList";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import {API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import PriorityTableItem from "../../../track/common/tableItems/planview/PriorityTableItem";
import PlanStatusTableItem from "../../../track/common/tableItems/plan/PlanStatusTableItem";
import BatchEdit from "../../../track/case/components/BatchEdit";
import {API_SCENARIO_LIST, TEST_CASE_LIST, TEST_PLAN_LIST, WORKSPACE_ID} from "../../../../../common/js/constants";
import {PROJECT_NAME} from "../../../../../common/js/constants";
import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
import BatchMove from "../../../track/case/components/BatchMove";
import {_sort, getLabel, getSystemLabel} from "@/common/js/tableUtils";
import {Api_Scenario_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../common/components/MsTag";
import {downloadFile, getUUID, strMapToObj} from "@/common/js/utils";
import MsApiReportDetail from "../report/ApiReportDetail";
import MsTableMoreBtn from "./TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
import MsTestPlanList from "./testplan/TestPlanList";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import {API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import PriorityTableItem from "../../../track/common/tableItems/planview/PriorityTableItem";
import PlanStatusTableItem from "../../../track/common/tableItems/plan/PlanStatusTableItem";
import BatchEdit from "../../../track/case/components/BatchEdit";
import {API_SCENARIO_LIST, PROJECT_NAME, WORKSPACE_ID} from "../../../../../common/js/constants";
import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
import BatchMove from "../../../track/case/components/BatchMove";
import {
_filter,
_handleSelect,
_handleSelectAll,
_sort,
getLabel,
getSelectDataCounts,
setUnSelectIds, toggleAllSelection
} from "@/common/js/tableUtils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
setUnSelectIds,
toggleAllSelection
} from "@/common/js/tableUtils";
import {Api_Scenario_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
export default {
name: "MsApiScenarioList",
components: {
HeaderLabelOperate,
@ -343,8 +345,6 @@
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.search();
this.getPrincipalOptions([]);
getSystemLabel(this, this.type)
},
watch: {
selectNodeIds() {
@ -422,7 +422,7 @@
}
this.selection = [];
if(!this.condition.selectAll){
if (!this.condition.selectAll) {
this.condition.selectAll = false;
this.condition.unSelectIds = [];
this.selectDataCounts = 0;
@ -440,36 +440,39 @@
item.tags = JSON.parse(item.tags);
}
});
this.result.loading = false;
if (this.$refs.scenarioTable) {
setTimeout(this.$refs.scenarioTable.doLayout, 200)
setTimeout(() => {
this.$refs.scenarioTable.doLayout();
this.result.loading = false;
}, 500)
}
if(!this.condition.selectAll){
if (!this.condition.selectAll) {
this.condition.unSelectIds = response.data.listObject.map(s => s.id);
}
this.$nextTick(function(){
this.$nextTick(function () {
this.checkTableRowIsSelect();
})
});
}
getLabel(this, API_SCENARIO_LIST);
},
checkTableRowIsSelect(){
checkTableRowIsSelect() {
//
if(this.condition.selectAll){
if (this.condition.selectAll) {
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row=>{
if(unSelectIds.indexOf(row.id)<0){
this.$refs.scenarioTable.toggleRowSelection(row,true);
this.tableData.forEach(row => {
if (unSelectIds.indexOf(row.id) < 0) {
this.$refs.scenarioTable.toggleRowSelection(row, true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
}else{
} else {
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
@ -804,32 +807,32 @@
});
},
}
}
}
</script>
<style scoped>
/deep/ .el-drawer__header {
/deep/ .el-drawer__header {
margin-bottom: 0px;
}
}
/deep/ .run-button {
/deep/ .run-button {
background-color: #409EFF;
border-color: #409EFF;
}
}
/deep/ .el-table__fixed-body-wrapper {
/deep/ .el-table__fixed-body-wrapper {
z-index: auto !important;
}
}
/deep/ .el-table__fixed-right {
/deep/ .el-table__fixed-right {
height: 100% !important;
}
}
/deep/ .el-table__fixed {
/deep/ .el-table__fixed {
height: 110px !important;
}
}
/deep/ .el-card__header {
/deep/ .el-card__header {
padding: 10px;
}
}
</style>

View File

@ -353,7 +353,10 @@ export default {
}
})
if (this.$refs.caseTable) {
setTimeout(this.$refs.caseTable.doLayout, 200)
setTimeout(() => {
this.$refs.caseTable.doLayout();
this.result.loading = false;
}, 500)
}
this.$nextTick(function(){
this.checkTableRowIsSelect();

View File

@ -465,7 +465,10 @@
}
})
if (this.$refs.apiDefinitionTable) {
setTimeout(this.$refs.apiDefinitionTable.doLayout, 200)
setTimeout(() => {
this.$refs.apiDefinitionTable.doLayout();
this.result.loading = false;
}, 500)
}
// nexttick:
this.$nextTick(function(){

View File

@ -393,7 +393,10 @@ export default {
item.tags = JSON.parse(item.tags);
})
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200)
setTimeout(() => {
this.$refs.table.doLayout();
this.result.loading = false;
}, 500)
}
this.$nextTick(function(){

View File

@ -476,7 +476,10 @@ export default {
}
this.selectRows.clear();
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200)
setTimeout(() => {
this.$refs.table.doLayout();
this.result.loading = false;
}, 500)
}
});
}