cloudcc-cli 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.json +18 -2
- package/.cloudcc-cache.json +17 -1
- package/.cursor/skills/{cloudcc-cli-usage → cloudcc-dev-usage}/SKILL.md +3 -2
- package/README.md +22 -0
- package/bin/index.js +2 -0
- package/build/{component-CCPlugin1774500425584.common.js → component-cc-cc-dd.common.js} +25 -25
- package/build/component-cc-cc-dd.common.js.map +1 -0
- package/build/component-cc-cc-dd.css +1 -0
- package/build/{component-CCPlugin1774500425584.umd.js → component-cc-cc-dd.umd.js} +27 -27
- package/build/component-cc-cc-dd.umd.js.map +1 -0
- package/build/{component-CCPlugin1774500425584.umd.min.js → component-cc-cc-dd.umd.min.js} +3 -3
- package/build/component-cc-cc-dd.umd.min.js.map +1 -0
- package/build/demo.html +1 -1
- package/package.json +3 -2
- package/plugins/cc-cc-dd/cc-cc-dd.vue +32 -0
- package/plugins/cc-cc-dd/components/HelloWorld.vue +11 -0
- package/plugins/cc-cc-dd/config.json +6 -0
- package/src/classes/docs/devguide.md +90 -0
- package/src/fields/create.js +12 -0
- package/src/globalSelectList/docs/devguide.md +0 -59
- package/src/menu/create-object.js +1 -0
- package/src/menu/create-page.js +1 -0
- package/src/menu/create-script.js +1 -0
- package/src/menu/create-site.js +1 -0
- package/src/menu/docs/devguide.md +57 -131
- package/src/object/create.js +2 -1
- package/src/object/docs/devguide.md +1 -5
- package/src/pagelayout/create.js +2 -2
- package/src/pagelayout/delete.js +57 -0
- package/src/pagelayout/docs/devguide.md +17 -229
- package/src/pagelayout/get.js +9 -9
- package/src/pagelayout/index.js +1 -0
- package/src/plugin/docs/devguide.md +90 -17
- package/src/profile/docs/devguide.md +3 -258
- package/src/role/create.js +2 -1
- package/src/role/delete.js +1 -0
- package/src/role/docs/devguide.md +5 -311
- package/src/timer/docs/devguide.md +83 -1
- package/src/triggers/docs/devguide.md +108 -0
- package/src/user/create.js +502 -19
- package/src/user/docs/devguide.md +22 -534
- package/src/validationRule/create.js +153 -0
- package/src/validationRule/delete.js +60 -0
- package/src/validationRule/doc.js +46 -0
- package/src/validationRule/docs/devguide.md +76 -0
- package/src/validationRule/docs/introduction.md +122 -0
- package/src/validationRule/get.js +47 -0
- package/src/validationRule/index.js +10 -0
- package/build/component-CCPlugin1774500425584.common.js.map +0 -1
- package/build/component-CCPlugin1774500425584.css +0 -1
- package/build/component-CCPlugin1774500425584.umd.js.map +0 -1
- package/build/component-CCPlugin1774500425584.umd.min.js.map +0 -1
- package/tmp_customsetting_detail.json +0 -1
|
@@ -1,203 +1,129 @@
|
|
|
1
|
-
# CloudCC
|
|
1
|
+
# CloudCC 菜单 CLI 命令说明
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 支持的命令
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
| 操作 | 说明 |
|
|
6
|
+
|------|------|
|
|
7
|
+
| `create menu object` | 创建自定义对象菜单 |
|
|
8
|
+
| `create menu page` | 创建自定义页面菜单 |
|
|
9
|
+
| `create menu script` | 创建自定义脚本菜单 |
|
|
10
|
+
| `create menu site` | 创建站点菜单 |
|
|
11
|
+
| `get menu` | 查询菜单列表 |
|
|
12
|
+
| `delete menu` | 删除菜单 |
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
## CLI 命令详解
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
cc doc menu introduction
|
|
12
|
-
cc doc menu devguide
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 2. 开发前准备
|
|
18
|
-
|
|
19
|
-
执行菜单相关命令前,请确认:
|
|
20
|
-
|
|
21
|
-
- 已完成 `cc doc project devguide` 的环境初始化
|
|
22
|
-
- 项目根目录存在可用的 `cloudcc-cli.config.js`
|
|
23
|
-
- 当前环境连接可用(org / token / endpoint 正确)
|
|
24
|
-
- 已明确菜单所属资源(对象 ID、页面 API、脚本内容或站点 ID)
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 3. 支持的命令总览
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
cc create menu object <path> <objectId> <tabName> [tabStyle] [mobileimg] [cloudccservicetab]
|
|
32
|
-
cc create menu page <path> <pageApi> <tabName> <pname> [tabStyle] [mobileimg] [cloudccservicetab] [mobileurl]
|
|
33
|
-
cc create menu script <path> <tabName> <pname> [functioncode] [tabStyle] [mobileimg] [cloudccservicetab]
|
|
34
|
-
cc create menu site <path> <siteId> <tabName> [tabStyle] [mobileimg] [cloudccservicetab]
|
|
35
|
-
|
|
36
|
-
cc get menu <projectPath> [encodedCondJson]
|
|
37
|
-
cc delete menu <projectPath> <tabId>
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## 4. 创建菜单
|
|
43
|
-
|
|
44
|
-
### 4.1 创建自定义对象菜单
|
|
16
|
+
### 创建自定义对象菜单
|
|
45
17
|
|
|
46
18
|
```bash
|
|
47
19
|
cc create menu object <path> <objectId> <tabName> [tabStyle] [mobileimg] [cloudccservicetab]
|
|
48
20
|
```
|
|
49
21
|
|
|
50
|
-
|
|
22
|
+
**参数说明:**
|
|
51
23
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
24
|
+
| 参数 | 必填 | 说明 |
|
|
25
|
+
|------|------|------|
|
|
26
|
+
| `path` | 是 | 项目路径,`.` 表示当前目录 |
|
|
27
|
+
| `objectId` | 是 | 自定义对象 ID |
|
|
28
|
+
| `tabName` | 是 | 菜单显示名称 |
|
|
29
|
+
| `tabStyle` | 否 | PC 端图标(默认 `cloudtab145`)|
|
|
30
|
+
| `mobileimg` | 否 | 移动端图标(默认 `cloudcc01`)|
|
|
31
|
+
| `cloudccservicetab` | 否 | 服务图标(默认 `cloudccservicetab_1`)|
|
|
58
32
|
|
|
59
|
-
|
|
33
|
+
**示例:**
|
|
60
34
|
|
|
61
35
|
```bash
|
|
62
36
|
cc create menu object . a0F9D000000XXXXUAI "客户管理"
|
|
63
37
|
```
|
|
64
38
|
|
|
65
|
-
###
|
|
39
|
+
### 创建自定义页面菜单
|
|
66
40
|
|
|
67
41
|
```bash
|
|
68
42
|
cc create menu page <path> <pageApi> <tabName> <pname> [tabStyle] [mobileimg] [cloudccservicetab] [mobileurl]
|
|
69
43
|
```
|
|
70
44
|
|
|
71
|
-
|
|
45
|
+
**参数说明:**
|
|
72
46
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
47
|
+
| 参数 | 必填 | 说明 |
|
|
48
|
+
|------|------|------|
|
|
49
|
+
| `path` | 是 | 项目路径 |
|
|
50
|
+
| `pageApi` | 是 | 自定义页面 API 名称(CLI 会追加 `#lightning`)|
|
|
51
|
+
| `tabName` | 是 | 菜单显示名称 |
|
|
52
|
+
| `pname` | 是 | 菜单内部名称(建议字母开头)|
|
|
53
|
+
| `tabStyle` / `mobileimg` / `cloudccservicetab` | 否 | 图标参数 |
|
|
54
|
+
| `mobileurl` | 否 | 移动端地址 |
|
|
79
55
|
|
|
80
|
-
|
|
56
|
+
**示例:**
|
|
81
57
|
|
|
82
58
|
```bash
|
|
83
59
|
cc create menu page . contract-assistant "合同助手" contract_menu
|
|
84
60
|
```
|
|
85
61
|
|
|
86
|
-
###
|
|
62
|
+
### 创建自定义脚本菜单
|
|
87
63
|
|
|
88
64
|
```bash
|
|
89
65
|
cc create menu script <path> <tabName> <pname> [functioncode] [tabStyle] [mobileimg] [cloudccservicetab]
|
|
90
66
|
```
|
|
91
67
|
|
|
92
|
-
|
|
68
|
+
**参数说明:**
|
|
93
69
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
70
|
+
| 参数 | 必填 | 说明 |
|
|
71
|
+
|------|------|------|
|
|
72
|
+
| `path` | 是 | 项目路径 |
|
|
73
|
+
| `tabName` | 是 | 菜单显示名称 |
|
|
74
|
+
| `pname` | 是 | 菜单内部名称 |
|
|
75
|
+
| `functioncode` | 否 | 脚本内容(默认示例脚本)|
|
|
99
76
|
|
|
100
|
-
|
|
77
|
+
**示例:**
|
|
101
78
|
|
|
102
79
|
```bash
|
|
103
80
|
cc create menu script . "数据导入工具" data_import_menu "ccc.alert('Hello World');"
|
|
104
81
|
```
|
|
105
82
|
|
|
106
|
-
###
|
|
83
|
+
### 创建站点菜单
|
|
107
84
|
|
|
108
85
|
```bash
|
|
109
86
|
cc create menu site <path> <siteId> <tabName> [tabStyle] [mobileimg] [cloudccservicetab]
|
|
110
87
|
```
|
|
111
88
|
|
|
112
|
-
|
|
89
|
+
**参数说明:**
|
|
113
90
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
91
|
+
| 参数 | 必填 | 说明 |
|
|
92
|
+
|------|------|------|
|
|
93
|
+
| `path` | 是 | 项目路径 |
|
|
94
|
+
| `siteId` | 是 | 站点 ID |
|
|
95
|
+
| `tabName` | 是 | 菜单显示名称 |
|
|
118
96
|
|
|
119
|
-
|
|
97
|
+
**示例:**
|
|
120
98
|
|
|
121
99
|
```bash
|
|
122
100
|
cc create menu site . a0H9D000000XXXXUAI "合作伙伴门户"
|
|
123
101
|
```
|
|
124
102
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
## 5. 查询与删除
|
|
128
|
-
|
|
129
|
-
### 5.1 查询菜单
|
|
103
|
+
### 查询菜单列表
|
|
130
104
|
|
|
131
105
|
```bash
|
|
132
106
|
cc get menu <projectPath> [encodedCondJson]
|
|
133
107
|
```
|
|
134
108
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- `projectPath` 默认当前目录
|
|
138
|
-
- `encodedCondJson` 为 URI 编码后的 JSON 查询条件
|
|
139
|
-
|
|
140
|
-
示例:
|
|
109
|
+
**示例:**
|
|
141
110
|
|
|
142
111
|
```bash
|
|
112
|
+
# 查询所有菜单
|
|
143
113
|
cc get menu .
|
|
114
|
+
|
|
115
|
+
# 带查询条件
|
|
144
116
|
cc get menu . '%7B%22type%22%3A%22page%22%7D'
|
|
145
117
|
```
|
|
146
118
|
|
|
147
|
-
###
|
|
119
|
+
### 删除菜单
|
|
148
120
|
|
|
149
121
|
```bash
|
|
150
122
|
cc delete menu <projectPath> <tabId>
|
|
151
123
|
```
|
|
152
124
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
- `tabId` 为菜单 ID,建议先执行 `cc get menu .` 再删除
|
|
156
|
-
|
|
157
|
-
示例:
|
|
125
|
+
**示例:**
|
|
158
126
|
|
|
159
127
|
```bash
|
|
160
128
|
cc delete menu . a0I9D000000XXXXUAI
|
|
161
129
|
```
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
## 6. 与后台菜单配置流程的映射
|
|
166
|
-
|
|
167
|
-
根据 CloudCC 官方菜单流程,完整上线通常包含三层动作:
|
|
168
|
-
|
|
169
|
-
1. 新建菜单(对象 / 页面 / 脚本)
|
|
170
|
-
2. 添加到简档(控制可见角色)
|
|
171
|
-
3. 添加到应用程序(控制出现在什么应用)
|
|
172
|
-
|
|
173
|
-
`cloudcc-cli` 当前主要覆盖第 1 步(菜单实体创建)。
|
|
174
|
-
因此在 CLI 创建后,建议在后台继续核验第 2-3 步,确保用户可见且出现在目标应用导航中。
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## 7. 常见注意事项
|
|
179
|
-
|
|
180
|
-
- 菜单创建成功不等于用户可见,需检查简档权限
|
|
181
|
-
- 菜单创建成功不等于出现在预期应用,需检查应用挂载
|
|
182
|
-
- `page` 类型请确认页面 API 存在且可访问
|
|
183
|
-
- 删除菜单前确认未被培训文档、操作手册或用户流程依赖
|
|
184
|
-
- 建议先在测试环境验证,再在生产环境执行
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## 8. 推荐操作顺序
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
# 1) 查询现有菜单,避免重名
|
|
192
|
-
cc get menu .
|
|
193
|
-
|
|
194
|
-
# 2) 创建目标菜单(示例:页面菜单)
|
|
195
|
-
cc create menu page . contract-manage "合同管理" contract_menu
|
|
196
|
-
|
|
197
|
-
# 3) 再次查询确认已创建
|
|
198
|
-
cc get menu .
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
创建后请在 CloudCC 后台完成简档与应用核验。
|
|
202
|
-
|
|
203
|
-
---
|
package/src/object/create.js
CHANGED
|
@@ -59,13 +59,9 @@ cc get object <projectPath> custom
|
|
|
59
59
|
### 4.1 基本命令
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
cc create object <projectPath> <label>
|
|
62
|
+
cc create object <projectPath> <label>
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
规则:
|
|
66
|
-
|
|
67
|
-
- 若传入 `nameLabel`,则使用传入值作为对象 API 名称
|
|
68
|
-
- 若未传入 `nameLabel`,CLI 会根据 `label` 自动生成一个英文可用的 slug,并拼成对象 API 名称
|
|
69
65
|
|
|
70
66
|
### 4.2 创建过程
|
|
71
67
|
|
package/src/pagelayout/create.js
CHANGED
|
@@ -16,8 +16,8 @@ async function getExistingLayouts(config, objId) {
|
|
|
16
16
|
config.accessToken
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
if (res && res.result && res.
|
|
20
|
-
return res.
|
|
19
|
+
if (res && res.result && res.data && Array.isArray(res.data) && res.data.length > 0) {
|
|
20
|
+
return res.data;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
throw new Error("未找到可用的页面布局");
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const { postClass } = require("../../utils/http");
|
|
2
|
+
const { getPackageJson } = require("../../utils/config");
|
|
3
|
+
const chalk = require("chalk");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 删除页面布局
|
|
7
|
+
* 用法:cc delete pagelayout <projectPath> <layoutId>
|
|
8
|
+
* @param {Array} argvs - 命令行参数数组
|
|
9
|
+
* @returns {Promise<Object>} 删除结果
|
|
10
|
+
*/
|
|
11
|
+
async function deleteLayout(argvs) {
|
|
12
|
+
try {
|
|
13
|
+
// 命令行参数格式:cc delete pagelayout <projectPath> <layoutId>
|
|
14
|
+
const projectPath = argvs[2] || process.cwd();
|
|
15
|
+
const layoutId = argvs[3];
|
|
16
|
+
|
|
17
|
+
if (!layoutId) {
|
|
18
|
+
console.error();
|
|
19
|
+
console.error(chalk.red("Error: 缺少页面布局 ID"));
|
|
20
|
+
console.error("用法: cc delete pagelayout <projectPath> <layoutId>");
|
|
21
|
+
console.error("示例:");
|
|
22
|
+
console.error(" cc delete pagelayout . add202610BD89F09XyGT");
|
|
23
|
+
console.error();
|
|
24
|
+
throw new Error("缺少必需参数: layoutId");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const config = await getPackageJson(projectPath);
|
|
28
|
+
|
|
29
|
+
console.error();
|
|
30
|
+
console.error(chalk.green(`Deleting page layout "${layoutId}"...`));
|
|
31
|
+
console.error();
|
|
32
|
+
|
|
33
|
+
const res = await postClass(
|
|
34
|
+
config.setupSvc + "/api/layout/deleteButton",
|
|
35
|
+
{
|
|
36
|
+
id: layoutId
|
|
37
|
+
},
|
|
38
|
+
config.accessToken
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
if (res && res.result) {
|
|
42
|
+
console.error(chalk.green("页面布局删除成功!"));
|
|
43
|
+
console.log(JSON.stringify(res.data || res));
|
|
44
|
+
return res.data || res;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const msg = res && (res.returnInfo || res.message) ? (res.returnInfo || res.message) : "Unknown error";
|
|
48
|
+
throw new Error("Delete PageLayout Failed: " + msg);
|
|
49
|
+
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error();
|
|
52
|
+
console.error(chalk.red("页面布局删除失败:"), error.message || error);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = deleteLayout;
|
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
# CloudCC
|
|
1
|
+
# CloudCC 页面布局 CLI 命令说明
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**前置条件**:页面布局操作需要先选中自定义对象或标准对象。
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 快速开始(CLI 命令)
|
|
10
|
-
|
|
11
|
-
### 支持的页面布局操作
|
|
3
|
+
## 支持的命令
|
|
12
4
|
|
|
13
5
|
| 操作 | 说明 |
|
|
14
6
|
|------|------|
|
|
15
7
|
| `get` | 查询页面布局列表 |
|
|
16
8
|
| `create` | 创建/复制页面布局 |
|
|
17
|
-
|
|
18
|
-
---
|
|
9
|
+
| `delete` | 删除页面布局 |
|
|
19
10
|
|
|
20
11
|
## CLI 命令详解
|
|
21
12
|
|
|
22
13
|
### 查询页面布局列表
|
|
23
14
|
|
|
24
|
-
获取指定对象的页面布局列表。
|
|
25
|
-
|
|
26
15
|
```bash
|
|
27
|
-
cc get pagelayout <projectPath> <
|
|
16
|
+
cc get pagelayout <projectPath> <prefix>
|
|
28
17
|
```
|
|
29
18
|
|
|
30
19
|
**参数说明:**
|
|
@@ -32,7 +21,7 @@ cc get pagelayout <projectPath> <objApiName>
|
|
|
32
21
|
| 参数 | 必填 | 说明 |
|
|
33
22
|
|------|------|------|
|
|
34
23
|
| `projectPath` | 否 | 项目路径,`.` 表示当前目录 |
|
|
35
|
-
| `
|
|
24
|
+
| `prefix` | 是 | 对象前缀(如 001, b25) |
|
|
36
25
|
|
|
37
26
|
**示例:**
|
|
38
27
|
|
|
@@ -40,16 +29,12 @@ cc get pagelayout <projectPath> <objApiName>
|
|
|
40
29
|
# 查询对象 b25 的页面布局列表
|
|
41
30
|
cc get pagelayout . b25
|
|
42
31
|
|
|
43
|
-
#
|
|
44
|
-
cc get pagelayout .
|
|
32
|
+
# 查询客户对象(001)的页面布局列表
|
|
33
|
+
cc get pagelayout . 001
|
|
45
34
|
```
|
|
46
35
|
|
|
47
|
-
---
|
|
48
|
-
|
|
49
36
|
### 创建页面布局
|
|
50
37
|
|
|
51
|
-
基于现有布局创建新的页面布局。
|
|
52
|
-
|
|
53
38
|
```bash
|
|
54
39
|
cc create pagelayout <projectPath> <objId> <layoutName> [sourceLayoutId] [isCloneDynamic]
|
|
55
40
|
```
|
|
@@ -77,219 +62,22 @@ cc create pagelayout . 20267D1465464C5OB6m5 "课程表2" add20261DA7347CZPAUz
|
|
|
77
62
|
cc create pagelayout . 20267D1465464C5OB6m5 "课程表2" add20261DA7347CZPAUz false
|
|
78
63
|
```
|
|
79
64
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## 完整工作流示例
|
|
83
|
-
|
|
84
|
-
### 场景:为自定义对象创建新的页面布局
|
|
65
|
+
### 删除页面布局
|
|
85
66
|
|
|
86
67
|
```bash
|
|
87
|
-
|
|
88
|
-
cat cloudcc-cli.config.js
|
|
89
|
-
|
|
90
|
-
# 2. 查询对象的页面布局列表
|
|
91
|
-
cc get pagelayout . b25
|
|
92
|
-
|
|
93
|
-
# 3. 根据对象 ID 创建新布局
|
|
94
|
-
cc create pagelayout . 20267D1465464C5OB6m5 "新的布局名称"
|
|
95
|
-
|
|
96
|
-
# 4. 验证创建成功,再次查询列表
|
|
97
|
-
cc get pagelayout . b25
|
|
68
|
+
cc delete pagelayout <projectPath> <layoutId>
|
|
98
69
|
```
|
|
99
70
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## API 接口详情
|
|
103
|
-
|
|
104
|
-
### 什么是页面布局?
|
|
105
|
-
|
|
106
|
-
**页面布局(Page Layout)** 定义了对象在详情页的展示方式,包括:
|
|
107
|
-
- 字段的排列和分组
|
|
108
|
-
- 相关列表的显示
|
|
109
|
-
- 操作按钮的位置
|
|
110
|
-
- 动态布局规则
|
|
111
|
-
|
|
112
|
-
### 核心属性
|
|
113
|
-
|
|
114
|
-
| 属性 | 说明 | 示例 |
|
|
115
|
-
|------|------|------|
|
|
116
|
-
| **ID(id)** | 页面布局唯一标识 | `add20261DA7347CZPAUz` |
|
|
117
|
-
| **名称(layoutName)** | 页面布局显示名称 | `课程表布局` |
|
|
118
|
-
| **对象 ID(objid)** | 关联的对象 ID | `20267D1465464C5OB6m5` |
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## 一、查询页面布局列表
|
|
123
|
-
|
|
124
|
-
### 1.1 接口说明
|
|
125
|
-
|
|
126
|
-
**接口**: `POST /api/layout/queryPageLayout`
|
|
127
|
-
|
|
128
|
-
**请求参数**:
|
|
129
|
-
|
|
130
|
-
| 参数名 | 类型 | 必填 | 说明 |
|
|
131
|
-
|--------|------|------|------|
|
|
132
|
-
| `prefix` | string | 是 | 对象 API 名称前缀 |
|
|
133
|
-
|
|
134
|
-
**返回数据**:
|
|
135
|
-
|
|
136
|
-
```javascript
|
|
137
|
-
{
|
|
138
|
-
"result": true,
|
|
139
|
-
"returnInfo": "操作成功",
|
|
140
|
-
"layouts": [
|
|
141
|
-
{
|
|
142
|
-
"id": "add20261DA7347CZPAUz",
|
|
143
|
-
"layoutName": "默认布局",
|
|
144
|
-
"objid": "20267D1465464C5OB6m5",
|
|
145
|
-
// ... 其他字段
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
**返回字段说明**:
|
|
71
|
+
**参数说明:**
|
|
152
72
|
|
|
153
|
-
|
|
|
73
|
+
| 参数 | 必填 | 说明 |
|
|
154
74
|
|------|------|------|
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `layouts[].layoutName` | string | 布局名称 |
|
|
158
|
-
| `layouts[].objid` | string | 关联对象 ID |
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## 二、创建页面布局
|
|
163
|
-
|
|
164
|
-
创建页面布局是一个两步流程:
|
|
165
|
-
|
|
166
|
-
1. **获取现有布局列表**:调用 `layout/newpage` 接口获取可用于复制的布局
|
|
167
|
-
2. **复制创建新布局**:调用 `layout/cloneLayout` 接口基于选定布局创建新布局
|
|
168
|
-
|
|
169
|
-
### 2.1 获取现有布局列表
|
|
170
|
-
|
|
171
|
-
**接口**: `POST /api/layout/newpage`
|
|
172
|
-
|
|
173
|
-
**请求参数**:
|
|
174
|
-
|
|
175
|
-
| 参数名 | 类型 | 必填 | 说明 |
|
|
176
|
-
|--------|------|------|------|
|
|
177
|
-
| `objid` | string | 是 | 对象 ID |
|
|
178
|
-
|
|
179
|
-
**返回数据**:
|
|
180
|
-
|
|
181
|
-
```javascript
|
|
182
|
-
{
|
|
183
|
-
"result": true,
|
|
184
|
-
"returnInfo": "操作成功",
|
|
185
|
-
"layouts": [
|
|
186
|
-
{
|
|
187
|
-
"id": "add20261DA7347CZPAUz",
|
|
188
|
-
"layoutName": "默认布局",
|
|
189
|
-
"objid": "20267D1465464C5OB6m5"
|
|
190
|
-
}
|
|
191
|
-
]
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
**默认布局选择逻辑**:
|
|
196
|
-
|
|
197
|
-
- 返回列表中的第一个布局作为默认复制源
|
|
198
|
-
|
|
199
|
-
### 2.2 复制创建新布局
|
|
200
|
-
|
|
201
|
-
**接口**: `POST /api/layout/cloneLayout`
|
|
202
|
-
|
|
203
|
-
**请求参数**:
|
|
204
|
-
|
|
205
|
-
| 参数名 | 类型 | 必填 | 说明 |
|
|
206
|
-
|--------|------|------|------|
|
|
207
|
-
| `layoutId` | string | 是 | 要复制的源布局 ID |
|
|
208
|
-
| `layoutName` | string | 是 | 新布局名称 |
|
|
209
|
-
| `objid` | string | 是 | 对象 ID |
|
|
210
|
-
| `isCloneDynamic` | string | 否 | 是否复制动态布局规则,默认 `"true"` |
|
|
211
|
-
|
|
212
|
-
**请求示例**:
|
|
213
|
-
|
|
214
|
-
```javascript
|
|
215
|
-
{
|
|
216
|
-
"layoutId": "add20261DA7347CZPAUz",
|
|
217
|
-
"layoutName": "课程表2",
|
|
218
|
-
"objid": "20267D1465464C5OB6m5",
|
|
219
|
-
"isCloneDynamic": "true"
|
|
220
|
-
}
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
**返回数据**:
|
|
224
|
-
|
|
225
|
-
```javascript
|
|
226
|
-
{
|
|
227
|
-
"result": true,
|
|
228
|
-
"returnInfo": "操作成功",
|
|
229
|
-
"data": {
|
|
230
|
-
"id": "add2026XXXXXXXXXXXXX",
|
|
231
|
-
"layoutName": "课程表2"
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
## 三、页面布局数据结构
|
|
75
|
+
| `projectPath` | 否 | 项目路径,`.` 表示当前目录 |
|
|
76
|
+
| `layoutId` | 是 | 要删除的页面布局 ID |
|
|
239
77
|
|
|
240
|
-
|
|
78
|
+
**示例:**
|
|
241
79
|
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
layoutName: "默认布局",
|
|
246
|
-
objid: "20267D1465464C5OB6m5"
|
|
247
|
-
}
|
|
80
|
+
```bash
|
|
81
|
+
# 删除指定页面布局
|
|
82
|
+
cc delete pagelayout . add202610BD89F09XyGT
|
|
248
83
|
```
|
|
249
|
-
|
|
250
|
-
---
|
|
251
|
-
|
|
252
|
-
## 四、最佳实践
|
|
253
|
-
|
|
254
|
-
### 命名规范
|
|
255
|
-
|
|
256
|
-
| 项目 | 规范 | 示例 |
|
|
257
|
-
|------|------|------|
|
|
258
|
-
| 布局名称 | 使用描述性名称 | `标准详情页布局`、`移动端布局` |
|
|
259
|
-
| 复制源选择 | 选择结构最相近的布局作为复制源 | - |
|
|
260
|
-
|
|
261
|
-
### 布局设计建议
|
|
262
|
-
|
|
263
|
-
- **按需复制动态布局规则**:如果源布局有复杂的动态规则,确认是否需要复制到新布局
|
|
264
|
-
- **避免重复创建**:创建前先查询现有布局,避免重复
|
|
265
|
-
|
|
266
|
-
### 推荐操作流程
|
|
267
|
-
|
|
268
|
-
1. 查看对象现有布局:`cc get pagelayout . <apiName>`
|
|
269
|
-
2. 确定复制源布局 ID
|
|
270
|
-
3. 创建新布局:`cc create pagelayout . <objId> <layoutName> [sourceLayoutId]`
|
|
271
|
-
4. 验证创建结果
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
## 五、常见问题
|
|
276
|
-
|
|
277
|
-
**Q: 为什么查询页面布局需要先选中对象?**
|
|
278
|
-
|
|
279
|
-
A: 页面布局是绑定到具体对象的,不同对象有不同的字段和关联关系,因此必须先确定对象才能操作其页面布局。
|
|
280
|
-
|
|
281
|
-
**Q: 如何获取对象 ID?**
|
|
282
|
-
|
|
283
|
-
A: 可以通过对象 API 名称查询对象信息获取 ID,或从管理后台的对象管理页面获取。
|
|
284
|
-
|
|
285
|
-
**Q: isCloneDynamic 参数的作用是什么?**
|
|
286
|
-
|
|
287
|
-
A: 该参数控制是否复制源布局的动态布局规则。设置为 `"true"` 时会复制动态规则,设置为 `"false"` 则只复制静态布局。
|
|
288
|
-
|
|
289
|
-
**Q: 创建页面布局时报错 "对象不存在"?**
|
|
290
|
-
|
|
291
|
-
A: 请确认传入的 `objId` 是正确的对象 ID,且该对象在当前环境中存在。
|
|
292
|
-
|
|
293
|
-
---
|
|
294
|
-
|
|
295
|
-
*文档版本:1.0 | 最后更新:2026-03-26*
|
package/src/pagelayout/get.js
CHANGED
|
@@ -4,21 +4,21 @@ const chalk = require("chalk");
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 查询页面布局列表
|
|
7
|
-
* 用法:cc get pagelayout <projectPath> <
|
|
7
|
+
* 用法:cc get pagelayout <projectPath> <prefix>
|
|
8
8
|
*/
|
|
9
9
|
async function get(argvs, isMcp = false) {
|
|
10
10
|
const projectPath = argvs[2] || process.cwd();
|
|
11
|
-
const
|
|
11
|
+
const prefix = argvs[3];
|
|
12
12
|
|
|
13
|
-
if (!
|
|
13
|
+
if (!prefix) {
|
|
14
14
|
console.error();
|
|
15
|
-
console.error(chalk.red("Error:
|
|
16
|
-
console.error("用法: cc get pagelayout <projectPath> <
|
|
15
|
+
console.error(chalk.red("Error: 缺少对象前缀"));
|
|
16
|
+
console.error("用法: cc get pagelayout <projectPath> <prefix>");
|
|
17
17
|
console.error("示例:");
|
|
18
|
+
console.error(" cc get pagelayout . 001");
|
|
18
19
|
console.error(" cc get pagelayout . b25");
|
|
19
|
-
console.error(" cc get pagelayout . Account");
|
|
20
20
|
console.error();
|
|
21
|
-
throw new Error("缺少必需参数:
|
|
21
|
+
throw new Error("缺少必需参数: prefix");
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const config = await getPackageJson(projectPath);
|
|
@@ -26,13 +26,13 @@ async function get(argvs, isMcp = false) {
|
|
|
26
26
|
const res = await postClass(
|
|
27
27
|
config.setupSvc + "/api/layout/queryPageLayout",
|
|
28
28
|
{
|
|
29
|
-
prefix:
|
|
29
|
+
prefix: prefix
|
|
30
30
|
},
|
|
31
31
|
config.accessToken
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
if (res && res.result) {
|
|
35
|
-
const layouts = res.layouts || [];
|
|
35
|
+
const layouts = res.data?.layouts || [];
|
|
36
36
|
if (!isMcp) {
|
|
37
37
|
console.log(JSON.stringify(layouts));
|
|
38
38
|
}
|