fix: 修复mobile选择类型不能用的情况 fix #723

Reviewed-on: daoyoucloud/tachycode#725
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-04-16 11:02:33 +08:00 committed by sealday
parent 520b0024d4
commit a08b45b498
4 changed files with 12 additions and 5 deletions

View File

@ -0,0 +1,5 @@
---
"@hera/plugin-mobile": patch
---
修复选择不能用的情况

View File

@ -21,7 +21,7 @@ export const useTabSearchFieldItemProps = () => {
result.labelKey = fieldSchema['x-component-props']?.fieldNames?.label || result.valueKey;
const fieldInterface = fieldSchema['x-component-props'].interface;
if (canBeOptionalField(fieldInterface)) {
const field = optionalFieldList.find((field) => field.fieldName === fieldSchema['fieldName']);
const field = optionalFieldList.find((field) => field.name === fieldSchema['fieldName']);
const operatorMap = {
select: '$in',
multipleSelect: '$anyOf',
@ -33,9 +33,8 @@ export const useTabSearchFieldItemProps = () => {
result.valueKey = 'value';
result.labelKey = 'label';
result.list = _list;
result.filterKey = `${field.fieldName}.${operatorMap[field.interface]}`;
result.filterKey = `${field.name}.${operatorMap[field.interface]}`;
}
return {
list: result.list,
valueKey: result.valueKey,

View File

@ -20,7 +20,10 @@ export const useTabSearchFieldItemRelatedProps = () => {
const blockProps = { dataSource: 'main' };
const headers = useDataSourceHeaders(blockProps?.dataSource);
const cm = useCollectionManager();
const collectionField = useMemo(() => collection?.getField(fieldSchema.name as any), [collection, fieldSchema.name]);
const collectionField = useMemo(
() => collection?.getField(fieldSchema['fieldName'] as any),
[collection, fieldSchema['fieldName']],
);
const collectionFieldName = collectionField?.name;
const fieldInterface = fieldSchema['x-component-props'].interface;
const result = { list: null, valueKey: '', labelKey: '', filterKey: '' };

View File

@ -75,7 +75,7 @@ export const TabSearchItemFieldSettings = new SchemaSettings({
const fieldCollection = fieldSchema['x-component-props']?.['collectionName'];
const correlation = fieldSchema['x-component-props']?.['correlation'];
const collectionField =
c.getField(fieldSchema['name']) ||
c.getField(fieldSchema['fieldName']) ||
cm.getCollectionField(fieldSchema['x-collection-field']) ||
cm.getCollection(fieldCollection + '.' + correlation);
const compile = useCompile();