From dd381da0a05d5a74185e5d4c9c917e8ee3c59e18 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 21 Jul 2023 10:55:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcase=E4=B8=8D=E6=98=BE=E7=A4=BA=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=86=85=E5=AE=B9=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1028054 --user=王孝刚 【接口测试】接口定义-编辑接口-CASE页面添加case-页面不显示请求内容信息 https://www.tapd.cn/55049933/s/1396066 --- .../components/case/ApiCaseItem.vue | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/api-test/frontend/src/business/definition/components/case/ApiCaseItem.vue b/api-test/frontend/src/business/definition/components/case/ApiCaseItem.vue index 192e41574b..b61e0e8ac2 100644 --- a/api-test/frontend/src/business/definition/components/case/ApiCaseItem.vue +++ b/api-test/frontend/src/business/definition/components/case/ApiCaseItem.vue @@ -268,7 +268,12 @@ import { relationGet, updateRuleRelation } from '@/api/xpack'; import { getUUID } from 'metersphere-frontend/src/utils'; import { getCurrentProjectID, getCurrentUser } from 'metersphere-frontend/src/utils/token'; import { hasLicense, hasPermissions } from 'metersphere-frontend/src/utils/permission'; -import { _getBodyUploadFiles, mergeRequestDocumentData } from '@/business/definition/api-definition'; +import { + _getBodyUploadFiles, + hisDataProcessing, + mergeRequestDocumentData, + stepCompute +} from '@/business/definition/api-definition'; import { API_METHOD_COLOUR, API_STATUS, PRIORITY } from '../../model/JsonData'; import MsTag from 'metersphere-frontend/src/components/MsTag'; import MsTipButton from 'metersphere-frontend/src/components/MsTipButton'; @@ -288,6 +293,7 @@ import { TYPE_TO_C } from '@/business/automation/scenario/Setting'; import ApiCaseHeader from './ApiCaseHeader'; import { deepClone } from 'metersphere-frontend/src/utils/tableUtils'; import { useApiStore } from '@/store'; +import {Body, KeyValue} from "@/business/definition/model/ApiTestModel"; const store = useApiStore(); export default { @@ -397,6 +403,7 @@ export default { this.$EventBus.$off('showXpackCaseSet'); }, created() { + this.init(); window.addEventListener('resize', this.resizeTable, false); store.scenarioEnvMap = undefined; if (this.apiCase.request && this.apiCase.request.hashTree && this.apiCase.request.hashTree.length > 0) { @@ -955,6 +962,42 @@ export default { } }); }, + initStepSize(array) { + stepCompute(array, this.apiCase.request); + }, + historicalDataProcessing(array) { + hisDataProcessing(array, this.apiCase.request); + }, + init() { + if ( + Object.prototype.toString + .call(this.apiCase.request) + .match(/\[object (\w+)\]/)[1] + .toLowerCase() !== 'object' + ) { + this.apiCase.request = JSON.parse(this.apiCase.request); + } + if (!this.apiCase.request.body) { + this.apiCase.request.body = new Body(); + } + if (!this.apiCase.request.body.kvs) { + this.apiCase.request.body.kvs = []; + } + if (!this.apiCase.request.rest) { + this.apiCase.request.rest = []; + } + if (!this.apiCase.request.arguments) { + this.apiCase.request.arguments = []; + } + if (!this.apiCase.request.headers) { + this.apiCase.request.headers = []; + this.apiCase.request.headers.push(new KeyValue({ enable: true, name: '', value: '' })); + } + if (this.apiCase.request.hashTree) { + this.initStepSize(this.apiCase.request.hashTree); + this.historicalDataProcessing(this.apiCase.request.hashTree); + } + }, }, };