|
378 | 378 | try { |
379 | 379 | const res = await getFieldDisplayList(formKey.value); |
380 | 380 | linkFieldOptions.value = res.fields |
381 | | - .filter((e) => [FieldTypeEnum.DATA_SOURCE, FieldTypeEnum.DATA_SOURCE_MULTIPLE].includes(e.type)) |
| 381 | + .filter((e) => |
| 382 | + [ |
| 383 | + FieldTypeEnum.DATA_SOURCE, |
| 384 | + FieldTypeEnum.DATA_SOURCE_MULTIPLE, |
| 385 | + FieldTypeEnum.MEMBER, |
| 386 | + FieldTypeEnum.MEMBER_MULTIPLE, |
| 387 | + FieldTypeEnum.LOCATION, |
| 388 | + ].includes(e.type) |
| 389 | + ) |
382 | 390 | .map((item) => { |
383 | 391 | return { |
384 | 392 | label: item.name, |
|
403 | 411 | const currentField = props.formFields.find((f) => f.id === currentFieldId); |
404 | 412 | if (currentField?.type === FieldTypeEnum.DATA_SOURCE) { |
405 | 413 | // 单选数据源不能填充多选数据源 |
406 | | - return linkFieldOptions.value.filter((f) => f.type !== FieldTypeEnum.DATA_SOURCE_MULTIPLE); |
| 414 | + return linkFieldOptions.value.filter((f) => f.type === FieldTypeEnum.DATA_SOURCE); |
| 415 | + } |
| 416 | + if (currentField?.type === FieldTypeEnum.DATA_SOURCE_MULTIPLE) { |
| 417 | + return linkFieldOptions.value.filter((f) => |
| 418 | + [FieldTypeEnum.DATA_SOURCE, FieldTypeEnum.DATA_SOURCE_MULTIPLE].includes(f.type) |
| 419 | + ); |
| 420 | + } |
| 421 | + if (currentField?.type === FieldTypeEnum.MEMBER) { |
| 422 | + // 单选成员不能填充多选成员 |
| 423 | + return linkFieldOptions.value.filter((f) => f.type === FieldTypeEnum.MEMBER); |
| 424 | + } |
| 425 | + if (currentField?.type === FieldTypeEnum.MEMBER_MULTIPLE) { |
| 426 | + // 多选成员不能填充单选成员 |
| 427 | + return linkFieldOptions.value.filter((f) => |
| 428 | + [FieldTypeEnum.MEMBER, FieldTypeEnum.MEMBER_MULTIPLE].includes(f.type) |
| 429 | + ); |
| 430 | + } |
| 431 | + if (currentField?.type === FieldTypeEnum.LOCATION) { |
| 432 | + return linkFieldOptions.value.filter((f) => f.type === FieldTypeEnum.LOCATION); |
407 | 433 | } |
408 | 434 | return linkFieldOptions.value; |
409 | 435 | } |
|
413 | 439 | return props.formFields |
414 | 440 | .filter( |
415 | 441 | (f) => |
416 | | - [FieldTypeEnum.DATA_SOURCE, FieldTypeEnum.DATA_SOURCE_MULTIPLE].includes(f.type) && |
| 442 | + [ |
| 443 | + FieldTypeEnum.DATA_SOURCE, |
| 444 | + FieldTypeEnum.DATA_SOURCE_MULTIPLE, |
| 445 | + FieldTypeEnum.LOCATION, |
| 446 | + FieldTypeEnum.MEMBER, |
| 447 | + FieldTypeEnum.MEMBER_MULTIPLE, |
| 448 | + ].includes(f.type) && |
417 | 449 | f.id !== props.fieldConfig.id && |
418 | 450 | (f.id === currentFieldId || !alreadySelectedFields.includes(f.id)) && |
419 | 451 | !f.resourceFieldId |
|
0 commit comments