diff --git a/frontend/src/views/api-test/components/paramTable.vue b/frontend/src/views/api-test/components/paramTable.vue index 55600895fd..4e30a30bab 100644 --- a/frontend/src/views/api-test/components/paramTable.vue +++ b/frontend/src/views/api-test/components/paramTable.vue @@ -926,12 +926,14 @@ } return item; }); + const { lastDataIsDefault } = filterKeyValParams(arr, defaultLineData.value, false); if ( - !props.disabledExceptParam && - !props.disabledParamValue && - hasNoIdItem && - !filterKeyValParams(arr, defaultLineData.value, !props.selectable).lastDataIsDefault && - !props.isTreeTable + (arr.length === 1 && !lastDataIsDefault) || + (hasNoIdItem && + !props.disabledExceptParam && + !props.disabledParamValue && + !lastDataIsDefault && + !props.isTreeTable) ) { addTableLine(arr.length - 1, false, true); } diff --git a/frontend/src/views/api-test/components/utils.ts b/frontend/src/views/api-test/components/utils.ts index 1b52416ec0..1cdddcf838 100644 --- a/frontend/src/views/api-test/components/utils.ts +++ b/frontend/src/views/api-test/components/utils.ts @@ -173,7 +173,7 @@ export function filterKeyValParams( const defaultParam = cloneDeep(defaultParamItem); if (!lastData || !defaultParam) { return { - lastDataIsDefault: false, + lastDataIsDefault: true, validParams: params, }; } diff --git a/frontend/src/views/case-management/caseManagementFeature/components/utils.ts b/frontend/src/views/case-management/caseManagementFeature/components/utils.ts index 2ad73784ce..f1b6c74c30 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/utils.ts +++ b/frontend/src/views/case-management/caseManagementFeature/components/utils.ts @@ -234,7 +234,7 @@ export function initFormCreate(customFields: CustomAttributes[], permission: str currentDefaultValue = item.defaultValue; // 处理多选情况 } else if (multipleType.includes(item.type)) { - const tempValue = JSON.parse(item.defaultValue); + const tempValue = typeof item.defaultValue === 'string' ? JSON.parse(item.defaultValue) : item.defaultValue; const optionsIds = optionsValue.map((e: any) => e.value); currentDefaultValue = (optionsIds || []).filter((e: any) => tempValue.includes(e)); } else if (memberType.includes(item.type)) { @@ -248,7 +248,7 @@ export function initFormCreate(customFields: CustomAttributes[], permission: str // @desc 如果默认原本的成员被系统移除则过滤掉该用户不展示 const optionsIds = optionsValue.map((e: any) => e.value); if (item.type === 'MULTIPLE_MEMBER') { - const tempValue = JSON.parse(item.defaultValue); + const tempValue = typeof item.defaultValue === 'string' ? JSON.parse(item.defaultValue) : item.defaultValue; currentDefaultValue = (optionsIds || []).filter((e: any) => tempValue.includes(e)); } else { currentDefaultValue = (optionsIds || []).find((e: any) => item.defaultValue === e) || '';