开发表单配置页面 如何使用附件关系字段

开发表单配置页面 如何使用附件关系字段。以下方式(编辑表单)文本字段正常显示和修改,图片附件字段无法正常使用

创建数据表

export default defineCollection({
name: ‘ConfigurationPage’,
fields: [
{
type: ‘string’,
name: ‘title’,
translation: true,
},
{
type: ‘belongsTo’,
name: ‘Pic’,
target: ‘attachments’,
},
],
});

定义数据表结构 创建表单 Schema

const MySettingPageForm = {
name: ‘ConfigurationPage’,
filterTargetKey: ‘id’,
fields: [
{
type: ‘string’,
name: ‘title’,
interface: ‘input’,
uiSchema: {
title: ‘Title’,
required: true,
‘x-component’: ‘Input’,
},
},
{ type: ‘object’,
name: ‘Pic’,
interface: ‘attachment’,
uiSchema: {
title: ‘Pic’,
‘x-component’: ‘Upload.Attachment’,
‘x-component-props’: {
action: ‘attachments:create’,
},
‘x-use-component-props’: ‘useAttachmentFieldProps’,
},
},
],
};

const schema: ISchema = {
type: ‘void’,
name: uid(),
‘x-component’: ‘CardItem’,
‘x-decorator’: ‘DataBlockProvider’,
‘x-decorator-props’: {
collection: MySettingPageForm.name,
action: ‘get’,
filterByTk: 1,
appends: [‘Pic’]
},
properties: {
form: {
type: ‘void’,
‘x-component’: ‘FormV2’,
‘x-use-component-props’: ‘useFormBlockProps’,
properties: {
title: {
title: ‘Title’,
‘x-decorator’: ‘FormItem’,
‘x-component’: ‘CollectionField’,
},
Pic: {
title: ‘Pic’,
‘x-decorator’: ‘FormItem’,
‘x-component’: ‘CollectionField’,
‘x-component-props’: {
collection: ‘attachments’,
},

    },
    footer: {
      type: 'void',
      'x-component': 'Action',
      title: 'Submit',
      'x-use-component-props': 'useSubmitActionProps',
    },
  },
},

},
};