fix(全局): bug修复

This commit is contained in:
baiqi 2024-04-18 19:40:32 +08:00 committed by 刘瑞斌
parent 68a8c68041
commit cc340ce8c5
5 changed files with 7 additions and 13 deletions

View File

@ -841,15 +841,7 @@
} }
return item; return item;
}); });
const lastTwoIsSame = if (hasNoIdItem && !filterKeyValParams(arr, props.defaultParamItem).lastDataIsDefault && !props.isTreeTable) {
(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 //
) {
addTableLine(arr.length - 1, false, true); addTableLine(arr.length - 1, false, true);
} }
} else { } else {

View File

@ -218,7 +218,7 @@
slotName: 'paramType', slotName: 'paramType',
hasRequired: true, hasRequired: true,
typeOptions: typeOptions.value, typeOptions: typeOptions.value,
width: 120, width: 130,
}, },
{ {
title: 'apiTestDebug.paramValue', title: 'apiTestDebug.paramValue',

View File

@ -134,7 +134,7 @@ export function filterKeyValParams<T>(
delete lastData.enable; delete lastData.enable;
delete defaultParam.id; delete defaultParam.id;
delete defaultParam.enable; delete defaultParam.enable;
const lastDataIsDefault = isEqual(lastData, defaultParam); const lastDataIsDefault = isEqual(lastData, defaultParam) || lastData.key === '';
let validParams: (T & Record<string, any>)[]; let validParams: (T & Record<string, any>)[];
if (lastDataIsDefault) { if (lastDataIsDefault) {
// 如果最后一条数据是默认数据,非用户添加更改的,说明是无效参数,删除最后一个 // 如果最后一条数据是默认数据,非用户添加更改的,说明是无效参数,删除最后一个

View File

@ -146,7 +146,6 @@
import { ProtocolItem } from '@/models/apiTest/common'; import { ProtocolItem } from '@/models/apiTest/common';
import { ApiDefinitionDetail } from '@/models/apiTest/management'; import { ApiDefinitionDetail } from '@/models/apiTest/management';
import { ModuleTreeNode } from '@/models/common'; import { ModuleTreeNode } from '@/models/common';
import { EnvConfig } from '@/models/projectManagement/environmental';
import { import {
RequestAuthType, RequestAuthType,
RequestComposition, RequestComposition,

View File

@ -116,6 +116,7 @@
() => props.visible, () => props.visible,
(val) => { (val) => {
innerVisible.value = val; innerVisible.value = val;
form.value.field = props.fieldConfig?.field || '';
} }
); );
@ -124,6 +125,8 @@
(val) => { (val) => {
if (!val) { if (!val) {
emit('close'); emit('close');
} else {
form.value.field = props.fieldConfig?.field || '';
} }
emit('update:visible', val); emit('update:visible', val);
} }
@ -205,7 +208,7 @@
function reset(val: boolean) { function reset(val: boolean) {
if (!val) { if (!val) {
formRef.value?.resetFields(); formRef.value?.clearValidate();
form.value.field = ''; form.value.field = '';
} }
} }