refactor(接口测试、接口场景、功能案例): 更改回收站交互:点击回收站节点时在表格处单开一个回收站弹窗

更改回收站交互:点击回收站节点时在表格处单开一个回收站弹窗
This commit is contained in:
song-tianyang 2021-07-17 14:35:58 +08:00 committed by 刘瑞斌
parent 63a38213c9
commit e9df57709a
14 changed files with 219 additions and 28 deletions

View File

@ -325,7 +325,7 @@
<update id="removeToGcByExample" parameterType="io.metersphere.base.domain.ApiScenarioExample">
update api_scenario
set original_state=status,
status = 'Trash', module_path = null, api_scenario_module_id = null
status = 'Trash', module_path = null, api_scenario_module_id = null, delete_user_id = #{operator},delete_time = #{operationTime}
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -334,7 +334,7 @@
<update id="reduction">
update api_scenario
set
status = original_state
status = original_state, delete_user_id = null,delete_time = null
where id in
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}

View File

@ -104,4 +104,6 @@ public interface ExtTestCaseMapper {
int deleteToGc(@Param("request") TestCase testCase);
int reduction(@Param("ids") List<String> ids);
void refreshOriginalStatusByIds(@Param("ids") List<String> ids);
}

View File

@ -529,4 +529,14 @@
#{v}
</foreach>
</update>
<update id="refreshOriginalStatusByIds">
update test_case
set
original_status = 'Underway'
where (original_status IS NULL OR original_status = 'Trash') AND id in
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</update>
</mapper>

View File

@ -1512,6 +1512,7 @@ public class TestCaseService {
public void reduction(TestCaseBatchRequest request) {
TestCaseExample example = this.getBatchExample(request);
if(CollectionUtils.isNotEmpty(request.getIds())){
extTestCaseMapper.refreshOriginalStatusByIds(request.getIds());
extTestCaseMapper.reduction(request.getIds());
}
}

View File

@ -20,6 +20,27 @@
<ms-main-container style="overflow: hidden">
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="removeTab">
<el-tab-pane
name="trash"
:label="$t('commons.trash')" v-if="trashEnable">
<ms-api-scenario-list
@getTrashCase="getTrashCase"
@refreshTree="refreshTree"
:module-tree="nodeTree"
:module-options="moduleOptions"
:select-node-ids="selectNodeIds"
:trash-enable="true"
:checkRedirectID="checkRedirectID"
:isRedirectEdit="isRedirectEdit"
:is-read-only="isReadOnly"
@openScenario="editScenario"
@edit="editScenario"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
:custom-num="customNum"
:init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="apiTrashScenarioList"/>
</el-tab-pane>
<el-tab-pane name="default" :label="$t('api_test.automation.scenario_list')">
<ms-api-scenario-list
@getTrashCase="getTrashCase"
@ -27,7 +48,7 @@
:module-tree="nodeTree"
:module-options="moduleOptions"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:trash-enable="false"
:checkRedirectID="checkRedirectID"
:isRedirectEdit="isRedirectEdit"
:is-read-only="isReadOnly"
@ -40,6 +61,7 @@
ref="apiScenarioList"/>
</el-tab-pane>
<el-tab-pane
:key="item.name"
v-for="(item) in tabs"
@ -156,6 +178,8 @@ export default {
},
selectNodeIds() {
this.activeName = "default";
},
activeName(){
}
},
methods: {
@ -222,6 +246,8 @@ export default {
addTab(tab) {
if (tab.name === 'default') {
this.$refs.apiScenarioList.search();
} else if(tab.name === 'trash'){
this.$refs.apiTrashScenarioList.search();
}
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
@ -322,10 +348,16 @@ export default {
saveScenario(data) {
this.setTabLabel(data);
this.$refs.apiScenarioList.search(data);
if(this.$refs.apiTrashScenarioList){
this.$refs.apiTrashScenarioList.search(data);
}
},
refresh(data) {
this.setTabTitle(data);
this.$refs.apiScenarioList.search(data);
if(this.$refs.apiTrashScenarioList){
this.$refs.apiTrashScenarioList.search(data);
}
this.$refs.nodeTree.list();
},
refreshTree() {
@ -334,6 +366,9 @@ export default {
refreshAll() {
this.$refs.nodeTree.list();
this.$refs.apiScenarioList.search();
if(this.$refs.apiTrashScenarioList){
this.$refs.apiTrashScenarioList.search();
}
},
setTabTitle(data) {
for (let index in this.tabs) {
@ -365,6 +400,12 @@ export default {
this.activeName = "default";
this.initApiTableOpretion = "enableTrash";
this.trashEnable = data;
if(data){
this.activeName = "trash";
}else {
this.activeName = "default";
}
this.getTrashCase();
},
getTrashCase() {

View File

@ -190,7 +190,7 @@
<!-- 执行结果 -->
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
size="90%">
<ms-api-report-detail @refresh="search" :debug="true" :scenario="currentScenario" :scenarioId="scenarioId" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
</el-drawer>
<!--测试计划-->
<el-drawer :visible.sync="planVisible" :destroy-on-close="true" direction="ltr" :withHeader="false"
@ -467,11 +467,23 @@ export default {
if (!this.projectName || this.projectName === "") {
this.getProjectName();
}
if (!this.isReferenceTable) {
this.operators = this.unTrashOperators;
this.buttons = this.unTrashButtons;
}
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
if(this.trashEnable){
this.condition.filters = {status: ["Trash"]};
this.condition.moduleIds = [];
this.operators = this.trashOperators;
this.buttons = this.trashButtons;
}else {
if (!this.isReferenceTable) {
this.operators = this.unTrashOperators;
this.buttons = this.unTrashButtons;
}else {
this.operators = this.unTrashOperators;
this.buttons = this.unTrashButtons;
}
}
let orderArr = this.getSortField();
if (orderArr) {
this.condition.orders = orderArr;
@ -575,6 +587,9 @@ export default {
});
if (this.$refs.scenarioTable) {
this.$refs.scenarioTable.clear();
this.$nextTick(() => {
this.$refs.scenarioTable.doLayout();
});
}
this.$emit('getTrashCase');
});

View File

@ -22,6 +22,58 @@
<ms-main-container>
<!-- 主框架列表 -->
<el-tabs v-model="apiDefaultTab" @edit="handleTabRemove" @tab-click="addTab">
<el-tab-pane
name="trash"
:label="$t('commons.trash')" v-if="trashEnable">
<ms-tab-button
v-if="this.trashTabInfo.type === 'list'"
:active-dom.sync="trashActiveDom"
:left-tip="$t('api_test.definition.api_title')"
:right-tip="$t('api_test.definition.case_title')"
:middle-button-enable="false"
left-content="API"
right-content="CASE"
>
<!-- 列表集合 -->
<ms-api-list
v-if="trashActiveDom==='left'"
@runTest="runTest"
@refreshTree="refreshTree"
:module-tree="nodeTree"
:module-options="moduleOptions"
:current-protocol="currentProtocol"
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
:trash-enable="true"
:queryDataType="queryDataType"
:selectDataRange="selectDataRange"
:is-read-only="isReadOnly"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@editApi="editApi"
@handleCase="handleCase"
@showExecResult="showExecResult"
@refreshTable="refresh"
:init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="trashApiList"/>
<!--测试用例列表-->
<api-case-simple-list
v-if="trashActiveDom==='right'"
:current-protocol="currentProtocol"
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
:trash-enable="true"
:queryDataType="queryDataType"
:is-read-only="isReadOnly"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@handleCase="handleCase"
@showExecResult="showExecResult"
ref="trashCaseList"/>
</ms-tab-button>
</el-tab-pane>
<el-tab-pane v-for="(item) in apiTabs"
:key="item.name"
:label="item.title"
@ -47,7 +99,7 @@
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:trash-enable="false"
:queryDataType="queryDataType"
:selectDataRange="selectDataRange"
:is-read-only="isReadOnly"
@ -58,7 +110,7 @@
@refreshTable="refresh"
:init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="apiList"/>
ref="apiDefList"/>
<!--测试用例列表-->
<api-case-simple-list
v-if="activeDom==='middle'"
@ -66,13 +118,13 @@
:visible="visible"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:trash-enable="false"
:queryDataType="queryDataType"
:is-read-only="isReadOnly"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@handleCase="handleCase"
@showExecResult="showExecResult"
ref="apiList"/>
ref="caseList"/>
<api-documents-page class="api-doc-page"
v-if="activeDom==='right'"
:project-id="projectId"
@ -247,7 +299,14 @@ export default {
type: "list",
closable: false
}],
trashTabInfo: {
title: this.$t('api_test.definition.api_title'),
name: 'default',
type: "list",
closable: false
},
activeDom: "left",
trashActiveDom: "left",
syncTabs: [],
nodeTree: [],
currentModulePath: "",
@ -259,6 +318,7 @@ export default {
let dataRange = this.$route.params.dataSelectRange;
if (dataRange && dataRange.length > 0) {
this.activeDom = 'middle';
this.trashActiveDom = 'left';
}
},
watch: {
@ -456,13 +516,25 @@ export default {
this.$warning('用例列表暂不支持导出,请切换成接口列表');
return;
}
this.$refs.apiList[0].exportApi(type);
this.$refs.apiDefList[0].exportApi(type);
},
refreshModule() {
this.$refs.nodeTree.list();
},
refresh(data) {
this.$refs.apiList[0].initTable(data);
if(this.$refs.caseList){
this.$refs.caseList[0].initTable();
}
if(this.$refs.trashApiList){
this.$refs.trashApiList.initTable();
}
if(this.$refs.trashCaseList){
this.$refs.trashCaseList.initTable();
}
if(this.$refs.apiDefList){
this.$refs.apiDefList[0].initTable();
}
//this.$refs.nodeTree.list();
},
refreshTree() {
@ -513,6 +585,11 @@ export default {
enableTrash(data) {
this.initApiTableOpretion = "trashEnable";
this.trashEnable = data;
if(data){
this.apiDefaultTab = "trash";
}else {
this.apiDefaultTab = "default"
}
},
updateInitApiTableOpretion(param){
this.initApiTableOpretion = param;

View File

@ -540,7 +540,8 @@ export default {
obj = Object.assign(obj, this.condition);
this.$post('/api/testcase/deleteBatchByParam/', obj, () => {
this.$refs.caseTable.clearSelectRows();
this.initTable();
// this.initTable();
this.$emit('refreshTable');
this.$success(this.$t('commons.delete_success'));
});
}
@ -560,7 +561,8 @@ export default {
obj = Object.assign(obj, this.condition);
this.$post('/api/testcase/deleteToGcByParam/', obj, () => {
this.$refs.caseTable.clearSelectRows();
this.initTable();
// this.initTable();
this.$emit('refreshTable');
this.$success(this.$t('commons.delete_success'));
});
}
@ -601,7 +603,8 @@ export default {
if (action === 'confirm') {
this.$get('/api/testcase/delete/' + apiCase.id, () => {
this.$success(this.$t('commons.delete_success'));
this.initTable();
// this.initTable();
this.$emit('refreshTable');
});
}
}
@ -615,7 +618,8 @@ export default {
if (action === 'confirm') {
this.$get('/api/testcase/deleteToGc/' + apiCase.id, () => {
this.$success(this.$t('commons.delete_success'));
this.initTable();
// this.initTable();
this.$emit('refreshTable');
});
}
}
@ -640,7 +644,8 @@ export default {
}else{
this.$success(this.$t('commons.save_success'));
}
this.search();
// this.search();
this.$emit('refreshTable');
});
},
handleBatchRestore() {
@ -665,7 +670,8 @@ export default {
}else{
this.$success(this.$t('commons.save_success'));
}
this.search();
// this.search();
this.$emit('refreshTable');
});
},
setEnvironment(data) {

View File

@ -644,13 +644,15 @@ export default {
let rows = {ids: [tmp.id]};
this.$post('/api/definition/reduction/', rows, () => {
this.$success(this.$t('commons.save_success'));
this.search();
// this.search();
this.$emit('refreshTable');
});
},
handleBatchRestore() {
this.$post('/api/definition/reduction/', buildBatchParam(this, this.$refs.table.selectIds), () => {
this.$success(this.$t('commons.save_success'));
this.search();
// this.search();
this.$emit('refreshTable');
});
},
handleDeleteBatch() {
@ -661,7 +663,8 @@ export default {
if (action === 'confirm') {
this.$post('/api/definition/deleteBatchByParams/', buildBatchParam(this, this.$refs.table.selectIds), () => {
this.$refs.table.clear();
this.initTable();
// this.initTable();
this.$emit("refreshTable");
this.$success(this.$t('commons.delete_success'));
});
}
@ -674,7 +677,8 @@ export default {
if (action === 'confirm') {
this.$post('/api/definition/removeToGcByParams/', buildBatchParam(this, this.$refs.table.selectIds), () => {
this.$refs.table.clear();
this.initTable();
// this.initTable();
this.$emit("refreshTable");
this.$success(this.$t('commons.delete_success'));
this.$refs.caseList.apiCaseClose();
});
@ -733,7 +737,8 @@ export default {
if (this.trashEnable) {
this.$get('/api/definition/delete/' + api.id, () => {
this.$success(this.$t('commons.delete_success'));
this.initTable();
// this.initTable();
this.$emit("refreshTable");
});
return;
}
@ -744,7 +749,8 @@ export default {
let ids = [api.id];
this.$post('/api/definition/removeToGc/', ids, () => {
this.$success(this.$t('commons.delete_success'));
this.initTable();
// this.initTable();
this.$emit("refreshTable");
this.$refs.caseList.apiCaseClose();
});
}

View File

@ -19,6 +19,24 @@
<ms-main-container>
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="removeTab">
<el-tab-pane name="trash" v-if="trashEnable" :label="$t('commons.trash')">
<test-case-list
:checkRedirectID="checkRedirectID"
:isRedirectEdit="isRedirectEdit"
:tree-nodes="treeNodes"
:trash-enable="true"
@refreshTable="refresh"
@testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase"
@testCaseDetail="showTestCaseDetail"
@refresh="refresh"
@refreshAll="refreshAll"
@setCondition="setCondition"
@decrease="decrease"
:custom-num="custom_num"
ref="testCaseList">
</test-case-list>
</el-tab-pane>
<el-tab-pane name="default" :label="$t('api_test.definition.case_title')">
<ms-tab-button
:active-dom.sync="activeDom"
@ -32,7 +50,7 @@
:checkRedirectID="checkRedirectID"
:isRedirectEdit="isRedirectEdit"
:tree-nodes="treeNodes"
:trash-enable="trashEnable"
:trash-enable="false"
@refreshTable="refresh"
@testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase"
@ -175,6 +193,13 @@ export default {
}
});
},
trashEnable(){
if(this.trashEnable){
this.activeName = 'trash';
}else {
this.activeName = 'default';
}
}
},
computed: {
checkRedirectID: function () {

View File

@ -365,8 +365,13 @@ export default {
},
},
created: function () {
this.getTemplateField();
this.$emit('setCondition', this.condition);
this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]};
if(this.trashEnable){
this.condition.filters = {status: ["Trash"]};
}else {
this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]};
}
let orderArr = this.getSortField();
if(orderArr){
this.condition.orders = orderArr;

View File

@ -3,6 +3,7 @@ export default {
project_permission: 'Please add the project permission first',
failure_continues: "Failure continues",
full_screen_editing: "Full screen editing",
trash: "Trash",
yes: "yes",
no: "no",
default: "default",

View File

@ -3,6 +3,7 @@ export default {
project_permission: '请先添加该项目权限',
failure_continues: "失败继续",
full_screen_editing: "全屏编辑",
trash: "回收站",
yes: "是",
no: "否",
default: "默认值",

View File

@ -3,6 +3,7 @@ export default {
project_permission: '請先添加該項目許可權',
failure_continues: "失敗繼續",
full_screen_editing: "全屏編輯",
trash: "回收站",
yes: "是",
no: "否",
default: "默認值",