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,134 @@
1
+ /**
2
+ * @file XObject 表格组件对接编辑器的描述文件
3
+ * @description 定义组件在 Neo 平台编辑器中的配置信息
4
+ * @author Neo Custom Widget CLI
5
+ * @version 1.0.0
6
+ */
7
+ export class EntityTableModel {
8
+ /**
9
+ * 组件类型标识
10
+ * 用于标识组件的唯一性,在构建时根据当前组件目录名称自动生成
11
+ * 注意:此字段在构建时会被自动替换,不需要手动设置
12
+ */
13
+ // cmpType: string = 'entityTable';
14
+
15
+ /** 组件名称,用于设置在编辑器左侧组件面板中展示的名称 */
16
+ label: string = '实体数据表格';
17
+
18
+ /** 组件描述,用于设置在编辑器左侧组件面板中展示的描述 */
19
+ description: string = '基于 XObject 的数据表格组件,支持增删改查操作';
20
+
21
+ /** 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签) */
22
+ // tags: string[] = ['自定义组件'];
23
+
24
+ /** 组件图标,用于设置在编辑器左侧组件面板中展示的图标 */
25
+ iconSrc: string = 'https://custom-widgets.bj.bcebos.com/table.svg';
26
+
27
+ /**
28
+ * 用于设置组件支持的页面类型
29
+ *
30
+ * 当前 NeoCRM 平台存在的页面类型:
31
+ * all: 1 全页面
32
+ * indexPage: 2 首页
33
+ * entityListPage: 3 实体列表页
34
+ * entityFormPage: 4 实体表单页
35
+ * entityDetailPage: 5 实体详情页
36
+ * customPage: 6 自定义页面
37
+ * bizPage: 7 业务页面
38
+ */
39
+ // targetPage: string[] = ['customPage'];
40
+
41
+ /** 初次插入页面的默认属性数据 */
42
+ defaultComProps = {
43
+ title: '实体数据表格',
44
+ showAddButton: true,
45
+ showEditButton: true,
46
+ showDeleteButton: true,
47
+ xObjectDataApi: {
48
+ xObjectApiKey: 'customContact__c',
49
+ fields: ['name', 'phone__c'],
50
+ },
51
+ };
52
+
53
+ /**
54
+ * 组件属性配置模式
55
+ * 支持静态配置:propsSchema,优先级比 propsSchemaCreator 低
56
+ * 定义组件在编辑器中可配置的属性
57
+ */
58
+ propsSchema = [
59
+ /*
60
+ {
61
+ type: 'select',
62
+ name: 'custom',
63
+ label: '实体类型',
64
+ value: true,
65
+ placeholder: '请选择要操作的实体类型',
66
+ options: [
67
+ {
68
+ label: '标准实体',
69
+ value: false,
70
+ },
71
+ {
72
+ label: '自定义实体',
73
+ value: true,
74
+ },
75
+ ],
76
+ },
77
+ {
78
+ type: 'select',
79
+ name: 'xObjectApiKey',
80
+ label: '选择实体对象',
81
+ source: {
82
+ url: '/rest/metadata/v2.0/xobjects/filter?custom=${custom}&active=true',
83
+ method: 'GET',
84
+ adaptor: (resp: any) => {
85
+ const entityList = resp.data?.data?.records || [];
86
+ return {
87
+ status: 0,
88
+ data: {
89
+ options: entityList.map((item: any) => ({
90
+ label: item.label || item.name,
91
+ value: item.apiKey || item.name,
92
+ })),
93
+ },
94
+ };
95
+ },
96
+ },
97
+ searchable: true,
98
+ value: 'account',
99
+ placeholder: '请选择要操作的实体对象',
100
+ },
101
+ */
102
+ {
103
+ type: 'xObjectDataApi', // 用于获取实体业务数据列表的配置项
104
+ name: 'xObjectDataApi',
105
+ label: '实体数据源',
106
+ value: {
107
+ xObjectApiKey: 'customContact__c',
108
+ fields: ['name', 'phone__c'],
109
+ },
110
+ placeholder: '请选择实体数据源',
111
+ custom: true,
112
+ },
113
+ {
114
+ type: 'switch',
115
+ name: 'showAddButton',
116
+ label: '显示新增按钮',
117
+ value: true,
118
+ },
119
+ {
120
+ type: 'switch',
121
+ name: 'showEditButton',
122
+ label: '显示编辑按钮',
123
+ value: true,
124
+ },
125
+ {
126
+ type: 'switch',
127
+ name: 'showDeleteButton',
128
+ label: '显示删除按钮',
129
+ value: true,
130
+ },
131
+ ];
132
+ }
133
+
134
+ export default EntityTableModel;
@@ -0,0 +1,304 @@
1
+ .entity-table-container {
2
+ .table-header {
3
+ margin-bottom: 16px;
4
+
5
+ .header-content {
6
+ display: flex;
7
+ justify-content: space-between;
8
+ align-items: center;
9
+ flex-wrap: wrap;
10
+ gap: 12px;
11
+
12
+ .header-title {
13
+ margin: 0;
14
+ font-size: 18px;
15
+ font-weight: 600;
16
+ color: #262626;
17
+ flex: 1;
18
+ min-width: 200px;
19
+ }
20
+
21
+ .ant-space {
22
+ flex-shrink: 0;
23
+ }
24
+ }
25
+ }
26
+
27
+ .table-content {
28
+ .ant-table {
29
+ .ant-table-thead > tr > th {
30
+ background-color: #fafafa;
31
+ font-weight: 600;
32
+ color: #262626;
33
+ border-bottom: 1px solid #f0f0f0;
34
+ }
35
+
36
+ .ant-table-tbody > tr > td {
37
+ border-bottom: 1px solid #f0f0f0;
38
+ padding: 12px 16px;
39
+ }
40
+
41
+ .ant-table-tbody > tr:hover > td {
42
+ background-color: #f5f5f5;
43
+ }
44
+
45
+ .ant-table-pagination {
46
+ margin-top: 16px;
47
+ text-align: right;
48
+ }
49
+ }
50
+
51
+ .ant-empty {
52
+ padding: 40px 0;
53
+
54
+ .ant-empty-description {
55
+ color: #8c8c8c;
56
+ font-size: 14px;
57
+ }
58
+ }
59
+
60
+ .error-container {
61
+ text-align: center;
62
+ padding: 40px 0;
63
+
64
+ .retry-button {
65
+ background: #1890ff;
66
+ border: 1px solid #1890ff;
67
+ color: #fff;
68
+ padding: 6px 15px;
69
+ border-radius: 4px;
70
+ cursor: pointer;
71
+ font-size: 14px;
72
+ transition: all 0.3s;
73
+
74
+ &:hover {
75
+ background: #40a9ff;
76
+ border-color: #40a9ff;
77
+ }
78
+ }
79
+ }
80
+ }
81
+
82
+ .ant-modal {
83
+ .ant-form {
84
+ .ant-form-item {
85
+ margin-bottom: 16px;
86
+
87
+ .ant-form-item-label {
88
+ padding-bottom: 4px;
89
+
90
+ label {
91
+ font-weight: 500;
92
+ color: #262626;
93
+ }
94
+ }
95
+
96
+ .ant-input,
97
+ .ant-select-selector,
98
+ .ant-input-number {
99
+ border-radius: 4px;
100
+ border: 1px solid #d9d9d9;
101
+ transition: all 0.3s;
102
+
103
+ &:hover {
104
+ border-color: #40a9ff;
105
+ }
106
+
107
+ &:focus,
108
+ &.ant-input-focused,
109
+ &.ant-select-focused .ant-select-selector {
110
+ border-color: #40a9ff;
111
+ box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
112
+ }
113
+ }
114
+
115
+ .ant-input-textarea {
116
+ resize: vertical;
117
+ min-height: 80px;
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ .ant-btn {
124
+ border-radius: 4px;
125
+ font-weight: 500;
126
+ transition: all 0.3s;
127
+
128
+ &.ant-btn-primary {
129
+ background: #1890ff;
130
+ border-color: #1890ff;
131
+
132
+ &:hover {
133
+ background: #40a9ff;
134
+ border-color: #40a9ff;
135
+ }
136
+
137
+ &:focus {
138
+ background: #40a9ff;
139
+ border-color: #40a9ff;
140
+ }
141
+ }
142
+
143
+ &.ant-btn-link {
144
+ padding: 4px 8px;
145
+ height: auto;
146
+ line-height: 1.5;
147
+
148
+ &:hover {
149
+ background-color: #f5f5f5;
150
+ }
151
+ }
152
+
153
+ &.ant-btn-link.ant-btn-dangerous {
154
+ color: #ff4d4f;
155
+
156
+ &:hover {
157
+ color: #ff7875;
158
+ background-color: #fff2f0;
159
+ }
160
+ }
161
+ }
162
+
163
+ .ant-popconfirm {
164
+ .ant-popover-inner-content {
165
+ padding: 12px 16px;
166
+ }
167
+
168
+ .ant-popover-buttons {
169
+ text-align: right;
170
+ margin-top: 8px;
171
+
172
+ .ant-btn {
173
+ margin-left: 8px;
174
+
175
+ &:first-child {
176
+ margin-left: 0;
177
+ }
178
+ }
179
+ }
180
+ }
181
+
182
+ .ant-spin {
183
+ .ant-spin-dot {
184
+ font-size: 20px;
185
+ }
186
+
187
+ .ant-spin-text {
188
+ color: #8c8c8c;
189
+ font-size: 14px;
190
+ }
191
+ }
192
+
193
+ // 响应式设计
194
+ @media (max-width: 768px) {
195
+ .table-header {
196
+ .header-content {
197
+ flex-direction: column;
198
+ align-items: flex-start;
199
+
200
+ .header-title {
201
+ margin-bottom: 8px;
202
+ }
203
+
204
+ .ant-space {
205
+ width: 100%;
206
+ justify-content: flex-end;
207
+ }
208
+ }
209
+ }
210
+
211
+ .table-content {
212
+ .ant-table {
213
+ .ant-table-thead > tr > th,
214
+ .ant-table-tbody > tr > td {
215
+ padding: 8px 12px;
216
+ font-size: 13px;
217
+ }
218
+ }
219
+ }
220
+ }
221
+
222
+ @media (max-width: 576px) {
223
+ .table-header {
224
+ .header-content {
225
+ .header-title {
226
+ font-size: 16px;
227
+ }
228
+ }
229
+ }
230
+
231
+ .table-content {
232
+ .ant-table {
233
+ .ant-table-thead > tr > th,
234
+ .ant-table-tbody > tr > td {
235
+ padding: 6px 8px;
236
+ font-size: 12px;
237
+ }
238
+ }
239
+
240
+ .ant-table-pagination {
241
+ .ant-pagination-options {
242
+ display: none;
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
248
+
249
+ // 全局样式覆盖
250
+ .ant-card {
251
+ border-radius: 6px;
252
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
253
+
254
+ .ant-card-body {
255
+ padding: 20px;
256
+ }
257
+ }
258
+
259
+ .ant-modal {
260
+ .ant-modal-header {
261
+ border-bottom: 1px solid #f0f0f0;
262
+ padding: 16px 24px;
263
+
264
+ .ant-modal-title {
265
+ font-size: 16px;
266
+ font-weight: 600;
267
+ color: #262626;
268
+ }
269
+ }
270
+
271
+ .ant-modal-body {
272
+ padding: 24px;
273
+ }
274
+
275
+ .ant-modal-footer {
276
+ border-top: 1px solid #f0f0f0;
277
+ padding: 12px 24px;
278
+ text-align: right;
279
+
280
+ .ant-btn {
281
+ margin-left: 8px;
282
+
283
+ &:first-child {
284
+ margin-left: 0;
285
+ }
286
+ }
287
+ }
288
+ }
289
+
290
+ .ant-modal-content {
291
+ display: flex;
292
+ flex-direction: column;
293
+
294
+ .ant-modal-header,
295
+ .ant-modal-footer {
296
+ flex: 0;
297
+ }
298
+
299
+ .ant-modal-body {
300
+ flex: 1;
301
+ max-height: 500px;
302
+ overflow-y: auto;
303
+ }
304
+ }
@@ -0,0 +1,37 @@
1
+ import axios from 'axios'; // https://www.axios-http.cn/docs/intro
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 || 30000,
15
+ };
16
+
17
+ if (config?.method === 'GET') {
18
+ config.params = options?.data || {};
19
+ }
20
+
21
+ const response = await axios(config);
22
+ return response?.data || {};
23
+ } catch (error) {
24
+ if (error.response) {
25
+ // 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围
26
+ console.error('接口请求报错 / 接口服务异常:', error.message);
27
+ } else if (error.request) {
28
+ // 请求已经成功发起,但没有收到响应
29
+ console.error('接口请求报错 / 接口未正常响应:', error.message);
30
+ } else {
31
+ console.error('接口请求报错:', error, ',请求参数:', options);
32
+ }
33
+ throw error;
34
+ }
35
+ };
36
+
37
+ export default axiosFetcher;
@@ -0,0 +1,76 @@
1
+ import axiosFetcher from '$utils/axiosFetcher';
2
+
3
+ /**
4
+ * 这里存放通用查询类 Open API
5
+ */
6
+
7
+ // 获取业务对象数据列表
8
+ export const queryXObjectData = async (options?: any) => {
9
+ const apiUrl = '/rest/data/v2/query';
10
+ const curOptions = options || {};
11
+ const xObjectApiKey = curOptions.xObjectApiKey || '';
12
+ const fields = curOptions.fields || [];
13
+ const page = curOptions.page || 1;
14
+ const pageSize = curOptions.pageSize || 10;
15
+
16
+ // 自动添加 objectId 字段
17
+ if (!fields.includes('id')) {
18
+ fields.push('id');
19
+ }
20
+
21
+ // 计算分页偏移量
22
+ const offset = (page - 1) * pageSize;
23
+
24
+ // 构建 SQL 查询
25
+ let querySql = `select ${fields.join(',')} from ${xObjectApiKey}`;
26
+
27
+ // 添加排序条件(如果有的话)
28
+ if (curOptions.orderBy) {
29
+ querySql += ` order by ${curOptions.orderBy}`;
30
+ }
31
+
32
+ if (curOptions.page || curOptions.pageSize) {
33
+ // 添加分页限制
34
+ querySql += ` limit ${pageSize} offset ${offset}`;
35
+ }
36
+
37
+ try {
38
+ const config = {
39
+ url: apiUrl,
40
+ method: 'GET',
41
+ data: {
42
+ q: querySql,
43
+ },
44
+ };
45
+
46
+ const resultData = await axiosFetcher(config);
47
+
48
+ if (resultData.code === 200) {
49
+ const { records, totalSize } = resultData.result || {};
50
+ return {
51
+ status: true,
52
+ code: resultData.code,
53
+ msg: resultData.msg || '获取业务对象数据列表成功',
54
+ totalSize,
55
+ data: records || [],
56
+ };
57
+ }
58
+
59
+ return {
60
+ status: false,
61
+ code: resultData.code,
62
+ msg: resultData.msg || '获取业务对象数据列表失败',
63
+ data: [],
64
+ };
65
+ } catch (error) {
66
+ console.error('获取业务对象数据列表失败:', error);
67
+
68
+ return {
69
+ status: false,
70
+ msg: error.msg || error.message || '获取业务对象数据列表失败',
71
+ data: [],
72
+ };
73
+ }
74
+ };
75
+
76
+ export default queryXObjectData;
@@ -0,0 +1,162 @@
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
+ };
17
+
18
+ const result = await axiosFetcher(config);
19
+ return result;
20
+ } catch (error) {
21
+ console.error('获取业务类型失败:', error);
22
+ message.error('获取业务类型失败。');
23
+ return {};
24
+ }
25
+ };
26
+
27
+ // 获取对象列表
28
+ export const getEntityList = async (options?: any) => {
29
+ const curOptions = options || {};
30
+ const custom = curOptions.custom || false; // 默认获取标准对象列表
31
+ const active = curOptions.active || true; // 仅获取有权限的对象
32
+ const apiUrl = `/rest/metadata/v2.0/xobjects/filter?custom=${custom}&active=${active}`;
33
+ try {
34
+ const config = {
35
+ ...curOptions,
36
+ url: apiUrl,
37
+ method: 'GET',
38
+ };
39
+
40
+ const result = await axiosFetcher(config);
41
+ return result;
42
+ } catch (error) {
43
+ console.error('获取对象列表失败:', error);
44
+ message.error('获取对象列表失败。');
45
+ return {};
46
+ }
47
+ };
48
+
49
+ // 创建业务数据
50
+ export const createXObject = async (xObjectApiKey: string, options: any) => {
51
+ const curOptions = options || {};
52
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}`;
53
+ const formData = curOptions.data || {};
54
+ try {
55
+ const config = {
56
+ ...options,
57
+ url: apiUrl,
58
+ method: curOptions.method || 'GET',
59
+ data: {
60
+ data: formData,
61
+ },
62
+ };
63
+
64
+ const result = await axiosFetcher(config);
65
+ return result;
66
+ } catch (error) {
67
+ console.error('创建业务数据失败:', error);
68
+ throw error;
69
+ }
70
+ };
71
+
72
+ // 获取业务对象描述
73
+ export const getXObjectDesc = async (xObjectApiKey: string, options?: any) => {
74
+ const curOptions = options || {};
75
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/description`;
76
+ try {
77
+ const config = {
78
+ ...options,
79
+ url: apiUrl,
80
+ method: curOptions.method || 'GET',
81
+ };
82
+
83
+ const result = await axiosFetcher(config);
84
+ return result;
85
+ } catch (error) {
86
+ console.error('获取业务对象描述:', error);
87
+ throw error;
88
+ }
89
+ };
90
+
91
+ // 更新业务数据
92
+ export const updateXObject = async (
93
+ xObjectApiKey: string,
94
+ objectId: string,
95
+ options: any,
96
+ ) => {
97
+ const curOptions = options || {};
98
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
99
+ const formData = curOptions.data || {};
100
+ try {
101
+ const config = {
102
+ ...curOptions,
103
+ url: apiUrl,
104
+ method: curOptions.method || 'PATCH',
105
+ data: {
106
+ data: formData,
107
+ },
108
+ };
109
+
110
+ const result = await axiosFetcher(config);
111
+ return result;
112
+ } catch (error) {
113
+ console.error('更新业务数据失败:', error);
114
+ throw error;
115
+ }
116
+ };
117
+
118
+ // 获取业务数据信息
119
+ export const getXObject = async (
120
+ xObjectApiKey: string,
121
+ objectId: string,
122
+ options?: any,
123
+ ) => {
124
+ const curOptions = options || {};
125
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
126
+ try {
127
+ const config = {
128
+ ...curOptions,
129
+ url: apiUrl,
130
+ method: curOptions.method || 'GET',
131
+ };
132
+
133
+ const result = await axiosFetcher(config);
134
+ return result;
135
+ } catch (error) {
136
+ console.error('获取业务数据信息失败:', error);
137
+ throw error;
138
+ }
139
+ };
140
+
141
+ // 删除业务数据
142
+ export const deleteXObject = async (
143
+ xObjectApiKey: string,
144
+ objectId: string,
145
+ options?: any,
146
+ ) => {
147
+ const curOptions = options || {};
148
+ const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
149
+ try {
150
+ const config = {
151
+ ...curOptions,
152
+ url: apiUrl,
153
+ method: curOptions.method || 'DELETE',
154
+ };
155
+
156
+ const result = await axiosFetcher(config);
157
+ return result;
158
+ } catch (error) {
159
+ console.error('删除业务数据:', error);
160
+ throw error;
161
+ }
162
+ };