feat(接口定义): 断言规则处理

This commit is contained in:
fit2-zhao 2020-11-23 19:18:47 +08:00
parent 0f0b11fd85
commit 064735b2a4
4 changed files with 92 additions and 52 deletions

View File

@ -58,7 +58,7 @@
<!--<ms-api-jsonpath-suggest-list @addJsonpathSuggest="addJsonpathSuggest" :request="request"-->
<!--ref="jsonpathSuggestList"/>-->
<ms-api-assertions-edit :is-read-only="isReadOnly" :assertions="assertions" style="margin-bottom: 20px"/>
<ms-api-assertions-edit :is-read-only="isReadOnly" :assertions="assertions" :reloadData="reloadData" style="margin-bottom: 20px"/>
</div>
</template>
@ -72,6 +72,7 @@
import MsApiAssertionJsr223 from "./ApiAssertionJsr223";
import MsApiJsonpathSuggestList from "./ApiJsonpathSuggestList";
import MsApiAssertionXPath2 from "./ApiAssertionXPath2";
import {getUUID} from "@/common/js/utils";
export default {
name: "MsApiAssertions",
@ -100,12 +101,14 @@
time: "",
type: "",
loading: false,
reloadData: "",
}
},
methods: {
after() {
this.type = "";
this.reloadData = getUUID().substring(0, 8);
this.reload();
},
suggestJsonOpen() {

View File

@ -1,5 +1,5 @@
<template>
<div>
<div v-loading="loading">
<div class="assertion-item-editing regex" v-if="assertions.regex.length > 0">
<div>
{{ $t("api_test.request.assertions.regex") }}
@ -63,21 +63,40 @@ export default {
components: {
MsApiAssertionXPath2,
MsApiAssertionJsr223, MsApiAssertionJsonPath, MsApiAssertionDuration, MsApiAssertionRegex},
MsApiAssertionJsr223, MsApiAssertionJsonPath, MsApiAssertionDuration, MsApiAssertionRegex
},
props: {
assertions: {},
reloadData: String,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {
return {
loading: false,
}
},
computed: {
isShow() {
let rt = this.assertions.duration;
return rt.value !== undefined;
}
},
watch: {
reloadData() {
this.reload();
}
},
methods: {
reload() {
this.loading = true
this.$nextTick(() => {
this.loading = false
})
},
}
}
</script>

View File

@ -25,7 +25,7 @@
</el-row>
</div>
<ms-api-extract-edit :is-read-only="isReadOnly" :extract="extract"/>
<ms-api-extract-edit :is-read-only="isReadOnly" :reloadData="reloadData" :extract="extract"/>
</div>
</div>
</template>
@ -34,6 +34,7 @@
import {EXTRACT_TYPE} from "../../model/ApiTestModel";
import MsApiExtractEdit from "./ApiExtractEdit";
import MsApiExtractCommon from "./ApiExtractCommon";
import {getUUID} from "@/common/js/utils";
export default {
name: "MsApiExtract",
@ -55,12 +56,14 @@
return {
options: EXTRACT_TYPE,
type: "",
reloadData: "",
}
},
methods: {
after() {
this.type = "";
this.reloadData = getUUID().substring(0, 8);
},
remove() {
this.$emit('remove', this.extract);

View File

@ -1,5 +1,5 @@
<template>
<div>
<div v-loading="loading">
<div class="extract-item-editing regex" v-if="extract.regex.length > 0">
<div>
{{$t("api_test.request.extract.regex")}}
@ -47,12 +47,27 @@
isReadOnly: {
type: Boolean,
default: false
},
reloadData: String,
},
watch: {
reloadData() {
this.reload();
}
},
methods: {
reload() {
this.loading = true
this.$nextTick(() => {
this.loading = false
})
},
},
data() {
return {
type: EXTRACT_TYPE
type: EXTRACT_TYPE,
loading: false
}
}
}