跳转到主要内容
查找 (Lookup) 字段不是一种具体的字段类型,我们可以从关联表查找任何一种字段,查找字段的类型是由关联表原字段决定的,并且具有 isLookup 属性,查找字段是不可以被编辑的。
所有字段的返回值都可能存在 isMultipleCellValue: true 的情况。
  1. 这是因为字段可能被查找(Lookup)的。当关联值可以多选的时候,查找字段的值必然是数组值
  2. 字段可配置,比如成员字段和关联字段可以配置单选或者多选,在代码中,你可以通过 field.isMultipleCellValue 来判断字段是否为多值。
不应当用字段类型来判断是否允许写入,而是通过字段上的 isComputed 来判断。

1. 数字字段 (Number Field)

  • type: number
  • 写入类型: number
  • 返回类型:
    • isMultipleCellValue: false: number
    • isMultipleCellValue: true: number[]
示例:

2. 单行文本字段 (Single Line Text Field)

  • type: singleLineText
  • 写入类型: string
  • 返回类型:
    • isMultipleCellValue: false: string
    • isMultipleCellValue: true: string[]
示例:

3. 长文本字段 (Long Text Field)

  • type: longText
  • 写入类型: string
  • 返回类型:
    • isMultipleCellValue: false: string
    • isMultipleCellValue: true: string[]
示例:

4. 单选字段 (Single Select Field)

  • type: singleSelect
  • 写入类型: string (选项值)
  • 返回类型:
    • isMultipleCellValue: false: string
    • isMultipleCellValue: true: string[]
示例:

5. 多选字段 (Multiple Select Field)

  • type: multipleSelect
  • 写入类型: string[] (选项值数组)
  • 返回类型: string[]
示例:
  • type: link
  • 写入类型:
    • isMultipleCellValue: false: { id: string }
    • isMultipleCellValue: true: { id: string }[]
  • 返回类型:
    • isMultipleCellValue: false: { id: string, title?: string }
    • isMultipleCellValue: true: { id: string, title?: string }[]
示例:

7. 公式字段 (Formula Field)

  • type: formula
  • 写入类型: 不可直接写入
  • 返回类型: 取决于公式结果,可能是 string | number | boolean 或它们的数组形式
示例:

8. 附件字段 (Attachment Field)

上传一个附件到附件字段需要使用独立的 API,详情请查看上传附件章节
  • type: attachment
  • 写入类型:
  • 返回类型:
示例:

9. 日期字段 (Date Field)

  • type: date
  • 写入类型: string (ISO 8601格式)
  • 返回类型:
    • isMultipleCellValue: false: string (ISO 8601格式)
    • isMultipleCellValue: true: string[] (ISO 8601格式) 可以使用 new Date().toISOString() 来获得ISO 8601 时间格式
示例:

10. 创建时间字段 (Created Time Field)

  • type: createdTime
  • 写入类型: 不可直接写入
  • 返回类型:
    • isMultipleCellValue: false: string (ISO 8601格式)
    • isMultipleCellValue: true: string[] (ISO 8601格式)
示例:

11. 最后修改时间字段 (Last Modified Time Field)

  • type: lastModifiedTime
  • 写入类型: 不可直接写入
  • 返回类型:
    • isMultipleCellValue: false: string (ISO 8601格式)
    • isMultipleCellValue: true: string[] (ISO 8601格式)
示例:

12. 勾选字段 (Checkbox Field)

  • type: checkbox
  • 写入类型: boolean
  • 返回类型:
    • isMultipleCellValue: false: boolean
    • isMultipleCellValue: true: boolean[]
示例:

13. 汇总字段 (Rollup Field)

  • type: rollup
  • 写入类型: 不可直接写入
  • 返回类型: 取决于汇总配置,可能是 number | string 或它们的数组形式
示例:

14. 评分字段 (Rating Field)

  • type: rating
  • 写入类型: number
  • 返回类型:
    • isMultipleCellValue: false: number
    • isMultipleCellValue: true: number[]
示例:

15. 自动编号字段 (Auto Number Field)

  • type: autoNumber
  • 写入类型: 不可直接写入
  • 返回类型:
    • isMultipleCellValue: false: number
    • isMultipleCellValue: true: number[]
示例:

16. 用户字段 (User Field)

  • type: user
  • 写入类型:
    • isMultipleCellValue: false: { id: string, title: string }
    • isMultipleCellValue: true: { id: string, title: string }[]
  • 返回类型:
    • isMultipleCellValue: false: { id: string, title: string, email?: string, avatar?: string }
    • isMultipleCellValue: true: { id: string, title: string, email?: string, avatar?: string }[]
示例:

17. 创建者字段 (Created By Field)

  • 写入类型: 不可直接写入
  • 返回类型:
    • isMultipleCellValue: false: { id: string, title: string, email?: string, avatar?: string }
    • isMultipleCellValue: true: { id: string, title: string, email?: string, avatar?: string }[] 示例:

18. 最后修改者字段 (Last Modified By Field)

  • 写入类型: 不可直接写入
  • 返回类型:
    • isMultipleCellValue: false: { id: string, title: string, email?: string, avatar?: string }
    • isMultipleCellValue: true: { id: string, title: string, email?: string, avatar?: string }[]
示例:
最后修改于 2025年2月13日