fix: 解决文档不现实回收站内的接口信息问题

解决文档不现实回收站内的接口信息问题
This commit is contained in:
song.tianyang 2021-03-24 15:53:07 +08:00
parent 1d1fb1bc96
commit bf73aa5e30
5 changed files with 24 additions and 11 deletions

View File

@ -20,4 +20,5 @@ public class ApiDocumentRequest {
private String type; private String type;
private String orderCondition; private String orderCondition;
private List<String> apiIdList; private List<String> apiIdList;
private boolean trashEnable;
} }

View File

@ -2,7 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiDocumentMapper"> <mapper namespace="io.metersphere.base.mapper.ext.ExtApiDocumentMapper">
<select id="findApiDocumentSimpleInfoByRequest" resultType="io.metersphere.api.dto.document.ApiDocumentInfoDTO"> <select id="findApiDocumentSimpleInfoByRequest" resultType="io.metersphere.api.dto.document.ApiDocumentInfoDTO">
SELECT api.id,api.name FROM Api_definition api WHERE api.protocol = 'HTTP' AND api.status != 'Trash' SELECT api.id,api.name FROM Api_definition api WHERE api.protocol = 'HTTP'
<if test="request.trashEnable == true">
AND api.status = 'Trash'
</if>
<if test="request.trashEnable == false">
AND api.status != 'Trash'
</if>
<if test="request.projectId != null"> <if test="request.projectId != null">
AND api.project_Id = #{request.projectId} AND api.project_Id = #{request.projectId}
</if> </if>

View File

@ -69,6 +69,7 @@
<api-documents-page class="api-doc-page" <api-documents-page class="api-doc-page"
v-if="activeDom==='right'" v-if="activeDom==='right'"
:project-id="projectId" :project-id="projectId"
:trash-enable="trashEnable"
:module-ids="selectNodeIds"/> :module-ids="selectNodeIds"/>
</ms-tab-button> </ms-tab-button>
<!-- 添加/编辑测试窗口--> <!-- 添加/编辑测试窗口-->

View File

@ -369,6 +369,10 @@ export default {
moduleIds: Array, moduleIds: Array,
sharePage:Boolean, sharePage:Boolean,
pageHeaderHeight:Number, pageHeaderHeight:Number,
trashEnable: {
type: Boolean,
default: false,
},
}, },
activated() { activated() {
this.initApiDocSimpleList(); this.initApiDocSimpleList();
@ -409,6 +413,9 @@ export default {
}, },
clientHeight() { //clientHeight clientHeight() { //clientHeight
this.changeFixed(this.clientHeight); this.changeFixed(this.clientHeight);
},
trashEnable() {
this.initApiDocSimpleList();
} }
}, },
methods: { methods: {
@ -441,7 +448,10 @@ export default {
} }
if (this.moduleIds.length > 0) { if (this.moduleIds.length > 0) {
simpleRequest.moduleIds = this.moduleIds; simpleRequest.moduleIds = this.moduleIds;
} else {
simpleRequest.moduleIds = [];
} }
simpleRequest.trashEnable = this.trashEnable;
let simpleInfoUrl = "/api/document/selectApiSimpleInfo"; let simpleInfoUrl = "/api/document/selectApiSimpleInfo";
this.apiInfoArray = []; this.apiInfoArray = [];
@ -533,9 +543,6 @@ export default {
// //
this.checkApiInfoNode(this.apiStepIndex,true); this.checkApiInfoNode(this.apiStepIndex,true);
}, },
stepClick(stepIndex) {
this.apiStepIndex = stepIndex;
},
getColor(enable, method) { getColor(enable, method) {
return this.methodColorMap.get(method); return this.methodColorMap.get(method);
}, },
@ -642,8 +649,6 @@ export default {
for(let i = 0;i<this.apiShowArray.length;i++){ for(let i = 0;i<this.apiShowArray.length;i++){
names += this.apiShowArray[i].name+";"; names += this.apiShowArray[i].name+";";
} }
console.log("["+apiDocDivScrollTop+":"+this.apiStepIndex+"]:["+lastIndex+":"+this.currentApiIndexInApiShowArray+"]-------->"+names);
if(lastIndex < this.currentApiIndexInApiShowArray){ if(lastIndex < this.currentApiIndexInApiShowArray){
// //
if(this.needAsyncSelect){ if(this.needAsyncSelect){
@ -684,10 +689,6 @@ export default {
} }
this.apiStepIndex ++; this.apiStepIndex ++;
} }
// this.apiStepIndex = lastIndex;
// // 2
// this.checkApiInfoNode(this.apiStepIndex);
}, },
redirectScroll(){ redirectScroll(){
//api //api

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<!-- <api-document-item :project-id="projectId" :module-ids="moduleIds"/>--> <!-- <api-document-item :project-id="projectId" :module-ids="moduleIds"/>-->
<api-document-anchor :is-share-page="isSharePage" :project-id="projectId" :module-ids="moduleIds"></api-document-anchor> <api-document-anchor :is-share-page="isSharePage" :trash-enable="trashEnable" :project-id="projectId" :module-ids="moduleIds"></api-document-anchor>
</div> </div>
</template> </template>
@ -23,6 +23,10 @@ export default {
projectId:String, projectId:String,
moduleIds:Array, moduleIds:Array,
activeDom:String, activeDom:String,
trashEnable: {
type: Boolean,
default: false,
},
}, },
created: function () { created: function () {
}, },