neo-cmp-cli 1.12.12 → 1.13.0
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/README.md +2 -1
- package/dist/index2.js +1 -1
- package/dist/module/neoInitByCopy.js +1 -1
- package/dist/package.json.js +1 -1
- package/package.json +1 -1
- package/template/antd-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/package.json +1 -1
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/empty-custom-cmp-template/package.json +1 -1
- package/template/map-custom-cmp-template/package.json +1 -1
- package/template/neo-bi-cmps/.prettierrc.js +12 -0
- package/template/neo-bi-cmps/@types/neo-ui-common.d.ts +36 -0
- package/template/neo-bi-cmps/README.md +99 -0
- package/template/neo-bi-cmps/commitlint.config.js +59 -0
- package/template/neo-bi-cmps/neo.config.js +124 -0
- package/template/neo-bi-cmps/package.json +62 -0
- package/template/neo-bi-cmps/public/css/base.css +283 -0
- package/template/neo-bi-cmps/public/scripts/app/bluebird.js +6679 -0
- package/template/neo-bi-cmps/public/template.html +13 -0
- package/template/neo-bi-cmps/src/assets/css/common.scss +127 -0
- package/template/neo-bi-cmps/src/assets/css/mixin.scss +47 -0
- package/template/neo-bi-cmps/src/assets/img/AIBtn.gif +0 -0
- package/template/neo-bi-cmps/src/assets/img/NeoCRM.jpg +0 -0
- package/template/neo-bi-cmps/src/assets/img/aiLogo.png +0 -0
- package/template/neo-bi-cmps/src/assets/img/card-list.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/contact-form.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/custom-form.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/custom-widget.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/data-list.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/detail.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/favicon.png +0 -0
- package/template/neo-bi-cmps/src/assets/img/map.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/search.svg +1 -0
- package/template/neo-bi-cmps/src/assets/img/table.svg +1 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/README.md +100 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/configSchema.ts +253 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.scss +76 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.tsx +148 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/index.tsx +440 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/model.ts +128 -0
- package/template/neo-bi-cmps/src/components/targetNumber__c/style.scss +173 -0
- package/template/neo-bi-cmps/src/utils/axiosFetcher.ts +37 -0
- package/template/neo-bi-cmps/src/utils/queryObjectData.ts +76 -0
- package/template/neo-bi-cmps/src/utils/xobjects.ts +162 -0
- package/template/neo-bi-cmps/tsconfig.json +40 -0
- package/template/neo-custom-cmp-template/package.json +1 -1
- package/template/neo-h5-cmps/package.json +1 -1
- package/template/neo-order-cmps/package.json +1 -1
- package/template/neo-web-cmps/package.json +1 -1
- package/template/react-custom-cmp-template/package.json +1 -1
- package/template/react-ts-custom-cmp-template/package.json +1 -1
- package/template/vue2-custom-cmp-template/package.json +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// 导入自定义配置项(用于对接复杂自定义配置)
|
|
2
|
+
// import './customStyleConfig';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file 数值指标组件对接编辑器的描述文件
|
|
6
|
+
* @description 定义组件在 Neo 平台编辑器中的配置信息
|
|
7
|
+
* @author Neo Custom Widget CLI
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
export class TargetNumberModel {
|
|
11
|
+
/**
|
|
12
|
+
* 组件类型标识
|
|
13
|
+
* 用于标识组件的唯一性,在构建时根据当前组件目录名称自动生成
|
|
14
|
+
* 注意:此字段在构建时会被自动替换,不需要手动设置
|
|
15
|
+
*/
|
|
16
|
+
// cmpType: string = 'targetNumber';
|
|
17
|
+
|
|
18
|
+
/** 组件名称,用于设置在编辑器左侧组件面板中展示的名称 */
|
|
19
|
+
label: string = '数值指标';
|
|
20
|
+
|
|
21
|
+
/** 组件描述,用于设置在编辑器左侧组件面板中展示的描述 */
|
|
22
|
+
description: string =
|
|
23
|
+
'用于展示关键数值指标,支持从 XObject 实体对象获取动态数据,支持绑定多个字段进行展示';
|
|
24
|
+
|
|
25
|
+
/** 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示 */
|
|
26
|
+
// tags: string[] = ['自定义组件'];
|
|
27
|
+
|
|
28
|
+
/** 组件图标,用于设置在编辑器左侧组件面板中展示的图标 */
|
|
29
|
+
iconUrl: string = 'https://custom-widgets.bj.bcebos.com/TargetNumber.svg';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 用于设置组件支持的页面类型
|
|
33
|
+
*
|
|
34
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
35
|
+
* all: 1 全页面
|
|
36
|
+
* entityFormPage: 4 实体表单页
|
|
37
|
+
* customPage: 6 自定义页面
|
|
38
|
+
*/
|
|
39
|
+
targetPage: string[] = ['all'];
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 用于设置组件支持的终端类型
|
|
43
|
+
*
|
|
44
|
+
* 当前 NeoCRM 平台存在的终端类型:
|
|
45
|
+
* web: 网页端
|
|
46
|
+
* mobile: 移动端
|
|
47
|
+
*/
|
|
48
|
+
targetDevice: string = 'all';
|
|
49
|
+
|
|
50
|
+
/** 初次插入页面的默认属性数据 */
|
|
51
|
+
defaultComProps = {
|
|
52
|
+
entityApiKey: '',
|
|
53
|
+
targetNumberStyle: {
|
|
54
|
+
baseStyle: {
|
|
55
|
+
backgroundColor: '#ffffff',
|
|
56
|
+
paddingMargin: {
|
|
57
|
+
margin: '0',
|
|
58
|
+
padding: '0',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
layoutStyle: {
|
|
62
|
+
alignClass: 'flex-col',
|
|
63
|
+
},
|
|
64
|
+
titleStyle: {
|
|
65
|
+
show: true,
|
|
66
|
+
text: '>> 关键数据',
|
|
67
|
+
fontSize: 18,
|
|
68
|
+
fontWeight: 700,
|
|
69
|
+
color: '#333',
|
|
70
|
+
backgroundColor: '#eaf3fc',
|
|
71
|
+
},
|
|
72
|
+
numberStyle: {
|
|
73
|
+
fontSize: 32,
|
|
74
|
+
fontWeight: 600,
|
|
75
|
+
color: '#262626',
|
|
76
|
+
},
|
|
77
|
+
numberTitleStyle: {
|
|
78
|
+
fontSize: 14,
|
|
79
|
+
fontWeight: 400,
|
|
80
|
+
color: '#8c8c8c',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// 当前组件支持的函数列表(其他组件可触发当前组件的函数)
|
|
86
|
+
functions = [
|
|
87
|
+
{
|
|
88
|
+
apiKey: 'loadData',
|
|
89
|
+
label: '刷新BI看板数据',
|
|
90
|
+
helpTextKey: '刷新BI看板组件数据',
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 组件属性配置模式
|
|
96
|
+
* 支持静态配置:propsSchema,优先级比 propsSchemaCreator 低
|
|
97
|
+
* 定义组件在编辑器中可配置的属性
|
|
98
|
+
*/
|
|
99
|
+
propsSchema = [
|
|
100
|
+
{
|
|
101
|
+
type: 'xObjectDetailApi',
|
|
102
|
+
name: 'entityApiKey',
|
|
103
|
+
label: '绑定实体业务数据',
|
|
104
|
+
placeholder: '绑定实体业务数据源',
|
|
105
|
+
disabledFieldSelect: true,
|
|
106
|
+
disabledAutoFetchData: true,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: 'selectFieldDescApi',
|
|
110
|
+
name: 'selectFieldDesc',
|
|
111
|
+
xObjectApiKey: 'entityApiKey.xObjectApiKey',
|
|
112
|
+
mode: 'tags', // 多选,必填
|
|
113
|
+
label: '绑定字段',
|
|
114
|
+
placeholder: '请至少选择一个要显示的字段',
|
|
115
|
+
},
|
|
116
|
+
/*
|
|
117
|
+
{
|
|
118
|
+
type: 'customStyleConfig',
|
|
119
|
+
name: 'targetNumberStyle',
|
|
120
|
+
label: '自定义样式配置',
|
|
121
|
+
viewStyle: 'tabs', // 'tabs'、'fold'
|
|
122
|
+
wideScreen: false, // 是否开启宽屏展示模式
|
|
123
|
+
},
|
|
124
|
+
*/
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export default TargetNumberModel;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
.targetNumber__c {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
padding: 0 !important;
|
|
5
|
+
background: #fff;
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
8
|
+
margin-bottom: 12px;
|
|
9
|
+
|
|
10
|
+
// 组件标题(根据 titleStyle.show 展示)
|
|
11
|
+
.target-number-title {
|
|
12
|
+
line-height: 1.4;
|
|
13
|
+
background-color: #eaf3fc;
|
|
14
|
+
padding: 8px 12px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.target-number-block {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
min-height: 60px;
|
|
22
|
+
padding: 8px;
|
|
23
|
+
|
|
24
|
+
&.flex-col {
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.flex-col-reverse {
|
|
30
|
+
flex-direction: column-reverse;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.flex-row {
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
gap: 12px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.flex-row-reverse {
|
|
40
|
+
flex-direction: row-reverse;
|
|
41
|
+
gap: 12px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 多字段模式
|
|
45
|
+
&.multiple-fields {
|
|
46
|
+
align-items: stretch;
|
|
47
|
+
justify-content: flex-start;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 多字段列表容器
|
|
52
|
+
.target-number-list {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-wrap: wrap;
|
|
55
|
+
gap: 16px;
|
|
56
|
+
width: 100%;
|
|
57
|
+
|
|
58
|
+
@media (max-width: 768px) {
|
|
59
|
+
gap: 12px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (max-width: 576px) {
|
|
63
|
+
gap: 8px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 单个数值项
|
|
68
|
+
.target-number-item {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex: 1;
|
|
71
|
+
min-width: 0;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
padding: 12px;
|
|
75
|
+
background: #fafafa;
|
|
76
|
+
border-radius: 6px;
|
|
77
|
+
transition: all 0.3s ease;
|
|
78
|
+
|
|
79
|
+
&:hover {
|
|
80
|
+
background: #f0f0f0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&.flex-col {
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
gap: 8px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&.flex-col-reverse {
|
|
89
|
+
flex-direction: column-reverse;
|
|
90
|
+
gap: 8px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&.flex-row {
|
|
94
|
+
flex-direction: row;
|
|
95
|
+
gap: 12px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&.flex-row-reverse {
|
|
99
|
+
flex-direction: row-reverse;
|
|
100
|
+
gap: 12px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (max-width: 576px) {
|
|
104
|
+
padding: 8px;
|
|
105
|
+
min-width: calc(50% - 4px);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.target-number-value {
|
|
110
|
+
font-size: 32px;
|
|
111
|
+
font-weight: 600;
|
|
112
|
+
color: #262626;
|
|
113
|
+
line-height: 1.2;
|
|
114
|
+
word-break: break-all;
|
|
115
|
+
text-align: center;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.target-number-label {
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
color: #8c8c8c;
|
|
121
|
+
font-weight: 400;
|
|
122
|
+
text-align: center;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.target-number-loading {
|
|
126
|
+
color: #8c8c8c;
|
|
127
|
+
font-size: 14px;
|
|
128
|
+
text-align: center;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.target-number-error {
|
|
132
|
+
color: #ff4d4f;
|
|
133
|
+
font-size: 14px;
|
|
134
|
+
text-align: center;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.target-number-empty {
|
|
138
|
+
color: #8c8c8c;
|
|
139
|
+
font-size: 14px;
|
|
140
|
+
text-align: center;
|
|
141
|
+
padding: 20px;
|
|
142
|
+
width: 100%;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 响应式设计
|
|
146
|
+
@media (max-width: 768px) {
|
|
147
|
+
padding: 12px;
|
|
148
|
+
|
|
149
|
+
.target-number-value {
|
|
150
|
+
font-size: 28px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.target-number-label {
|
|
154
|
+
font-size: 13px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@media (max-width: 576px) {
|
|
159
|
+
padding: 10px;
|
|
160
|
+
|
|
161
|
+
.target-number-value {
|
|
162
|
+
font-size: 24px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.target-number-label {
|
|
166
|
+
font-size: 12px;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.target-number {
|
|
172
|
+
background-color: red;
|
|
173
|
+
}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"experimentalDecorators": true,
|
|
4
|
+
"target": "esnext",
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"allowJs": false,
|
|
7
|
+
"jsx": "react", // preserve
|
|
8
|
+
"declaration": false,
|
|
9
|
+
"noEmit": false,
|
|
10
|
+
"importHelpers": true,
|
|
11
|
+
"isolatedModules": false,
|
|
12
|
+
"strict": false,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"strictNullChecks": true,
|
|
15
|
+
"noImplicitThis": true,
|
|
16
|
+
"noUnusedLocals": false,
|
|
17
|
+
"noImplicitReturns": true,
|
|
18
|
+
"moduleResolution": "node",
|
|
19
|
+
"baseUrl": "./",
|
|
20
|
+
"paths": {
|
|
21
|
+
"@": [
|
|
22
|
+
"./src"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"typeRoots": [
|
|
26
|
+
"./@types",
|
|
27
|
+
"./node_modules/@types"
|
|
28
|
+
],
|
|
29
|
+
"allowSyntheticDefaultImports": true,
|
|
30
|
+
"esModuleInterop": true,
|
|
31
|
+
"forceConsistentCasingInFileNames": true
|
|
32
|
+
},
|
|
33
|
+
"include": [
|
|
34
|
+
"src",
|
|
35
|
+
"test"
|
|
36
|
+
],
|
|
37
|
+
"exclude": [
|
|
38
|
+
"node_modules"
|
|
39
|
+
]
|
|
40
|
+
}
|