fix (接口定义): 修复另存新用例缺陷

--bug=1007392 --user=赵勇 【接口定义】-编辑接口-TEST-生成测试数据后选择”另存为新用例“失败,单击没反应 https://www.tapd.cn/55049933/s/1058509
This commit is contained in:
fit2-zhao 2021-10-25 16:19:58 +08:00 committed by fit2-zhao
parent 04bc76ff2c
commit 7a167d4454
8 changed files with 34 additions and 16 deletions

View File

@ -41,6 +41,7 @@
:api-data="currentApi" :api-data="currentApi"
:project-id="projectId" :project-id="projectId"
@saveAsApi="editApi" @saveAsApi="editApi"
@saveAsCase="saveAsCase"
@refresh="refresh" @refresh="refresh"
v-if="currentProtocol==='HTTP'" v-if="currentProtocol==='HTTP'"
/> />
@ -50,6 +51,7 @@
:api-data="currentApi" :api-data="currentApi"
:project-id="projectId" :project-id="projectId"
@saveAsApi="editApi" @saveAsApi="editApi"
@saveAsCase="saveAsCase"
@refresh="refresh" @refresh="refresh"
v-if="currentProtocol==='TCP'" v-if="currentProtocol==='TCP'"
/> />
@ -59,6 +61,7 @@
:api-data="currentApi" :api-data="currentApi"
:project-id="projectId" :project-id="projectId"
@saveAsApi="editApi" @saveAsApi="editApi"
@saveAsCase="saveAsCase"
@refresh="refresh" @refresh="refresh"
v-if="currentProtocol==='SQL'" v-if="currentProtocol==='SQL'"
/> />
@ -68,18 +71,19 @@
:api-data="currentApi" :api-data="currentApi"
:project-id="projectId" :project-id="projectId"
@saveAsApi="editApi" @saveAsApi="editApi"
@saveAsCase="saveAsCase"
@refresh="refresh" @refresh="refresh"
v-if="currentProtocol==='DUBBO'" v-if="currentProtocol==='DUBBO'"
/> />
</div> </div>
<div v-if="showMock && (currentProtocol === 'HTTP')" class="ms-api-div"> <div v-if="showMock && (currentProtocol === 'HTTP')" class="ms-api-div">
<!-- <mock-config :base-mock-config-data="baseMockConfigData" type="http"/>--> <!-- <mock-config :base-mock-config-data="baseMockConfigData" type="http"/>-->
<mock-tab :base-mock-config-data="baseMockConfigData" :is-tcp="false"/> <mock-tab :base-mock-config-data="baseMockConfigData" :is-tcp="false"/>
</div> </div>
<div v-if="showMock && (currentProtocol === 'TCP')" class="ms-api-div"> <div v-if="showMock && (currentProtocol === 'TCP')" class="ms-api-div">
<mock-tab :base-mock-config-data="baseMockConfigData" :is-tcp="true"/> <mock-tab :base-mock-config-data="baseMockConfigData" :is-tcp="true"/>
<!-- <tcp-mock-config :base-mock-config-data="baseMockConfigData" type="tcp"/>--> <!-- <tcp-mock-config :base-mock-config-data="baseMockConfigData" type="tcp"/>-->
</div> </div>
<div v-if="showTestCaseList"> <div v-if="showTestCaseList">
<!--测试用例列表--> <!--测试用例列表-->
@ -96,6 +100,7 @@
<ms-api-case-list <ms-api-case-list
:createCase="createCase" :createCase="createCase"
:currentApi="api" :currentApi="api"
@reLoadCase="reLoadCase"
ref="caseList"/> ref="caseList"/>
</el-card> </el-card>
</template> </template>
@ -178,6 +183,9 @@ export default {
} }
}, },
methods: { methods: {
reLoadCase() {
this.$refs.trashCaseList.initTable();
},
sort(stepArray) { sort(stepArray) {
if (stepArray) { if (stepArray) {
for (let i in stepArray) { for (let i in stepArray) {
@ -281,17 +289,21 @@ export default {
this.loading = false this.loading = false
}); });
}, },
saveAsCase(api) {
this.showApiList = false;
this.showTestCaseList = true;
this.showTest = false;
this.showMock = false;
this.createCase = getUUID();
this.api = api;
this.$refs.caseList.open();
},
refreshButtonActiveClass(tabType) { refreshButtonActiveClass(tabType) {
if (tabType === "testCase") { if (tabType === "testCase") {
this.showApiList = false; this.showApiList = false;
this.showTestCaseList = true; this.showTestCaseList = true;
this.showTest = false; this.showTest = false;
this.showMock = false; this.showMock = false;
if (this.$store.state.currentApiCase && this.$store.state.currentApiCase.api) {
this.createCase = getUUID();
this.api = this.$store.state.currentApiCase.api;
this.$refs.caseList.open();
}
this.$store.state.currentApiCase = {case: true}; this.$store.state.currentApiCase = {case: true};
} else if (tabType === "test") { } else if (tabType === "test") {
this.showApiList = false; this.showApiList = false;

View File

@ -280,9 +280,11 @@ export default {
if (requireComponent != null && JSON.stringify(esbDefinition) != '{}' && JSON.stringify(esbDefinitionResponse) != '{}') { if (requireComponent != null && JSON.stringify(esbDefinition) != '{}' && JSON.stringify(esbDefinitionResponse) != '{}') {
this.showXpackCompnent = true; this.showXpackCompnent = true;
} }
if (this.apiCase && this.apiCase.id) {
this.$get('/api/testcase/follow/' + this.apiCase.id, response => { this.$get('/api/testcase/follow/' + this.apiCase.id, response => {
this.apiCase.follows = response.data; this.apiCase.follows = response.data;
}); });
}
}, },
watch: { watch: {
'apiCase.selected'() { 'apiCase.selected'() {
@ -463,7 +465,7 @@ export default {
this.reload(); this.reload();
// //
if (this.api.source === "editCase") { if (this.api.source === "editCase") {
this.$store.state.currentApiCase = {refresh: "true"}; this.$emit('reLoadCase');
} }
if (!hideAlert) { if (!hideAlert) {
this.$emit('refresh'); this.$emit('refresh');

View File

@ -33,6 +33,7 @@
@batchRun="batchRun" @batchRun="batchRun"
@apiCaseSelected="apiCaseSelected" @apiCaseSelected="apiCaseSelected"
@showHistory="showHistory" @showHistory="showHistory"
@reLoadCase="reLoadCase"
:environment="environment" :environment="environment"
:select-size="selectSize" :select-size="selectSize"
:is-case-edit="isCaseEdit" :is-case-edit="isCaseEdit"
@ -268,6 +269,9 @@ export default {
refresh() { refresh() {
this.$emit('refresh'); this.$emit('refresh');
}, },
reLoadCase(){
this.$emit('reLoadCase');
},
selectAll(isSelectAll) { selectAll(isSelectAll) {
this.apiCaseList.forEach(item => { this.apiCaseList.forEach(item => {
this.$set(item, 'selected', isSelectAll); this.$set(item, 'selected', isSelectAll);

View File

@ -194,7 +194,7 @@
</div> </div>
<api-case-list @showExecResult="showExecResult" @refreshCase="setRunning" :currentApi="selectCase" ref="caseList" <api-case-list @showExecResult="showExecResult" @refreshCase="setRunning" :currentApi="selectCase" ref="caseList"
@stop="stop"/> @stop="stop" @reLoadCase="initTable"/>
<!--批量编辑--> <!--批量编辑-->
<ms-batch-edit ref="batchEdit" :data-count="$refs.caseTable ? $refs.caseTable.selectDataCounts : 0" <ms-batch-edit ref="batchEdit" :data-count="$refs.caseTable ? $refs.caseTable.selectDataCounts : 0"
@batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/> @batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/>

View File

@ -166,7 +166,7 @@ export default {
}, },
saveAsCase() { saveAsCase() {
// //
this.$store.state.currentApiCase = {case: getUUID(), api: this.api}; this.$emit('saveAsCase', this.api);
}, },
saveAsApi() { saveAsApi() {
let data = {}; let data = {};

View File

@ -204,7 +204,7 @@ export default {
}, },
saveAsCase() { saveAsCase() {
// //
this.$store.state.currentApiCase = {case: getUUID(), api: this.api}; this.$emit('saveAsCase', this.api);
}, },
saveAsApi() { saveAsApi() {
let data = {}; let data = {};

View File

@ -164,7 +164,7 @@ export default {
return bodyUploadFiles; return bodyUploadFiles;
}, },
saveAsCase() { saveAsCase() {
this.$store.state.currentApiCase = {case: getUUID(), api: this.api}; this.$emit('saveAsCase', this.api);
}, },
saveAsApi() { saveAsApi() {
let data = {}; let data = {};

View File

@ -195,7 +195,7 @@ export default {
return bodyUploadFiles; return bodyUploadFiles;
}, },
saveAsCase() { saveAsCase() {
this.$store.state.currentApiCase = {case: getUUID(), api: this.api}; this.$emit('saveAsCase', this.api);
}, },
saveAsApi() { saveAsApi() {
let data = {}; let data = {};