neo-cmp-cli 1.12.8 → 1.12.10
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 +204 -6
- package/dist/index2.js +1 -1
- package/dist/module/neoInitByCopy.js +1 -1
- package/dist/neo/env.js +1 -1
- package/dist/package.json.js +1 -1
- package/package.json +4 -1
- package/template/antd-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/README.md +154 -0
- package/template/asset-manage-template/docs/README.md +244 -0
- package/template/asset-manage-template/neo.config.js +60 -0
- package/template/asset-manage-template/package.json +74 -0
- package/template/asset-manage-template/src/assets/img/chart.svg +1 -0
- package/template/asset-manage-template/src/components/README.md +3 -0
- package/template/asset-manage-template/src/components/assetManage__c/assetApi.ts +70 -0
- package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetCreateModal.tsx +260 -0
- package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetGrid.tsx +48 -0
- package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetSidebar.tsx +74 -0
- package/template/asset-manage-template/src/components/assetManage__c/cmps/AssetToolbar.tsx +79 -0
- package/template/asset-manage-template/src/components/assetManage__c/cmps/assetDisplay.tsx +72 -0
- package/template/asset-manage-template/src/components/assetManage__c/constants.ts +28 -0
- package/template/asset-manage-template/src/components/assetManage__c/index.tsx +258 -0
- package/template/asset-manage-template/src/components/assetManage__c/model.ts +75 -0
- package/template/asset-manage-template/src/components/assetManage__c/style.scss +425 -0
- package/template/asset-manage-template/src/components/assetManage__c/types.ts +60 -0
- package/template/asset-manage-template/src/components/bidList__c/cmps/BidCard.tsx +47 -0
- package/template/asset-manage-template/src/components/bidList__c/constants.ts +6 -0
- package/template/asset-manage-template/src/components/bidList__c/formatUtils.ts +14 -0
- package/template/asset-manage-template/src/components/bidList__c/index.tsx +194 -0
- package/template/asset-manage-template/src/components/bidList__c/model.ts +57 -0
- package/template/asset-manage-template/src/components/bidList__c/style.scss +179 -0
- package/template/asset-manage-template/src/components/bidList__c/types.ts +10 -0
- package/template/asset-manage-template/src/components/bidPackage__c/cmps/BidPackageHeader.tsx +140 -0
- package/template/asset-manage-template/src/components/bidPackage__c/cmps/PackageItemTable.tsx +148 -0
- package/template/asset-manage-template/src/components/bidPackage__c/index.tsx +394 -0
- package/template/asset-manage-template/src/components/bidPackage__c/mainTableColumns.tsx +57 -0
- package/template/asset-manage-template/src/components/bidPackage__c/model.ts +86 -0
- package/template/asset-manage-template/src/components/bidPackage__c/style.scss +256 -0
- package/template/asset-manage-template/src/components/bidPackage__c/types.ts +35 -0
- package/template/asset-manage-template/src/components/bidPackage__c/utils.ts +19 -0
- package/template/{neo-bi-cmps → asset-manage-template}/src/utils/axiosFetcher.ts +0 -0
- package/template/{neo-bi-cmps → asset-manage-template}/src/utils/queryObjectData.ts +36 -0
- package/template/asset-manage-template/src/utils/url.ts +82 -0
- package/template/{neo-bi-cmps → asset-manage-template}/src/utils/xobjects.ts +0 -0
- package/template/asset-manage-template/tsconfig.json +40 -0
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/empty-custom-cmp-template/package.json +2 -2
- package/template/neo-custom-cmp-template/package.json +5 -2
- package/template/neo-custom-cmp-template/src/components/entityTable__c/index.tsx +62 -6
- 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 +7 -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 +2 -2
- package/template/neo-order-cmps/src/utils/queryObjectData.ts +36 -0
- package/template/neo-web-cmps/@types/neo-ui-common.d.ts +36 -0
- package/template/neo-web-cmps/neo.config.js +53 -0
- package/template/{neo-bi-cmps → neo-web-cmps}/package.json +10 -7
- package/template/neo-web-cmps/src/assets/img/AIBtn.gif +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/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/map.svg +1 -0
- package/template/neo-web-cmps/src/assets/img/search.svg +1 -0
- package/template/neo-web-cmps/src/components/entityGrid2__c/index.tsx +72 -0
- package/template/neo-web-cmps/src/components/entityGrid2__c/model.ts +195 -0
- package/template/neo-web-cmps/src/components/entityGrid2__c/style.scss +13 -0
- package/template/neo-web-cmps/src/components/entityGrid__c/index.tsx +52 -0
- package/template/neo-web-cmps/src/components/entityGrid__c/model.ts +195 -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/{develop/neo-custom-cmp-template → neo-web-cmps}/src/utils/xobjects.ts +28 -64
- package/template/{neo-bi-cmps → neo-web-cmps}/tsconfig.json +2 -3
- 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
- package/template/develop/BI /351/241/271/347/233/256/345/210/206/346/236/220/346/212/245/345/221/212.md" +0 -562
- package/template/develop/ChatPage /347/273/204/344/273/266/344/275/277/347/224/250/350/257/264/346/230/216/346/226/207/346/241/243.md" +0 -507
- package/template/develop/EntityGrid Web /347/273/204/344/273/266/347/232/204/350/257/246/347/273/206/345/210/206/346/236/220/346/226/207/346/241/243.md" +0 -868
- package/template/develop/EntityList H5 /347/273/204/344/273/266/347/232/204/350/257/246/347/273/206/345/210/206/346/236/220/346/226/207/346/241/243.md" +0 -1386
- package/template/develop/GlobalSearch/347/273/204/344/273/266/345/257/271/346/257/224/345/210/206/346/236/220.md +0 -866
- package/template/develop/Neo /344/270/255/345/217/257/347/224/250 amis /347/273/204/344/273/266.md" +0 -1490
- package/template/develop/cmpEventFunctions.ts +0 -257
- package/template/develop/cmpEvents.ts +0 -864
- package/template/develop/comTree/347/224/237/346/210/220/350/277/207/347/250/213/345/210/206/346/236/220.md +0 -469
- package/template/develop/commonModules.js +0 -55
- package/template/develop/components-table.md +0 -50
- package/template/develop/neo-custom-cmp-template/README.md +0 -48
- package/template/develop/neo-custom-cmp-template/docs/README.md +0 -13
- package/template/develop/neo-custom-cmp-template/neo.config.js +0 -121
- package/template/develop/neo-custom-cmp-template/package.json +0 -63
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/README.md +0 -65
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/index.tsx +0 -180
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/model.ts +0 -50
- package/template/develop/neo-custom-cmp-template/src/components/contactCardList/style.scss +0 -260
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/README.md +0 -94
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/index.tsx +0 -252
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/model.ts +0 -56
- package/template/develop/neo-custom-cmp-template/src/components/contactForm/style.scss +0 -120
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/README.md +0 -115
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/index.tsx +0 -304
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/model.ts +0 -87
- package/template/develop/neo-custom-cmp-template/src/components/neoEntityGrid/style.scss +0 -127
- package/template/develop/neo-custom-cmp-template/src/utils/axiosFetcher.ts +0 -29
- package/template/develop/neo-custom-cmp-template/src/utils/queryObjectData.ts +0 -39
- package/template/develop/neo-custom-cmp-template/tsconfig.json +0 -68
- package/template/develop/neo-ui-component-h5.md +0 -105
- package/template/develop/neo-ui-component-web-xregister.md +0 -31
- package/template/develop/neo-ui-component-web.md +0 -292
- package/template/develop/neoCmps.ts +0 -7508
- package/template/develop/neoGlobalSearchInput /347/273/204/344/273/266/347/232/204/350/257/246/347/273/206/345/210/206/346/236/220/346/226/207/346/241/243.md" +0 -497
- package/template/develop/pageSchema1.json +0 -744
- package/template/develop//344/272/213/344/273/266/345/212/250/344/275/234/344/277/235/345/255/230/346/265/201/347/250/213/345/210/206/346/236/220.md +0 -390
- package/template/develop//345/215/225/345/205/203/346/265/213/350/257/225/344/275/277/347/224/250/350/257/264/346/230/216.md +0 -1139
- package/template/develop//345/261/236/346/200/247/351/205/215/347/275/256/351/241/271/347/261/273/345/236/213/346/261/207/346/200/273.md +0 -558
- package/template/neo-bi-cmps/neo.config.js +0 -124
- package/template/neo-bi-cmps/src/components/targetNumber__c/README.md +0 -100
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/configSchema.ts +0 -253
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.scss +0 -76
- package/template/neo-bi-cmps/src/components/targetNumber__c/customStyleConfig/index.tsx +0 -148
- package/template/neo-bi-cmps/src/components/targetNumber__c/index.tsx +0 -440
- package/template/neo-bi-cmps/src/components/targetNumber__c/model.ts +0 -128
- package/template/neo-bi-cmps/src/components/targetNumber__c/style.scss +0 -173
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/.prettierrc.js +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/@types/neo-ui-common.d.ts +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/commitlint.config.js +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/public/css/base.css +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/public/scripts/app/bluebird.js +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/public/template.html +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/css/common.scss +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/css/mixin.scss +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/AIBtn.gif +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/NeoCRM.jpg +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/aiLogo.png +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/card-list.svg +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/contact-form.svg +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/custom-form.svg +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/custom-widget.svg +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/data-list.svg +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/detail.svg +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/favicon.png +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/map.svg +0 -0
- /package/template/{neo-bi-cmps → asset-manage-template}/src/assets/img/search.svg +0 -0
- /package/template/{develop/neo-custom-cmp-template → asset-manage-template}/src/assets/img/table.svg +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/.prettierrc.js +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/README.md +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/commitlint.config.js +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/public/css/base.css +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/public/scripts/app/bluebird.js +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/public/template.html +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/css/common.scss +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/css/mixin.scss +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/img/NeoCRM.jpg +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/img/custom-widget.svg +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/img/favicon.png +0 -0
- /package/template/{neo-bi-cmps → neo-web-cmps}/src/assets/img/table.svg +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './style.scss'; // 组件内容样式
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
5
|
+
|
|
6
|
+
interface NeoEntityGridProps {
|
|
7
|
+
objectApiKey: string;
|
|
8
|
+
disableSearch?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
render: (name: string, schema: any) => React.ReactNode;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default class NeoEntityGridCmp extends React.PureComponent<NeoEntityGridProps> {
|
|
15
|
+
constructor(props: NeoEntityGridProps) {
|
|
16
|
+
super(props);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
const { className, objectApiKey, pattern, hiddenHeader, showView, enableChangeView, defaultViewId, disableSearch, canCreate, canImport, editable, withOrder, withCheck, enableToolbar, disableExport, disablePagination, paginationPageSize, autoHeight, height, additionalConditions, onRecordChange, ...restProps } = this.props;
|
|
21
|
+
console.log('entityGrid__c: ', this.props, this);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className={`entityGrid__c ${className}`}>
|
|
25
|
+
<NeoEntityGrid
|
|
26
|
+
render={this.props.render}
|
|
27
|
+
objectApiKey={objectApiKey || 'account'}
|
|
28
|
+
pattern={pattern || 'entityView'}
|
|
29
|
+
// defaultViewId="default_view" // 默认展示的列表视图
|
|
30
|
+
hiddenHeader={hiddenHeader ?? false}
|
|
31
|
+
showView={showView ?? true}
|
|
32
|
+
enableChangeView={enableChangeView ?? true}
|
|
33
|
+
defaultViewId={defaultViewId ?? 'default_view'}
|
|
34
|
+
disableSearch={disableSearch ?? false}
|
|
35
|
+
canCreate={canCreate ?? true}
|
|
36
|
+
canImport={canImport ?? true}
|
|
37
|
+
editable={editable ?? true}
|
|
38
|
+
withOrder={withOrder ?? true}
|
|
39
|
+
withCheck={withCheck ?? true}
|
|
40
|
+
enableToolbar={enableToolbar ?? true}
|
|
41
|
+
disableExport={disableExport ?? false}
|
|
42
|
+
disablePagination={disablePagination ?? false}
|
|
43
|
+
paginationPageSize={paginationPageSize ?? 20}
|
|
44
|
+
autoHeight={autoHeight ?? false}
|
|
45
|
+
height={height ?? '500px'}
|
|
46
|
+
additionalConditions={[]}
|
|
47
|
+
onRecordChange={(data: any) => console.log('数据变化', data)}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 自定义组件对接编辑器的描述文件
|
|
3
|
+
*/
|
|
4
|
+
export class NeoEntityGridModel {
|
|
5
|
+
/**
|
|
6
|
+
* cmpType 为自定义组件名称,用于标识组件的唯一性
|
|
7
|
+
* 在构建时根据当前组件目录名称自动生成
|
|
8
|
+
*/
|
|
9
|
+
// cmpType: string = 'entityList__c';
|
|
10
|
+
|
|
11
|
+
// 组件名称,用于设置在编辑器左侧组件面板中展示的名称
|
|
12
|
+
label: string = '数据列表示例1';
|
|
13
|
+
|
|
14
|
+
// 组件描述,用于设置在编辑器左侧组件面板中展示的描述
|
|
15
|
+
description: string = '数据列表示例1';
|
|
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
|
+
pattern: 'entityView',
|
|
48
|
+
hiddenHeader: false,
|
|
49
|
+
showView: true,
|
|
50
|
+
enableChangeView: true,
|
|
51
|
+
enableToolbar: true,
|
|
52
|
+
canCreate: true,
|
|
53
|
+
canImport: true,
|
|
54
|
+
withOrder: true,
|
|
55
|
+
withCheck: true,
|
|
56
|
+
editable: true,
|
|
57
|
+
disableSearch: false,
|
|
58
|
+
disableExport: false,
|
|
59
|
+
disablePagination: false,
|
|
60
|
+
paginationPageSize: 20,
|
|
61
|
+
autoHeight: false,
|
|
62
|
+
height: '500px',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
67
|
+
*/
|
|
68
|
+
propsSchema = [
|
|
69
|
+
{
|
|
70
|
+
type: 'xObjectEntityList',
|
|
71
|
+
name: 'objectApiKey',
|
|
72
|
+
label: '实体对象',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'dataViewIdSelect',
|
|
76
|
+
name: 'defaultViewId',
|
|
77
|
+
xObjectApiKey: 'objectApiKey',
|
|
78
|
+
label: '列表视图',
|
|
79
|
+
},
|
|
80
|
+
/*
|
|
81
|
+
// 选择器模式下,需要额外配置 referData
|
|
82
|
+
{
|
|
83
|
+
type: 'panelSelect',
|
|
84
|
+
name: 'pattern',
|
|
85
|
+
label: '列表模式',
|
|
86
|
+
value: 'entityView',
|
|
87
|
+
options: [
|
|
88
|
+
{ label: '标准实体列表', value: 'entityView' },
|
|
89
|
+
{ label: '简单列表模式', value: 'simpleListView' },
|
|
90
|
+
{ label: '选择器模式', value: 'pickView' },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
*/
|
|
94
|
+
{
|
|
95
|
+
type: 'panelSwitch',
|
|
96
|
+
name: 'hiddenHeader',
|
|
97
|
+
label: '隐藏头部',
|
|
98
|
+
defaultChecked: false,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'panelSwitch',
|
|
102
|
+
name: 'disableSearch',
|
|
103
|
+
label: '禁用搜索',
|
|
104
|
+
defaultChecked: false,
|
|
105
|
+
hiddenOn: 'hiddenHeader',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: 'panelSwitch',
|
|
109
|
+
name: 'showView',
|
|
110
|
+
label: '显示列表视图控制栏',
|
|
111
|
+
defaultChecked: true,
|
|
112
|
+
hiddenOn: 'hiddenHeader',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
type: 'panelSwitch',
|
|
116
|
+
name: 'enableChangeView',
|
|
117
|
+
label: '支持列表视图切换',
|
|
118
|
+
defaultChecked: true,
|
|
119
|
+
hiddenOn: 'hiddenHeader',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'panelSwitch',
|
|
123
|
+
name: 'enableToolbar',
|
|
124
|
+
label: '显示工具栏(含刷新、导出等)',
|
|
125
|
+
defaultChecked: true,
|
|
126
|
+
hiddenOn: 'hiddenHeader',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: 'panelSwitch',
|
|
130
|
+
name: 'canCreate',
|
|
131
|
+
label: '支持新建',
|
|
132
|
+
defaultChecked: true,
|
|
133
|
+
hiddenOn: 'hiddenHeader',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'panelSwitch',
|
|
137
|
+
name: 'canImport',
|
|
138
|
+
label: '支持导入',
|
|
139
|
+
defaultChecked: false,
|
|
140
|
+
hiddenOn: 'hiddenHeader',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: 'panelSwitch',
|
|
144
|
+
name: 'disableExport',
|
|
145
|
+
label: '禁用导出',
|
|
146
|
+
defaultChecked: false,
|
|
147
|
+
hiddenOn: 'hiddenHeader',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: 'panelSwitch',
|
|
151
|
+
name: 'withOrder',
|
|
152
|
+
label: '显示序号列',
|
|
153
|
+
defaultChecked: true,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
type: 'panelSwitch',
|
|
157
|
+
name: 'withCheck',
|
|
158
|
+
label: '显示多选列',
|
|
159
|
+
defaultChecked: true,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: 'panelSwitch',
|
|
163
|
+
name: 'editable',
|
|
164
|
+
label: '支持单元格编辑',
|
|
165
|
+
defaultChecked: true,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
type: 'panelSwitch',
|
|
169
|
+
name: 'disablePagination',
|
|
170
|
+
label: '是否禁用分页',
|
|
171
|
+
defaultChecked: false,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: 'panelNumber',
|
|
175
|
+
name: 'paginationPageSize',
|
|
176
|
+
label: '每页展示条数',
|
|
177
|
+
visibleOn: '!disablePagination',
|
|
178
|
+
value: 20,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: 'panelSwitch',
|
|
182
|
+
name: 'autoHeight',
|
|
183
|
+
label: '高度自适应(根据父容器高度自动适配)',
|
|
184
|
+
defaultChecked: false,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: 'panelInput',
|
|
188
|
+
name: 'height',
|
|
189
|
+
label: '高度',
|
|
190
|
+
visibleOn: '!autoHeight',
|
|
191
|
+
},
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Toast } from 'antd-mobile';
|
|
2
2
|
import axiosFetcher from './axiosFetcher';
|
|
3
3
|
|
|
4
4
|
// 获取业务类型列表
|
|
@@ -13,18 +13,13 @@ export const getEntityTypeList = async (
|
|
|
13
13
|
...curOptions,
|
|
14
14
|
url: apiUrl,
|
|
15
15
|
method: 'GET',
|
|
16
|
-
headers: {
|
|
17
|
-
'Content-Type': 'application/json',
|
|
18
|
-
...curOptions.headers,
|
|
19
|
-
},
|
|
20
|
-
timeout: curOptions.timeout || 10000,
|
|
21
16
|
};
|
|
22
17
|
|
|
23
|
-
const
|
|
24
|
-
return
|
|
18
|
+
const result = await axiosFetcher(config);
|
|
19
|
+
return result;
|
|
25
20
|
} catch (error) {
|
|
26
21
|
console.error('获取业务类型失败:', error);
|
|
27
|
-
|
|
22
|
+
Toast.fail('获取业务类型失败。');
|
|
28
23
|
return {};
|
|
29
24
|
}
|
|
30
25
|
};
|
|
@@ -40,27 +35,19 @@ export const getEntityList = async (options?: any) => {
|
|
|
40
35
|
...curOptions,
|
|
41
36
|
url: apiUrl,
|
|
42
37
|
method: 'GET',
|
|
43
|
-
headers: {
|
|
44
|
-
'Content-Type': 'application/json',
|
|
45
|
-
...curOptions.headers,
|
|
46
|
-
},
|
|
47
|
-
timeout: curOptions.timeout || 10000,
|
|
48
38
|
};
|
|
49
39
|
|
|
50
|
-
const
|
|
51
|
-
return
|
|
40
|
+
const result = await axiosFetcher(config);
|
|
41
|
+
return result;
|
|
52
42
|
} catch (error) {
|
|
53
43
|
console.error('获取对象列表失败:', error);
|
|
54
|
-
|
|
44
|
+
Toast.fail('获取对象列表失败。');
|
|
55
45
|
return {};
|
|
56
46
|
}
|
|
57
47
|
};
|
|
58
48
|
|
|
59
49
|
// 创建业务数据
|
|
60
|
-
export const createXObject = async (
|
|
61
|
-
xObjectApiKey: string,
|
|
62
|
-
options: any
|
|
63
|
-
) => {
|
|
50
|
+
export const createXObject = async (xObjectApiKey: string, options: any) => {
|
|
64
51
|
const curOptions = options || {};
|
|
65
52
|
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}`;
|
|
66
53
|
const formData = curOptions.data || {};
|
|
@@ -72,26 +59,19 @@ export const createXObject = async (
|
|
|
72
59
|
data: {
|
|
73
60
|
data: formData,
|
|
74
61
|
},
|
|
75
|
-
headers: {
|
|
76
|
-
'Content-Type': 'application/json',
|
|
77
|
-
...curOptions.headers,
|
|
78
|
-
},
|
|
79
|
-
timeout: curOptions.timeout || 10000,
|
|
80
62
|
};
|
|
81
63
|
|
|
82
|
-
const
|
|
83
|
-
return
|
|
64
|
+
const result = await axiosFetcher(config);
|
|
65
|
+
return result;
|
|
84
66
|
} catch (error) {
|
|
85
67
|
console.error('创建业务数据失败:', error);
|
|
68
|
+
Toast.fail('创建业务数据失败');
|
|
86
69
|
throw error;
|
|
87
70
|
}
|
|
88
71
|
};
|
|
89
72
|
|
|
90
73
|
// 获取业务对象描述
|
|
91
|
-
export const getXObjectDesc = async (
|
|
92
|
-
xObjectApiKey: string,
|
|
93
|
-
options?: any,
|
|
94
|
-
) => {
|
|
74
|
+
export const getXObjectDesc = async (xObjectApiKey: string, options?: any) => {
|
|
95
75
|
const curOptions = options || {};
|
|
96
76
|
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/description`;
|
|
97
77
|
try {
|
|
@@ -99,17 +79,13 @@ export const getXObjectDesc = async (
|
|
|
99
79
|
...options,
|
|
100
80
|
url: apiUrl,
|
|
101
81
|
method: curOptions.method || 'GET',
|
|
102
|
-
headers: {
|
|
103
|
-
'Content-Type': 'application/json',
|
|
104
|
-
...curOptions.headers,
|
|
105
|
-
},
|
|
106
|
-
timeout: curOptions.timeout || 10000,
|
|
107
82
|
};
|
|
108
83
|
|
|
109
|
-
const
|
|
110
|
-
return
|
|
84
|
+
const result = await axiosFetcher(config);
|
|
85
|
+
return result;
|
|
111
86
|
} catch (error) {
|
|
112
87
|
console.error('获取业务对象描述:', error);
|
|
88
|
+
Toast.fail('获取业务对象描述失败');
|
|
113
89
|
throw error;
|
|
114
90
|
}
|
|
115
91
|
};
|
|
@@ -118,7 +94,7 @@ export const getXObjectDesc = async (
|
|
|
118
94
|
export const updateXObject = async (
|
|
119
95
|
xObjectApiKey: string,
|
|
120
96
|
objectId: string,
|
|
121
|
-
options: any
|
|
97
|
+
options: any,
|
|
122
98
|
) => {
|
|
123
99
|
const curOptions = options || {};
|
|
124
100
|
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
@@ -131,17 +107,13 @@ export const updateXObject = async (
|
|
|
131
107
|
data: {
|
|
132
108
|
data: formData,
|
|
133
109
|
},
|
|
134
|
-
headers: {
|
|
135
|
-
'Content-Type': 'application/json',
|
|
136
|
-
...curOptions.headers,
|
|
137
|
-
},
|
|
138
|
-
timeout: curOptions.timeout || 10000,
|
|
139
110
|
};
|
|
140
111
|
|
|
141
|
-
const
|
|
142
|
-
return
|
|
112
|
+
const result = await axiosFetcher(config);
|
|
113
|
+
return result;
|
|
143
114
|
} catch (error) {
|
|
144
115
|
console.error('更新业务数据失败:', error);
|
|
116
|
+
Toast.fail('更新业务数据失败');
|
|
145
117
|
throw error;
|
|
146
118
|
}
|
|
147
119
|
};
|
|
@@ -150,7 +122,7 @@ export const updateXObject = async (
|
|
|
150
122
|
export const getXObject = async (
|
|
151
123
|
xObjectApiKey: string,
|
|
152
124
|
objectId: string,
|
|
153
|
-
options?: any
|
|
125
|
+
options?: any,
|
|
154
126
|
) => {
|
|
155
127
|
const curOptions = options || {};
|
|
156
128
|
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
@@ -159,17 +131,13 @@ export const getXObject = async (
|
|
|
159
131
|
...curOptions,
|
|
160
132
|
url: apiUrl,
|
|
161
133
|
method: curOptions.method || 'GET',
|
|
162
|
-
headers: {
|
|
163
|
-
'Content-Type': 'application/json',
|
|
164
|
-
...curOptions.headers,
|
|
165
|
-
},
|
|
166
|
-
timeout: curOptions.timeout || 10000,
|
|
167
134
|
};
|
|
168
135
|
|
|
169
|
-
const
|
|
170
|
-
return
|
|
136
|
+
const result = await axiosFetcher(config);
|
|
137
|
+
return result;
|
|
171
138
|
} catch (error) {
|
|
172
139
|
console.error('获取业务数据信息失败:', error);
|
|
140
|
+
Toast.fail('获取业务数据信息失败');
|
|
173
141
|
throw error;
|
|
174
142
|
}
|
|
175
143
|
};
|
|
@@ -178,7 +146,7 @@ export const getXObject = async (
|
|
|
178
146
|
export const deleteXObject = async (
|
|
179
147
|
xObjectApiKey: string,
|
|
180
148
|
objectId: string,
|
|
181
|
-
options?: any
|
|
149
|
+
options?: any,
|
|
182
150
|
) => {
|
|
183
151
|
const curOptions = options || {};
|
|
184
152
|
const apiUrl = `/rest/data/v2.0/xobjects/${xObjectApiKey}/${objectId}`;
|
|
@@ -187,17 +155,13 @@ export const deleteXObject = async (
|
|
|
187
155
|
...curOptions,
|
|
188
156
|
url: apiUrl,
|
|
189
157
|
method: curOptions.method || 'DELETE',
|
|
190
|
-
headers: {
|
|
191
|
-
'Content-Type': 'application/json',
|
|
192
|
-
...curOptions.headers,
|
|
193
|
-
},
|
|
194
|
-
timeout: curOptions.timeout || 10000,
|
|
195
158
|
};
|
|
196
159
|
|
|
197
|
-
const
|
|
198
|
-
return
|
|
160
|
+
const result = await axiosFetcher(config);
|
|
161
|
+
return result;
|
|
199
162
|
} catch (error) {
|
|
200
163
|
console.error('删除业务数据:', error);
|
|
164
|
+
Toast.fail('删除业务数据失败');
|
|
201
165
|
throw error;
|
|
202
166
|
}
|
|
203
|
-
};
|
|
167
|
+
};
|