cloudcc-cli 2.3.7 → 2.3.9

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.
Files changed (65) hide show
  1. package/.cursor/skills/{cloudcc-cli-dev → dev-guide}/SKILL.md +5 -1
  2. package/README.md +65 -1
  3. package/cloudcc-dev-skill/SKILL.md +78 -0
  4. package/cloudcc-dev-skill/config.json +4 -0
  5. package/mcp/index.js +25 -2
  6. package/mcp/tools/Object Fields Creator/handler.js +149 -3
  7. package/package.json +1 -1
  8. package/src/classes/create.js +10 -0
  9. package/src/fields/buildFieldData.js +692 -0
  10. package/src/fields/create.js +10 -170
  11. package/src/fields/detail.js +37 -0
  12. package/src/fields/docs/devguide.md +168 -44
  13. package/src/fields/docs/introduction.md +2 -0
  14. package/src/fields/fields/A.js +3 -2
  15. package/src/fields/fields/AD.js +4 -2
  16. package/src/fields/fields/B.js +8 -5
  17. package/src/fields/fields/C.js +13 -5
  18. package/src/fields/fields/D.js +4 -4
  19. package/src/fields/fields/E.js +10 -5
  20. package/src/fields/fields/ENC.js +27 -8
  21. package/src/fields/fields/ENCD.js +27 -8
  22. package/src/fields/fields/F.js +4 -4
  23. package/src/fields/fields/FL.js +8 -4
  24. package/src/fields/fields/H.js +4 -4
  25. package/src/fields/fields/IMG.js +23 -5
  26. package/src/fields/fields/J.js +21 -6
  27. package/src/fields/fields/L.js +32 -8
  28. package/src/fields/fields/LT.js +23 -6
  29. package/src/fields/fields/M.js +2 -2
  30. package/src/fields/fields/MR.js +2 -2
  31. package/src/fields/fields/N.js +31 -8
  32. package/src/fields/fields/P.js +13 -5
  33. package/src/fields/fields/Q.js +42 -12
  34. package/src/fields/fields/S.js +19 -7
  35. package/src/fields/fields/SCORE.js +9 -4
  36. package/src/fields/fields/T.js +4 -4
  37. package/src/fields/fields/U.js +18 -5
  38. package/src/fields/fields/X.js +20 -6
  39. package/src/fields/fields/Y.js +17 -4
  40. package/src/fields/index.js +2 -0
  41. package/src/fields/update.js +148 -0
  42. package/test/fields.cli.test.js +3 -1
  43. package/utils/config.js +9 -0
  44. package/utils/utils.js +12 -5
  45. package/.cursor/skills/cloudcc-dev-skill/SKILL.md +0 -71
  46. package/target/classes/com/cloudcc/core/BaseException.class +0 -0
  47. package/target/classes/com/cloudcc/core/BusiException.class +0 -0
  48. package/target/classes/com/cloudcc/core/CCObject.class +0 -0
  49. package/target/classes/com/cloudcc/core/CCSchedule.class +0 -0
  50. package/target/classes/com/cloudcc/core/CCService.class +0 -0
  51. package/target/classes/com/cloudcc/core/CCTrigger.class +0 -0
  52. package/target/classes/com/cloudcc/core/CCTriggerHandler.class +0 -0
  53. package/target/classes/com/cloudcc/core/DevLogger.class +0 -0
  54. package/target/classes/com/cloudcc/core/OperatationEnum.class +0 -0
  55. package/target/classes/com/cloudcc/core/PeakInterf.class +0 -0
  56. package/target/classes/com/cloudcc/core/SendEmail.class +0 -0
  57. package/target/classes/com/cloudcc/core/ServiceResult.class +0 -0
  58. package/target/classes/com/cloudcc/core/StringUtils.class +0 -0
  59. package/target/classes/com/cloudcc/core/TimeUtil.class +0 -0
  60. package/target/classes/com/cloudcc/core/Tool$1.class +0 -0
  61. package/target/classes/com/cloudcc/core/Tool.class +0 -0
  62. package/target/classes/com/cloudcc/core/TriggerInvoker.class +0 -0
  63. package/target/classes/com/cloudcc/core/TriggerMethod.class +0 -0
  64. package/target/classes/com/cloudcc/core/TriggerTimeEnum.class +0 -0
  65. package/target/classes/com/cloudcc/core/UserInfo.class +0 -0
@@ -1,22 +1,25 @@
1
1
  /**
2
2
  * 复选框字段(B)配置模板
3
+ * defaultValue 仅 "0"(默认未选中)或 "1"(默认选中);其它或空按 "0"
3
4
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
5
+ module.exports = function (objid, nameLabel, apiname, helps = "", defaultValue = "", profileList) {
6
+ const raw = defaultValue !== undefined && defaultValue !== null ? String(defaultValue).trim() : "";
7
+ const dv = raw === "1" ? "1" : "0";
5
8
  return {
6
9
  "objid": objid,
7
10
  "obj": {
8
11
  "id": "",
9
12
  "nameLabel": nameLabel,
10
13
  "apiname": apiname,
11
- "schemefieldLength": "255",
12
14
  "remark": "",
13
- "helps": "",
14
- "defaultValue": "0"
15
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
16
+ "schemefieldLength": "10",
17
+ "defaultValue": dv
15
18
  },
16
19
  "dtype": "B:复选框",
17
20
  "fdtype": "B",
18
21
  "ischecked": "false",
19
- "defaultValue": "0",
22
+ "defaultValue": dv,
20
23
  "iscover": "",
21
24
  "formulaText": "",
22
25
  "profileFieldJson": profileList.map(profile => ({
@@ -1,7 +1,15 @@
1
1
  /**
2
2
  * 币种字段(C)配置模板
3
+ * schemefieldLength:小数点左侧(整数部分)位数
4
+ * decimalPlaces:小数点右侧位数
3
5
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
6
+ module.exports = function (objid, nameLabel, apiname, helps, defaultValue, schemefieldLength, decimalPlaces, profileList) {
7
+ const intDigits = schemefieldLength !== undefined && schemefieldLength !== null && String(schemefieldLength).trim() !== ""
8
+ ? String(schemefieldLength).trim()
9
+ : "10";
10
+ const fracDigits = decimalPlaces !== undefined && decimalPlaces !== null && String(decimalPlaces).trim() !== ""
11
+ ? String(decimalPlaces).trim()
12
+ : "2";
5
13
  return {
6
14
  "objid": objid,
7
15
  "obj": {
@@ -9,10 +17,10 @@ module.exports = function (objid, nameLabel, apiname, profileList) {
9
17
  "nameLabel": nameLabel,
10
18
  "apiname": apiname,
11
19
  "remark": "",
12
- "helps": "",
13
- "defaultValue": "",
14
- "schemefieldLength": "10",
15
- "decimalPlaces": "2"
20
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
21
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
22
+ "schemefieldLength": intDigits,
23
+ "decimalPlaces": fracDigits
16
24
  },
17
25
  "dtype": "c:币种",
18
26
  "fdtype": "c",
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * 日期字段(D)配置模板
3
3
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
4
+ module.exports = function (objid, nameLabel, apiname, helps = "", defaultValue = "", profileList) {
5
5
  return {
6
6
  "objid": objid,
7
7
  "obj": {
8
8
  "id": "",
9
9
  "nameLabel": nameLabel,
10
10
  "apiname": apiname,
11
- "schemefieldLength": "255",
12
11
  "remark": "",
13
- "helps": "",
14
- "defaultValue": ""
12
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
13
+ "schemefieldLength": "20",
14
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : ""
15
15
  },
16
16
  "dtype": "D:日期",
17
17
  "fdtype": "D",
@@ -1,18 +1,23 @@
1
1
  /**
2
2
  * 电子邮件字段(E)配置模板
3
+ * isrepeat: "true" 允许重复,"false" 不允许重复
3
4
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
5
+ module.exports = function (objid, nameLabel, apiname, helps = "", defaultValue = "", isrepeat = "true", profileList) {
6
+ const ir =
7
+ isrepeat !== undefined && isrepeat !== null && String(isrepeat).trim().toLowerCase() === "false"
8
+ ? "false"
9
+ : "true";
5
10
  return {
6
11
  "objid": objid,
7
12
  "obj": {
8
13
  "id": "",
9
14
  "nameLabel": nameLabel,
10
15
  "apiname": apiname,
11
- "schemefieldLength": "255",
12
16
  "remark": "",
13
- "helps": "",
14
- "defaultValue": "",
15
- "isrepeat": "true"
17
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
18
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
19
+ "schemefieldLength": "254",
20
+ "isrepeat": ir
16
21
  },
17
22
  "dtype": "E:电子邮件",
18
23
  "fdtype": "E",
@@ -1,7 +1,26 @@
1
1
  /**
2
2
  * 加密文本(存储加密)字段(ENC)配置模板
3
+ * @param {string} schemefieldLength 文本最大长度,写入 `obj.schemefieldLength`;须 ≤ **255**
4
+ * @param {string} masktype 掩码类型:`all` 掩码全部;`4` 掩码后四位;`card` 卡号格式;`custom` 自定义
5
+ * @param {string} encrypttype **`masktype` 为 `custom` 时**生效,自定义掩码规则,如 `"{AAAA}{****}{AAAA}"`
6
+ * @param {string} maskcharacter 掩码显示字符:**`*`** 或 **`X`**
3
7
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
8
+ module.exports = function (
9
+ objid,
10
+ nameLabel,
11
+ apiname,
12
+ helps = "",
13
+ defaultValue = "",
14
+ profileList,
15
+ schemefieldLength = "255",
16
+ masktype = "all",
17
+ encrypttype = "",
18
+ maskcharacter = "*"
19
+ ) {
20
+ const sl = String(schemefieldLength || "255").trim() || "255";
21
+ const mt = masktype;
22
+ const mc = maskcharacter === "X" ? "X" : "*";
23
+ const et = encrypttype !== undefined && encrypttype !== null ? String(encrypttype) : "";
5
24
  return {
6
25
  "objid": objid,
7
26
  "obj": {
@@ -9,20 +28,20 @@ module.exports = function (objid, nameLabel, apiname, profileList) {
9
28
  "nameLabel": nameLabel,
10
29
  "apiname": apiname,
11
30
  "remark": "",
12
- "helps": "",
13
- "defaultValue": "",
14
- "schemefieldLength": "255"
31
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
32
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
33
+ "schemefieldLength": sl
15
34
  },
16
35
  "dtype": "enc:加密文本(存储加密)",
17
36
  "fdtype": "enc",
18
- "masktype": "all",
19
- "maskcharacter": "*",
20
- "encrypttype": "{AAAA}{****}{AAAA}",
37
+ "masktype": mt,
38
+ "maskcharacter": mc,
39
+ "encrypttype": et,
21
40
  "profileFieldJson": profileList.map(profile => ({
22
41
  "profileId": profile.id,
23
42
  "visible": "true",
24
43
  "readonly": "false",
25
44
  "encryptvisible": "false"
26
- })),
45
+ }))
27
46
  }
28
47
  }
@@ -1,7 +1,26 @@
1
1
  /**
2
2
  * 加密文本(显示加密)字段(ENCD)配置模板
3
+ * @param {string} schemefieldLength 文本最大长度,写入 `obj.schemefieldLength`;须 ≤ **255**
4
+ * @param {string} masktype 掩码类型:`all` 掩码全部;`4` 掩码后四位;`card` 卡号格式;`custom` 自定义
5
+ * @param {string} encrypttype **`masktype` 为 `custom` 时**生效,自定义掩码规则,如 `"{AAAA}{****}{AAAA}"`
6
+ * @param {string} maskcharacter 掩码显示字符:**`*`** 或 **`X`**
3
7
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
8
+ module.exports = function (
9
+ objid,
10
+ nameLabel,
11
+ apiname,
12
+ helps = "",
13
+ defaultValue = "",
14
+ profileList,
15
+ schemefieldLength = "255",
16
+ masktype = "all",
17
+ encrypttype = "",
18
+ maskcharacter = "*"
19
+ ) {
20
+ const sl = String(schemefieldLength || "255").trim() || "255";
21
+ const mt = masktype;
22
+ const mc = maskcharacter === "X" ? "X" : "*";
23
+ const et = encrypttype !== undefined && encrypttype !== null ? String(encrypttype) : "";
5
24
  return {
6
25
  "objid": objid,
7
26
  "obj": {
@@ -9,20 +28,20 @@ module.exports = function (objid, nameLabel, apiname, profileList) {
9
28
  "nameLabel": nameLabel,
10
29
  "apiname": apiname,
11
30
  "remark": "",
12
- "helps": "",
13
- "defaultValue": "",
14
- "schemefieldLength": "255"
31
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
32
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
33
+ "schemefieldLength": sl
15
34
  },
16
35
  "dtype": "encd:加密文本(显示加密)",
17
36
  "fdtype": "encd",
18
- "masktype": "all",
19
- "maskcharacter": "*",
20
- "encrypttype": "{AAAA}{****}{AAAA}",
37
+ "masktype": mt,
38
+ "maskcharacter": mc,
39
+ "encrypttype": et,
21
40
  "profileFieldJson": profileList.map(profile => ({
22
41
  "profileId": profile.id,
23
42
  "visible": "true",
24
43
  "readonly": "false",
25
44
  "encryptvisible": "false"
26
- })),
45
+ }))
27
46
  }
28
47
  }
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * 日期/时间字段(F)配置模板
3
3
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
4
+ module.exports = function (objid, nameLabel, apiname, helps = "", defaultValue = "", profileList) {
5
5
  return {
6
6
  "objid": objid,
7
7
  "obj": {
8
8
  "id": "",
9
9
  "nameLabel": nameLabel,
10
10
  "apiname": apiname,
11
- "schemefieldLength": "255",
12
11
  "remark": "",
13
- "helps": "",
14
- "defaultValue": ""
12
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
13
+ "schemefieldLength": "30",
14
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : ""
15
15
  },
16
16
  "dtype": "F:日期/时间",
17
17
  "fdtype": "F",
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  * 文件字段(FL)配置模板
3
+ * @param {string} defaultValue 可上传文件数量;与 `isrepeat` 同步写入同一数值(`obj.defaultValue`、`obj.isrepeat`);空则默认 `1`
3
4
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
5
+ module.exports = function (objid, nameLabel, apiname, helps = "", defaultValue = "", profileList) {
6
+ const dv = defaultValue !== undefined && defaultValue !== null && String(defaultValue).trim() !== ""
7
+ ? String(defaultValue)
8
+ : "1";
5
9
  return {
6
10
  "objid": objid,
7
11
  "obj": {
@@ -9,10 +13,10 @@ module.exports = function (objid, nameLabel, apiname, profileList) {
9
13
  "nameLabel": nameLabel,
10
14
  "apiname": apiname,
11
15
  "remark": "",
12
- "helps": "",
13
- "defaultValue": "1",
16
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
17
+ "defaultValue": dv,
18
+ "isrepeat": dv,
14
19
  "schemefieldLength": "255",
15
- "isrepeat": "1"
16
20
  },
17
21
  "dtype": "FL:文件",
18
22
  "fdtype": "FL",
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * 电话字段(H)配置模板
3
3
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
4
+ module.exports = function (objid, nameLabel, apiname, helps = "", defaultValue = "", profileList) {
5
5
  return {
6
6
  "objid": objid,
7
7
  "obj": {
8
8
  "id": "",
9
9
  "nameLabel": nameLabel,
10
10
  "apiname": apiname,
11
- "schemefieldLength": "255",
12
11
  "remark": "",
13
- "helps": "",
14
- "defaultValue": ""
12
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
13
+ "schemefieldLength": "15",
14
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : ""
15
15
  },
16
16
  "dtype": "H:电话",
17
17
  "fdtype": "H",
@@ -1,7 +1,24 @@
1
1
  /**
2
2
  * 图片字段(IMG)配置模板
3
+ * @param {string} defaultValue 可上传图片数量,写入 `obj.defaultValue`;空则默认 `3`
4
+ * @param {string} formulaType 录入方式:`url` | `input`(顶层 `formulaType`)
5
+ * @param {string} watermarkstatus 是否支持水印拍照:`"0"` 不支持,`"1"` 支持
3
6
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
7
+ module.exports = function (
8
+ objid,
9
+ nameLabel,
10
+ apiname,
11
+ helps = "",
12
+ defaultValue = "",
13
+ profileList,
14
+ formulaType = "input",
15
+ watermarkstatus = "0"
16
+ ) {
17
+ const dv = defaultValue !== undefined && defaultValue !== null && String(defaultValue).trim() !== ""
18
+ ? String(defaultValue)
19
+ : "3";
20
+ const ft = formulaType === "url" || formulaType === "input" ? formulaType : "input";
21
+ const wm = watermarkstatus === "1" ? "1" : "0";
5
22
  return {
6
23
  "objid": objid,
7
24
  "obj": {
@@ -9,14 +26,15 @@ module.exports = function (objid, nameLabel, apiname, profileList) {
9
26
  "nameLabel": nameLabel,
10
27
  "apiname": apiname,
11
28
  "remark": "",
12
- "helps": "",
13
- "defaultValue": "3"
29
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
30
+ "schemefieldLength": "255",
31
+ "defaultValue": dv
14
32
  },
15
33
  "dtype": "IMG:图片",
16
34
  "fdtype": "IMG",
17
35
  "formulaText": "",
18
- "formulaType": "input",
19
- "watermarkstatus": "0",
36
+ "formulaType": ft,
37
+ "watermarkstatus": wm,
20
38
  "watermarkfield": "",
21
39
  "profileFieldJson": profileList.map(profile => ({
22
40
  "profileId": profile.id,
@@ -1,7 +1,22 @@
1
1
  /**
2
2
  * 文本区(长)字段(J)配置模板
3
+ * schemefieldLength:多行文本最大字符数,最多 32000;平台规则:每对象最多 10 个 J 类型字段(CLI 不校验条数)
3
4
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
5
+ module.exports = function (
6
+ objid,
7
+ nameLabel,
8
+ apiname,
9
+ helps = "",
10
+ defaultValue = "",
11
+ schemefieldLength = "32000",
12
+ placeholder = "",
13
+ profileList
14
+ ) {
15
+ const len =
16
+ schemefieldLength !== undefined && schemefieldLength !== null && String(schemefieldLength).trim() !== ""
17
+ ? String(schemefieldLength).trim()
18
+ : "32000";
19
+ const ph = placeholder !== undefined && placeholder !== null ? String(placeholder) : "";
5
20
  return {
6
21
  "objid": objid,
7
22
  "obj": {
@@ -9,14 +24,14 @@ module.exports = function (objid, nameLabel, apiname, profileList) {
9
24
  "nameLabel": nameLabel,
10
25
  "apiname": apiname,
11
26
  "remark": "",
12
- "helps": "",
13
- "schemefieldLength": "10000",
14
- "defaultValue": "",
15
- "placeholder": ""
27
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
28
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
29
+ "schemefieldLength": len,
30
+ "placeholder": ph
16
31
  },
17
32
  "dtype": "J:文本区(长)",
18
33
  "fdtype": "J",
19
- "defaultValue": "",
34
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
20
35
  "profileFieldJson": profileList.map(profile => ({
21
36
  "profileId": profile.id,
22
37
  "visible": "true",
@@ -1,28 +1,52 @@
1
1
  /**
2
2
  * 选项列表(单选)字段(L)配置模板
3
+ * @param {string} useGlobalSelect 是否使用全局选项列表:`"0"` 否,`"1"` 是(顶层 `useGlobalSelect`)
4
+ * @param {string} edittype 选择样式,写入 `obj.edittype`:`radio` 单选框列表,`select` 单选下拉
5
+ * @param {string} isPicklistSorted 是否按字母排序:`"0"` 否,`"1"` 是
6
+ * @param {string} defPl 是否将第一个值作为默认值:`"0"` 否,`"1"` 是
7
+ * @param {string} globalSelectId 全局选项列表 id(`useGlobalSelect` 为 `"1"` 时使用)
3
8
  */
4
- module.exports = function (objid, nameLabel, apiname, ptext, profileList) {
9
+ module.exports = function (
10
+ objid,
11
+ nameLabel,
12
+ apiname,
13
+ ptext,
14
+ helps = "",
15
+ defaultValue = "",
16
+ profileList,
17
+ useGlobalSelect = "0",
18
+ edittype = "select",
19
+ isPicklistSorted = "0",
20
+ defPl = "0",
21
+ globalSelectId = ""
22
+ ) {
23
+ const ugs = useGlobalSelect === "1" ? "1" : "0";
24
+ const et = edittype === "radio" ? "radio" : "select";
25
+ const sorted = isPicklistSorted === "1" ? "1" : "0";
26
+ const dp = defPl === "1" ? "1" : "0";
27
+ const gid = ugs === "1" ? String(globalSelectId || "").trim() : "";
5
28
  return {
6
- "objid": objid,
7
29
  "obj": {
8
30
  "id": "",
9
31
  "nameLabel": nameLabel,
10
32
  "apiname": apiname,
11
33
  "schemefieldLength": "255",
12
34
  "remark": "",
13
- "helps": "",
14
- "edittype": "select"
35
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
36
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
37
+ "edittype": et
15
38
  },
39
+ "objid": objid,
16
40
  "dtype": "L:选项列表",
17
41
  "fdtype": "L",
18
42
  "ischecked": "false",
19
43
  "iscover": "",
20
44
  "formulaText": "",
21
- "useGlobalSelect": "0",
22
- "globalSelectId": "province",
45
+ "useGlobalSelect": ugs,
46
+ "globalSelectId": gid,
23
47
  "ptext": ptext,
24
- "isPicklistSorted": "0",
25
- "defPl": "0",
48
+ "isPicklistSorted": sorted,
49
+ "defPl": dp,
26
50
  "profileFieldJson": profileList.map(profile => ({
27
51
  "profileId": profile.id,
28
52
  "visible": "true",
@@ -1,7 +1,23 @@
1
1
  /**
2
2
  * 地理定位字段(LT)配置模板
3
+ * @param {string} schemefieldLength 小数点左侧数字位数,写入 `obj.schemefieldLength`(与 **`decimalPlaces`** 之和须 **≤ 18**)
4
+ * @param {string} decimalPlaces 小数点右侧数字位数,写入 `obj.decimalPlaces`
5
+ * @param {string} displayType 经纬度显示: **`"1"`** 数字展示,**`"2"`** 度、分、秒
3
6
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
7
+ module.exports = function (
8
+ objid,
9
+ nameLabel,
10
+ apiname,
11
+ helps = "",
12
+ defaultValue = "",
13
+ profileList,
14
+ schemefieldLength = "8",
15
+ decimalPlaces = "10",
16
+ displayType = "1"
17
+ ) {
18
+ const sl = String(schemefieldLength || "8").trim() || "8";
19
+ const dp = String(decimalPlaces || "10").trim() || "10";
20
+ const dt = displayType === "2" ? "2" : "1";
5
21
  return {
6
22
  "objid": objid,
7
23
  "obj": {
@@ -9,20 +25,21 @@ module.exports = function (objid, nameLabel, apiname, profileList) {
9
25
  "nameLabel": nameLabel,
10
26
  "apiname": apiname,
11
27
  "remark": "",
12
- "helps": "",
13
- "schemefieldLength": "10",
14
- "decimalPlaces": "10"
28
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
29
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
30
+ "schemefieldLength": sl,
31
+ "decimalPlaces": dp
15
32
  },
16
33
  "dtype": "LT:地理定位",
17
34
  "fdtype": "LT",
18
35
  "ischecked": "false",
19
36
  "iscover": "",
20
37
  "formulaText": "",
21
- "displayType": "1",
38
+ "displayType": dt,
22
39
  "profileFieldJson": profileList.map(profile => ({
23
40
  "profileId": profile.id,
24
41
  "visible": "true",
25
42
  "readonly": "false"
26
- })),
43
+ }))
27
44
  }
28
45
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 主详信息关系字段(M)配置模板
3
3
  */
4
- module.exports = function (objid, nameLabel, apiname, lookupObj, profileList) {
4
+ module.exports = function (objid, nameLabel, apiname, lookupObj, helps = "", defaultValue = "", profileList) {
5
5
  return {
6
6
  "objid": objid,
7
7
  "obj": {
@@ -10,7 +10,7 @@ module.exports = function (objid, nameLabel, apiname, lookupObj, profileList) {
10
10
  "apiname": apiname,
11
11
  "schemefieldLength": "255",
12
12
  "remark": "",
13
- "helps": "",
13
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
14
14
  "lookupObj": lookupObj,
15
15
  "childrelationName": nameLabel
16
16
  },
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 查找多选字段(MR)配置模板
3
3
  */
4
- module.exports = function (objid, nameLabel, apiname, lookupObj, profileList) {
4
+ module.exports = function (objid, nameLabel, apiname, lookupObj, helps = "", defaultValue = "", profileList) {
5
5
  return {
6
6
  "objid": objid,
7
7
  "obj": {
@@ -10,7 +10,7 @@ module.exports = function (objid, nameLabel, apiname, lookupObj, profileList) {
10
10
  "apiname": apiname,
11
11
  "schemefieldLength": "255",
12
12
  "remark": "",
13
- "helps": "",
13
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
14
14
  "lookupObj": lookupObj
15
15
  },
16
16
  "dtype": "MR:查找多选",
@@ -1,7 +1,30 @@
1
1
  /**
2
- * 数字字段(N)配置模板
2
+ * 数字字段(N)配置模板(schemefieldLength=整数位,decimalPlaces=小数位,isrepeat,displayThousands 见平台约定)
3
3
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
4
+ module.exports = function (
5
+ objid,
6
+ nameLabel,
7
+ apiname,
8
+ helps = "",
9
+ defaultValue = "",
10
+ schemefieldLength = "10",
11
+ decimalPlaces = "0",
12
+ isrepeat = "true",
13
+ displayThousands = "0",
14
+ profileList
15
+ ) {
16
+ const len = schemefieldLength !== undefined && schemefieldLength !== null && String(schemefieldLength).trim() !== ""
17
+ ? String(schemefieldLength).trim()
18
+ : "10";
19
+ const dec = decimalPlaces !== undefined && decimalPlaces !== null && String(decimalPlaces).trim() !== ""
20
+ ? String(decimalPlaces).trim()
21
+ : "0";
22
+ const rep = isrepeat !== undefined && isrepeat !== null && String(isrepeat).trim() !== ""
23
+ ? String(isrepeat).trim()
24
+ : "true";
25
+ const dth = displayThousands !== undefined && displayThousands !== null && String(displayThousands).trim() !== ""
26
+ ? String(displayThousands).trim()
27
+ : "0";
5
28
  return {
6
29
  "objid": objid,
7
30
  "obj": {
@@ -9,12 +32,12 @@ module.exports = function (objid, nameLabel, apiname, profileList) {
9
32
  "nameLabel": nameLabel,
10
33
  "apiname": apiname,
11
34
  "remark": "",
12
- "helps": "",
13
- "defaultValue": "",
14
- "schemefieldLength": "10",
15
- "decimalPlaces": "0",
16
- "isrepeat": "true",
17
- "displayThousands": "0"
35
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
36
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
37
+ "schemefieldLength": len,
38
+ "decimalPlaces": dec,
39
+ "isrepeat": rep,
40
+ "displayThousands": dth
18
41
  },
19
42
  "dtype": "N:数字",
20
43
  "fdtype": "N",
@@ -1,7 +1,15 @@
1
1
  /**
2
2
  * 百分比字段(P)配置模板
3
+ * schemefieldLength:小数点左侧(整数部分)位数
4
+ * decimalPlaces:小数点右侧位数
3
5
  */
4
- module.exports = function (objid, nameLabel, apiname, profileList) {
6
+ module.exports = function (objid, nameLabel, apiname, helps, defaultValue, schemefieldLength, decimalPlaces, profileList) {
7
+ const intDigits = schemefieldLength !== undefined && schemefieldLength !== null && String(schemefieldLength).trim() !== ""
8
+ ? String(schemefieldLength).trim()
9
+ : "10";
10
+ const fracDigits = decimalPlaces !== undefined && decimalPlaces !== null && String(decimalPlaces).trim() !== ""
11
+ ? String(decimalPlaces).trim()
12
+ : "2";
5
13
  return {
6
14
  "objid": objid,
7
15
  "obj": {
@@ -9,10 +17,10 @@ module.exports = function (objid, nameLabel, apiname, profileList) {
9
17
  "nameLabel": nameLabel,
10
18
  "apiname": apiname,
11
19
  "remark": "",
12
- "helps": "",
13
- "defaultValue": "",
14
- "schemefieldLength": "10",
15
- "decimalPlaces": "2"
20
+ "helps": helps !== undefined && helps !== null ? String(helps) : "",
21
+ "defaultValue": defaultValue !== undefined && defaultValue !== null ? String(defaultValue) : "",
22
+ "schemefieldLength": intDigits,
23
+ "decimalPlaces": fracDigits
16
24
  },
17
25
  "dtype": "P:百分比",
18
26
  "fdtype": "P",