fix(接口测试): 列表切换模块时清空选择框的数据

--bug=1014658 --user=王孝刚 【接口测试】接口、场景列表,切换模块或者进行其他操作后,勾选数据没清空
https://www.tapd.cn/55049933/s/1196198
This commit is contained in:
wxg0103 2022-07-06 17:51:41 +08:00 committed by fit2-zhao
parent 8f3b88621a
commit 0b0780e256
7 changed files with 84 additions and 65 deletions

View File

@ -521,7 +521,7 @@ export default {
if (tab.name === targetName) {
this.diff(tab);
if (tab && this.isSave) {
message += tab.currentScenario.name ? tab.currentScenario.name : this.$t('api_test.automation.add_scenario') + "";
message += tab.currentScenario.name ? tab.currentScenario.name : this.$t('api_test.automation.add_scenario');
}
}
})
@ -707,7 +707,13 @@ export default {
gotoTurn(resource, workspaceId, isTurnSpace) {
let automationData = this.$router.resolve({
name: 'ApiAutomation',
params: {redirectID: getUUID(), dataType: "scenario", dataSelectRange: 'edit:' + resource.id, projectId: resource.projectId, workspaceId: workspaceId}
params: {
redirectID: getUUID(),
dataType: "scenario",
dataSelectRange: 'edit:' + resource.id,
projectId: resource.projectId,
workspaceId: workspaceId
}
});
if (isTurnSpace) {
window.open(automationData.href, '_blank');

View File

@ -308,7 +308,15 @@
</template>
<script>
import {downloadFile, getCurrentProjectID, getUUID, hasLicense, hasPermission, objToStrMap, strMapToObj} from "@/common/js/utils";
import {
downloadFile,
getCurrentProjectID,
getUUID,
hasLicense,
hasPermission,
objToStrMap,
strMapToObj
} from "@/common/js/utils";
import {API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
import {API_SCENARIO_LIST} from "../../../../../common/js/constants";
@ -753,6 +761,7 @@ export default {
}
});
this.$emit('getTrashCase');
this.$refs.scenarioTable.clearSelection();
});
}
},

View File

@ -618,15 +618,15 @@ export default {
id = t.api.id;
if (this.$store.state.apiMap.get(t.api.id).get("responseChange") === true || this.$store.state.apiMap.get(t.api.id).get("requestChange") === true ||
this.$store.state.apiMap.get(t.api.id).get("fromChange") === true) {
message += t.api.name + "";
message += t.api.name;
id = t.api.id;
}
} else if (t.type === 'ADD' && t.title === this.$t('api_test.definition.request.title')) {
message += this.$t('api_test.definition.request.title') + "";
message += this.$t('api_test.definition.request.title');
id = t.api.id;
}
if (t.type === 'ADD' && t.isCopy) {
message += t.api.name + "";
message += t.api.name;
id = t.api.id;
}
}

View File

@ -504,7 +504,7 @@ export default {
//
if (this.$route.query.caseId) {
this.$get('/api/testcase/findById/' + this.$route.query.caseId, (response) => {
if(!response.data){
if (!response.data) {
this.$error(this.$t('api_test.case_jump_message'));
return;
}
@ -717,6 +717,7 @@ export default {
}
});
}
this.$refs.caseTable.clearSelection();
},
setRunning(id) {
this.tableData.forEach(item => {

View File

@ -640,6 +640,7 @@ export default {
item.caseTotal = parseInt(item.caseTotal);
});
this.$emit('getTrashApi');
this.$refs.table.clearSelection();
});
}
if (this.needRefreshModule()) {

View File

@ -23,9 +23,9 @@
ref="table">
<el-table-column
v-if="enableSelection"
width="50"
type="selection"/>
v-if="enableSelection"
width="50"
type="selection"/>
<ms-table-header-select-popover v-if="enableSelection && showSelectAll"
:page-size="pageSize > total ? total : pageSize"
@ -60,13 +60,13 @@
<!-- 拖拽排序 -->
<el-table-column
v-if="enableOrderDrag"
width="20"
column-key="tableRowDropCol">
v-if="enableOrderDrag"
width="20"
column-key="tableRowDropCol">
<template v-slot:default="scope">
<div class="table-row-drop-bar">
<i class="el-icon-more ms-icon-more"/>
<i class="el-icon-more ms-icon-more"/>
<i class="el-icon-more ms-icon-more"/>
<i class="el-icon-more ms-icon-more"/>
</div>
</template>
</el-table-column>
@ -74,30 +74,30 @@
<slot></slot>
<el-table-column
v-if="operators && operators.length > 0"
:fixed="operatorFixed"
:min-width="operatorWidth"
:label="$t('commons.operating')">
v-if="operators && operators.length > 0"
:fixed="operatorFixed"
:min-width="operatorWidth"
:label="$t('commons.operating')">
<template slot="header">
<header-label-operate
v-if="fieldKey"
:disable-header-config="disableHeaderConfig"
@exec="openCustomHeader"/>
v-if="fieldKey"
:disable-header-config="disableHeaderConfig"
@exec="openCustomHeader"/>
</template>
<template
v-slot:default="scope">
v-slot:default="scope">
<div>
<slot
name="opt-before"
:row="scope.row">
name="opt-before"
:row="scope.row">
</slot>
<ms-table-operators
:buttons="operators"
:row="scope.row"
:index="scope.$index"/>
:buttons="operators"
:row="scope.row"
:index="scope.$index"/>
<slot
name="opt-behind"
:row="scope.row">
name="opt-behind"
:row="scope.row">
</slot>
</div>
</template>
@ -105,11 +105,11 @@
</el-table>
<ms-custom-table-header
v-if="fieldKey"
:type="fieldKey"
:custom-fields="customFields"
@reload="resetHeader"
ref="customTableHeader"/>
v-if="fieldKey"
:type="fieldKey"
:custom-fields="customFields"
@reload="resetHeader"
ref="customTableHeader"/>
</div>
</template>
@ -120,15 +120,15 @@ import {
_handleSelect,
_handleSelectAll,
_sort,
getSelectDataCounts,
setUnSelectIds,
toggleAllSelection,
checkTableRowIsSelect,
clearShareDragParam,
getCustomTableHeader,
getSelectDataCounts,
handleRowDrop,
saveCustomTableWidth,
saveLastTableSortField,
handleRowDrop,
clearShareDragParam,
setUnSelectIds,
toggleAllSelection,
} from "@/common/js/tableUtils";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
@ -252,8 +252,8 @@ export default {
return false;
}
},
tableIsLoading:{
type:Boolean,
tableIsLoading: {
type: Boolean,
default() {
return false;
}
@ -340,7 +340,7 @@ export default {
});
}
},
isScrollShow(column, tableTop){ //
isScrollShow(column, tableTop) { //
let columnTop = column.getBoundingClientRect().top;
return columnTop - tableTop > 30;
},
@ -366,7 +366,7 @@ export default {
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
this.selectIds = Array.from(this.selectRows).map(o => o.id);
//
this.$emit('callBackSelectAll',selection);
this.$emit('callBackSelectAll', selection);
this.$nextTick(function () {
setTimeout(this.removeBatchPopper, 1);
});
@ -377,7 +377,7 @@ export default {
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
this.selectIds = Array.from(this.selectRows).map(o => o.id);
//
this.$emit('callBackSelect',selection);
this.$emit('callBackSelect', selection);
this.$nextTick(function () {
setTimeout(this.removeBatchPopper, 1);
});
@ -395,10 +395,10 @@ export default {
this.selectIds = Array.from(this.selectRows).map(o => o.id);
},
headerDragend(newWidth, oldWidth, column, event) {
if(column){
if(column.minWidth){
if (column) {
if (column.minWidth) {
let minWidth = column.minWidth;
if(minWidth > newWidth){
if (minWidth > newWidth) {
column.width = minWidth;
newWidth = minWidth;
}
@ -462,6 +462,8 @@ export default {
},
clearSelection() {
this.clearSelectRows();
this.condition.selectAll = false;
this.condition.unSelectIds = [];
},
getSelectRows() {
return this.selectRows;
@ -469,7 +471,7 @@ export default {
clearSelectRows() {
this.selectRows.clear();
this.selectIds = [];
if(!this.condition.selectAll){
if (!this.condition.selectAll) {
this.condition.selectAll = false;
this.condition.unSelectIds = [];
}
@ -500,8 +502,8 @@ export default {
},
addPaddingColClass({column}) {
if (column.columnKey === 'tableRowDropCol'
|| column.columnKey === 'selectionCol'
|| column.columnKey ==='batchBtnCol') {
|| column.columnKey === 'selectionCol'
|| column.columnKey === 'batchBtnCol') {
return 'padding-col';
}
},
@ -550,24 +552,24 @@ export default {
margin-right: -5px;
}
.ms-table >>> .el-table__body tr.hover-row.current-row>td,
.ms-table >>> .el-table__body tr.hover-row.el-table__row--striped.current-row>td,
.ms-table >>> .el-table__body tr.hover-row.el-table__row--striped>td,
.ms-table >>> .el-table__body tr.hover-row>td {
.ms-table >>> .el-table__body tr.hover-row.current-row > td,
.ms-table >>> .el-table__body tr.hover-row.el-table__row--striped.current-row > td,
.ms-table >>> .el-table__body tr.hover-row.el-table__row--striped > td,
.ms-table >>> .el-table__body tr.hover-row > td {
background-color: #ffffff;
}
/* 解决拖拽排序后hover阴影错乱问题 */
.ms-table >>> .el-table__body tr:hover>td
{
.ms-table >>> .el-table__body tr:hover > td {
background-color: #F5F7FA;
}
.disable-hover >>> tr:hover>td{
.disable-hover >>> tr:hover > td {
background-color: #ffffff !important;
}
.row-click {
cursor:pointer;
cursor: pointer;
}
</style>

View File

@ -210,10 +210,10 @@ import MsContainer from "../../common/components/MsContainer";
import MsAsideContainer from "../../common/components/MsAsideContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {
hasLicense,
getCurrentProjectID,
getCurrentWorkspaceId,
getUUID,
hasLicense,
hasPermission,
setCurTabId
} from "@/common/js/utils";
@ -222,7 +222,7 @@ import TestCaseNodeTree from "../common/TestCaseNodeTree";
import MsTabButton from "@/business/components/common/components/MsTabButton";
import TestCaseMinder from "@/business/components/track/common/minder/TestCaseMinder";
import IsChangeConfirm from "@/business/components/common/components/IsChangeConfirm";
import {openMinderConfirm, saveMinderConfirm} from "@/business/components/track/common/minder/minderUtils";
import {openMinderConfirm} from "@/business/components/track/common/minder/minderUtils";
import TestCaseEditShow from "@/business/components/track/case/components/TestCaseEditShow";
import {PROJECT_ID} from "@/common/js/constants";
@ -268,7 +268,7 @@ export default {
isAsideHidden: true,
showPublicNode: false,
publicTreeNodes: [],
ignoreTreeNodes:false,
ignoreTreeNodes: false,
};
},
created() {
@ -532,13 +532,13 @@ export default {
let t = this.tabs.filter(tab => tab.name === targetName);
let message = "";
if (t && this.$store.state.testCaseMap.has(t[0].testCaseInfo.id) && this.$store.state.testCaseMap.get(t[0].testCaseInfo.id) > 0) {
message += t[0].testCaseInfo.name + "";
message += t[0].testCaseInfo.name;
}
if (t[0].label === this.$t('test_track.case.create')) {
message += this.$t('test_track.case.create') + "";
message += this.$t('test_track.case.create');
}
if (t[0].testCaseInfo.isCopy) {
message += t[0].testCaseInfo.name + "";
message += t[0].testCaseInfo.name;
}
if (message !== "") {
this.$alert(this.$t('commons.track') + " [ " + message + " ] " + this.$t('commons.confirm_info'), '', {