neo-cmp-cli 1.12.9 → 1.12.11
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/dist/index2.js +1 -1
- package/dist/module/neoInitByCopy.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/utils/projectUtils/createCmpProjectByTemplate.js +1 -1
- package/docs/NeoEntityGrid /344/275/277/347/224/250/350/257/264/346/230/216.md" +1202 -0
- package/docs//345/217/257/347/224/250/345/261/236/346/200/247/351/205/215/347/275/256/351/241/271.md +801 -0
- package/package.json +5 -1
- package/template/antd-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/package.json +1 -2
- package/template/asset-manage-template/src/utils/queryObjectData.ts +36 -0
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/empty-custom-cmp-template/package.json +1 -1
- package/template/neo-custom-cmp-template/package.json +4 -1
- package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +36 -0
- package/template/neo-custom-cmp-template/tsconfig.json +1 -2
- package/template/neo-h5-cmps/neo.config.js +1 -6
- package/template/neo-h5-cmps/package.json +6 -4
- package/template/neo-h5-cmps/src/utils/queryObjectData.ts +36 -0
- package/template/neo-h5-cmps/tsconfig.json +3 -4
- package/template/neo-order-cmps/package.json +1 -1
- package/template/neo-order-cmps/src/utils/queryObjectData.ts +36 -0
- package/template/neo-web-cmps/.prettierrc.js +12 -0
- package/template/neo-web-cmps/@types/neo-ui-common.d.ts +36 -0
- package/template/neo-web-cmps/README.md +99 -0
- package/template/neo-web-cmps/commitlint.config.js +59 -0
- package/template/neo-web-cmps/neo.config.js +53 -0
- package/template/neo-web-cmps/package.json +65 -0
- package/template/neo-web-cmps/public/css/base.css +283 -0
- package/template/neo-web-cmps/public/scripts/app/bluebird.js +6679 -0
- package/template/neo-web-cmps/public/template.html +13 -0
- package/template/neo-web-cmps/src/assets/css/common.scss +127 -0
- package/template/neo-web-cmps/src/assets/css/mixin.scss +47 -0
- package/template/neo-web-cmps/src/assets/img/AIBtn.gif +0 -0
- package/template/neo-web-cmps/src/assets/img/NeoCRM.jpg +0 -0
- package/template/neo-web-cmps/src/assets/img/aiLogo.png +0 -0
- package/template/neo-web-cmps/src/assets/img/card-list.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/contact-form.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/custom-form.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/custom-widget.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/data-list.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/detail.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/favicon.png +0 -0
- package/template/neo-web-cmps/src/assets/img/map.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/search.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/table.svg +1 -0
- package/template/neo-web-cmps/src/components/entityGrid2__c/index.tsx +119 -0
- package/template/neo-web-cmps/src/components/entityGrid2__c/model.ts +180 -0
- package/template/neo-web-cmps/src/components/entityGrid2__c/style.scss +69 -0
- package/template/neo-web-cmps/src/components/entityGrid3__c/index.tsx +79 -0
- package/template/neo-web-cmps/src/components/entityGrid3__c/model.ts +121 -0
- package/template/neo-web-cmps/src/components/entityGrid3__c/style.scss +60 -0
- package/template/neo-web-cmps/src/components/entityGrid4__c/index.tsx +80 -0
- package/template/neo-web-cmps/src/components/entityGrid4__c/model.ts +180 -0
- package/template/neo-web-cmps/src/components/entityGrid4__c/style.scss +13 -0
- package/template/neo-web-cmps/src/components/entityGrid__c/index.tsx +77 -0
- package/template/neo-web-cmps/src/components/entityGrid__c/model.ts +180 -0
- package/template/neo-web-cmps/src/components/entityGrid__c/style.scss +13 -0
- package/template/neo-web-cmps/src/utils/axiosFetcher.ts +37 -0
- package/template/neo-web-cmps/src/utils/queryObjectData.ts +112 -0
- package/template/neo-web-cmps/src/utils/xobjects.ts +167 -0
- package/template/neo-web-cmps/tsconfig.json +39 -0
- 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,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 自定义组件对接编辑器的描述文件
|
|
3
|
+
*/
|
|
4
|
+
export class NeoEntityGridModel {
|
|
5
|
+
/**
|
|
6
|
+
* cmpType 为自定义组件名称,用于标识组件的唯一性
|
|
7
|
+
* 在构建时根据当前组件目录名称自动生成
|
|
8
|
+
*/
|
|
9
|
+
// cmpType: string = 'entityList__c';
|
|
10
|
+
|
|
11
|
+
// 组件名称,用于设置在编辑器左侧组件面板中展示的名称
|
|
12
|
+
label: string = '基础大列表';
|
|
13
|
+
|
|
14
|
+
// 组件描述,用于设置在编辑器左侧组件面板中展示的描述
|
|
15
|
+
description: string = '数据列表示例: 基础大列表,支持搜索、排序、导出、分页等操作';
|
|
16
|
+
|
|
17
|
+
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示
|
|
18
|
+
// tags: string[] = ['自定义组件'];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 用于设置组件支持的页面类型
|
|
22
|
+
*
|
|
23
|
+
* 当前 NeoCRM 平台存在的页面类型:
|
|
24
|
+
* all: 1 全页面
|
|
25
|
+
* entityFormPage: 4 实体表单页
|
|
26
|
+
* customPage: 6 自定义页面
|
|
27
|
+
*/
|
|
28
|
+
// targetPage: string[] = ['all'];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 用于设置组件支持的终端类型
|
|
32
|
+
*
|
|
33
|
+
* 当前 NeoCRM 平台存在的终端类型:
|
|
34
|
+
* web: 网页端
|
|
35
|
+
* mobile: 移动端
|
|
36
|
+
*/
|
|
37
|
+
targetDevice: string = 'web';
|
|
38
|
+
|
|
39
|
+
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
40
|
+
iconUrl: string = 'https://custom-widgets.bj.bcebos.com/table.svg';
|
|
41
|
+
// iconUrl = 'https://neo-widgets.bj.bcebos.com/favicon.png';
|
|
42
|
+
|
|
43
|
+
// 初次插入页面的默认属性数据
|
|
44
|
+
defaultComProps = {
|
|
45
|
+
objectApiKey: 'account',
|
|
46
|
+
funPermission: true, // 设计器添加时绕过职能权限检查,确保能正常渲染列表
|
|
47
|
+
hiddenHeader: false,
|
|
48
|
+
showView: true,
|
|
49
|
+
enableChangeView: true,
|
|
50
|
+
enableToolbar: true,
|
|
51
|
+
canCreate: true,
|
|
52
|
+
canImport: true,
|
|
53
|
+
withOrder: true,
|
|
54
|
+
withCheck: true,
|
|
55
|
+
editable: true,
|
|
56
|
+
disableSearch: false,
|
|
57
|
+
disableExport: false,
|
|
58
|
+
disablePagination: false,
|
|
59
|
+
paginationPageSize: 20,
|
|
60
|
+
autoHeight: false,
|
|
61
|
+
height: '500px',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
66
|
+
*/
|
|
67
|
+
propsSchema = [
|
|
68
|
+
{
|
|
69
|
+
type: 'xObjectEntityList',
|
|
70
|
+
name: 'objectApiKey',
|
|
71
|
+
label: '实体对象',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'dataViewIdSelect',
|
|
75
|
+
name: 'defaultViewId',
|
|
76
|
+
xObjectApiKey: 'objectApiKey',
|
|
77
|
+
label: '列表视图',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: 'panelSwitch',
|
|
81
|
+
name: 'hiddenHeader',
|
|
82
|
+
label: '隐藏头部',
|
|
83
|
+
defaultChecked: false,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'panelSwitch',
|
|
87
|
+
name: 'disableSearch',
|
|
88
|
+
label: '禁用搜索',
|
|
89
|
+
defaultChecked: false,
|
|
90
|
+
hiddenOn: 'hiddenHeader',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: 'panelSwitch',
|
|
94
|
+
name: 'showView',
|
|
95
|
+
label: '显示列表视图控制栏',
|
|
96
|
+
defaultChecked: true,
|
|
97
|
+
hiddenOn: 'hiddenHeader',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: 'panelSwitch',
|
|
101
|
+
name: 'enableChangeView',
|
|
102
|
+
label: '支持列表视图切换',
|
|
103
|
+
defaultChecked: true,
|
|
104
|
+
hiddenOn: 'hiddenHeader',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: 'panelSwitch',
|
|
108
|
+
name: 'enableToolbar',
|
|
109
|
+
label: '显示工具栏(含刷新、导出等)',
|
|
110
|
+
defaultChecked: true,
|
|
111
|
+
hiddenOn: 'hiddenHeader',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: 'panelSwitch',
|
|
115
|
+
name: 'canCreate',
|
|
116
|
+
label: '支持新建',
|
|
117
|
+
defaultChecked: true,
|
|
118
|
+
hiddenOn: 'hiddenHeader',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: 'panelSwitch',
|
|
122
|
+
name: 'canImport',
|
|
123
|
+
label: '支持导入',
|
|
124
|
+
defaultChecked: false,
|
|
125
|
+
hiddenOn: 'hiddenHeader',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'panelSwitch',
|
|
129
|
+
name: 'disableExport',
|
|
130
|
+
label: '禁用导出',
|
|
131
|
+
defaultChecked: false,
|
|
132
|
+
hiddenOn: 'hiddenHeader',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
type: 'panelSwitch',
|
|
136
|
+
name: 'withOrder',
|
|
137
|
+
label: '显示序号列',
|
|
138
|
+
defaultChecked: true,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'panelSwitch',
|
|
142
|
+
name: 'withCheck',
|
|
143
|
+
label: '显示多选列',
|
|
144
|
+
defaultChecked: true,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
type: 'panelSwitch',
|
|
148
|
+
name: 'editable',
|
|
149
|
+
label: '支持单元格编辑',
|
|
150
|
+
defaultChecked: true,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: 'panelSwitch',
|
|
154
|
+
name: 'disablePagination',
|
|
155
|
+
label: '是否禁用分页',
|
|
156
|
+
defaultChecked: false,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: 'panelNumber',
|
|
160
|
+
name: 'paginationPageSize',
|
|
161
|
+
label: '每页展示条数',
|
|
162
|
+
visibleOn: '!disablePagination',
|
|
163
|
+
value: 20,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: 'panelSwitch',
|
|
167
|
+
name: 'autoHeight',
|
|
168
|
+
label: '高度自适应(根据父容器高度自动适配)',
|
|
169
|
+
defaultChecked: false,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
type: 'panelInput',
|
|
173
|
+
name: 'height',
|
|
174
|
+
label: '高度',
|
|
175
|
+
visibleOn: '!autoHeight',
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export default NeoEntityGridModel;
|
|
@@ -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,112 @@
|
|
|
1
|
+
import axiosFetcher from '$utils/axiosFetcher';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 这里存放通用查询类 Open API
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** 将 where 规范为 SQL 片段:字符串直接使用;数组用 and 拼接各条件 */
|
|
8
|
+
function normalizeWhere(where: unknown): string {
|
|
9
|
+
if (where == null || where === '') {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
if (typeof where === 'string') {
|
|
13
|
+
return where.trim();
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(where)) {
|
|
16
|
+
return where
|
|
17
|
+
.map((part) => (part == null ? '' : String(part).trim()))
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join(' and ');
|
|
20
|
+
}
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 获取业务对象数据列表
|
|
25
|
+
export const queryXObjectData = async (options?: any) => {
|
|
26
|
+
const apiUrl = '/rest/data/v2/query';
|
|
27
|
+
const curOptions = options || {};
|
|
28
|
+
const xObjectApiKey = curOptions.xObjectApiKey || '';
|
|
29
|
+
const fields = curOptions.fields || [];
|
|
30
|
+
const page = curOptions.page || 1;
|
|
31
|
+
const pageSize = curOptions.pageSize || 10;
|
|
32
|
+
|
|
33
|
+
// 自动添加 objectId 字段
|
|
34
|
+
if (!fields.includes('id')) {
|
|
35
|
+
fields.push('id');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 计算分页偏移量
|
|
39
|
+
const offset = (page - 1) * pageSize;
|
|
40
|
+
|
|
41
|
+
// 构建 SQL 查询
|
|
42
|
+
let querySql = `select ${fields.join(',')} from ${xObjectApiKey}`;
|
|
43
|
+
|
|
44
|
+
// 添加排序条件(如果有的话)
|
|
45
|
+
if (curOptions.orderBy) {
|
|
46
|
+
querySql += ` order by ${curOptions.orderBy}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 添加过滤条件(如果有的话)
|
|
51
|
+
* 支持的操作符包括:=、!=、like、not like、not in、is not null、is null、>、<、<>、>=、<=、in、between ... and ...。
|
|
52
|
+
* 对于 =、like 和 in 有以下说明:
|
|
53
|
+
* “=” 作为字符串的条件时,表示精确匹配。例如,查询条件 city = '北京',将返回 city 字段值严格等于 "北京" 的所有记录。
|
|
54
|
+
* "like" 作为字符串的条件时,需要使用"%" 通配符进行模糊匹配。例如,city like‘北京%',将返回 city 字段值以 "北京" 开头的所有记录。
|
|
55
|
+
* 目前仅支持将通配符“%” 放到已知内容之后的查询方式,例如,不支持 city like ‘% 北京'的查询方式。
|
|
56
|
+
* 当 SQL 查询中包含“%”等特殊字符时,需要对 SQL 进行 URL 编码处理。
|
|
57
|
+
* 支持"in",但不包括子查询。
|
|
58
|
+
* 支持的逻辑运算符包括:and、or。
|
|
59
|
+
*
|
|
60
|
+
* `where` 可为字符串,或字符串数组(多项默认以 and 连接,等价于手写 `a and b`)。
|
|
61
|
+
*/
|
|
62
|
+
const whereClause = normalizeWhere(curOptions.where);
|
|
63
|
+
console.log('whereClause:', whereClause);
|
|
64
|
+
if (whereClause) {
|
|
65
|
+
querySql += ` where ${whereClause}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (curOptions.page || curOptions.pageSize) {
|
|
69
|
+
// 添加分页限制
|
|
70
|
+
querySql += ` limit ${pageSize} offset ${offset}`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const config = {
|
|
75
|
+
url: apiUrl,
|
|
76
|
+
method: 'GET',
|
|
77
|
+
data: {
|
|
78
|
+
q: querySql,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const resultData = await axiosFetcher(config);
|
|
83
|
+
|
|
84
|
+
if (resultData.code === 200) {
|
|
85
|
+
const { records, totalSize } = resultData.result || {};
|
|
86
|
+
return {
|
|
87
|
+
status: true,
|
|
88
|
+
code: resultData.code,
|
|
89
|
+
msg: resultData.msg || '获取业务对象数据列表成功',
|
|
90
|
+
totalSize,
|
|
91
|
+
data: records || [],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
status: false,
|
|
97
|
+
code: resultData.code,
|
|
98
|
+
msg: resultData.msg || '获取业务对象数据列表失败',
|
|
99
|
+
data: [],
|
|
100
|
+
};
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('获取业务对象数据列表失败:', error);
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
status: false,
|
|
106
|
+
msg: error.msg || error.message || '获取业务对象数据列表失败',
|
|
107
|
+
data: [],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default queryXObjectData;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Toast } from 'antd-mobile';
|
|
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
|
+
Toast.fail('获取业务类型失败。');
|
|
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
|
+
Toast.fail('获取对象列表失败。');
|
|
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
|
+
Toast.fail('创建业务数据失败');
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// 获取业务对象描述
|
|
74
|
+
export const getXObjectDesc = async (xObjectApiKey: string, options?: any) => {
|
|
75
|
+
const curOptions = options || {};
|
|
76
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/description`;
|
|
77
|
+
try {
|
|
78
|
+
const config = {
|
|
79
|
+
...options,
|
|
80
|
+
url: apiUrl,
|
|
81
|
+
method: curOptions.method || 'GET',
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const result = await axiosFetcher(config);
|
|
85
|
+
return result;
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.error('获取业务对象描述:', error);
|
|
88
|
+
Toast.fail('获取业务对象描述失败');
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// 更新业务数据
|
|
94
|
+
export const updateXObject = async (
|
|
95
|
+
xObjectApiKey: string,
|
|
96
|
+
objectId: string,
|
|
97
|
+
options: any,
|
|
98
|
+
) => {
|
|
99
|
+
const curOptions = options || {};
|
|
100
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
101
|
+
const formData = curOptions.data || {};
|
|
102
|
+
try {
|
|
103
|
+
const config = {
|
|
104
|
+
...curOptions,
|
|
105
|
+
url: apiUrl,
|
|
106
|
+
method: curOptions.method || 'PATCH',
|
|
107
|
+
data: {
|
|
108
|
+
data: formData,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const result = await axiosFetcher(config);
|
|
113
|
+
return result;
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error('更新业务数据失败:', error);
|
|
116
|
+
Toast.fail('更新业务数据失败');
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// 获取业务数据信息
|
|
122
|
+
export const getXObject = async (
|
|
123
|
+
xObjectApiKey: string,
|
|
124
|
+
objectId: string,
|
|
125
|
+
options?: any,
|
|
126
|
+
) => {
|
|
127
|
+
const curOptions = options || {};
|
|
128
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
129
|
+
try {
|
|
130
|
+
const config = {
|
|
131
|
+
...curOptions,
|
|
132
|
+
url: apiUrl,
|
|
133
|
+
method: curOptions.method || 'GET',
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const result = await axiosFetcher(config);
|
|
137
|
+
return result;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.error('获取业务数据信息失败:', error);
|
|
140
|
+
Toast.fail('获取业务数据信息失败');
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// 删除业务数据
|
|
146
|
+
export const deleteXObject = async (
|
|
147
|
+
xObjectApiKey: string,
|
|
148
|
+
objectId: string,
|
|
149
|
+
options?: any,
|
|
150
|
+
) => {
|
|
151
|
+
const curOptions = options || {};
|
|
152
|
+
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
153
|
+
try {
|
|
154
|
+
const config = {
|
|
155
|
+
...curOptions,
|
|
156
|
+
url: apiUrl,
|
|
157
|
+
method: curOptions.method || 'DELETE',
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const result = await axiosFetcher(config);
|
|
161
|
+
return result;
|
|
162
|
+
} catch (error) {
|
|
163
|
+
console.error('删除业务数据:', error);
|
|
164
|
+
Toast.fail('删除业务数据失败');
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
],
|
|
36
|
+
"exclude": [
|
|
37
|
+
"node_modules"
|
|
38
|
+
]
|
|
39
|
+
}
|