neo-cmp-cli 1.8.3 → 1.8.6

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 (189) hide show
  1. package/package.json +3 -3
  2. package/src/utils/cmpUtils/createCmpByTemplate.js +1 -1
  3. package/src/utils/projectUtils/createCmpProjectByTemplate.js +1 -1
  4. package/template/antd-custom-cmp-template/.prettierrc.js +12 -0
  5. package/template/antd-custom-cmp-template/README.md +153 -0
  6. package/template/antd-custom-cmp-template/commitlint.config.js +59 -0
  7. package/template/antd-custom-cmp-template/neo.config.js +144 -0
  8. package/template/antd-custom-cmp-template/package.json +60 -0
  9. package/template/antd-custom-cmp-template/public/css/base.css +283 -0
  10. package/template/antd-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  11. package/template/antd-custom-cmp-template/public/template.html +13 -0
  12. package/template/antd-custom-cmp-template/src/assets/css/common.scss +127 -0
  13. package/template/antd-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  14. package/template/antd-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  15. package/template/antd-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  16. package/template/antd-custom-cmp-template/src/assets/img/favicon.png +0 -0
  17. package/template/antd-custom-cmp-template/src/components/dataDashboard/README.md +39 -0
  18. package/template/antd-custom-cmp-template/src/components/dataDashboard/index.tsx +462 -0
  19. package/template/antd-custom-cmp-template/src/components/dataDashboard/model.ts +75 -0
  20. package/template/antd-custom-cmp-template/src/components/dataDashboard/style.scss +1667 -0
  21. package/template/antd-custom-cmp-template/src/components/infoCard/index.tsx +87 -0
  22. package/template/antd-custom-cmp-template/src/components/infoCard/model.ts +80 -0
  23. package/template/antd-custom-cmp-template/src/components/infoCard/style.scss +105 -0
  24. package/template/antd-custom-cmp-template/tsconfig.json +68 -0
  25. package/template/develop/neo-custom-cmp-template/.prettierrc.js +12 -0
  26. package/template/develop/neo-custom-cmp-template/README.md +48 -0
  27. package/template/develop/neo-custom-cmp-template/commitlint.config.js +59 -0
  28. package/template/develop/neo-custom-cmp-template/docs/README.md +13 -0
  29. package/template/develop/neo-custom-cmp-template/neo.config.js +121 -0
  30. package/template/develop/neo-custom-cmp-template/package.json +63 -0
  31. package/template/develop/neo-custom-cmp-template/public/css/base.css +283 -0
  32. package/template/develop/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  33. package/template/develop/neo-custom-cmp-template/public/template.html +13 -0
  34. package/template/develop/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
  35. package/template/develop/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  36. package/template/develop/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  37. package/template/develop/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  38. package/template/develop/neo-custom-cmp-template/src/assets/img/favicon.png +0 -0
  39. package/template/develop/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
  40. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/README.md +65 -0
  41. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/index.tsx +180 -0
  42. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +50 -0
  43. package/template/develop/neo-custom-cmp-template/src/components/contactCardList/style.scss +260 -0
  44. package/template/develop/neo-custom-cmp-template/src/components/contactForm/README.md +94 -0
  45. package/template/develop/neo-custom-cmp-template/src/components/contactForm/index.tsx +251 -0
  46. package/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +56 -0
  47. package/template/develop/neo-custom-cmp-template/src/components/contactForm/style.scss +120 -0
  48. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/README.md +115 -0
  49. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/index.tsx +304 -0
  50. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +87 -0
  51. package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/style.scss +127 -0
  52. package/template/develop/neo-custom-cmp-template/src/utils/axiosFetcher.ts +29 -0
  53. package/template/develop/neo-custom-cmp-template/src/utils/queryObjectData.ts +39 -0
  54. package/template/develop/neo-custom-cmp-template/src/utils/xobjects.ts +203 -0
  55. package/template/develop/neo-custom-cmp-template/tsconfig.json +68 -0
  56. package/template/echarts-custom-cmp-template/.prettierrc.js +12 -0
  57. package/template/echarts-custom-cmp-template/README.md +198 -0
  58. package/template/echarts-custom-cmp-template/commitlint.config.js +59 -0
  59. package/template/echarts-custom-cmp-template/neo.config.js +140 -0
  60. package/template/echarts-custom-cmp-template/package.json +61 -0
  61. package/template/echarts-custom-cmp-template/public/css/base.css +283 -0
  62. package/template/echarts-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  63. package/template/echarts-custom-cmp-template/public/template.html +13 -0
  64. package/template/echarts-custom-cmp-template/src/assets/css/common.scss +127 -0
  65. package/template/echarts-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  66. package/template/echarts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  67. package/template/echarts-custom-cmp-template/src/assets/img/chart.svg +1 -0
  68. package/template/echarts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  69. package/template/echarts-custom-cmp-template/src/assets/img/favicon.png +0 -0
  70. package/template/echarts-custom-cmp-template/src/components/chartWidget/README.md +186 -0
  71. package/template/echarts-custom-cmp-template/src/components/chartWidget/index.tsx +724 -0
  72. package/template/echarts-custom-cmp-template/src/components/chartWidget/model.ts +151 -0
  73. package/template/echarts-custom-cmp-template/src/components/chartWidget/style.scss +209 -0
  74. package/template/echarts-custom-cmp-template/src/components/mapWidget/README.md +125 -0
  75. package/template/echarts-custom-cmp-template/src/components/mapWidget/USAGE.md +190 -0
  76. package/template/echarts-custom-cmp-template/src/components/mapWidget/index.tsx +385 -0
  77. package/template/echarts-custom-cmp-template/src/components/mapWidget/model.ts +107 -0
  78. package/template/echarts-custom-cmp-template/src/components/mapWidget/style.scss +192 -0
  79. package/template/echarts-custom-cmp-template/src/utils/url.ts +82 -0
  80. package/template/echarts-custom-cmp-template/tsconfig.json +68 -0
  81. package/template/empty-cmp/index.tsx +58 -0
  82. package/template/empty-cmp/model.ts +79 -0
  83. package/template/empty-cmp/style.scss +72 -0
  84. package/template/empty-custom-cmp-template/.prettierrc.js +12 -0
  85. package/template/empty-custom-cmp-template/README.md +154 -0
  86. package/template/empty-custom-cmp-template/commitlint.config.js +59 -0
  87. package/template/empty-custom-cmp-template/neo.config.js +138 -0
  88. package/template/empty-custom-cmp-template/package.json +58 -0
  89. package/template/empty-custom-cmp-template/public/css/base.css +283 -0
  90. package/template/empty-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  91. package/template/empty-custom-cmp-template/public/template.html +13 -0
  92. package/template/empty-custom-cmp-template/src/assets/css/common.scss +127 -0
  93. package/template/empty-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  94. package/template/empty-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  95. package/template/empty-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  96. package/template/empty-custom-cmp-template/src/assets/img/favicon.png +0 -0
  97. package/template/empty-custom-cmp-template/src/assets/img/map.svg +1 -0
  98. package/template/empty-custom-cmp-template/src/components/README.md +3 -0
  99. package/template/empty-custom-cmp-template/tsconfig.json +68 -0
  100. package/template/neo-custom-cmp-template/.prettierrc.js +12 -0
  101. package/template/neo-custom-cmp-template/README.md +155 -0
  102. package/template/neo-custom-cmp-template/commitlint.config.js +59 -0
  103. package/template/neo-custom-cmp-template/docs/README.md +244 -0
  104. package/template/neo-custom-cmp-template/neo.config.js +140 -0
  105. package/template/neo-custom-cmp-template/package.json +66 -0
  106. package/template/neo-custom-cmp-template/public/css/base.css +283 -0
  107. package/template/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  108. package/template/neo-custom-cmp-template/public/template.html +13 -0
  109. package/template/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
  110. package/template/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  111. package/template/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  112. package/template/neo-custom-cmp-template/src/assets/img/card-list.svg +1 -0
  113. package/template/neo-custom-cmp-template/src/assets/img/contact-form.svg +1 -0
  114. package/template/neo-custom-cmp-template/src/assets/img/custom-form.svg +1 -0
  115. package/template/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  116. package/template/neo-custom-cmp-template/src/assets/img/data-list.svg +1 -0
  117. package/template/neo-custom-cmp-template/src/assets/img/detail.svg +1 -0
  118. package/template/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
  119. package/template/neo-custom-cmp-template/src/components/entityCardList/README.md +61 -0
  120. package/template/neo-custom-cmp-template/src/components/entityCardList/index.tsx +202 -0
  121. package/template/neo-custom-cmp-template/src/components/entityCardList/model.ts +74 -0
  122. package/template/neo-custom-cmp-template/src/components/entityCardList/style.scss +260 -0
  123. package/template/neo-custom-cmp-template/src/components/entityDetail/README.md +176 -0
  124. package/template/neo-custom-cmp-template/src/components/entityDetail/index.tsx +334 -0
  125. package/template/neo-custom-cmp-template/src/components/entityDetail/model.ts +123 -0
  126. package/template/neo-custom-cmp-template/src/components/entityDetail/style.scss +292 -0
  127. package/template/neo-custom-cmp-template/src/components/entityForm/README.md +176 -0
  128. package/template/neo-custom-cmp-template/src/components/entityForm/index.tsx +615 -0
  129. package/template/neo-custom-cmp-template/src/components/entityForm/model.ts +107 -0
  130. package/template/neo-custom-cmp-template/src/components/entityForm/style.scss +370 -0
  131. package/template/neo-custom-cmp-template/src/components/entityTable/README.md +92 -0
  132. package/template/neo-custom-cmp-template/src/components/entityTable/index.tsx +784 -0
  133. package/template/neo-custom-cmp-template/src/components/entityTable/model.ts +134 -0
  134. package/template/neo-custom-cmp-template/src/components/entityTable/style.scss +304 -0
  135. package/template/neo-custom-cmp-template/src/utils/axiosFetcher.ts +37 -0
  136. package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +76 -0
  137. package/template/neo-custom-cmp-template/src/utils/xobjects.ts +162 -0
  138. package/template/neo-custom-cmp-template/tsconfig.json +49 -0
  139. package/template/react-custom-cmp-template/.prettierrc.js +12 -0
  140. package/template/react-custom-cmp-template/README.md +154 -0
  141. package/template/react-custom-cmp-template/commitlint.config.js +59 -0
  142. package/template/react-custom-cmp-template/neo.config.js +137 -0
  143. package/template/react-custom-cmp-template/package.json +57 -0
  144. package/template/react-custom-cmp-template/public/css/base.css +283 -0
  145. package/template/react-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  146. package/template/react-custom-cmp-template/public/template.html +13 -0
  147. package/template/react-custom-cmp-template/src/assets/css/common.scss +127 -0
  148. package/template/react-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  149. package/template/react-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  150. package/template/react-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  151. package/template/react-custom-cmp-template/src/assets/img/favicon.png +0 -0
  152. package/template/react-custom-cmp-template/src/components/infoCard/index.jsx +45 -0
  153. package/template/react-custom-cmp-template/src/components/infoCard/model.js +81 -0
  154. package/template/react-custom-cmp-template/src/components/infoCard/style.scss +67 -0
  155. package/template/react-ts-custom-cmp-template/.prettierrc.js +12 -0
  156. package/template/react-ts-custom-cmp-template/README.md +154 -0
  157. package/template/react-ts-custom-cmp-template/commitlint.config.js +59 -0
  158. package/template/react-ts-custom-cmp-template/neo.config.js +138 -0
  159. package/template/react-ts-custom-cmp-template/package.json +59 -0
  160. package/template/react-ts-custom-cmp-template/public/css/base.css +283 -0
  161. package/template/react-ts-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  162. package/template/react-ts-custom-cmp-template/public/template.html +13 -0
  163. package/template/react-ts-custom-cmp-template/src/assets/css/common.scss +127 -0
  164. package/template/react-ts-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  165. package/template/react-ts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  166. package/template/react-ts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  167. package/template/react-ts-custom-cmp-template/src/assets/img/favicon.png +0 -0
  168. package/template/react-ts-custom-cmp-template/src/assets/img/map.svg +1 -0
  169. package/template/react-ts-custom-cmp-template/src/components/listWidget/README.md +2 -0
  170. package/template/react-ts-custom-cmp-template/src/components/listWidget/index.tsx +208 -0
  171. package/template/react-ts-custom-cmp-template/src/components/listWidget/model.ts +92 -0
  172. package/template/react-ts-custom-cmp-template/src/components/listWidget/style.scss +350 -0
  173. package/template/react-ts-custom-cmp-template/tsconfig.json +68 -0
  174. package/template/vue2-custom-cmp-template/.prettierrc.js +12 -0
  175. package/template/vue2-custom-cmp-template/README.md +154 -0
  176. package/template/vue2-custom-cmp-template/commitlint.config.js +59 -0
  177. package/template/vue2-custom-cmp-template/neo.config.js +146 -0
  178. package/template/vue2-custom-cmp-template/package.json +59 -0
  179. package/template/vue2-custom-cmp-template/public/css/base.css +283 -0
  180. package/template/vue2-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
  181. package/template/vue2-custom-cmp-template/public/template.html +13 -0
  182. package/template/vue2-custom-cmp-template/src/assets/css/common.scss +126 -0
  183. package/template/vue2-custom-cmp-template/src/assets/css/mixin.scss +47 -0
  184. package/template/vue2-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
  185. package/template/vue2-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
  186. package/template/vue2-custom-cmp-template/src/assets/img/favicon.png +0 -0
  187. package/template/vue2-custom-cmp-template/src/components/vueInfoCard/index.vue +131 -0
  188. package/template/vue2-custom-cmp-template/src/components/vueInfoCard/model.js +81 -0
  189. package/test/deprecate-versions.js +1 -1
@@ -0,0 +1,127 @@
1
+ :root {
2
+ --padding-bottom: 12px;
3
+ }
4
+
5
+ .neo-entity-grid-container {
6
+ position: relative;
7
+ box-sizing: border-box;
8
+ height: 100%;
9
+ display: flex;
10
+ flex-direction: column;
11
+
12
+ /* border-bottom: 1px solid #ececec; */
13
+ margin: 6px 12px;
14
+ padding: 6px var(--padding-bottom);
15
+ background-color: #fff;
16
+
17
+ .news-title {
18
+ padding: 6px 0;
19
+ font-family: PingFangSC-Regular;
20
+ font-size: 16px;
21
+ line-height: 22px;
22
+ color: #5f5e5e;
23
+ flex-shrink: 0;
24
+ }
25
+
26
+ // EntityGrid 容器样式
27
+ .entity-grid-wrapper {
28
+ flex: 1;
29
+ min-height: 400px;
30
+ overflow: hidden;
31
+
32
+ // 确保表格能正确显示
33
+ .neo-entity-view {
34
+ height: 100%;
35
+
36
+ .entity-grid {
37
+ height: 100%;
38
+ display: flex;
39
+ flex-direction: column;
40
+ }
41
+ }
42
+ }
43
+
44
+ .item-imgbox {
45
+ position: relative;
46
+ height: 395px;
47
+ background: #f0f0f0;
48
+ cursor: pointer;
49
+ box-sizing: border-box;
50
+ text-align: center;
51
+ overflow: hidden;
52
+
53
+ .news-img {
54
+ width: 100%;
55
+ height: 100%;
56
+ box-sizing: border-box;
57
+ background-size: contain;
58
+ }
59
+
60
+ .img-count {
61
+ position: absolute;
62
+ top: 0;
63
+ right: 0;
64
+ padding: 6px 8px;
65
+ color: #fff;
66
+ min-width: 60px;
67
+ text-align: center;
68
+ line-height: 1.2;
69
+ background: rgb(0 0 0 / 40%);
70
+ font-size: 25px;
71
+ box-sizing: border-box;
72
+ overflow: hidden;
73
+ }
74
+
75
+ .user-info-box {
76
+ position: absolute;
77
+ top: 10px;
78
+ left: 10px;
79
+ width: 100px;
80
+ min-height: 100px;
81
+ padding: 6px 8px;
82
+ color: #fff;
83
+ min-width: 60px;
84
+ text-align: center;
85
+ line-height: 1.2;
86
+ background: rgb(0 0 0 / 40%);
87
+ font-size: 25px;
88
+ box-sizing: border-box;
89
+ overflow: hidden;
90
+ display: flex;
91
+ flex-direction: column;
92
+ align-items: center;
93
+ justify-content: center;
94
+
95
+ .user-icon {
96
+ width: 64px;
97
+ height: 64px;
98
+ border-radius: 50%;
99
+ }
100
+
101
+ .user-name {
102
+ font-size: 16px;
103
+ font-weight: 600;
104
+ margin-top: 10px;
105
+ }
106
+ }
107
+ }
108
+
109
+ .news-info {
110
+ font-family: PingFangSC-Light;
111
+ height: 28px;
112
+ box-sizing: border-box;
113
+ display: flex;
114
+ justify-content: space-between;
115
+ align-items: center;
116
+ }
117
+
118
+ .media-mark,
119
+ .cmt-num {
120
+ display: inline-block;
121
+ height: 28px;
122
+ line-height: 28px;
123
+ font-family: PingFangSC-Light;
124
+ font-size: 18px;
125
+ color: #828282;
126
+ }
127
+ }
@@ -0,0 +1,29 @@
1
+ import axios from 'axios';
2
+
3
+ // 创建基于 axios 的 fetcher 函数
4
+ const axiosFetcher = async (options: any) => {
5
+ try {
6
+ const config = {
7
+ ...options,
8
+ method: options?.method || 'GET',
9
+ data: options?.data || {},
10
+ headers: {
11
+ 'Content-Type': 'application/json',
12
+ ...options?.headers,
13
+ },
14
+ timeout: options?.timeout || 10000,
15
+ };
16
+
17
+ if (config?.method === 'GET') {
18
+ config.params = options?.data || {};
19
+ }
20
+
21
+ const response = await axios(config);
22
+ return response;
23
+ } catch (error) {
24
+ console.error('接口请求报错:', error, ',请求参数:', options);
25
+ throw error;
26
+ }
27
+ };
28
+
29
+ export default axiosFetcher;
@@ -0,0 +1,39 @@
1
+ import { message } from 'antd';
2
+ import axiosFetcher from './axiosFetcher';
3
+
4
+ /**
5
+ * 这里存放通用查询类 Open API
6
+ */
7
+
8
+ // 获取业务对象数据列表
9
+ export const queryXObjectData = async (options?: any) => {
10
+ const apiUrl = '/rest/data/v2/query';
11
+ const curOptions = options || {};
12
+ const xObjectApiKey = curOptions.xObjectApiKey || '';
13
+ const fields = curOptions.fields || [];
14
+
15
+ const querySql = `select ${fields.join(',')} from ${xObjectApiKey}`;
16
+ try {
17
+ const config = {
18
+ url: apiUrl,
19
+ method: 'GET',
20
+ headers: {
21
+ 'Content-Type': 'application/json',
22
+ ...curOptions.headers,
23
+ },
24
+ data: {
25
+ q: querySql,
26
+ },
27
+ timeout: curOptions.timeout || 10000,
28
+ };
29
+
30
+ const response = await axiosFetcher(config);
31
+ return response?.data;
32
+ } catch (error) {
33
+ console.error('获取业务类型失败:', error);
34
+ message.error('获取业务类型失败。');
35
+ return {};
36
+ }
37
+ };
38
+
39
+ export default queryXObjectData;
@@ -0,0 +1,203 @@
1
+ import { message } from 'antd';
2
+ import axiosFetcher from './axiosFetcher';
3
+
4
+ // 获取业务类型列表
5
+ export const getEntityTypeList = async (
6
+ xObjectApiKey: string,
7
+ options?: any,
8
+ ) => {
9
+ const curOptions = options || {};
10
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/busiType`;
11
+ try {
12
+ const config = {
13
+ ...curOptions,
14
+ url: apiUrl,
15
+ method: 'GET',
16
+ headers: {
17
+ 'Content-Type': 'application/json',
18
+ ...curOptions.headers,
19
+ },
20
+ timeout: curOptions.timeout || 10000,
21
+ };
22
+
23
+ const response = await axiosFetcher(config);
24
+ return response?.data;
25
+ } catch (error) {
26
+ console.error('获取业务类型失败:', error);
27
+ message.error('获取业务类型失败。');
28
+ return {};
29
+ }
30
+ };
31
+
32
+ // 获取对象列表
33
+ export const getEntityList = async (options?: any) => {
34
+ const curOptions = options || {};
35
+ const custom = curOptions.custom || false; // 默认获取标准对象列表
36
+ const active = curOptions.active || true; // 仅获取有权限的对象
37
+ const apiUrl = `/rest/metadata/v2.0/xobjects/filter?custom=${custom}&active=${active}`;
38
+ try {
39
+ const config = {
40
+ ...curOptions,
41
+ url: apiUrl,
42
+ method: 'GET',
43
+ headers: {
44
+ 'Content-Type': 'application/json',
45
+ ...curOptions.headers,
46
+ },
47
+ timeout: curOptions.timeout || 10000,
48
+ };
49
+
50
+ const response = await axiosFetcher(config);
51
+ return response?.data;
52
+ } catch (error) {
53
+ console.error('获取对象列表失败:', error);
54
+ message.error('获取对象列表失败。');
55
+ return {};
56
+ }
57
+ };
58
+
59
+ // 创建业务数据
60
+ export const createXObject = async (
61
+ xObjectApiKey: string,
62
+ options: any
63
+ ) => {
64
+ const curOptions = options || {};
65
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}`;
66
+ const formData = curOptions.data || {};
67
+ try {
68
+ const config = {
69
+ ...options,
70
+ url: apiUrl,
71
+ method: curOptions.method || 'GET',
72
+ data: {
73
+ data: formData,
74
+ },
75
+ headers: {
76
+ 'Content-Type': 'application/json',
77
+ ...curOptions.headers,
78
+ },
79
+ timeout: curOptions.timeout || 10000,
80
+ };
81
+
82
+ const response = await axiosFetcher(config);
83
+ return response?.data;
84
+ } catch (error) {
85
+ console.error('创建业务数据失败:', error);
86
+ throw error;
87
+ }
88
+ };
89
+
90
+ // 获取业务对象描述
91
+ export const getXObjectDesc = async (
92
+ xObjectApiKey: string,
93
+ options?: any,
94
+ ) => {
95
+ const curOptions = options || {};
96
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/description`;
97
+ try {
98
+ const config = {
99
+ ...options,
100
+ url: apiUrl,
101
+ method: curOptions.method || 'GET',
102
+ headers: {
103
+ 'Content-Type': 'application/json',
104
+ ...curOptions.headers,
105
+ },
106
+ timeout: curOptions.timeout || 10000,
107
+ };
108
+
109
+ const response = await axiosFetcher(config);
110
+ return response?.data;
111
+ } catch (error) {
112
+ console.error('获取业务对象描述:', error);
113
+ throw error;
114
+ }
115
+ };
116
+
117
+ // 更新业务数据
118
+ export const updateXObject = async (
119
+ xObjectApiKey: string,
120
+ objectId: string,
121
+ options: any
122
+ ) => {
123
+ const curOptions = options || {};
124
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
125
+ const formData = curOptions.data || {};
126
+ try {
127
+ const config = {
128
+ ...curOptions,
129
+ url: apiUrl,
130
+ method: curOptions.method || 'PATCH',
131
+ data: {
132
+ data: formData,
133
+ },
134
+ headers: {
135
+ 'Content-Type': 'application/json',
136
+ ...curOptions.headers,
137
+ },
138
+ timeout: curOptions.timeout || 10000,
139
+ };
140
+
141
+ const response = await axiosFetcher(config);
142
+ return response?.data;
143
+ } catch (error) {
144
+ console.error('更新业务数据失败:', error);
145
+ throw error;
146
+ }
147
+ };
148
+
149
+ // 获取业务数据信息
150
+ export const getXObject = async (
151
+ xObjectApiKey: string,
152
+ objectId: string,
153
+ options?: any
154
+ ) => {
155
+ const curOptions = options || {};
156
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
157
+ try {
158
+ const config = {
159
+ ...curOptions,
160
+ url: apiUrl,
161
+ method: curOptions.method || 'GET',
162
+ headers: {
163
+ 'Content-Type': 'application/json',
164
+ ...curOptions.headers,
165
+ },
166
+ timeout: curOptions.timeout || 10000,
167
+ };
168
+
169
+ const response = await axiosFetcher(config);
170
+ return response?.data;
171
+ } catch (error) {
172
+ console.error('获取业务数据信息失败:', error);
173
+ throw error;
174
+ }
175
+ };
176
+
177
+ // 删除业务数据
178
+ export const deleteXObject = async (
179
+ xObjectApiKey: string,
180
+ objectId: string,
181
+ options?: any
182
+ ) => {
183
+ const curOptions = options || {};
184
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
185
+ try {
186
+ const config = {
187
+ ...curOptions,
188
+ url: apiUrl,
189
+ method: curOptions.method || 'DELETE',
190
+ headers: {
191
+ 'Content-Type': 'application/json',
192
+ ...curOptions.headers,
193
+ },
194
+ timeout: curOptions.timeout || 10000,
195
+ };
196
+
197
+ const response = await axiosFetcher(config);
198
+ return response?.data;
199
+ } catch (error) {
200
+ console.error('删除业务数据:', error);
201
+ throw error;
202
+ }
203
+ };
@@ -0,0 +1,68 @@
1
+ {
2
+ "compilerOptions": {
3
+ "experimentalDecorators": true,
4
+ /* Basic Options */
5
+ "target": "esnext",
6
+ /* 指定编译之后的版本: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
7
+ "module": "esnext" /* 指定要使用的模板标准: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
8
+ // "lib": [], /* Specify library files to be included in the compilation. */
9
+ "allowJs": false /* 指定是否允许编译JS文件,默认false,即不编译JS文件. */,
10
+ // "checkJs": true, /* 指定是否检查和报告JS文件中的错误,默认false */
11
+ "jsx": "react" /* 指定jsx代码用于的开发环境:'preserve','react-native', or 'react'. */,
12
+ "declaration": false /* 指定是否在编译的时候生成相的d.ts声明文件 */,
13
+ // "declarationMap": true, /* 指定编译时是否生成.map文件 */
14
+ // "sourceMap": true, /* 指定编译时是否生成.map文件 */
15
+ // "outFile": "./", /* 指定输出文件合并为一个文件 */
16
+ // "outDir": "dist", /* 指定输出文件夹,值为一个文件夹路径字符串,输出的文件都将放置在这个文件夹*/
17
+ // "rootDir": "src", /* 指定编译文件的根目录,编译器会在根目录查找入口文件 */
18
+ // "composite": true, /* 是否编译构建引用项目 */
19
+ // "removeComments": true, /* 指定是否将编译后的文件注释删掉,设为true的话即删除注释,默认为false */
20
+ "noEmit": false /* 不生成编译文件 */,
21
+ "importHelpers": true /* 指定是否引入tslib里的复制工具函数,默认为false */,
22
+ // "downlevelIteration": true, /* 当target为"ES5"或"ES3"时,为"for-of" "spread"和"destructuring"中的迭代器提供完全支持 */
23
+ "isolatedModules": false /* 指定是否将每个文件作为单独的模块,默认为true */,
24
+
25
+ /* Strict Type-Checking Options */
26
+ "strict": false /* 指定是否启动所有类型检查 */,
27
+ "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
28
+ "strictNullChecks": true /* Enable strict null checks. */,
29
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
30
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
31
+ "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
32
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
33
+
34
+ /* Additional Checks */
35
+ "noUnusedLocals": false /* Report errors on unused locals. */,
36
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
37
+ "noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
38
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
39
+
40
+ /* Module Resolution Options */
41
+ "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
42
+ "baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
43
+ "paths": {
44
+ "@": ["./src"]
45
+ } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
46
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
47
+ /* 指定声明文件或文件夹的路径列表,如果指定了此项,则只有在这里列出的声明文件才会被加载 */
48
+ "typeRoots": ["./@types", "./node_modules/@types"],
49
+ // "types": [], /* 指定需要包含的模块,只有在这里列出的模块的声明文件才会被加载 */
50
+ "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
51
+ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
52
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
53
+
54
+ /* Source Map Options */
55
+ // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
56
+ // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
57
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
58
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
59
+
60
+ /* Experimental Options */
61
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
62
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
63
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
64
+ // "suppressImplicitAnyIndexErrors": true /* Suppress --noImplicitAny errors for indexing objects lacking index signatures. See issue #1232 for more details. */
65
+ },
66
+ "include": ["src", "test"],
67
+ "exclude": ["node_modules"]
68
+ }
@@ -0,0 +1,12 @@
1
+ /*
2
+ prettier 配置文件
3
+ 更多配置信息:https://prettier.io/docs/en/options.html
4
+ */
5
+ module.exports = {
6
+ semi: true, // Semicolons 分号,默认需要分号
7
+ tabWidth: 2, // 空格,默认 2,
8
+ useTabs: false,
9
+ singleQuote: true, // 单引号还是双引号,默认为false 双引号
10
+ trailingComma: 'all', // 逗号
11
+ jsxBracketSameLine: false, // 默认为false,Put the > of a multi-line JSX element at the end of the last line instead of being alone on the next line (does not apply to self closing elements).
12
+ };
@@ -0,0 +1,198 @@
1
+ ### 目录说明
2
+ - src: 自定义组件源码;
3
+ - src/assets: 存放组件静态资源,比如 css、img等;
4
+ - src/components: 存放自定义组件代码,每个自定义组件以自身名称(cmpType 数值)作为目录进行存放;
5
+ - src/components/xxCmp/index: 自定义组件的内容文件;
6
+ - src/components/xxCmp/model: 自定义组件的模型文件,用于对接页面设计器;
7
+ - neo.config.js: neo-cmp-cli 配置文件。
8
+
9
+ ### 🎨 酷炫图表组件 (Chart Widget)
10
+
11
+ 这是一个功能丰富的图表组件,基于 ECharts 5.x 构建,支持多种图表类型和丰富的配置选项。
12
+
13
+ #### 特性
14
+ - **8种图表类型**: 折线图、柱状图、饼图、散点图、雷达图、仪表盘、漏斗图、桑基图
15
+ - **现代化设计**: 渐变背景、毛玻璃效果、响应式布局
16
+ - **丰富配置**: JSON AMIS 表单配置,支持主题切换、尺寸调整、交互控制
17
+ - **数据驱动**: 支持多种数据源,实时数据更新
18
+
19
+ #### 快速开始
20
+ ```bash
21
+ # 安装依赖
22
+ ./install-deps.sh
23
+
24
+ # 预览图表组件
25
+ npm run preview --cmpType=chart-widget
26
+
27
+ # 查看演示页面
28
+ npm run preview --cmpType=demo
29
+ ```
30
+
31
+ #### 组件使用
32
+ ```tsx
33
+ import ChartWidget from './components/chart-widget';
34
+
35
+ <ChartWidget
36
+ chartType="line"
37
+ title="销售趋势"
38
+ subtitle="2024年数据"
39
+ width={800}
40
+ height={400}
41
+ mockData={{
42
+ xAxis: ['1月', '2月', '3月', '4月', '5月', '6月'],
43
+ series: [{
44
+ name: '销售额',
45
+ data: [120, 200, 150, 80, 70, 110]
46
+ }]
47
+ }}
48
+ />
49
+ ```
50
+
51
+ 更多详细信息请查看 [图表组件文档](./src/components/chart-widget/README.md)。
52
+
53
+ ### 组件开发规范
54
+ - 存放在 src/components 目录下的自定义组件,默认 index 为自定义组件源码入口文件,register.[tj]s 为注册 自定义组件的脚本文件,model.[tj]s 为自定义组件的模型文件(对接页面设计器需要);
55
+ - 当 neo.config.js 中的 entry 为空或者不存在时,cli 将根据 src/components 目录下的自定义组件结构生成对应的 entry 配置(可在命令控制台查看生成的 entry 配置);
56
+ - 自定义组件中可用的配置项类型 请见 [当前可用表单项](https://github.com/wibetter/neo-register/blob/master/docs/FormItemType.md);
57
+ - 自定义组件最外层请设置一个唯一的 ClassName(比如 xx-cmpType-container),所有内容样式请放在该 ClassName 中,避免自定义组件样式相互干扰;
58
+ - 默认开启代码规范检测(含样式内容),如需关闭,请调整 neo.config.js 相关配置;
59
+ - 请使用 react 16版本。
60
+
61
+ ### 自定义组件注册器使用说明
62
+ - [neo-register 使用说明](https://www.npmjs.com/package/neo-register?activeTab=readme)
63
+ 备注:预览、调试(linkDebug)和构建发布时 cli 会自动创建对应的注册文件(含 neo-register 的使用),用户无需关注 neo-register。
64
+
65
+ ### 开发说明
66
+
67
+ 1. **安装依赖**
68
+ ```bash
69
+ $ npm i 或者 yarn
70
+ ```
71
+
72
+ 2. **preview: 组件预览模式(带热更新)**
73
+ > preview模式:用于预览自定义组件内容。
74
+ ```bash
75
+ $ npm run preview
76
+ ```
77
+
78
+ 3. **linkDebug: 外链调试(在线上页面设计器端预览自定义组件)**
79
+ > linkDebug模式:用于在线上页面设计器中预览和调试自定义组件。
80
+ ```bash
81
+ $ npm run linkDebug
82
+ ```
83
+
84
+ 4. **发布到 NeoCRM 平台**
85
+ > 需要确保 package.json 中的 name 值唯一,version 值不重复。
86
+ ```bash
87
+ $ npm run pushCmp
88
+ ```
89
+
90
+
91
+ ### 🔐 授权配置
92
+
93
+ 使用 `neo push cmp`、`neo pull cmp`、`neo delete cmp` 等命令与 NeoCRM 平台交互时,需要配置授权信息。
94
+
95
+ #### 方式一:OAuth2 登录授权(推荐)
96
+
97
+ OAuth2 授权码模式更加安全可靠,无需用户配置账户名和密码。
98
+
99
+ ##### 使用步骤
100
+
101
+ 1. **登录 NeoCRM 平台**
102
+ ```bash
103
+ neo login
104
+ ```
105
+
106
+ 执行流程:
107
+ - 自动打开浏览器访问授权页面
108
+ - 在浏览器中输入 NeoCRM 账号密码进行登录(需选择对应的租户)
109
+ - 授权成功后自动跳转回本地(附带 code)
110
+ - cli 端 通过 code 获取 Token,并自动保存到项目的 `.neo-cli/token.json` 文件中
111
+
112
+ 2. **登出 NeoCRM 平台**
113
+ ```bash
114
+ neo logout
115
+ ```
116
+
117
+ 功能:清除本地保存的 token 文件,下次使用需要重新登录。
118
+
119
+ ##### 配置示例
120
+
121
+ ```javascript
122
+ // neo.config.js
123
+ module.exports = {
124
+ neoConfig: {
125
+ neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
126
+ // 登录授权 URL(用于获取 code)
127
+ loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth',
128
+ tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址
129
+ },
130
+ }
131
+ ```
132
+
133
+ ##### Token 有效期
134
+
135
+ - **access_token**:默认有效期 2 小时
136
+ - **refresh_token**:默认有效期 30 天
137
+ - 系统会在 access_token 过期前 5 分钟自动刷新
138
+ - 如果 refresh_token 也过期,需要重新执行 `neo login`
139
+
140
+ ##### 常见问题
141
+
142
+ **Q1: 浏览器无法自动打开怎么办?**
143
+ A: 命令行会输出授权 URL,手动复制到浏览器中打开即可。
144
+
145
+ **Q2: Token 刷新失败怎么办?**
146
+ A: 如果 refresh_token 也过期(默认 30 天),需要重新执行 `neo login`。同时检查网络连接是否正常。
147
+
148
+ **Q3: 授权登录后没有正常跳回 redirect_uri**
149
+ A: 可能被浏览器安装的插件影响,目前已知会影响授权登录的浏览器插件有:Neo UI Extension,请关闭插件后重试。
150
+
151
+ #### 方式二:密码授权配置
152
+
153
+ 在项目根目录的 `neo.config.js` 文件中添加 NeoCRM 平台授权配置:
154
+
155
+ ```javascript
156
+ module.exports = {
157
+ neoConfig: {
158
+ neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
159
+ tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址
160
+ // NeoCRM 授权配置
161
+ auth: {
162
+ client_id: 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
163
+ client_secret: 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
164
+ username: 'xx', // 用户在销售易系统中的用户名
165
+ /**
166
+ * password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
167
+ * 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
168
+ */
169
+ password: 'xx xx' // 用户账户密码 + 8 位安全令牌
170
+ },
171
+ },
172
+ }
173
+ ```
174
+
175
+ ##### 授权配置获取方式
176
+
177
+ 1. **客户端 ID 和客户端秘钥**:需通过创建连接器获取
178
+ - 访问 [销售易文档中心](https://doc.xiaoshouyi.com) / 创建连接器
179
+ - 创建连接器后,从客户端信息中获取 `Client_Id` 和 `Client_Secret`
180
+
181
+ 2. **安全令牌**:如何获取安全令牌
182
+ - 访问 [销售易文档中心](https://doc.xiaoshouyi.com) / OAuth安全认证 / 密码模式 / 获取令牌
183
+ - 按照文档说明获取 8 位安全令牌
184
+ - `password` 字段 = 用户账户密码 + 8 位安全令牌(直接拼接,无空格或分隔符)
185
+
186
+ #### OAuth2 模式 vs 密码模式
187
+
188
+ | 特性 | OAuth2 授权码模式 | 密码模式 |
189
+ |------|------------------|---------|
190
+ | 安全性 | ✅ 高(无需在配置文件中存储密码) | ⚠️ 较低(需要配置密码和安全令牌) |
191
+ | Token 刷新 | ✅ 自动刷新 | ✅ 自动刷新 |
192
+ | 有效期 | 2 小时(可自动刷新) | 永不过期 |
193
+ | 推荐程度 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
194
+
195
+ ---
196
+
197
+ ### 配置项说明(neo-cmp-cli)
198
+ [请查看neo-cmp-cli](https://www.npmjs.com/package/neo-cmp-cli)