From 6fc4f75e108d46c938f6b452e8cfb8e2e0f344fc Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Mon, 5 Dec 2022 19:04:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E9=83=A8=E5=88=86=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=B7=E5=BC=8F=E6=94=B9=E4=B8=BA=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E9=92=88=E5=AF=B9=E4=B8=80=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=B1=87=E6=80=BB=E8=BF=9B=E8=A1=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020653 --user=宋天阳 【接口测试】接口高级设置问题汇总 {#_orginal_url#} --- .../commons/json-schema/JsonSchemaEditor.vue | 13 + .../json-schema/schema/editor/main.vue | 70 +++- .../definition/components/ApiVariable.vue | 384 +++++++++++------- .../definition/components/body/ApiBody.vue | 11 +- .../components/body/ApiBodyFileUpload.vue | 16 +- .../document/components/ApiInfoCollapse.vue | 12 - .../document/components/ApiRequestInfo.vue | 12 - .../document/components/ApiResponseInfo.vue | 130 ++++-- .../components/JsonSchema/JsonSchemaPanel.vue | 28 +- .../components/response/ResponseText.vue | 7 +- .../components/table/ScheduleTaskList.vue | 2 +- 11 files changed, 447 insertions(+), 238 deletions(-) diff --git a/api-test/frontend/src/business/commons/json-schema/JsonSchemaEditor.vue b/api-test/frontend/src/business/commons/json-schema/JsonSchemaEditor.vue index 4c43f854ae..b6f666ef55 100644 --- a/api-test/frontend/src/business/commons/json-schema/JsonSchemaEditor.vue +++ b/api-test/frontend/src/business/commons/json-schema/JsonSchemaEditor.vue @@ -13,6 +13,9 @@ {{ this.$t('commons.import') }}
+ + {{ expandTitle }} + diff --git a/api-test/frontend/src/business/commons/json-schema/schema/editor/main.vue b/api-test/frontend/src/business/commons/json-schema/schema/editor/main.vue index 66a8c6c19a..3c2e34f64c 100644 --- a/api-test/frontend/src/business/commons/json-schema/schema/editor/main.vue +++ b/api-test/frontend/src/business/commons/json-schema/schema/editor/main.vue @@ -33,7 +33,7 @@ - + - + - - + - + - + - + - +
- + - + - +
@@ -182,6 +189,7 @@ v-for="(item, key, index) in pickValue.properties" :value="{ [key]: item }" :parent="pickValue" + :expand-all-params="expandAllParams" :key="index" :deep="deep + 1" :root="false" @@ -202,6 +210,7 @@ v-for="(item, key, index) in pickValue.items" :value="{ [key]: item }" :parent="pickValue" + :expand-all-params="expandAllParams" :key="index" :deep="deep + 1" :root="false" @@ -289,6 +298,12 @@ export default { type: Object, required: true, }, + expandAllParams: { + type: Boolean, + default() { + return false; + }, + }, paramColumns: Array, showMockVars: { type: Boolean, @@ -393,16 +408,31 @@ export default { }; }, created() { - if (this.pickValue) { - if (this.pickValue.hidden === undefined) { - this.hidden = this.root ? false : true; - } else { - this.hidden = this.root ? false : this.pickValue.hidden; - } + if (this.expandAllParams) { + this.hidden = false; } else { - this.hidden = true; + if (this.pickValue) { + if (this.pickValue.hidden === undefined) { + this.hidden = this.root ? false : true; + } else { + this.hidden = this.root ? false : this.pickValue.hidden; + } + } else { + this.hidden = true; + } } }, + watch: { + expandAllParams() { + if (this.expandAllParams) { + this.hidden = false; + } else { + if (!this.root) { + this.hidden = true; + } + } + }, + }, methods: { showColumns(columns) { if (!this.paramColumns) { diff --git a/api-test/frontend/src/business/definition/components/ApiVariable.vue b/api-test/frontend/src/business/definition/components/ApiVariable.vue index 285ff94965..650da8d261 100644 --- a/api-test/frontend/src/business/definition/components/ApiVariable.vue +++ b/api-test/frontend/src/business/definition/components/ApiVariable.vue @@ -4,170 +4,157 @@ {{ description }} - - - - - -
- - - - - - - - - - - {{ keyText }} - - - + - - - - - - - {{ $t('api_test.definition.document.table_coloum.is_required') }} - - - - - - - - - {{ valueText }} - - - - - - - - - {{ valueText }} - - - - - - - {{ $t('api_test.request.content_type') }} - - - - - - - - {{ $t('schema.minLength') }} - - - - - - - {{ $t('schema.maxLength') }} - - - - - - - {{ $t('commons.encode') }} - - - - - - - - - {{ $t('commons.description') }} - - - - - - - - - - - - + + + +
{ + item.isEdit = false; + }); + }, + getTableMinWidth(col) { + if (col === 'name') { + return '200px'; + } else if (col === 'value') { + return '300px'; + } else if (col === 'description') { + return '200px'; + } else { + return '120px'; + } + }, + clickRow(row, column, event) { + this.closeAllTableDataEdit(); + if (!this.isReadOnly) { + this.$nextTick(() => { + this.$set(row, 'isEdit', true); + }); + } + }, + initTableColumn() { + this.tableColumnArr = []; + if (this.type === 'body') { + this.tableColumnArr.push({ + id: 0, + prop: 'type', + label: this.$t('api_test.definition.document.request_param') + this.$t('commons.type'), + }); + } + this.tableColumnArr.push({ id: 1, prop: 'name', label: this.$t('api_definition.document.name') }); + this.tableColumnArr.push({ id: 3, prop: 'required', label: this.$t('api_definition.document.is_required') }); + this.tableColumnArr.push({ id: 4, prop: 'value', label: this.$t('api_definition.document.value') }); + if (this.type === 'body') { + this.tableColumnArr.push({ id: 2, prop: 'contentType', label: this.$t('api_definition.document.type') }); + } + if (this.paramColumns) { + this.paramColumns.forEach((item) => { + let tableColumn = {}; + if (item === 'MIX_LENGTH') { + tableColumn.id = 5; + tableColumn.prop = 'min'; + tableColumn.label = this.$t('schema.minLength'); + } else if (item === 'MAX_LENGTH') { + tableColumn.id = 6; + tableColumn.prop = 'max'; + tableColumn.label = this.$t('schema.maxLength'); + } else if (item === 'ENCODE') { + tableColumn.id = 7; + tableColumn.prop = 'urlEncode'; + tableColumn.label = this.$t('commons.encode'); + } else if (item === 'DESCRIPTION') { + tableColumn.id = 8; + tableColumn.prop = 'description'; + tableColumn.label = this.$t('commons.description'); + } else { + tableColumn = null; + } + if (tableColumn) { + this.tableColumnArr.push(tableColumn); + } + }); + } + }, showColumns(columns) { return this.paramColumns.indexOf(columns) >= 0; }, @@ -359,6 +420,7 @@ export default { urlEncode: this.urlEncode, uuid: this.uuid(), required: false, + isEdit: false, contentType: 'text/plain', }) ); @@ -443,6 +505,9 @@ export default { }, }, created() { + if (this.paramType === 'response') { + this.storageKey = 'API_RESPONSE_PARAMS_SHOW_FIELD'; + } if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) { this.parameters.push( new KeyValue({ @@ -451,14 +516,25 @@ export default { required: false, urlEncode: this.urlEncode, uuid: this.uuid(), + isEdit: false, contentType: 'text/plain', }) ); } - let savedApiParamsShowFields = getShowFields('API_PARAMS_SHOW_FIELD'); + let savedApiParamsShowFields = getShowFields(this.storageKey); if (savedApiParamsShowFields) { this.paramColumns = savedApiParamsShowFields; } + this.parameters.forEach((item) => { + this.$set(item, 'isEdit', false); + }); + this.initTableColumn(); + }, + activated() { + this.initTableColumn(); + }, + mounted() { + this.initTableColumn(); }, }; @@ -515,4 +591,8 @@ export default { margin-bottom: 5px; font-weight: 600; } + +.param-div-show { + min-height: 16px; +} diff --git a/api-test/frontend/src/business/definition/components/body/ApiBody.vue b/api-test/frontend/src/business/definition/components/body/ApiBody.vue index 9f2bd070cc..516ad1c1d3 100644 --- a/api-test/frontend/src/business/definition/components/body/ApiBody.vue +++ b/api-test/frontend/src/business/definition/components/body/ApiBody.vue @@ -31,9 +31,11 @@ - +
- + +
- - - -
diff --git a/api-test/frontend/src/business/definition/components/document/components/ApiRequestInfo.vue b/api-test/frontend/src/business/definition/components/document/components/ApiRequestInfo.vue index 4091b0d5f8..f5c872c996 100644 --- a/api-test/frontend/src/business/definition/components/document/components/ApiRequestInfo.vue +++ b/api-test/frontend/src/business/definition/components/document/components/ApiRequestInfo.vue @@ -25,18 +25,6 @@ :prop="item.prop" :label="item.label" show-overflow-tooltip /> - - - -
diff --git a/api-test/frontend/src/business/definition/components/document/components/ApiResponseInfo.vue b/api-test/frontend/src/business/definition/components/document/components/ApiResponseInfo.vue index 8e892783fb..85eebb3283 100644 --- a/api-test/frontend/src/business/definition/components/document/components/ApiResponseInfo.vue +++ b/api-test/frontend/src/business/definition/components/document/components/ApiResponseInfo.vue @@ -2,36 +2,24 @@
+ +
+ +
+
- - - -
@@ -62,25 +50,111 @@