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.
- package/package.json +3 -3
- package/src/utils/cmpUtils/createCmpByTemplate.js +1 -1
- package/src/utils/projectUtils/createCmpProjectByTemplate.js +1 -1
- package/template/antd-custom-cmp-template/.prettierrc.js +12 -0
- package/template/antd-custom-cmp-template/README.md +153 -0
- package/template/antd-custom-cmp-template/commitlint.config.js +59 -0
- package/template/antd-custom-cmp-template/neo.config.js +144 -0
- package/template/antd-custom-cmp-template/package.json +60 -0
- package/template/antd-custom-cmp-template/public/css/base.css +283 -0
- package/template/antd-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/antd-custom-cmp-template/public/template.html +13 -0
- package/template/antd-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/antd-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/antd-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/antd-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/antd-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/antd-custom-cmp-template/src/components/dataDashboard/README.md +39 -0
- package/template/antd-custom-cmp-template/src/components/dataDashboard/index.tsx +462 -0
- package/template/antd-custom-cmp-template/src/components/dataDashboard/model.ts +75 -0
- package/template/antd-custom-cmp-template/src/components/dataDashboard/style.scss +1667 -0
- package/template/antd-custom-cmp-template/src/components/infoCard/index.tsx +87 -0
- package/template/antd-custom-cmp-template/src/components/infoCard/model.ts +80 -0
- package/template/antd-custom-cmp-template/src/components/infoCard/style.scss +105 -0
- package/template/antd-custom-cmp-template/tsconfig.json +68 -0
- package/template/develop/neo-custom-cmp-template/.prettierrc.js +12 -0
- package/template/develop/neo-custom-cmp-template/README.md +48 -0
- package/template/develop/neo-custom-cmp-template/commitlint.config.js +59 -0
- package/template/develop/neo-custom-cmp-template/docs/README.md +13 -0
- package/template/develop/neo-custom-cmp-template/neo.config.js +121 -0
- package/template/develop/neo-custom-cmp-template/package.json +63 -0
- package/template/develop/neo-custom-cmp-template/public/css/base.css +283 -0
- package/template/develop/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/develop/neo-custom-cmp-template/public/template.html +13 -0
- package/template/develop/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/develop/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/develop/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/develop/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/develop/neo-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/develop/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/README.md +65 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/index.tsx +180 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +50 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/style.scss +260 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/README.md +94 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/index.tsx +251 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +56 -0
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/style.scss +120 -0
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/README.md +115 -0
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/index.tsx +304 -0
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +87 -0
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/style.scss +127 -0
- package/template/develop/neo-custom-cmp-template/src/utils/axiosFetcher.ts +29 -0
- package/template/develop/neo-custom-cmp-template/src/utils/queryObjectData.ts +39 -0
- package/template/develop/neo-custom-cmp-template/src/utils/xobjects.ts +203 -0
- package/template/develop/neo-custom-cmp-template/tsconfig.json +68 -0
- package/template/echarts-custom-cmp-template/.prettierrc.js +12 -0
- package/template/echarts-custom-cmp-template/README.md +198 -0
- package/template/echarts-custom-cmp-template/commitlint.config.js +59 -0
- package/template/echarts-custom-cmp-template/neo.config.js +140 -0
- package/template/echarts-custom-cmp-template/package.json +61 -0
- package/template/echarts-custom-cmp-template/public/css/base.css +283 -0
- package/template/echarts-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/echarts-custom-cmp-template/public/template.html +13 -0
- package/template/echarts-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/echarts-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/echarts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/echarts-custom-cmp-template/src/assets/img/chart.svg +1 -0
- package/template/echarts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/echarts-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/echarts-custom-cmp-template/src/components/chartWidget/README.md +186 -0
- package/template/echarts-custom-cmp-template/src/components/chartWidget/index.tsx +724 -0
- package/template/echarts-custom-cmp-template/src/components/chartWidget/model.ts +151 -0
- package/template/echarts-custom-cmp-template/src/components/chartWidget/style.scss +209 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/README.md +125 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/USAGE.md +190 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/index.tsx +385 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/model.ts +107 -0
- package/template/echarts-custom-cmp-template/src/components/mapWidget/style.scss +192 -0
- package/template/echarts-custom-cmp-template/src/utils/url.ts +82 -0
- package/template/echarts-custom-cmp-template/tsconfig.json +68 -0
- package/template/empty-cmp/index.tsx +58 -0
- package/template/empty-cmp/model.ts +79 -0
- package/template/empty-cmp/style.scss +72 -0
- package/template/empty-custom-cmp-template/.prettierrc.js +12 -0
- package/template/empty-custom-cmp-template/README.md +154 -0
- package/template/empty-custom-cmp-template/commitlint.config.js +59 -0
- package/template/empty-custom-cmp-template/neo.config.js +138 -0
- package/template/empty-custom-cmp-template/package.json +58 -0
- package/template/empty-custom-cmp-template/public/css/base.css +283 -0
- package/template/empty-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/empty-custom-cmp-template/public/template.html +13 -0
- package/template/empty-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/empty-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/empty-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/empty-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/empty-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/empty-custom-cmp-template/src/assets/img/map.svg +1 -0
- package/template/empty-custom-cmp-template/src/components/README.md +3 -0
- package/template/empty-custom-cmp-template/tsconfig.json +68 -0
- package/template/neo-custom-cmp-template/.prettierrc.js +12 -0
- package/template/neo-custom-cmp-template/README.md +155 -0
- package/template/neo-custom-cmp-template/commitlint.config.js +59 -0
- package/template/neo-custom-cmp-template/docs/README.md +244 -0
- package/template/neo-custom-cmp-template/neo.config.js +140 -0
- package/template/neo-custom-cmp-template/package.json +66 -0
- package/template/neo-custom-cmp-template/public/css/base.css +283 -0
- package/template/neo-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/neo-custom-cmp-template/public/template.html +13 -0
- package/template/neo-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/neo-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/neo-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/neo-custom-cmp-template/src/assets/img/card-list.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/contact-form.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/custom-form.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/data-list.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/detail.svg +1 -0
- package/template/neo-custom-cmp-template/src/assets/img/table.svg +1 -0
- package/template/neo-custom-cmp-template/src/components/entityCardList/README.md +61 -0
- package/template/neo-custom-cmp-template/src/components/entityCardList/index.tsx +202 -0
- package/template/neo-custom-cmp-template/src/components/entityCardList/model.ts +74 -0
- package/template/neo-custom-cmp-template/src/components/entityCardList/style.scss +260 -0
- package/template/neo-custom-cmp-template/src/components/entityDetail/README.md +176 -0
- package/template/neo-custom-cmp-template/src/components/entityDetail/index.tsx +334 -0
- package/template/neo-custom-cmp-template/src/components/entityDetail/model.ts +123 -0
- package/template/neo-custom-cmp-template/src/components/entityDetail/style.scss +292 -0
- package/template/neo-custom-cmp-template/src/components/entityForm/README.md +176 -0
- package/template/neo-custom-cmp-template/src/components/entityForm/index.tsx +615 -0
- package/template/neo-custom-cmp-template/src/components/entityForm/model.ts +107 -0
- package/template/neo-custom-cmp-template/src/components/entityForm/style.scss +370 -0
- package/template/neo-custom-cmp-template/src/components/entityTable/README.md +92 -0
- package/template/neo-custom-cmp-template/src/components/entityTable/index.tsx +784 -0
- package/template/neo-custom-cmp-template/src/components/entityTable/model.ts +134 -0
- package/template/neo-custom-cmp-template/src/components/entityTable/style.scss +304 -0
- package/template/neo-custom-cmp-template/src/utils/axiosFetcher.ts +37 -0
- package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +76 -0
- package/template/neo-custom-cmp-template/src/utils/xobjects.ts +162 -0
- package/template/neo-custom-cmp-template/tsconfig.json +49 -0
- package/template/react-custom-cmp-template/.prettierrc.js +12 -0
- package/template/react-custom-cmp-template/README.md +154 -0
- package/template/react-custom-cmp-template/commitlint.config.js +59 -0
- package/template/react-custom-cmp-template/neo.config.js +137 -0
- package/template/react-custom-cmp-template/package.json +57 -0
- package/template/react-custom-cmp-template/public/css/base.css +283 -0
- package/template/react-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/react-custom-cmp-template/public/template.html +13 -0
- package/template/react-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/react-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/react-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/react-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/react-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/react-custom-cmp-template/src/components/infoCard/index.jsx +45 -0
- package/template/react-custom-cmp-template/src/components/infoCard/model.js +81 -0
- package/template/react-custom-cmp-template/src/components/infoCard/style.scss +67 -0
- package/template/react-ts-custom-cmp-template/.prettierrc.js +12 -0
- package/template/react-ts-custom-cmp-template/README.md +154 -0
- package/template/react-ts-custom-cmp-template/commitlint.config.js +59 -0
- package/template/react-ts-custom-cmp-template/neo.config.js +138 -0
- package/template/react-ts-custom-cmp-template/package.json +59 -0
- package/template/react-ts-custom-cmp-template/public/css/base.css +283 -0
- package/template/react-ts-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/react-ts-custom-cmp-template/public/template.html +13 -0
- package/template/react-ts-custom-cmp-template/src/assets/css/common.scss +127 -0
- package/template/react-ts-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/react-ts-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/react-ts-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/react-ts-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/react-ts-custom-cmp-template/src/assets/img/map.svg +1 -0
- package/template/react-ts-custom-cmp-template/src/components/listWidget/README.md +2 -0
- package/template/react-ts-custom-cmp-template/src/components/listWidget/index.tsx +208 -0
- package/template/react-ts-custom-cmp-template/src/components/listWidget/model.ts +92 -0
- package/template/react-ts-custom-cmp-template/src/components/listWidget/style.scss +350 -0
- package/template/react-ts-custom-cmp-template/tsconfig.json +68 -0
- package/template/vue2-custom-cmp-template/.prettierrc.js +12 -0
- package/template/vue2-custom-cmp-template/README.md +154 -0
- package/template/vue2-custom-cmp-template/commitlint.config.js +59 -0
- package/template/vue2-custom-cmp-template/neo.config.js +146 -0
- package/template/vue2-custom-cmp-template/package.json +59 -0
- package/template/vue2-custom-cmp-template/public/css/base.css +283 -0
- package/template/vue2-custom-cmp-template/public/scripts/app/bluebird.js +6679 -0
- package/template/vue2-custom-cmp-template/public/template.html +13 -0
- package/template/vue2-custom-cmp-template/src/assets/css/common.scss +126 -0
- package/template/vue2-custom-cmp-template/src/assets/css/mixin.scss +47 -0
- package/template/vue2-custom-cmp-template/src/assets/img/NeoCRM.jpg +0 -0
- package/template/vue2-custom-cmp-template/src/assets/img/custom-widget.svg +1 -0
- package/template/vue2-custom-cmp-template/src/assets/img/favicon.png +0 -0
- package/template/vue2-custom-cmp-template/src/components/vueInfoCard/index.vue +131 -0
- package/template/vue2-custom-cmp-template/src/components/vueInfoCard/model.js +81 -0
- package/test/deprecate-versions.js +1 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
## Open api 文档
|
|
2
|
+
- [Open API 简介](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_apiIntroduction.html&id=1405&dir=output_1757929564205)。
|
|
3
|
+
|
|
4
|
+
## Neo 自定义组件中可用的 open api 接口
|
|
5
|
+
- [查询对象列表](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2FpaasQueryObjectList.html&id=1405&dir=output_1757929564205&time=1758780224026): /rest/metadata/v2.0/xobjects/filter;
|
|
6
|
+
- 查询标准对象列表: /rest/metadata/v2.0/xobjects/filter?custom=false&active=true;
|
|
7
|
+
- 查询自定义对象列表: /rest/metadata/v2.0/xobjects/filter?custom=true&active=true;
|
|
8
|
+
- [创建业务数据](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_create.html&id=1405&dir=output_1757929564205&time=1758782257815): /rest/data/v2.0/xobjects/{xObjectApiKey};
|
|
9
|
+
- [更新业务数据](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_update.html&id=1405&dir=output_1757929564205&time=1758782321910): /rest/data/v2.0/xobjects/{xObjectApiKey}/{id};
|
|
10
|
+
- [获取业务数据信息(单个数据)](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_getBusinessDataInformation.html&id=1405&dir=output_1757929564205&time=1758781533725): /rest/data/v2.0/xobjects/{xObjectApiKey}/{id};
|
|
11
|
+
- [查询接口(通用查询接口)](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_queryInterfaceDescription.html&id=1405&dir=output_1757929564205&time=1758784491846): /rest/data/v2/query;
|
|
12
|
+
- [获取业务类型描述](https://doc.xiaoshouyi.com/?sso-domain=login-cd.xiaoshouyi.com#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_paas_customObject_getBusinessTypeDescription.html&id=1405&dir=output_1757929564205&time=1758798530511): /rest/data/v2.0/xobjects/{xObjectApiKey}/busiType;
|
|
13
|
+
- 更多可用接口见[文档](https://doc.xiaoshouyi.com/#/proMan/workplaceDetailApi?url=%2F%2Fconcepts%2Fapi_apiIntroduction.html&id=1405&dir=output_1757929564205)。
|
|
14
|
+
|
|
15
|
+
## Open API 请求方法
|
|
16
|
+
|
|
17
|
+
### 基础请求工具
|
|
18
|
+
|
|
19
|
+
#### axiosFetcher
|
|
20
|
+
基于 axios 封装的通用请求工具,支持 GET、POST、PATCH、DELETE 等请求方法。
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import axiosFetcher from '@/utils/axiosFetcher';
|
|
24
|
+
|
|
25
|
+
// 基本用法
|
|
26
|
+
const result = await axiosFetcher({
|
|
27
|
+
url: '/api/endpoint',
|
|
28
|
+
method: 'GET',
|
|
29
|
+
data: { key: 'value' },
|
|
30
|
+
headers: { 'Custom-Header': 'value' },
|
|
31
|
+
timeout: 30000
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**参数说明:**
|
|
36
|
+
- `url`: 请求地址
|
|
37
|
+
- `method`: 请求方法,默认为 'GET'
|
|
38
|
+
- `data`: 请求数据,GET 请求会转为 params
|
|
39
|
+
- `headers`: 请求头,默认包含 'Content-Type': 'application/json'
|
|
40
|
+
- `timeout`: 超时时间,默认 30000ms
|
|
41
|
+
|
|
42
|
+
### 业务对象相关接口
|
|
43
|
+
|
|
44
|
+
#### 1. 查询业务对象数据列表 (queryXObjectData)
|
|
45
|
+
使用通用查询接口获取业务对象数据,支持分页和排序。
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { queryXObjectData } from '@/utils/queryObjectData';
|
|
49
|
+
|
|
50
|
+
// 基本查询
|
|
51
|
+
const result = await queryXObjectData({
|
|
52
|
+
xObjectApiKey: 'Contact', // 业务对象 API Key
|
|
53
|
+
fields: ['name', 'phone', 'email'], // 查询字段
|
|
54
|
+
page: 1, // 页码
|
|
55
|
+
pageSize: 10, // 每页数量
|
|
56
|
+
orderBy: 'name asc' // 排序条件(可选)
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**参数说明:**
|
|
61
|
+
- `xObjectApiKey`: 业务对象的 API Key
|
|
62
|
+
- `fields`: 需要查询的字段数组,会自动添加 'id' 字段
|
|
63
|
+
- `page`: 页码,默认为 1
|
|
64
|
+
- `pageSize`: 每页数量,默认为 10
|
|
65
|
+
- `orderBy`: 排序条件,如 'name asc' 或 'createdTime desc'
|
|
66
|
+
|
|
67
|
+
**返回结果:**
|
|
68
|
+
```typescript
|
|
69
|
+
{
|
|
70
|
+
code: 200,
|
|
71
|
+
result: {
|
|
72
|
+
// 查询结果数据
|
|
73
|
+
records: any[],
|
|
74
|
+
// 分页信息
|
|
75
|
+
totalSize: number, // 总个数
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### 2. 获取业务类型列表 (getEntityTypeList)
|
|
81
|
+
获取指定业务对象的业务类型列表。
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { getEntityTypeList } from '@/utils/xobjects';
|
|
85
|
+
|
|
86
|
+
const result = await getEntityTypeList('Contact', {
|
|
87
|
+
// 其他请求选项
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**参数说明:**
|
|
92
|
+
- `xObjectApiKey`: 业务对象的 API Key
|
|
93
|
+
- `options`: 可选的请求配置
|
|
94
|
+
|
|
95
|
+
#### 3. 获取对象列表 (getEntityList)
|
|
96
|
+
获取系统中的对象列表,支持标准对象和自定义对象。
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { getEntityList } from '@/utils/xobjects';
|
|
100
|
+
|
|
101
|
+
// 获取标准对象列表
|
|
102
|
+
const standardObjects = await getEntityList({
|
|
103
|
+
custom: false, // 获取标准对象
|
|
104
|
+
active: true // 仅获取有权限的对象
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// 获取自定义对象列表
|
|
108
|
+
const customObjects = await getEntityList({
|
|
109
|
+
custom: true, // 获取自定义对象
|
|
110
|
+
active: true // 仅获取有权限的对象
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**参数说明:**
|
|
115
|
+
- `custom`: 是否获取自定义对象,false 为标准对象,true 为自定义对象
|
|
116
|
+
- `active`: 是否仅获取有权限的对象,默认为 true
|
|
117
|
+
|
|
118
|
+
#### 4. 创建业务数据 (createXObject)
|
|
119
|
+
创建新的业务数据记录。
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { createXObject } from '@/utils/xobjects';
|
|
123
|
+
|
|
124
|
+
const result = await createXObject('Contact', {
|
|
125
|
+
method: 'POST',
|
|
126
|
+
data: {
|
|
127
|
+
name: '张三',
|
|
128
|
+
phone: '13800138000',
|
|
129
|
+
email: 'zhangsan@example.com'
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**参数说明:**
|
|
135
|
+
- `xObjectApiKey`: 业务对象的 API Key
|
|
136
|
+
- `options.data`: 要创建的数据对象
|
|
137
|
+
- `options.method`: 请求方法,默认为 'GET'(建议使用 'POST')
|
|
138
|
+
|
|
139
|
+
#### 5. 更新业务数据 (updateXObject)
|
|
140
|
+
更新指定的业务数据记录。
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { updateXObject } from '@/utils/xobjects';
|
|
144
|
+
|
|
145
|
+
const result = await updateXObject('Contact', '12345', {
|
|
146
|
+
method: 'PATCH',
|
|
147
|
+
data: {
|
|
148
|
+
name: '李四',
|
|
149
|
+
phone: '13900139000'
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**参数说明:**
|
|
155
|
+
- `xObjectApiKey`: 业务对象的 API Key
|
|
156
|
+
- `objectId`: 要更新的记录 ID
|
|
157
|
+
- `options.data`: 要更新的数据对象
|
|
158
|
+
- `options.method`: 请求方法,默认为 'PATCH'
|
|
159
|
+
|
|
160
|
+
#### 6. 获取业务数据信息 (getXObject)
|
|
161
|
+
获取指定业务数据记录的详细信息。
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
import { getXObject } from '@/utils/xobjects';
|
|
165
|
+
|
|
166
|
+
const result = await getXObject('Contact', '12345', {
|
|
167
|
+
// 其他请求选项
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**参数说明:**
|
|
172
|
+
- `xObjectApiKey`: 业务对象的 API Key
|
|
173
|
+
- `objectId`: 要获取的记录 ID
|
|
174
|
+
- `options`: 可选的请求配置
|
|
175
|
+
|
|
176
|
+
#### 7. 删除业务数据 (deleteXObject)
|
|
177
|
+
删除指定的业务数据记录。
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { deleteXObject } from '@/utils/xobjects';
|
|
181
|
+
|
|
182
|
+
const result = await deleteXObject('Contact', '12345');
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**参数说明:**
|
|
186
|
+
- `xObjectApiKey`: 业务对象的 API Key
|
|
187
|
+
- `objectId`: 要删除的记录 ID
|
|
188
|
+
|
|
189
|
+
#### 8. 获取业务对象描述 (getXObjectDesc)
|
|
190
|
+
获取业务对象的描述信息。
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import { getXObjectDesc } from '@/utils/xobjects';
|
|
194
|
+
|
|
195
|
+
const result = await getXObjectDesc('Contact');
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**参数说明:**
|
|
199
|
+
- `xObjectApiKey`: 业务对象的 API Key
|
|
200
|
+
|
|
201
|
+
### 使用示例
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import {
|
|
205
|
+
queryXObjectData,
|
|
206
|
+
createXObject,
|
|
207
|
+
updateXObject,
|
|
208
|
+
getXObject,
|
|
209
|
+
deleteXObject
|
|
210
|
+
} from '@/utils/xobjects';
|
|
211
|
+
|
|
212
|
+
// 查询联系人列表
|
|
213
|
+
const contacts = await queryXObjectData({
|
|
214
|
+
xObjectApiKey: 'Contact',
|
|
215
|
+
fields: ['name', 'phone', 'email'],
|
|
216
|
+
page: 1,
|
|
217
|
+
pageSize: 20,
|
|
218
|
+
orderBy: 'createdTime desc'
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// 创建新联系人
|
|
222
|
+
const newContact = await createXObject('Contact', {
|
|
223
|
+
method: 'POST',
|
|
224
|
+
data: {
|
|
225
|
+
name: '王五',
|
|
226
|
+
phone: '13700137000',
|
|
227
|
+
email: 'wangwu@example.com'
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// 更新联系人
|
|
232
|
+
const updatedContact = await updateXObject('Contact', newContact.id, {
|
|
233
|
+
data: {
|
|
234
|
+
name: '王五(更新)'
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// 获取联系人详情
|
|
239
|
+
const contactDetail = await getXObject('Contact', newContact.id);
|
|
240
|
+
|
|
241
|
+
// 删除联系人
|
|
242
|
+
await deleteXObject('Contact', newContact.id);
|
|
243
|
+
```
|
|
244
|
+
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
// 统一路径解析
|
|
6
|
+
function resolve(dir) {
|
|
7
|
+
return path.resolve(__dirname, dir);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 包括生产和开发的环境配置信息
|
|
11
|
+
module.exports = {
|
|
12
|
+
settings: {
|
|
13
|
+
enableESLint: false, // 调试模式是否开启ESLint,默认开启ESLint检测代码格式
|
|
14
|
+
enableESLintFix: false, // 是否自动修正代码格式,默认不自动修正
|
|
15
|
+
enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
|
|
16
|
+
enableStyleLintFix: false, // 是否需要StyleLint自动修正代码格式
|
|
17
|
+
},
|
|
18
|
+
webpack: {
|
|
19
|
+
target: ['web', 'es5'], // 指定目标环境为 web 和 es5,确保兼容性
|
|
20
|
+
resolve: {
|
|
21
|
+
// webpack的resolve配置
|
|
22
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.umd.js', '.min.js', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
|
|
23
|
+
alias: {
|
|
24
|
+
'@': resolve('src'),
|
|
25
|
+
$assets: resolve('src/assets'),
|
|
26
|
+
$public: resolve('public'),
|
|
27
|
+
$utils: resolve('src/utils'),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
// sassResources中的sass文件会自动注入每一个sass文件中
|
|
31
|
+
sassResources: [
|
|
32
|
+
resolve('./src/assets/css/common.scss'),
|
|
33
|
+
resolve('./src/assets/css/mixin.scss'),
|
|
34
|
+
],
|
|
35
|
+
// createDeclaration: true, // 打包时是否创建ts声明文件
|
|
36
|
+
ignoreNodeModules: false, // 打包时是否忽略 node_modules
|
|
37
|
+
// allowList: [], // ignoreNodeModules为true时生效
|
|
38
|
+
// projectDir: ['src'],
|
|
39
|
+
// template: resolve('./public/template.html'), // 自定义html模板
|
|
40
|
+
// plugins: [],
|
|
41
|
+
// babelPlugins: [],
|
|
42
|
+
},
|
|
43
|
+
// 用于添加 Neo 共享依赖模块的配置信息
|
|
44
|
+
/*
|
|
45
|
+
neoCommonModule: {
|
|
46
|
+
// exports: ['xxModule'], // 数组写法,用于导出当前自定义组件中的第三方依赖模块
|
|
47
|
+
exports: { // 对象写法,可用于导出自定义组件中的某个内容模块(需要使用绝对路径导出)
|
|
48
|
+
'xxModule': path.resolve('./src/components/xxModule'), // 导出 xx组件 或 xx模块
|
|
49
|
+
},
|
|
50
|
+
// remoteDeps: ['xxCmpType'], // 远程依赖组件,表示当前自定义组件会用到的依赖组件,需要和 externals 配合使用
|
|
51
|
+
// externals: ['xxModule'], // 自定义组件中需要剔除的模块,仅支持数组写法
|
|
52
|
+
},
|
|
53
|
+
*/
|
|
54
|
+
preview: {
|
|
55
|
+
// 用于开启本地预览模式的相关配置信息
|
|
56
|
+
/*
|
|
57
|
+
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
58
|
+
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
59
|
+
// 本地预览自定义组件内容
|
|
60
|
+
index: './src/preview.jsx',
|
|
61
|
+
},
|
|
62
|
+
NODE_ENV: 'development',
|
|
63
|
+
port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
|
|
64
|
+
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
|
|
65
|
+
assetsSubDirectory: '',
|
|
66
|
+
hostname: 'localhost',
|
|
67
|
+
proxyTable: {
|
|
68
|
+
'/apiTest': {
|
|
69
|
+
target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
|
|
70
|
+
ws: true,
|
|
71
|
+
changeOrigin: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
*/
|
|
75
|
+
},
|
|
76
|
+
linkDebug: {
|
|
77
|
+
// 用于开启本地调试模式的相关配置信息
|
|
78
|
+
/*
|
|
79
|
+
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
80
|
+
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
81
|
+
// 外链调试(在线上页面设计器端预览自定义组件)
|
|
82
|
+
index: [
|
|
83
|
+
'./src/components/xxCmp/register.ts',
|
|
84
|
+
'./src/components/xxCmp/model.ts',
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
NODE_ENV: 'development',
|
|
88
|
+
port: 80, // 设置基础端口,如果被占用则自动寻找可用端口
|
|
89
|
+
closeHotReload: true, // 是否关闭热更新
|
|
90
|
+
assetsPublicPath: '/', // 设置静态资源的引用路径(根域名+路径)
|
|
91
|
+
assetsSubDirectory: '',
|
|
92
|
+
hostname: 'localhost',
|
|
93
|
+
proxyTable: {
|
|
94
|
+
'/apiTest': {
|
|
95
|
+
target: 'http://api-test.com.cn', // 不支持跨域的接口根地址
|
|
96
|
+
ws: true,
|
|
97
|
+
changeOrigin: true,
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
*/
|
|
101
|
+
},
|
|
102
|
+
// 授权码授权模式下的 NeoCRM 平台配置
|
|
103
|
+
neoConfig: {
|
|
104
|
+
authType: 'oauth2', // 授权类型,可选值:oauth2(默认)、password
|
|
105
|
+
neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
|
|
106
|
+
// 当 authType 为 oauth2 时,loginURL 配置项必填
|
|
107
|
+
loginURL: 'https://login-cd.xiaoshouyi.com/auc/oauth2/auth', // 登录授权 URL(默认:https://login.xiaoshouyi.com/auc/oauth2/auth)
|
|
108
|
+
tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
|
|
109
|
+
},
|
|
110
|
+
/*
|
|
111
|
+
// 密码授权模式下的 NeoCRM 平台配置
|
|
112
|
+
neoConfig: {
|
|
113
|
+
authType: 'password', // 授权类型,可选值:oauth2(默认)、password
|
|
114
|
+
neoBaseURL: 'https://crm-cd.xiaoshouyi.com', // 平台根地址(默认:https://crm.xiaoshouyi.com)
|
|
115
|
+
tokenAPI: 'https://login-cd.xiaoshouyi.com/auc/oauth2/token', // Token 获取接口地址(默认:https://login.xiaoshouyi.com/auc/oauth2/token)
|
|
116
|
+
// 当 authType 为 password 时,auth 配置项必填
|
|
117
|
+
auth: {
|
|
118
|
+
client_id: 'xx', // 客户端 ID,从创建连接器的客户端信息中获取(Client_Id)
|
|
119
|
+
client_secret: 'xxx', // 客户端秘钥,从创建连接器的客户端信息中获取(Client_Secret)
|
|
120
|
+
username: 'xx', // 用户在销售易系统中的用户名
|
|
121
|
+
// password 为 用户在销售易系统中的账号密码加上 8 位安全令牌。
|
|
122
|
+
// 例如,用户密码为 123456,安全令牌为 ABCDEFGH,则 password 的值应为 123456ABCDEFGH。
|
|
123
|
+
password: 'xx xx', // 用户账户密码 + 8 位安全令牌
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
*/
|
|
127
|
+
pushCmp: {
|
|
128
|
+
// 用于构建并发布至 NeoCRM 的相关配置
|
|
129
|
+
/*
|
|
130
|
+
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
131
|
+
NODE_ENV: 'production',
|
|
132
|
+
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
133
|
+
InfoCardModel: './src/components/xxCmp/model.ts',
|
|
134
|
+
infoCard: './src/components/xxCmp/register.ts'
|
|
135
|
+
},
|
|
136
|
+
cssExtract: false, // 不额外提取css文件
|
|
137
|
+
assetsRoot: resolve('dist') // 上传指定目录下的脚本文件
|
|
138
|
+
*/
|
|
139
|
+
},
|
|
140
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "neo-custom-cmp-template",
|
|
3
|
+
"version": "1.1.10",
|
|
4
|
+
"description": "neo自定义组件模板(react&ts技术栈)",
|
|
5
|
+
"framework": "react-ts",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"自定义组件模板",
|
|
8
|
+
"react&ts技术栈",
|
|
9
|
+
"neo自定义组件"
|
|
10
|
+
],
|
|
11
|
+
"author": "wibetter",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"preview": "neo preview",
|
|
15
|
+
"linkDebug": "neo linkDebug",
|
|
16
|
+
"pushCmp": "neo push cmp",
|
|
17
|
+
"pullCmp": "neo pull cmp",
|
|
18
|
+
"deleteCmp": "neo delete cmp",
|
|
19
|
+
"format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\""
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/*"
|
|
23
|
+
],
|
|
24
|
+
"husky": {
|
|
25
|
+
"hooks": {
|
|
26
|
+
"pre-commit": "lint-staged",
|
|
27
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"lint-staged": {
|
|
31
|
+
"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}": [
|
|
32
|
+
"prettier --write"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://git@github.com:wibetter/neo-custom-cmp-template.git"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/wibetter/neo-custom-cmp-template/issues"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"neo-register": "^1.0.8",
|
|
44
|
+
"react": "^16.9.0",
|
|
45
|
+
"react-dom": "^16.9.0",
|
|
46
|
+
"axios": "^0.27.2",
|
|
47
|
+
"antd": "^4.9.4",
|
|
48
|
+
"lodash": "^4.17.21",
|
|
49
|
+
"neo-open-api": "^1.1.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@commitlint/cli": "^8.3.5",
|
|
53
|
+
"@commitlint/config-conventional": "^9.1.1",
|
|
54
|
+
"@types/react": "^16.9.11",
|
|
55
|
+
"@types/react-dom": "^16.9.15",
|
|
56
|
+
"@types/axios": "^0.14.0",
|
|
57
|
+
"neo-cmp-cli": "^1.8.0",
|
|
58
|
+
"husky": "^4.2.5",
|
|
59
|
+
"lint-staged": "^10.2.9",
|
|
60
|
+
"prettier": "^2.0.5"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">= 10.13.0",
|
|
64
|
+
"npm": ">= 6.4.1"
|
|
65
|
+
}
|
|
66
|
+
}
|