datai/datai-scenes/datai-scene-salesforce/docs/api-docs/partner-api/PartnerDescribeController/004-describe-layout.md

169 lines
4.6 KiB
Markdown
Raw Normal View History

# API 文档 - 描述对象布局
## 元数据
- 需求编号001
- 子需求编号001-01
- 接口编号004
- 创建时间2026-02-02
- 创建人AI Assistant
- 状态:已完成
## 接口概述
获取对象的页面布局信息。
## 基本信息
- **功能描述**:获取对象的页面布局信息
- **请求方式**POST
- **请求路径**`/partner/describe/layout`
- **权限要求**`@PreAuthorize("@ss.hasPermi('partner:describe:layout')")`
## 请求参数
### 请求体JSON
| 参数名 | 类型 | 必填 | 说明 | 示例值 |
|--------|------|------|------|--------|
| objectType | String | 是 | 对象类型(如 Account、Contact | Account |
| recordTypeId | String | 否 | 记录类型 ID可选未指定则返回默认布局 | 012xx0000000001AAA |
### 请求示例
```json
{
"objectType": "Account",
"recordTypeId": "012xx0000000001AAA"
}
```
## 响应参数
| 参数名 | 类型 | 说明 |
|--------|------|------|
| code | Integer | 状态码200 成功,其他失败) |
| msg | String | 提示信息 |
| data | Object | 响应数据 |
| data.layouts | Array | 布局描述列表 |
| data.layouts[].id | String | 布局 ID |
| data.layouts[].name | String | 布局名称 |
| data.layouts[].layoutType | String | 布局类型Compact、Full |
| data.layouts[].recordTypeId | String | 记录类型 ID |
| data.layouts[].sections | Array | 布局部分列表 |
| data.layouts[].sections[].heading | String | 部分标题 |
| data.layouts[].sections[].columns | Integer | 列数 |
| data.layouts[].sections[].rows | Array | 行列表 |
| data.layouts[].sections[].rows[].layoutItems | Array | 布局项列表 |
| data.layouts[].sections[].rows[].layoutItems[].field | String | 字段名称 |
| data.layouts[].sections[].rows[].layoutItems[].label | String | 字段标签 |
| data.layouts[].sections[].rows[].layoutItems[].required | Boolean | 是否必填 |
| data.success | Boolean | 是否成功 |
| data.errors | Array | 错误信息列表 |
### 成功响应示例
```json
{
"code": 200,
"msg": "操作成功",
"data": {
"layouts": [
{
"id": "00hxx0000000001AAA",
"name": "Account Layout",
"layoutType": "Full",
"recordTypeId": "012xx0000000001AAA",
"sections": [
{
"heading": "Account Information",
"columns": 2,
"rows": [
{
"layoutItems": [
{
"field": "Name",
"label": "Account Name",
"required": true
},
{
"field": "Type",
"label": "Account Type",
"required": false
}
]
},
{
"layoutItems": [
{
"field": "Industry",
"label": "Industry",
"required": false
},
{
"field": "Phone",
"label": "Phone",
"required": false
}
]
}
]
}
]
}
],
"success": true,
"errors": null
}
}
```
### 失败响应示例
```json
{
"code": 500,
"msg": "描述对象布局失败",
"data": {
"layouts": null,
"success": false,
"errors": [
{
"statusCode": "INVALID_TYPE",
"message": "Invalid object type: InvalidObject"
}
]
}
}
```
## 错误码
| 错误码 | 说明 | 处理建议 |
|--------|------|----------|
| 200 | 操作成功 | - |
| 400 | 请求参数错误 | 检查请求参数格式和必填项 |
| 401 | 未登录或登录已过期 | 请重新登录 |
| 403 | 无权限访问 | 请检查用户权限 |
| 500 | 服务器内部错误 | 请联系管理员或稍后重试 |
## 注意事项
1. 对象名称区分大小写
2. 如果不指定 recordTypeId则返回默认布局
3. 记录类型 ID 必须是有效的记录类型 ID
4. 布局信息包含字段顺序、必填状态等
5. 某些对象可能没有布局信息
6. 布局信息可能因为权限限制不可访问
## 使用场景
- 动态生成表单
- 获取字段的显示顺序
- 验证必填字段
- 构建自定义页面
- 权限检查和验证
## 相关文档
- [需求文档](../../requirements/2026-01-28-001-PartnerAPI源org实现.md)
- [设计文档](../../design/2026-01-29-001-01-认证和会话管理-设计.md)
- [决策记录](../../decisions/2026-01-29-001-01-ADR-认证和会话管理技术选型.md)