From cc340ce8c53efdf3025b1e9a88827e9da8b57216 Mon Sep 17 00:00:00 2001 From: baiqi Date: Thu, 18 Apr 2024 19:40:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=85=A8=E5=B1=80):=20bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/api-test/components/paramTable.vue | 10 +--------- .../api-test/components/requestComposition/body.vue | 2 +- frontend/src/views/api-test/components/utils.ts | 2 +- .../management/components/management/api/index.vue | 1 - .../fileManagement/components/popConfirm.vue | 5 ++++- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/frontend/src/views/api-test/components/paramTable.vue b/frontend/src/views/api-test/components/paramTable.vue index 2d8fd709ac..e4aa8b6b37 100644 --- a/frontend/src/views/api-test/components/paramTable.vue +++ b/frontend/src/views/api-test/components/paramTable.vue @@ -841,15 +841,7 @@ } return item; }); - const lastTwoIsSame = - (arr.length === 1 && !hasNoIdItem) || - (arr.length >= 2 && filterKeyValParams([arr[arr.length - 2]], arr[arr.length - 1]).lastDataIsDefault); - if ( - hasNoIdItem && - !filterKeyValParams(arr, props.defaultParamItem).lastDataIsDefault && - !props.isTreeTable && - !lastTwoIsSame // 为了判断最后俩行是否一致(因为下拉框切换会新增一行一样的数据,此时最后一条数据与默认数据是不一样的) - ) { + if (hasNoIdItem && !filterKeyValParams(arr, props.defaultParamItem).lastDataIsDefault && !props.isTreeTable) { addTableLine(arr.length - 1, false, true); } } else { diff --git a/frontend/src/views/api-test/components/requestComposition/body.vue b/frontend/src/views/api-test/components/requestComposition/body.vue index 84fe895409..63f8e73252 100644 --- a/frontend/src/views/api-test/components/requestComposition/body.vue +++ b/frontend/src/views/api-test/components/requestComposition/body.vue @@ -218,7 +218,7 @@ slotName: 'paramType', hasRequired: true, typeOptions: typeOptions.value, - width: 120, + width: 130, }, { title: 'apiTestDebug.paramValue', diff --git a/frontend/src/views/api-test/components/utils.ts b/frontend/src/views/api-test/components/utils.ts index 7be51af6e7..40c5c30b9c 100644 --- a/frontend/src/views/api-test/components/utils.ts +++ b/frontend/src/views/api-test/components/utils.ts @@ -134,7 +134,7 @@ export function filterKeyValParams( delete lastData.enable; delete defaultParam.id; delete defaultParam.enable; - const lastDataIsDefault = isEqual(lastData, defaultParam); + const lastDataIsDefault = isEqual(lastData, defaultParam) || lastData.key === ''; let validParams: (T & Record)[]; if (lastDataIsDefault) { // 如果最后一条数据是默认数据,非用户添加更改的,说明是无效参数,删除最后一个 diff --git a/frontend/src/views/api-test/management/components/management/api/index.vue b/frontend/src/views/api-test/management/components/management/api/index.vue index f1be52ebd7..dfb2705e4e 100644 --- a/frontend/src/views/api-test/management/components/management/api/index.vue +++ b/frontend/src/views/api-test/management/components/management/api/index.vue @@ -146,7 +146,6 @@ import { ProtocolItem } from '@/models/apiTest/common'; import { ApiDefinitionDetail } from '@/models/apiTest/management'; import { ModuleTreeNode } from '@/models/common'; - import { EnvConfig } from '@/models/projectManagement/environmental'; import { RequestAuthType, RequestComposition, diff --git a/frontend/src/views/project-management/fileManagement/components/popConfirm.vue b/frontend/src/views/project-management/fileManagement/components/popConfirm.vue index a9e6278bb9..1fb96d253a 100644 --- a/frontend/src/views/project-management/fileManagement/components/popConfirm.vue +++ b/frontend/src/views/project-management/fileManagement/components/popConfirm.vue @@ -116,6 +116,7 @@ () => props.visible, (val) => { innerVisible.value = val; + form.value.field = props.fieldConfig?.field || ''; } ); @@ -124,6 +125,8 @@ (val) => { if (!val) { emit('close'); + } else { + form.value.field = props.fieldConfig?.field || ''; } emit('update:visible', val); } @@ -205,7 +208,7 @@ function reset(val: boolean) { if (!val) { - formRef.value?.resetFields(); + formRef.value?.clearValidate(); form.value.field = ''; } }