This commit is contained in:
shiziyuan9527 2020-12-16 15:44:09 +08:00
commit d4f28df3b9
6 changed files with 50 additions and 64 deletions

@ -1 +1 @@
Subproject commit 1fe20ba15a7ca3fe9f77ddf866021e7c7dfe5969 Subproject commit 61397c16728a63493507679f7e0940d9099f337f

View File

@ -17,15 +17,21 @@
<el-col :span="5"> <el-col :span="5">
<el-tooltip effect="dark" :content="request.responseResult.responseCode" placement="bottom" :open-delay="800"> <el-tooltip effect="dark" :content="request.responseResult.responseCode" placement="bottom" :open-delay="800">
<div class="url" style="color: #5daf34">{{ request.responseResult.responseCode }}</div> <div style="color: #5daf34" v-if="request.success">{{ request.responseResult.responseCode }}</div>
<div style="color: #FE6F71" v-else>{{ request.responseResult.responseCode }}</div>
</el-tooltip> </el-tooltip>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
{{request.responseResult.responseTime}} ms <span v-if="request.success">
{{request.responseResult.responseTime}} ms
</span>
<span style="color: #FE6F71" v-else>
{{request.responseResult.responseTime}} ms
</span>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<div class="success"> <div>
<el-tag size="mini" type="success" v-if="request.success"> <el-tag size="mini" type="success" v-if="request.success">
{{ $t('api_report.success') }} {{ $t('api_report.success') }}
</el-tag> </el-tag>

View File

@ -8,33 +8,10 @@
</div> </div>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<div class="name">{{request.name}}</div>
<el-tooltip effect="dark" :content="request.url" placement="bottom" :open-delay="800"> <el-tooltip effect="dark" :content="request.url" placement="bottom" :open-delay="800">
<div class="url">{{request.url}}</div> <div class="url">{{request.url}}</div>
</el-tooltip> </el-tooltip>
</el-col> </el-col>
<el-col :span="4">
{{request.startTime | timestampFormatDate(true) }}
</el-col>
<el-col :span="2">
<div class="time">
{{request.responseResult.responseTime}}
</div>
</el-col>
<el-col :span="2">
{{request.error}}
</el-col>
<el-col :span="2">
{{assertion}}
</el-col>
<el-col :span="2">
<el-tag size="mini" type="success" v-if="request.success">
{{$t('api_report.success')}}
</el-tag>
<el-tag size="mini" type="danger" v-else>
{{$t('api_report.fail')}}
</el-tag>
</el-col>
</el-row> </el-row>
</div> </div>
<el-collapse-transition> <el-collapse-transition>
@ -52,7 +29,6 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div v-else> <div v-else>
<ms-request-metric :request="request"/>
<ms-request-text v-if="isCodeEditAlive" :request="request"/> <ms-request-text v-if="isCodeEditAlive" :request="request"/>
<br> <br>
<ms-response-text :request-type="requestType" v-if="isCodeEditAlive" :response="request.responseResult"/> <ms-response-text :request-type="requestType" v-if="isCodeEditAlive" :response="request.responseResult"/>

View File

@ -32,36 +32,40 @@
methods: { methods: {
setFiles(item, bodyUploadFiles, obj) { setFiles(item, bodyUploadFiles, obj) {
if (item.body) { if (item.body) {
item.body.kvs.forEach(param => { if (item.body.kvs) {
if (param.files) { item.body.kvs.forEach(param => {
param.files.forEach(item => { if (param.files) {
if (item.file) { param.files.forEach(item => {
if (!item.id) { if (item.file) {
let fileId = getUUID().substring(0, 12); if (!item.id) {
item.name = item.file.name; let fileId = getUUID().substring(0, 12);
item.id = fileId; item.name = item.file.name;
item.id = fileId;
}
obj.bodyUploadIds.push(item.id);
bodyUploadFiles.push(item.file);
} }
obj.bodyUploadIds.push(item.id); });
bodyUploadFiles.push(item.file); }
} });
}); }
} if (item.body.binary) {
}); item.body.binary.forEach(param => {
item.body.binary.forEach(param => { if (param.files) {
if (param.files) { param.files.forEach(item => {
param.files.forEach(item => { if (item.file) {
if (item.file) { if (!item.id) {
if (!item.id) { let fileId = getUUID().substring(0, 12);
let fileId = getUUID().substring(0, 12); item.name = item.file.name;
item.name = item.file.name; item.id = fileId;
item.id = fileId; }
obj.bodyUploadIds.push(item.id);
bodyUploadFiles.push(item.file);
} }
obj.bodyUploadIds.push(item.id); });
bodyUploadFiles.push(item.file); }
} });
}); }
}
});
} }
}, },
recursiveFile(arr, bodyUploadFiles, obj) { recursiveFile(arr, bodyUploadFiles, obj) {

View File

@ -113,7 +113,7 @@
</el-form> </el-form>
<!-- 场景步骤--> <!-- 场景步骤-->
<div v-loading="isReloadData"> <div v-loading="loading">
<p class="tip">{{$t('api_test.automation.scenario_step')}} </p> <p class="tip">{{$t('api_test.automation.scenario_step')}} </p>
<el-row> <el-row>
<el-col :span="21"> <el-col :span="21">
@ -157,13 +157,13 @@
</el-row> </el-row>
</div> </div>
<!-- 场景步骤内容 --> <!-- 场景步骤内容 -->
<div style="margin-top: 10px" v-loading="isReloadData"> <div style="margin-top: 10px" v-loading="loading">
<el-tree node-key="resourceId" :props="props" :data="scenarioDefinition" <el-tree node-key="resourceId" :props="props" :data="scenarioDefinition"
:default-expanded-keys="expandedNode" :default-expanded-keys="expandedNode"
:expand-on-click-node="false" :expand-on-click-node="false"
@node-expand="nodeExpand" @node-expand="nodeExpand"
@node-collapse="nodeCollapse" @node-collapse="nodeCollapse"
:allow-drop="allowDrop" @node-drag-end="allowDrag" @node-click="nodeClick" v-if="!isReloadData" draggable> :allow-drop="allowDrop" @node-drag-end="allowDrag" @node-click="nodeClick" v-if="!loading" draggable>
<span class="custom-tree-node father" slot-scope="{ node, data}" style="width: 96%"> <span class="custom-tree-node father" slot-scope="{ node, data}" style="width: 96%">
<template> <template>
<!-- 场景 --> <!-- 场景 -->
@ -344,7 +344,7 @@
options: API_STATUS, options: API_STATUS,
levels: PRIORITY, levels: PRIORITY,
scenario: {}, scenario: {},
isReloadData: false, loading: false,
apiListVisible: false, apiListVisible: false,
customizeVisible: false, customizeVisible: false,
scenarioVisible: false, scenarioVisible: false,
@ -565,9 +565,9 @@
this.reload(); this.reload();
}, },
reload() { reload() {
this.isReloadData = true this.loading = true
this.$nextTick(() => { this.$nextTick(() => {
this.isReloadData = false this.loading = false
}) })
}, },
runDebug() { runDebug() {
@ -744,7 +744,7 @@
}, },
runRefresh() { runRefresh() {
this.debugVisible = true; this.debugVisible = true;
this.isReloadData = false; this.loading = false;
}, },
showScenarioParameters() { showScenarioParameters() {
this.$refs.scenarioParameters.open(this.currentScenario.variables); this.$refs.scenarioParameters.open(this.currentScenario.variables);

@ -1 +1 @@
Subproject commit 29a8fc09602fde5708af06582ac972d98eb69836 Subproject commit e1e8b4dffb4f71f1402ddae6bb149dd0be195342