fix(接口场景): 场景参数默认行

This commit is contained in:
baiqi 2024-06-26 18:20:20 +08:00 committed by 刘瑞斌
parent 157758ea45
commit 2243142491
3 changed files with 10 additions and 8 deletions

View File

@ -926,12 +926,14 @@
}
return item;
});
const { lastDataIsDefault } = filterKeyValParams(arr, defaultLineData.value, false);
if (
(arr.length === 1 && !lastDataIsDefault) ||
(hasNoIdItem &&
!props.disabledExceptParam &&
!props.disabledParamValue &&
hasNoIdItem &&
!filterKeyValParams(arr, defaultLineData.value, !props.selectable).lastDataIsDefault &&
!props.isTreeTable
!lastDataIsDefault &&
!props.isTreeTable)
) {
addTableLine(arr.length - 1, false, true);
}

View File

@ -173,7 +173,7 @@ export function filterKeyValParams<T>(
const defaultParam = cloneDeep(defaultParamItem);
if (!lastData || !defaultParam) {
return {
lastDataIsDefault: false,
lastDataIsDefault: true,
validParams: params,
};
}

View File

@ -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) || '';