From 2243142491c0e6ae6b26a0b3f0a757c34f0afdc8 Mon Sep 17 00:00:00 2001 From: baiqi Date: Wed, 26 Jun 2024 18:20:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=9C=BA=E6=99=AF):=20?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E5=8F=82=E6=95=B0=E9=BB=98=E8=AE=A4=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/api-test/components/paramTable.vue | 12 +++++++----- frontend/src/views/api-test/components/utils.ts | 2 +- .../caseManagementFeature/components/utils.ts | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) 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) || '';