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

View File

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

View File

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

View File

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

View File

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