cloudcc-cli 2.2.9 → 2.3.1
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/.cloudcc-cache.json +4 -52
- package/.cursor/skills/cloudcc-cli-dev/BACKEND_CLASS.md +15 -1
- package/.cursor/skills/cloudcc-cli-dev/BACKEND_SCHEDULE.md +82 -8
- package/.cursor/skills/cloudcc-cli-dev/BACKEND_TRIGGER.md +13 -0
- package/.cursor/skills/cloudcc-cli-dev/CLI_CHEATSHEET.md +234 -77
- package/.cursor/skills/cloudcc-cli-dev/CUSTOM-SETTING-API.md +62 -0
- package/.cursor/skills/cloudcc-cli-dev/INSTALL_AND_BOOTSTRAP.md +9 -6
- package/.cursor/skills/cloudcc-cli-dev/OBJECTS_AND_FIELDS.md +99 -5
- package/.cursor/skills/cloudcc-cli-dev/REQUIREMENTS_BREAKDOWN.md +15 -0
- package/.cursor/skills/cloudcc-cli-dev/SKILL.md +29 -7
- package/.cursor/skills/cloudcc-cli-dev/STATIC-RESOURCE-API.md +60 -0
- package/.cursor/skills/cloudcc-cli-dev/VUE_CUSTOM_PAGE.md +216 -0
- package/.cursor/skills/cloudcc-cli-dev/docs//350/207/252/345/256/232/344/271/211/351/241/265/351/235/242.md +228 -0
- package/README.md +23 -1
- package/bin/index.js +7 -0
- package/package.json +2 -2
- package/src/application/delete.js +59 -0
- package/src/application/get.js +31 -5
- package/src/application/index.js +1 -0
- package/src/classes/delete.js +43 -0
- package/src/classes/detail.js +14 -7
- package/src/classes/index.js +7 -1
- package/src/customPage/create.js +139 -0
- package/src/customPage/delete.js +65 -0
- package/src/customPage/get.js +85 -0
- package/src/customPage/index.js +10 -0
- package/src/customSetting/create.js +27 -0
- package/src/customSetting/delete.js +26 -0
- package/src/customSetting/detail.js +24 -0
- package/src/customSetting/doc.js +196 -0
- package/src/customSetting/get.js +25 -0
- package/src/customSetting/index.js +11 -0
- package/src/fields/delete.js +52 -0
- package/src/fields/index.js +1 -0
- package/src/menu/create-page.js +16 -25
- package/src/menu/create.js +9 -3
- package/src/menu/delete.js +59 -0
- package/src/menu/get.js +56 -0
- package/src/menu/index.js +2 -0
- package/src/object/delete.js +51 -0
- package/src/object/index.js +1 -0
- package/src/plugin/detail.js +14 -6
- package/src/plugin/publish1.js +3 -3
- package/src/recordType/get.js +1 -1
- package/src/scheduleJob/delete.js +26 -0
- package/src/scheduleJob/detail.js +23 -0
- package/src/scheduleJob/get.js +26 -0
- package/src/scheduleJob/index.js +10 -0
- package/src/staticResource/count.js +25 -0
- package/src/staticResource/delete.js +26 -0
- package/src/staticResource/detail.js +24 -0
- package/src/staticResource/doc.js +106 -0
- package/src/staticResource/get.js +25 -0
- package/src/staticResource/index.js +12 -0
- package/src/timer/delete.js +43 -0
- package/src/timer/index.js +1 -0
- package/src/triggers/delete.js +46 -0
- package/src/triggers/index.js +1 -0
- package/test/application.cli.test.js +49 -8
- package/test/classes.cli.test.js +9 -3
- package/test/customSetting.cli.test.js +84 -0
- package/test/fields.cli.test.js +18 -3
- package/test/menu.cli.test.js +34 -4
- package/test/object.cli.test.js +17 -1
- package/test/scheduleJob.cli.test.js +52 -0
- package/test/staticResource.cli.test.js +78 -0
- package/test/timer.cli.test.js +8 -2
- package/test/trigger.cli.test.js +8 -2
- package/build/component-cc-test-001.common.js +0 -831
- package/build/component-cc-test-001.common.js.map +0 -1
- package/build/component-cc-test-001.css +0 -1
- package/build/component-cc-test-001.umd.js +0 -874
- package/build/component-cc-test-001.umd.js.map +0 -1
- package/build/component-cc-test-001.umd.min.js +0 -8
- package/build/component-cc-test-001.umd.min.js.map +0 -1
- package/build/demo.html +0 -1
- package/core.zip +0 -0
- package/plugins/cc-test-001/cc-test-001.vue +0 -32
- package/plugins/cc-test-001/components/HelloWorld.vue +0 -11
- package/plugins/cc-test-001/config.json +0 -6
- package/target/ccopenapi-0.0.4-classes.jar +0 -0
- package/target/ccopenapi-0.0.4.jar +0 -0
- package/target/maven-archiver/pom.properties +0 -3
- package/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +0 -20
- package/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +0 -19
- /package/{docs → .cursor/skills/cloudcc-cli-dev/docs}/CloudCC/350/207/252/345/256/232/344/271/211/347/273/204/344/273/266/344/275/277/347/224/250/350/257/264/346/230/216.md" +0 -0
- /package/{docs → .cursor/skills/cloudcc-cli-dev/docs}/cloudcc/345/256/232/346/227/266/344/275/234/344/270/232.md" +0 -0
- /package/{docs → .cursor/skills/cloudcc-cli-dev/docs}/cloudcc/345/256/232/346/227/266/347/261/273.md" +0 -0
- /package/{docs → .cursor/skills/cloudcc-cli-dev/docs}//350/207/252/345/256/232/344/271/211/347/261/273.md" +0 -0
- /package/{docs → .cursor/skills/cloudcc-cli-dev/docs}//350/247/246/345/217/221/345/231/250/347/261/273.md" +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getPackageJson } = require('../../utils/config');
|
|
3
|
+
const { post } = require('../../utils/http');
|
|
4
|
+
const BaseUrl = 'https://developer.apis.cloudcc.cn';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 删除自定义页面
|
|
8
|
+
*
|
|
9
|
+
* 用法:cc delete customPage <id> [projectPath]
|
|
10
|
+
*/
|
|
11
|
+
async function deleteCustomPage(argvs) {
|
|
12
|
+
const id = argvs[2];
|
|
13
|
+
const projectPath = argvs[3] || process.cwd();
|
|
14
|
+
|
|
15
|
+
if (!id) {
|
|
16
|
+
console.error();
|
|
17
|
+
console.error(chalk.red('Error: Custom page ID is required'));
|
|
18
|
+
console.error(chalk.yellow('Usage: cc delete customPage <id> [projectPath]'));
|
|
19
|
+
console.error();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const config = await getPackageJson(projectPath);
|
|
24
|
+
if (!config || !config.accessToken) {
|
|
25
|
+
console.error();
|
|
26
|
+
console.error(chalk.red('Error: Configuration not found or accessToken is missing'));
|
|
27
|
+
console.error();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const devSvcDispatch = config.devSvcDispatch || '/devconsole';
|
|
32
|
+
const baseUrl = config.baseUrl || BaseUrl;
|
|
33
|
+
|
|
34
|
+
const header = {
|
|
35
|
+
appType: 'lightning-devconsole',
|
|
36
|
+
accessToken: config.accessToken,
|
|
37
|
+
source: 'lightning-devconsole',
|
|
38
|
+
version: 'public',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const body = { id };
|
|
42
|
+
|
|
43
|
+
console.error();
|
|
44
|
+
console.error(chalk.green(`Deleting custom page (ID: ${id}), please wait...`));
|
|
45
|
+
|
|
46
|
+
const res = await post(
|
|
47
|
+
`${baseUrl}${devSvcDispatch}/custom/pc/1.0/post/deleteCustomPage`,
|
|
48
|
+
body,
|
|
49
|
+
header
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
if (res && res.returnCode == 200) {
|
|
53
|
+
console.error(chalk.green(`Success! Custom page (ID: ${id}) deleted.`));
|
|
54
|
+
console.error();
|
|
55
|
+
} else {
|
|
56
|
+
const errMsg = res?.returnInfo || 'Unknown error';
|
|
57
|
+
console.error(chalk.red(`Fail: ${errMsg}`));
|
|
58
|
+
console.error();
|
|
59
|
+
throw new Error('Delete Custom Page Failed: ' + errMsg);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return res;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = deleteCustomPage;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getPackageJson } = require('../../utils/config');
|
|
3
|
+
const { post } = require('../../utils/http');
|
|
4
|
+
const BaseUrl = 'https://developer.apis.cloudcc.cn';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 获取自定义页面列表
|
|
8
|
+
*
|
|
9
|
+
* 用法:cc get customPage [pageNo] [pageSize] [projectPath]
|
|
10
|
+
*/
|
|
11
|
+
async function listCustomPage(argvs) {
|
|
12
|
+
const pageNo = parseInt(argvs[2], 10) || 1;
|
|
13
|
+
const pageSize = parseInt(argvs[3], 10) || 20;
|
|
14
|
+
const projectPath = argvs[4] || process.cwd();
|
|
15
|
+
|
|
16
|
+
const config = await getPackageJson(projectPath);
|
|
17
|
+
if (!config || !config.accessToken) {
|
|
18
|
+
console.error();
|
|
19
|
+
console.error(chalk.red('Error: Configuration not found or accessToken is missing'));
|
|
20
|
+
console.error();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const devSvcDispatch = config.devSvcDispatch || '/devconsole';
|
|
25
|
+
const baseUrl = config.baseUrl || BaseUrl;
|
|
26
|
+
|
|
27
|
+
const header = {
|
|
28
|
+
appType: 'lightning-devconsole',
|
|
29
|
+
accessToken: config.accessToken,
|
|
30
|
+
source: 'lightning-devconsole',
|
|
31
|
+
version: 'public',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const body = {
|
|
35
|
+
pageNo,
|
|
36
|
+
pageSize,
|
|
37
|
+
condition: {
|
|
38
|
+
pageLabel: '',
|
|
39
|
+
dtBegin: '',
|
|
40
|
+
dtEnd: '',
|
|
41
|
+
pageApi: '',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
console.error();
|
|
46
|
+
console.error(chalk.green(`Fetching custom page list (page ${pageNo}, size ${pageSize})...`));
|
|
47
|
+
|
|
48
|
+
const res = await post(
|
|
49
|
+
`${baseUrl}${devSvcDispatch}/custom/pc/1.0/post/pageCustomPage`,
|
|
50
|
+
body,
|
|
51
|
+
header
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (res && res.returnCode == 200) {
|
|
55
|
+
const data = res.data || {};
|
|
56
|
+
const records = data.records || data.list || data || [];
|
|
57
|
+
const total = data.total ?? (Array.isArray(records) ? records.length : 0);
|
|
58
|
+
|
|
59
|
+
console.error(chalk.green(`Success! Total: ${total}`));
|
|
60
|
+
console.error();
|
|
61
|
+
|
|
62
|
+
if (Array.isArray(records) && records.length > 0) {
|
|
63
|
+
records.forEach((item, index) => {
|
|
64
|
+
console.log(
|
|
65
|
+
chalk.cyan(`[${index + 1}]`) +
|
|
66
|
+
` ID: ${item.id || '-'}` +
|
|
67
|
+
` Label: ${item.pageLabel || '-'}` +
|
|
68
|
+
` API: ${item.pageApi || '-'}`
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
console.log(chalk.yellow('No custom pages found.'));
|
|
73
|
+
}
|
|
74
|
+
console.error();
|
|
75
|
+
} else {
|
|
76
|
+
const errMsg = res?.returnInfo || 'Unknown error';
|
|
77
|
+
console.error(chalk.red(`Fail: ${errMsg}`));
|
|
78
|
+
console.error();
|
|
79
|
+
throw new Error('List Custom Page Failed: ' + errMsg);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return res;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = listCustomPage;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const chalk = require("chalk");
|
|
2
|
+
const { getPackageJson } = require("../../utils/config");
|
|
3
|
+
const { postClass } = require("../../utils/http");
|
|
4
|
+
|
|
5
|
+
async function create(projectPath = process.cwd(), encodedBodyJson) {
|
|
6
|
+
if (!encodedBodyJson) {
|
|
7
|
+
throw new Error("Create Custom Setting Failed: encodedBodyJson is required");
|
|
8
|
+
}
|
|
9
|
+
const body = JSON.parse(decodeURI(encodedBodyJson));
|
|
10
|
+
const config = await getPackageJson(projectPath);
|
|
11
|
+
console.error();
|
|
12
|
+
console.error(chalk.green("Creating custom setting, please wait..."));
|
|
13
|
+
console.error();
|
|
14
|
+
const res = await postClass(
|
|
15
|
+
config.setupSvc + "/api/customsetting/save",
|
|
16
|
+
body,
|
|
17
|
+
config.accessToken
|
|
18
|
+
);
|
|
19
|
+
if (res && res.result) {
|
|
20
|
+
console.error(chalk.green("Success! Custom setting saved."));
|
|
21
|
+
console.error();
|
|
22
|
+
return res;
|
|
23
|
+
}
|
|
24
|
+
throw new Error("Create Custom Setting Failed: " + (res?.returnInfo || res?.message || "Unknown error"));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = create;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const chalk = require("chalk");
|
|
2
|
+
const { getPackageJson } = require("../../utils/config");
|
|
3
|
+
const { postClass } = require("../../utils/http");
|
|
4
|
+
|
|
5
|
+
async function remove(projectPath = process.cwd(), id) {
|
|
6
|
+
if (!id) {
|
|
7
|
+
throw new Error("Delete Custom Setting Failed: id is required");
|
|
8
|
+
}
|
|
9
|
+
const config = await getPackageJson(projectPath);
|
|
10
|
+
console.error();
|
|
11
|
+
console.error(chalk.green(`Deleting custom setting (${id}), please wait...`));
|
|
12
|
+
console.error();
|
|
13
|
+
const res = await postClass(
|
|
14
|
+
config.setupSvc + "/api/customsetting/deleteobj",
|
|
15
|
+
{ id },
|
|
16
|
+
config.accessToken
|
|
17
|
+
);
|
|
18
|
+
if (res && res.result) {
|
|
19
|
+
console.error(chalk.green("Success! Custom setting deleted."));
|
|
20
|
+
console.error();
|
|
21
|
+
return res;
|
|
22
|
+
}
|
|
23
|
+
throw new Error("Delete Custom Setting Failed: " + (res?.returnInfo || res?.message || "Unknown error"));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = remove;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const { getPackageJson } = require("../../utils/config");
|
|
2
|
+
const { postClass } = require("../../utils/http");
|
|
3
|
+
|
|
4
|
+
async function detail(projectPath = process.cwd(), id, isMcp = false) {
|
|
5
|
+
if (!id) {
|
|
6
|
+
throw new Error("Custom Setting detail requires id");
|
|
7
|
+
}
|
|
8
|
+
const config = await getPackageJson(projectPath);
|
|
9
|
+
const res = await postClass(
|
|
10
|
+
config.setupSvc + "/api/customsetting/detail",
|
|
11
|
+
{ id },
|
|
12
|
+
config.accessToken
|
|
13
|
+
);
|
|
14
|
+
if (res && res.result) {
|
|
15
|
+
const data = res.data || {};
|
|
16
|
+
if (!isMcp) {
|
|
17
|
+
console.log(JSON.stringify(data));
|
|
18
|
+
}
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
throw new Error("Get Custom Setting Detail Failed: " + (res?.returnInfo || res?.message || "Unknown error"));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = detail;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* customSetting 文档统一入口(全量一次性输出)
|
|
3
|
+
*/
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
function generateFullMarkdownDoc() {
|
|
8
|
+
const lines = [
|
|
9
|
+
"# CloudCC 自定义设置操作指南",
|
|
10
|
+
"",
|
|
11
|
+
"> 本文档按实际页面操作顺序整理,覆盖你提供的 7 个步骤图:",
|
|
12
|
+
"> 列表 -> 新建 -> 编辑 -> 详情建字段 -> 字段类型选择 -> 字段属性填写 -> 字段编辑。",
|
|
13
|
+
"",
|
|
14
|
+
"直接查看 CLI 文档:`cc doc customSetting`",
|
|
15
|
+
"",
|
|
16
|
+
"---",
|
|
17
|
+
"",
|
|
18
|
+
"## 1. 入口与列表页(图一)",
|
|
19
|
+
"",
|
|
20
|
+
"进入路径:`设置 -> 开发者空间 -> 自定义设置`。",
|
|
21
|
+
"",
|
|
22
|
+
"在列表页可看到:",
|
|
23
|
+
"- 标签",
|
|
24
|
+
"- 可见性",
|
|
25
|
+
"- 设置类型",
|
|
26
|
+
"- 描述",
|
|
27
|
+
"",
|
|
28
|
+
"右上角点击「新建」进入自定义设置创建弹窗。",
|
|
29
|
+
"",
|
|
30
|
+
"---",
|
|
31
|
+
"",
|
|
32
|
+
"## 2. 新建自定义设置(图二)",
|
|
33
|
+
"",
|
|
34
|
+
"点击图一右上角「新建」,弹出「自定义设置:新建」窗口,需要填写:",
|
|
35
|
+
"",
|
|
36
|
+
"- `标签`(必填)",
|
|
37
|
+
"- `对象名`(必填)",
|
|
38
|
+
"- `设置类型`(如:列表)",
|
|
39
|
+
"- `可见性`(如:公用)",
|
|
40
|
+
"- `描述`(可选)",
|
|
41
|
+
"",
|
|
42
|
+
"填写后保存,返回列表可看到新建记录。",
|
|
43
|
+
"",
|
|
44
|
+
"---",
|
|
45
|
+
"",
|
|
46
|
+
"## 3. 编辑自定义设置基础信息(图三)",
|
|
47
|
+
"",
|
|
48
|
+
"在列表中选择一条记录进入编辑弹窗「自定义设置:编辑」。",
|
|
49
|
+
"",
|
|
50
|
+
"常见行为:",
|
|
51
|
+
"- 可编辑:标签、可见性、描述等",
|
|
52
|
+
"- 对象名、设置类型通常按产品规则受限(常见为不可改)",
|
|
53
|
+
"",
|
|
54
|
+
"保存后回到列表,确认信息更新成功。",
|
|
55
|
+
"",
|
|
56
|
+
"---",
|
|
57
|
+
"",
|
|
58
|
+
"## 4. 进入详情并管理字段(图四)",
|
|
59
|
+
"",
|
|
60
|
+
"点击某条自定义设置后进入详情页,页面分为两块:",
|
|
61
|
+
"",
|
|
62
|
+
"1. 自定义设置详细信息(头部)",
|
|
63
|
+
"2. 自定义设置字段列表(下半区)",
|
|
64
|
+
"",
|
|
65
|
+
"在字段列表区域可点击「新建」,为当前自定义设置新增字段。",
|
|
66
|
+
"",
|
|
67
|
+
"---",
|
|
68
|
+
"",
|
|
69
|
+
"## 5. 新建字段 - 选择数据类型(图五)",
|
|
70
|
+
"",
|
|
71
|
+
"点击图四的「新建」后,进入「自定义字段」向导第一步:",
|
|
72
|
+
"",
|
|
73
|
+
"- 选择字段数据类型(如 URL、百分比、货币、电话、电子邮件、文本、日期等)",
|
|
74
|
+
"- 该步骤决定下一步字段属性表单内容",
|
|
75
|
+
"",
|
|
76
|
+
"选择完成后点击「下一步」。",
|
|
77
|
+
"",
|
|
78
|
+
"---",
|
|
79
|
+
"",
|
|
80
|
+
"## 6. 新建字段 - 填写字段属性并保存(图六)",
|
|
81
|
+
"",
|
|
82
|
+
"在第二步填写字段属性(示例为文本字段):",
|
|
83
|
+
"",
|
|
84
|
+
"- 字段标签(必填)",
|
|
85
|
+
"- 长度(如文本长度 255)",
|
|
86
|
+
"- 字段名 / API 名称(必填)",
|
|
87
|
+
"- 独有配置(如不允许重复值,按需开启)",
|
|
88
|
+
"",
|
|
89
|
+
"点击「保存」后,即在当前自定义设置下创建了一个新字段。",
|
|
90
|
+
"",
|
|
91
|
+
"---",
|
|
92
|
+
"",
|
|
93
|
+
"## 7. 编辑已有字段(图七)",
|
|
94
|
+
"",
|
|
95
|
+
"保存成功后回到字段列表,可看到新字段。点击某字段的操作菜单(如「...」)可进行:",
|
|
96
|
+
"",
|
|
97
|
+
"- 编辑:修改字段属性(可修改范围受字段类型和系统规则限制)",
|
|
98
|
+
"- 删除:移除该字段(建议先确认是否已有业务依赖)",
|
|
99
|
+
"",
|
|
100
|
+
"编辑保存后,字段列表会展示最新结果。",
|
|
101
|
+
"",
|
|
102
|
+
"---",
|
|
103
|
+
"",
|
|
104
|
+
"## 8. 新建字段支持的所有字段类型",
|
|
105
|
+
"",
|
|
106
|
+
"自定义设置详情页「新建字段」当前支持以下字段类型(与前端字段类型选择一致):",
|
|
107
|
+
"",
|
|
108
|
+
"| 类型代码(fdtype) | 类型名称 | 说明 |",
|
|
109
|
+
"|---|---|---|",
|
|
110
|
+
"| `U` | URL | 允许输入有效网址;点击后按打开方式在新/当前窗口打开 |",
|
|
111
|
+
"| `P` | 百分比 | 输入数字并自动添加百分号(如 10 -> 10%) |",
|
|
112
|
+
"| `c` | 币种 | 金额/币种类型字段 |",
|
|
113
|
+
"| `H` | 电话 | 输入电话号码并按电话格式展示 |",
|
|
114
|
+
"| `E` | 电子邮件 | 输入邮箱并校验格式(可用于“发送电子邮件”选择地址) |",
|
|
115
|
+
"| `B` | 复选框 | 布尔值(真/假) |",
|
|
116
|
+
"| `D` | 日期 | 输入或选择日期 |",
|
|
117
|
+
"| `F` | 日期和时间 | 输入或选择日期时间 |",
|
|
118
|
+
"| `N` | 数字 | 输入数字(会删除前置零) |",
|
|
119
|
+
"| `S` | 文本 | 字母数字组合文本 |",
|
|
120
|
+
"| `X` | 长文本 | 多行文本,最多 4000 字符 |",
|
|
121
|
+
"",
|
|
122
|
+
"在接口层面:新建/编辑字段使用 `POST /api/customsetting/saveField`,其中 `fdtype` 与 `tpSysSchemetableVO.schemefieldType` 建议保持一致(例如文本为 `S`,百分比为 `P`)。",
|
|
123
|
+
"",
|
|
124
|
+
"---",
|
|
125
|
+
"",
|
|
126
|
+
"## 9. Java 侧读取自定义设置(CCService)",
|
|
127
|
+
"",
|
|
128
|
+
"### 9.1 列表类型(List)",
|
|
129
|
+
"",
|
|
130
|
+
"```java",
|
|
131
|
+
"// 某 API 名称下的全部数据",
|
|
132
|
+
"Map listSettings = cs.getListCustomSetting(\"MyListSettingApiName\");",
|
|
133
|
+
"",
|
|
134
|
+
"// 指定 Name 的单条",
|
|
135
|
+
"Map singleSetting = cs.getListCustomSetting(\"MyListSettingApiName\", \"SomeName\");",
|
|
136
|
+
"```",
|
|
137
|
+
"",
|
|
138
|
+
"### 9.2 层次结构类型(Hierarchy)",
|
|
139
|
+
"",
|
|
140
|
+
"```java",
|
|
141
|
+
"// id 为简档 ID 或用户 ID",
|
|
142
|
+
"Map hiSetting = cs.getCustomSetting(\"MyHierarchySettingApiName\", profileOrUserId);",
|
|
143
|
+
"```",
|
|
144
|
+
"",
|
|
145
|
+
"---",
|
|
146
|
+
"",
|
|
147
|
+
"## 10. 操作 Checklist",
|
|
148
|
+
"",
|
|
149
|
+
"- [ ] 已在列表页确认目标自定义设置(标签/对象名)",
|
|
150
|
+
"- [ ] 新建时已正确选择设置类型与可见性",
|
|
151
|
+
"- [ ] 进入详情后通过字段向导完成字段新增",
|
|
152
|
+
"- [ ] 字段 `标签`、`API 名称`、`长度` 等配置符合规范",
|
|
153
|
+
"- [ ] 保存后已在字段列表验证新增或编辑结果",
|
|
154
|
+
"- [ ] 代码侧读取时,API 名称与平台配置保持一致",
|
|
155
|
+
"",
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
const base = lines.join("\n");
|
|
159
|
+
const apiPath = path.join(
|
|
160
|
+
__dirname,
|
|
161
|
+
"..",
|
|
162
|
+
"..",
|
|
163
|
+
"cloudcc-cli-dev",
|
|
164
|
+
"CUSTOM-SETTING-API.md"
|
|
165
|
+
);
|
|
166
|
+
let apiContent = "";
|
|
167
|
+
try {
|
|
168
|
+
apiContent = fs.readFileSync(apiPath, "utf8");
|
|
169
|
+
} catch (e) {
|
|
170
|
+
apiContent = `# 自定义设置相关接口\n\n(未找到文件:${apiPath})\n`;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return [
|
|
174
|
+
base,
|
|
175
|
+
"",
|
|
176
|
+
"---",
|
|
177
|
+
"",
|
|
178
|
+
"## 附录:自定义设置 Setup 接口速查",
|
|
179
|
+
"",
|
|
180
|
+
"> 来源:`cloudcc-cli-dev/CUSTOM-SETTING-API.md`",
|
|
181
|
+
"",
|
|
182
|
+
apiContent.trim(),
|
|
183
|
+
"",
|
|
184
|
+
].join("\n");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function doc() {
|
|
188
|
+
const content = generateFullMarkdownDoc();
|
|
189
|
+
console.log(content);
|
|
190
|
+
return content;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
doc.getClassEditorDoc = doc;
|
|
194
|
+
doc.getEditGuide = doc;
|
|
195
|
+
|
|
196
|
+
module.exports = doc;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { getPackageJson } = require("../../utils/config");
|
|
2
|
+
const { postClass } = require("../../utils/http");
|
|
3
|
+
|
|
4
|
+
async function get(projectPath = process.cwd(), encodedCondJson, isMcp = false) {
|
|
5
|
+
let body = {};
|
|
6
|
+
if (encodedCondJson) {
|
|
7
|
+
body = JSON.parse(decodeURI(encodedCondJson));
|
|
8
|
+
}
|
|
9
|
+
const config = await getPackageJson(projectPath);
|
|
10
|
+
const res = await postClass(
|
|
11
|
+
config.setupSvc + "/api/customsetting/list",
|
|
12
|
+
body,
|
|
13
|
+
config.accessToken
|
|
14
|
+
);
|
|
15
|
+
if (res && res.result) {
|
|
16
|
+
const list = res?.data?.objList || [];
|
|
17
|
+
if (!isMcp) {
|
|
18
|
+
console.log(JSON.stringify(list));
|
|
19
|
+
}
|
|
20
|
+
return list;
|
|
21
|
+
}
|
|
22
|
+
throw new Error("Get Custom Setting Failed: " + (res?.returnInfo || res?.message || "Unknown error"));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = get;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const cc = {};
|
|
2
|
+
cc.doc = require("./doc");
|
|
3
|
+
cc.get = require("./get");
|
|
4
|
+
cc.create = require("./create");
|
|
5
|
+
cc.detail = require("./detail");
|
|
6
|
+
cc.delete = require("./delete");
|
|
7
|
+
function CustomSetting(action, argvs) {
|
|
8
|
+
cc[action](argvs[2], argvs[3]);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = CustomSetting;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const chalk = require("chalk");
|
|
2
|
+
const { postClass } = require("../../utils/http");
|
|
3
|
+
const { getPackageJson } = require("../../utils/config");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 删除字段(彻底删除)
|
|
7
|
+
* 用法:cc delete fields <projectPath> <fieldId> <objid>
|
|
8
|
+
*/
|
|
9
|
+
async function remove(argvs) {
|
|
10
|
+
const projectPath = argvs[2] || process.cwd();
|
|
11
|
+
const id = argvs[3];
|
|
12
|
+
const objid = argvs[4];
|
|
13
|
+
|
|
14
|
+
if (!id || !objid) {
|
|
15
|
+
console.error();
|
|
16
|
+
console.error(chalk.red("Error: fieldId and objid are required"));
|
|
17
|
+
console.error(chalk.yellow("Usage: cc delete fields <projectPath> <fieldId> <objid>"));
|
|
18
|
+
console.error();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const config = await getPackageJson(projectPath);
|
|
23
|
+
if (!config || !config.accessToken) {
|
|
24
|
+
console.error();
|
|
25
|
+
console.error(chalk.red("Error: Configuration not found or accessToken is missing"));
|
|
26
|
+
console.error();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
console.error();
|
|
31
|
+
console.error(chalk.green(`Deleting field (${id}) from object (${objid}), please wait...`));
|
|
32
|
+
console.error();
|
|
33
|
+
|
|
34
|
+
const res = await postClass(
|
|
35
|
+
config.setupSvc + "/api/fieldSetup/deleteFieldCompletely",
|
|
36
|
+
{ id, objid },
|
|
37
|
+
config.accessToken
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (res && res.result) {
|
|
41
|
+
console.error(chalk.green("Success! Field deleted."));
|
|
42
|
+
console.error();
|
|
43
|
+
return res;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const errMsg = res && (res.returnInfo || res.message) ? (res.returnInfo || res.message) : "Unknown error";
|
|
47
|
+
console.error(chalk.red(`Fail: ${errMsg}`));
|
|
48
|
+
console.error();
|
|
49
|
+
throw new Error("Delete Field Failed: " + errMsg);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = remove;
|
package/src/fields/index.js
CHANGED
package/src/menu/create-page.js
CHANGED
|
@@ -11,22 +11,25 @@ const { buildCommonMenuFields } = require('./common');
|
|
|
11
11
|
*/
|
|
12
12
|
async function createPageMenu(argvs) {
|
|
13
13
|
try {
|
|
14
|
-
// 命令行参数格式:cc create menu page <path> <
|
|
15
|
-
// argvs: ['create', 'menu', 'page', '.', '
|
|
14
|
+
// 命令行参数格式:cc create menu page <path> <pageApi> <tabName> <pname> [tabStyle] [mobileimg] [cloudccservicetab] [mobileurl]
|
|
15
|
+
// argvs: ['create', 'menu', 'page', '.', 'contract-assistant', '标签名', '菜单名称', ...]
|
|
16
16
|
let path = argvs[3]; // 路径 (argvs[3])
|
|
17
|
-
let
|
|
17
|
+
let pageApi = argvs[4]; // 自定义页面 pageApi,例如 contract-assistant
|
|
18
18
|
let tabName = argvs[5]; // 标签名称
|
|
19
|
-
let
|
|
20
|
-
let
|
|
21
|
-
let
|
|
19
|
+
let pname = argvs[6]; // 菜单名称
|
|
20
|
+
let tabStyle = argvs[7] || "cloudtab145"; // 标签样式图标,默认 cloudtab145
|
|
21
|
+
let mobileimg = argvs[8] || "cloudcc01"; // 移动端图标,默认 cloudcc01
|
|
22
|
+
let cloudccservicetab = argvs[9] || "cloudccservicetab_1"; // 服务标签图标,默认 cloudccservicetab_1
|
|
23
|
+
let mobileurl = argvs[10] || ""; // 移动端地址,默认空字符串
|
|
22
24
|
|
|
23
|
-
if (!
|
|
25
|
+
if (!pageApi || !tabName || !pname) {
|
|
24
26
|
console.error();
|
|
25
27
|
console.error(chalk.red('Error: 缺少必需参数'));
|
|
26
|
-
console.error('用法: cc create menu page <path> <
|
|
28
|
+
console.error('用法: cc create menu page <path> <pageApi> <tabName> <pname> [tabStyle] [mobileimg] [cloudccservicetab] [mobileurl]');
|
|
27
29
|
console.error();
|
|
28
|
-
throw new Error('缺少必需参数:
|
|
30
|
+
throw new Error('缺少必需参数: pageApi、tabName 和 pname');
|
|
29
31
|
}
|
|
32
|
+
const lightningPage = pageApi.endsWith("#lightning") ? pageApi : `${pageApi}#lightning`;
|
|
30
33
|
|
|
31
34
|
let config = await getPackageJson(path);
|
|
32
35
|
|
|
@@ -54,22 +57,10 @@ async function createPageMenu(argvs) {
|
|
|
54
57
|
visited_2: "1",
|
|
55
58
|
allOrSome: "some",
|
|
56
59
|
type: "page",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
field: "Select",
|
|
62
|
-
required: "right",
|
|
63
|
-
hint: "label.customer.tab.step1.selectonepage",
|
|
64
|
-
rules: [
|
|
65
|
-
{
|
|
66
|
-
required: true,
|
|
67
|
-
message: "请选择页面",
|
|
68
|
-
trigger: "blur"
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
value: pageId
|
|
72
|
-
},
|
|
60
|
+
pageType: "customPage",
|
|
61
|
+
lightningPage: lightningPage,
|
|
62
|
+
mobileurl: mobileurl,
|
|
63
|
+
pname: pname,
|
|
73
64
|
...commonFields,
|
|
74
65
|
profileIds: profileIds,
|
|
75
66
|
};
|
package/src/menu/create.js
CHANGED
|
@@ -7,7 +7,9 @@ const createSiteMenu = require('./create-site');
|
|
|
7
7
|
/**
|
|
8
8
|
* 创建自定义菜单(标签页)
|
|
9
9
|
* 支持类型:object(自定义对象)、page(自定义页面)、script(自定义脚本)、site(站点)
|
|
10
|
-
* 命令格式:
|
|
10
|
+
* 命令格式:
|
|
11
|
+
* - object/script/site: cc create menu <type> <path> <resourceId> <tabName> [tabStyle] [mobileimg] [cloudccservicetab]
|
|
12
|
+
* - page: cc create menu page <path> <pageApi> <tabName> <pname> [tabStyle] [mobileimg] [cloudccservicetab] [mobileurl]
|
|
11
13
|
* @param {Array} argvs - 命令行参数数组
|
|
12
14
|
* @returns {Promise<Object>} 创建结果
|
|
13
15
|
*/
|
|
@@ -24,10 +26,14 @@ async function create(argvs) {
|
|
|
24
26
|
console.error();
|
|
25
27
|
console.error(chalk.red('Error: 无效的菜单类型'));
|
|
26
28
|
console.error(`支持的菜单类型: ${validTypes.join(', ')}`);
|
|
27
|
-
console.error('用法:
|
|
29
|
+
console.error('用法:');
|
|
30
|
+
console.error(' cc create menu object <path> <objectId> <tabName> [tabStyle] [mobileimg] [cloudccservicetab]');
|
|
31
|
+
console.error(' cc create menu page <path> <pageApi> <tabName> <pname> [tabStyle] [mobileimg] [cloudccservicetab] [mobileurl]');
|
|
32
|
+
console.error(' cc create menu script <path> <scriptId> <tabName> [tabStyle] [mobileimg] [cloudccservicetab]');
|
|
33
|
+
console.error(' cc create menu site <path> <siteId> <tabName> [tabStyle] [mobileimg] [cloudccservicetab]');
|
|
28
34
|
console.error('示例:');
|
|
29
35
|
console.error(' cc create menu object . <objectId> "我的对象菜单"');
|
|
30
|
-
console.error(' cc create menu page .
|
|
36
|
+
console.error(' cc create menu page . contract-assistant "我的页面标签" my_page_menu');
|
|
31
37
|
console.error(' cc create menu script . <scriptId> "我的脚本菜单"');
|
|
32
38
|
console.error(' cc create menu site . <siteId> "我的站点菜单"');
|
|
33
39
|
console.error();
|