neo-cmp-cli 1.13.19 → 1.13.21
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 +206 -609
- package/dist/config/auth.config.js +1 -1
- package/dist/neo/neoRequire.js +1 -1
- package/dist/package.json.js +1 -1
- package/package.json +1 -2
- package/template/antd-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/package.json +2 -2
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/empty-custom-cmp-template/package.json +2 -2
- package/template/map-custom-cmp-template/package.json +1 -1
- package/template/neo-bi-cmps/package.json +2 -2
- package/template/neo-custom-cmp-template/package.json +2 -2
- package/template/neo-custom-cmp-template/src/components/customApi__c/README.md +90 -0
- package/template/neo-custom-cmp-template/src/components/customApi__c/index.tsx +184 -0
- package/template/neo-custom-cmp-template/src/components/customApi__c/model.ts +53 -0
- package/template/neo-custom-cmp-template/src/components/customApi__c/style.scss +116 -0
- package/template/neo-custom-cmp-template/src/components/entityTable__c/index.tsx +5 -1
- package/template/neo-custom-cmp-template/src/components/simpleCmp__c/index.tsx +4 -1
- package/template/neo-h5-cmps/neo.config.js +1 -1
- package/template/neo-h5-cmps/package.json +2 -2
- package/template/neo-h5-cmps/src/components/entityList__c/index.tsx +0 -1
- package/template/neo-order-cmps/package.json +2 -2
- package/template/neo-pipeline-cmps/package.json +2 -2
- package/template/neo-pipeline-cmps/src/components/showHealthResult__c/index.tsx +2 -1
- package/template/neo-web-entity-grid/package.json +2 -2
- package/template/neo-web-form/package.json +2 -2
- 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/docs/H5/347/253/257 NeoEntityList /344/275/277/347/224/250/350/257/264/346/230/216.md" +0 -293
- package/docs/Web/347/253/257 NeoEntityGrid /344/275/277/347/224/250/350/257/264/346/230/216.md" +0 -1206
- package/docs//345/217/257/347/224/250/345/261/236/346/200/247/351/205/215/347/275/256/351/241/271.md +0 -801
- package/docs//351/200/232/347/224/250/344/273/243/347/220/206/346/216/245/345/217/243/forward.zip +0 -0
- package/docs//351/200/232/347/224/250/344/273/243/347/220/206/346/216/245/345/217/243//350/207/252/345/256/232/344/271/211API:/351/200/232/347/224/250/344/273/243/347/220/206/346/216/245/345/217/243/344/275/277/347/224/250/350/257/264/346/230/216.md +0 -13
package/docs/Web/347/253/257 NeoEntityGrid /344/275/277/347/224/250/350/257/264/346/230/216.md"
DELETED
|
@@ -1,1206 +0,0 @@
|
|
|
1
|
-
# Web端 NeoEntityGrid 使用说明
|
|
2
|
-
|
|
3
|
-
## 目录
|
|
4
|
-
|
|
5
|
-
- [一、组件概述](#一组件概述)
|
|
6
|
-
- [技术栈](#技术栈)
|
|
7
|
-
- [二、核心功能](#二核心功能)
|
|
8
|
-
- [1. 多种展示模式](#1-多种展示模式)
|
|
9
|
-
- [2. 数据展示功能](#2-数据展示功能)
|
|
10
|
-
- [3. 支持列表视图切换、搜索、筛选和排序](#3-支持列表视图切换搜索筛选和排序)
|
|
11
|
-
- [4. 批量操作](#4-批量操作)
|
|
12
|
-
- [5. 单元格编辑](#5-单元格编辑)
|
|
13
|
-
- [6. 详情打开方式](#6-详情打开方式)
|
|
14
|
-
- [7. 分页器](#7-分页器)
|
|
15
|
-
- [8. 列表汇总](#8-列表汇总)
|
|
16
|
-
- [三、组件扩展性](#三组件扩展性)
|
|
17
|
-
- [基础属性](#基础属性)
|
|
18
|
-
- [数据加载属性](#数据加载属性)
|
|
19
|
-
- [显隐控制属性](#显隐控制属性)
|
|
20
|
-
- [列表配置属性](#列表配置属性)
|
|
21
|
-
- [工具栏配置属性](#工具栏配置属性)
|
|
22
|
-
- [事件回调属性](#事件回调属性)
|
|
23
|
-
- [其他属性](#其他属性)
|
|
24
|
-
- [四、核心方法介绍](#四核心方法介绍)
|
|
25
|
-
- [customToolbarButtons — 工具栏自定义按钮](#customtoolbarbuttons--工具栏自定义按钮)
|
|
26
|
-
- [additionalConditions - 自定义筛选条件](#additionalconditions--自定义筛选条件)
|
|
27
|
-
- [onRowSelected — 行选中变化回调](#onrowselected--行选中变化回调)
|
|
28
|
-
- [onSinglerClick — 行单击拦截](#onsinglerclick--行单击拦截)
|
|
29
|
-
- [customEmptyMsg — 自定义空数据提示](#customemptymsg--自定义空数据提示)
|
|
30
|
-
- [五、完整使用示例](#五完整使用示例)
|
|
31
|
-
- [示例 1: 基础大列表](#示例-1-基础大列表)
|
|
32
|
-
- [示例 2: Picker 列表(选择器)](#示例-2-picker-列表选择器)
|
|
33
|
-
- [示例 3: 自定义筛选条件 + 自定义工具栏](#示例-3-自定义筛选条件--自定义工具栏)
|
|
34
|
-
- [示例 4: 自定义数据源](#示例-4-自定义数据源)
|
|
35
|
-
- [六、注意事项](#六注意事项)
|
|
36
|
-
- [1. Store 初始化](#1-store-初始化)
|
|
37
|
-
- [2. 模式区分](#2-模式区分)
|
|
38
|
-
- [3. 必传参数](#3-必传参数)
|
|
39
|
-
- [4. 树形模式](#4-树形模式)
|
|
40
|
-
- [5. 性能优化](#5-性能优化)
|
|
41
|
-
- [6. render 必传说明](#6-render-必传说明)
|
|
42
|
-
- [七、常见问题](#七常见问题)
|
|
43
|
-
- [Q1: 如何刷新列表数据?](#q1-如何刷新列表数据)
|
|
44
|
-
- [Q2: 如何拦截行点击打开详情?](#q2-如何拦截行点击打开详情)
|
|
45
|
-
- [Q3: 如何获取选中的数据?](#q3-如何获取选中的数据)
|
|
46
|
-
- [Q4: 如何自定义空状态提示?](#q4-如何自定义空状态提示)
|
|
47
|
-
- [Q5: 如何禁用某些功能?](#q5-如何禁用某些功能)
|
|
48
|
-
- [Q6: Picker 模式如何获取选中结果?](#q6-picker-模式如何获取选中结果)
|
|
49
|
-
- [Q7: 如何添加自定义工具栏按钮?](#q7-如何添加自定义工具栏按钮)
|
|
50
|
-
- [Q8: 树形列表如何配置?](#q8-树形列表如何配置)
|
|
51
|
-
- [Q9: 无权限时如何自定义展示?](#q9-无权限时如何自定义展示)
|
|
52
|
-
- [八、总结](#八总结)
|
|
53
|
-
|
|
54
|
-
## 一、组件概述
|
|
55
|
-
|
|
56
|
-
`EntityGrid` 是 Neo UI Component Web 端的核心业务组件,用于展示和管理实体数据列表。它基于 AG-Grid 实现,支持表格视图、分屏视图、地图视图、BI 看板等多种展示模式,提供了完整的数据展示、筛选、排序、批量操作、单元格编辑等功能。
|
|
57
|
-
|
|
58
|
-
### 技术栈
|
|
59
|
-
|
|
60
|
-
- **React**: 基于 React 类组件实现
|
|
61
|
-
- **MobX**: 使用 MobX 进行状态管理
|
|
62
|
-
- **AG-Grid**: 基于 AG-Grid 进行表格渲染
|
|
63
|
-
- **amis**: 通过 amis 框架进行布局和部分 UI 渲染
|
|
64
|
-
- **TypeScript**: 完整的类型定义支持
|
|
65
|
-
|
|
66
|
-
## 二、核心功能
|
|
67
|
-
|
|
68
|
-
### 1. 多种展示模式
|
|
69
|
-
|
|
70
|
-
组件支持以下展示模式(通过 `displayMode` 控制):
|
|
71
|
-
|
|
72
|
-
- **`list`**: 列表视图(默认)- 标准表格展示
|
|
73
|
-
- **`listSplitView`**: 分屏视图 - 左侧列表 + 右侧详情
|
|
74
|
-
- **`listMapView`**: 地图视图 - 地图 + 列表联动
|
|
75
|
-
- **BI Board**: BI 看板视图(通过 `biListVisible` 控制)
|
|
76
|
-
|
|
77
|
-
### 2. 数据展示功能
|
|
78
|
-
|
|
79
|
-
- **表格视图**: 基于 AG-Grid 的完整表格能力
|
|
80
|
-
- **列表视图切换**: 支持多个列表视图切换
|
|
81
|
-
- **分页加载**: 支持服务端分页(serverSide)和客户端分页(clientSide)
|
|
82
|
-
- **树形结构**: 支持树形数据展示(`treeData: true`)
|
|
83
|
-
- **空状态处理**: 提供友好的空数据提示
|
|
84
|
-
- **错误处理**: 完善的错误提示和重试机制
|
|
85
|
-
|
|
86
|
-
### 3. 支持列表视图切换、搜索、筛选和排序
|
|
87
|
-
|
|
88
|
-
- **列表视图切换功能**:
|
|
89
|
-
- 切换视图后自动重新加载列表数据
|
|
90
|
-
- 视图决定数据范围(筛选条件)和显示列
|
|
91
|
-
- 支持系统视图和用户自定义视图
|
|
92
|
-
- **搜索功能**:
|
|
93
|
-
- 用户在搜索框输入关键字
|
|
94
|
-
- 系统对基本类型字段(文本、数字、电话、邮箱)进行模糊匹配
|
|
95
|
-
- 支持防抖处理(默认300ms)
|
|
96
|
-
- 支持回车触发搜索
|
|
97
|
-
- **筛选功能**:
|
|
98
|
-
- 支持列头筛选
|
|
99
|
-
- 支持自定义筛选条件(`setCustomCondition`)
|
|
100
|
-
- 筛选条件持久化
|
|
101
|
-
- **排序功能**:
|
|
102
|
-
- 支持多列排序
|
|
103
|
-
- 支持升序/降序切换
|
|
104
|
-
- 排序状态持久化
|
|
105
|
-
|
|
106
|
-
### 4. 批量操作
|
|
107
|
-
|
|
108
|
-
- **批量选择**: 支持单选/多选模式
|
|
109
|
-
- **批量操作按钮**: 支持批量编辑、删除、转移等操作
|
|
110
|
-
- **批量编辑**: 支持扣框编辑(单元格内联编辑)
|
|
111
|
-
- **Picker 模式**: 支持作为选择器使用(`pattern: 'pickView'`)
|
|
112
|
-
|
|
113
|
-
### 5. 单元格编辑
|
|
114
|
-
|
|
115
|
-
- **扣框编辑**: 支持单元格内联编辑
|
|
116
|
-
- **批量保存**: 支持批量编辑后统一保存
|
|
117
|
-
- **权限控制**: 支持字段级编辑权限
|
|
118
|
-
- **校验**: 支持保存前校验
|
|
119
|
-
|
|
120
|
-
### 6. 详情打开方式
|
|
121
|
-
|
|
122
|
-
- **单击**: 侧滑抽屉打开详情
|
|
123
|
-
- **双击**: 新页签打开详情
|
|
124
|
-
- **分屏视图**: 右侧直接展示详情
|
|
125
|
-
- **地图视图**: 点击地图标记打开详情
|
|
126
|
-
|
|
127
|
-
### 7. 分页器
|
|
128
|
-
|
|
129
|
-
- 用户通过底部分页器切换页码
|
|
130
|
-
- 支持上一页、下一页、跳转到指定页
|
|
131
|
-
- 支持修改每页显示条数
|
|
132
|
-
- 翻页时保持当前的筛选和排序条件
|
|
133
|
-
|
|
134
|
-
### 8. 列表汇总
|
|
135
|
-
|
|
136
|
-
- 底部显示当前结果集的汇总信息
|
|
137
|
-
- 支持总条数、金额汇总等【暂不支持】
|
|
138
|
-
- 勾选记录后显示选中集的汇总【暂不支持】
|
|
139
|
-
- 支持展开/收起汇总项【暂不支持】
|
|
140
|
-
|
|
141
|
-
## 三、组件扩展性
|
|
142
|
-
|
|
143
|
-
### 基础属性
|
|
144
|
-
|
|
145
|
-
| 属性名 | 类型 | 默认值 | 说明 |
|
|
146
|
-
|--------|------|--------|------|
|
|
147
|
-
| `objectApiKey` | `string` | - | 实体的 ApiKey(必填)。即使用 `agGridDataSource` 自定义行数据,仍需传入,用于布局、权限、缓存 key 等(见 [示例 4](#示例-4-自定义数据源)) |
|
|
148
|
-
| `pattern` | `string` | `'entityView'` | 使用模式:`entityView`/`pickView`/`simpleListView`/`globalSearchPage`/`secondaryList` |
|
|
149
|
-
| `autoHeight` | `boolean` | `false` | 是否根据内容自动撑高(true 时 height 属性失效) |
|
|
150
|
-
| `height` | `string \| number` | `'100%'` | 组件高度,`autoHeight` 为 false 时生效 |
|
|
151
|
-
| `className` | `string` | `''` | 自定义样式类名 |
|
|
152
|
-
| `name` | `string` | - | 组件名称,用于 amis 通信(必填) |
|
|
153
|
-
| `render` | `Function` | - | **必传**(Neo 业务组件内使用 `NeoEntityGrid` 时)。类组件传 `this.props.render`,函数组件传 `props.render`,由上层 amis/Neo 注入,用于渲染列表内部 Schema;否则列表无法正常渲染 |
|
|
154
|
-
|
|
155
|
-
### 数据加载属性
|
|
156
|
-
|
|
157
|
-
| 属性名 | 类型 | 默认值 | 说明 |
|
|
158
|
-
|--------|------|--------|------|
|
|
159
|
-
| `dataLoadType` | `'serverSide' \| 'clientSide' \| 'auto' \| 'pagination'` | - | 数据加载方式:`serverSide` 搜索时总是从远程加载数据;`clientSide` 一次性请求完所有数据,在本地检索、编辑 |
|
|
160
|
-
| `cacheBlockSize` | `number` | - | 服务端模式下单次请求条数 |
|
|
161
|
-
| `agGridDataSource` | `object` | - | 自定义 AG Grid **服务端**行数据源:须实现 `getRows`(见 [示例 4](#示例-4-自定义数据源))。传入后列表行数据不再走默认实体 search,列布局仍按 `objectApiKey` 走布局接口 |
|
|
162
|
-
| `defaultViewId` | `string` | - | 默认显示的列表视图 ID |
|
|
163
|
-
| `additionalConditions` | `array` | `[]` | 固定附加筛选条件,格式同 `setCustomCondition` 参数 |
|
|
164
|
-
|
|
165
|
-
### 显隐控制属性
|
|
166
|
-
|
|
167
|
-
| 属性名 | 类型 | 默认值 | 说明 |
|
|
168
|
-
|--------|------|--------|------|
|
|
169
|
-
| `hiddenHeader` | `boolean` | `false` | 隐藏头部(视图切换栏 + 操作工具栏) |
|
|
170
|
-
| `disableSearch` | `boolean` | `false` | 禁用搜索框 |
|
|
171
|
-
| `showView` | `boolean` | `true` | 是否显示列表视图控制栏 |
|
|
172
|
-
| `enableChangeView` | `boolean` | `true` | 是否支持列表视图切换 |
|
|
173
|
-
| `canCreate` | `boolean` | `true` | 是否显示新建按钮 |
|
|
174
|
-
| `canImport` | `boolean` | `false` | 是否显示导入按钮 |
|
|
175
|
-
| `disablePagination` | `boolean` | `false` | 是否禁用分页 |
|
|
176
|
-
| `paginationPageSize` | `number` | `20` | 每页显示条数 |
|
|
177
|
-
|
|
178
|
-
### 列表配置属性
|
|
179
|
-
|
|
180
|
-
| 属性名 | 类型 | 默认值 | 说明 |
|
|
181
|
-
|--------|------|--------|------|
|
|
182
|
-
| `withOrder` | `boolean` | `true` | 是否显示序号列 |
|
|
183
|
-
| `withCheck` | `boolean` | `true` | 是否显示多选列 |
|
|
184
|
-
| `editable` | `boolean` | `true` | 是否支持单元格编辑(扣框编辑) |
|
|
185
|
-
| `selectionMode` | `'single' \| 'multiple'` | - | 选择模式(Picker 模式下默认 `single`) |
|
|
186
|
-
|
|
187
|
-
### 工具栏配置属性
|
|
188
|
-
|
|
189
|
-
| 属性名 | 类型 | 默认值 | 说明 |
|
|
190
|
-
|--------|------|--------|------|
|
|
191
|
-
| `enableToolbar` | `boolean` | `true` | 是否开启工具栏 |
|
|
192
|
-
| `disableExport` | `boolean` | `false` | 是否禁用导出 |
|
|
193
|
-
| `disableBatchEdit` | `boolean` | `false` | 是否禁用编辑列表 |
|
|
194
|
-
| `disableFieldSetup` | `boolean` | `false` | 是否禁用字段设置 |
|
|
195
|
-
| `disableBiView` | `boolean` | `false` | 是否禁用 BI 视图 |
|
|
196
|
-
| `disableFullScreen` | `boolean` | `false` | 是否禁用全屏 |
|
|
197
|
-
| `disableAutoSizeColumns` | `boolean` | `false` | 是否禁用一键调整列宽 |
|
|
198
|
-
| `customToolbarButtons` | `array` | - | 工具栏自定义按钮配置 |
|
|
199
|
-
|
|
200
|
-
### 事件回调属性
|
|
201
|
-
|
|
202
|
-
| 属性名 | 类型 | 说明 |
|
|
203
|
-
|--------|------|------|
|
|
204
|
-
| `onRowSelected` | `(data: Array<{data: Record}>, event) => void` | 行选中状态变化回调,`data` 为当前所有已选中行数据数组,每项为 `{data: {...行字段, id, name}}` |
|
|
205
|
-
| `onGridReady` | `(gridModel) => void` | 表格就绪回调,`gridModel` 包含 `reloadGrid`/`setCustomCondition` 等方法 |
|
|
206
|
-
| `onFirstDataRendered` | `() => void` | 首次数据渲染完成回调 |
|
|
207
|
-
| `onDataLoaded` | `(data) => void` | 数据加载完成回调 |
|
|
208
|
-
| `onDataRequest` | `(store) => void` | 数据请求前回调,可通过 `store.setCustomCondition(...)` 修改请求条件 |
|
|
209
|
-
| `onLayoutLoaded` | `(data) => void` | 布局加载完成回调 |
|
|
210
|
-
| `onSmartViewChanged` | `(data) => void` | SmartView 切换回调 |
|
|
211
|
-
| `onSinglerClick` | `(clickData) => boolean` | 行单击拦截,返回 `true` 则阻止默认打开详情逻辑 |
|
|
212
|
-
| `onDetailPageChange` | `(data) => void` | 侧滑详情翻页时回调(分屏视图/地图视图) |
|
|
213
|
-
| `onSelectedCall` | `(data) => void` | picker 选择器模式时,点击「确认」的回调方法 |
|
|
214
|
-
| `onCancel` | `() => void` | picker 选择器模式时,点击「取消」的回调方法 |
|
|
215
|
-
|
|
216
|
-
### 其他属性
|
|
217
|
-
|
|
218
|
-
| 属性名 | 类型 | 说明 |
|
|
219
|
-
|--------|------|------|
|
|
220
|
-
| `searchPlaceholder` | `string` | 搜索框自定义 placeholder 文本 |
|
|
221
|
-
| `pageInfo` | `{pageKey: string, scope: {objectApiKey: string}}` | 页面信息,传入后会自动注册 `reloadPage`/`refreshData`/`refreshPage` 等刷新方法到页面 Com |
|
|
222
|
-
| `noPermission` | `ReactNode \| Function` | 无数据权限时展示的内容,可为 React 节点或无参函数,通过设计器添加的列表组件时该值固定为 `true` |
|
|
223
|
-
| `customEmptyMsg` | `string` | 自定义空数据提示文本,覆盖默认的「暂无数据」提示 |
|
|
224
|
-
| `scene` | `string` | 场景标识,如 `'standard'`(standard 场景下侧滑详情会带遮罩并可点击关闭) |
|
|
225
|
-
| `busiTypeApiKey` | `string` | 业务类型 ApiKey,用于打开详情时传入业务类型参数 |
|
|
226
|
-
| `selectedCount` | `number` | picker选择器模式时可选择的最多个数 |
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
## 四、核心方法介绍
|
|
230
|
-
|
|
231
|
-
### customToolbarButtons — 工具栏自定义按钮
|
|
232
|
-
|
|
233
|
-
**作用**:在列表右上角工具栏区域插入业务线自定义按钮,支持在默认按钮组的**前方**(`header`)和**后方**(`footer`)分别注入,常用于业务线定制化操作入口。
|
|
234
|
-
|
|
235
|
-
**函数签名**:
|
|
236
|
-
```typescript
|
|
237
|
-
customToolbarButtons?: {
|
|
238
|
-
header?: Array<CustomButtonProps> // 插入到默认按钮组前方
|
|
239
|
-
footer?: Array<CustomButtonProps> // 插入到默认按钮组后方
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
interface CustomButtonProps {
|
|
243
|
-
id: string // 唯一标识(必填)
|
|
244
|
-
label: string // 按钮文本(图标模式时作为 tooltip 备用)
|
|
245
|
-
icon?: string // 图标名称(IconView 组件的 name),有图标时优先展示图标
|
|
246
|
-
tooltip?: string // hover 时的提示文本,未设置时使用 label
|
|
247
|
-
visible?: boolean // 是否显示,false 时不渲染,默认 true
|
|
248
|
-
disabled?: boolean // 是否禁用(添加 disable 样式类)
|
|
249
|
-
onClick?: (event: MouseEvent) => void // 点击回调
|
|
250
|
-
className?: string // 自定义 CSS 类名
|
|
251
|
-
testId?: string // 测试 ID,默认为 `{objectApiKey}-listbutton-custom-{id}`
|
|
252
|
-
customRender?: (button: CustomButtonProps) => ReactNode // 完全自定义渲染,优先级最高
|
|
253
|
-
}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
**实现逻辑**:
|
|
257
|
-
- 工具栏按钮的渲染顺序为:`header 自定义按钮` → 一键调整列宽 → 刷新 → 导出 → 批量编辑 → 字段设置 → BI 视图 → 地图 → 全屏 → `footer 自定义按钮`
|
|
258
|
-
- 每个按钮用 `Tooltip` 包裹,hover 时展示 `tooltip`(未配置则用 `label`)
|
|
259
|
-
- 设置了 `icon` 时,按钮只展示图标(`IconView`);否则展示文本 `label`
|
|
260
|
-
- `visible === false` 时该按钮不渲染(跳过)
|
|
261
|
-
- `customRender` 优先级最高,设置后完全由业务方控制渲染内容
|
|
262
|
-
- `disabled` 为 `true` 时,按钮添加 `disable` 样式类,但**不会阻止** `onClick` 触发(需业务方自行在 `onClick` 内判断)
|
|
263
|
-
|
|
264
|
-
**使用示例**:
|
|
265
|
-
|
|
266
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
267
|
-
|
|
268
|
-
```tsx
|
|
269
|
-
import React from 'react'
|
|
270
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
271
|
-
|
|
272
|
-
function syncDataFromExternalSystem() {
|
|
273
|
-
/* 业务实现 */
|
|
274
|
-
}
|
|
275
|
-
function exportAsPDF() {
|
|
276
|
-
/* 业务实现 */
|
|
277
|
-
}
|
|
278
|
-
function openApprovalDialog(_ids: string[]) {
|
|
279
|
-
/* 业务实现 */
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/** 示例 1:在工具栏末尾追加一个图标按钮 */
|
|
283
|
-
export class AccountToolbarFooterBtnExample extends React.Component<{ render: any }> {
|
|
284
|
-
render() {
|
|
285
|
-
return (
|
|
286
|
-
<NeoEntityGrid
|
|
287
|
-
render={this.props.render}
|
|
288
|
-
name="accountList"
|
|
289
|
-
objectApiKey="account"
|
|
290
|
-
pattern="entityView"
|
|
291
|
-
customToolbarButtons={{
|
|
292
|
-
footer: [
|
|
293
|
-
{
|
|
294
|
-
id: 'sync-btn',
|
|
295
|
-
label: '同步数据',
|
|
296
|
-
icon: 'Refresh',
|
|
297
|
-
tooltip: '点击同步最新数据',
|
|
298
|
-
onClick: () => syncDataFromExternalSystem()
|
|
299
|
-
}
|
|
300
|
-
]
|
|
301
|
-
}}
|
|
302
|
-
/>
|
|
303
|
-
)
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/** 示例 2:工具栏前方注入按钮,控制显隐/禁用(以下为示意变量,实际来自 props/state) */
|
|
308
|
-
const hasApprovePermission = true
|
|
309
|
-
const selectedCount = 0
|
|
310
|
-
const selectedIds: string[] = []
|
|
311
|
-
|
|
312
|
-
export class PriceToolbarHeaderFooterExample extends React.Component<{ render: any }> {
|
|
313
|
-
render() {
|
|
314
|
-
return (
|
|
315
|
-
<NeoEntityGrid
|
|
316
|
-
render={this.props.render}
|
|
317
|
-
name="priceList"
|
|
318
|
-
objectApiKey="price"
|
|
319
|
-
pattern="entityView"
|
|
320
|
-
customToolbarButtons={{
|
|
321
|
-
header: [
|
|
322
|
-
{
|
|
323
|
-
id: 'approve-btn',
|
|
324
|
-
label: '批量审批',
|
|
325
|
-
icon: 'CheckOne',
|
|
326
|
-
tooltip: '对选中记录批量审批',
|
|
327
|
-
visible: hasApprovePermission,
|
|
328
|
-
disabled: selectedCount === 0,
|
|
329
|
-
onClick: () => {
|
|
330
|
-
if (selectedCount === 0) return
|
|
331
|
-
openApprovalDialog(selectedIds)
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
],
|
|
335
|
-
footer: [
|
|
336
|
-
{
|
|
337
|
-
id: 'export-pdf-btn',
|
|
338
|
-
label: '导出 PDF',
|
|
339
|
-
icon: 'FilePdf',
|
|
340
|
-
onClick: () => exportAsPDF()
|
|
341
|
-
}
|
|
342
|
-
]
|
|
343
|
-
}}
|
|
344
|
-
/>
|
|
345
|
-
)
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const syncStatus: 'ok' | 'fail' = 'ok'
|
|
350
|
-
|
|
351
|
-
/** 示例 3:customRender 完全自定义 */
|
|
352
|
-
export class OrderToolbarCustomRenderExample extends React.Component<{ render: any }> {
|
|
353
|
-
render() {
|
|
354
|
-
return (
|
|
355
|
-
<NeoEntityGrid
|
|
356
|
-
render={this.props.render}
|
|
357
|
-
name="orderList"
|
|
358
|
-
objectApiKey="order"
|
|
359
|
-
pattern="entityView"
|
|
360
|
-
customToolbarButtons={{
|
|
361
|
-
footer: [
|
|
362
|
-
{
|
|
363
|
-
id: 'status-indicator',
|
|
364
|
-
label: '同步状态',
|
|
365
|
-
customRender: (button) => (
|
|
366
|
-
<li key={button.id} className="custom-sync-status">
|
|
367
|
-
<span className={`dot ${syncStatus === 'ok' ? 'green' : 'red'}`} />
|
|
368
|
-
{syncStatus === 'ok' ? '已同步' : '同步失败'}
|
|
369
|
-
</li>
|
|
370
|
-
)
|
|
371
|
-
}
|
|
372
|
-
]
|
|
373
|
-
}}
|
|
374
|
-
/>
|
|
375
|
-
)
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
---
|
|
381
|
-
|
|
382
|
-
### additionalConditions - 自定义筛选条件
|
|
383
|
-
|
|
384
|
-
通过 `additionalConditions` 可传入静态筛选条件。初始化时 Store 会将其与 `urlConditions`(若有)合并,顺序为:**先 `additionalConditions`,后 `urlConditions`**。这些条件会参与列表 **search** 请求的 `conditions` 参数。
|
|
385
|
-
|
|
386
|
-
**字段说明**
|
|
387
|
-
|
|
388
|
-
| 字段 | 类型 | 说明 |
|
|
389
|
-
|------|------|------|
|
|
390
|
-
| **apiKey** | `string` | 字段 API 名(与实体字段元数据中的 `apiKey` 一致)。 |
|
|
391
|
-
| **type** | `number` | 查询 **运算符**。常用取值见下表;复杂场景(如日期区间等)还可能使用其它数值,与表头筛选生成的条件类型保持一致。 |
|
|
392
|
-
| **value** | `string` 等 | 比较右侧的值。例如 **等于** 时为单个标量;**包含多选 / IN(type 10)** 时常为逗号分隔的 id 字符串;具体格式需与字段类型及后端约定一致。 |
|
|
393
|
-
|
|
394
|
-
**type 常用取值**(与组件内 `FilterCondition` 常量一致,源码:`EntityGrid/constant/index.ts`)
|
|
395
|
-
|
|
396
|
-
| 数值 | 含义 |
|
|
397
|
-
|------|------|
|
|
398
|
-
| `1` | 等于(EQUALS) |
|
|
399
|
-
| `2` | 不等于(NOT_EQUALS) |
|
|
400
|
-
| `3` | 包含(CONTAINS) |
|
|
401
|
-
| `4` | 不包含(NOT_CONTAINS) |
|
|
402
|
-
| `5` | 开始于(STARTS_WITH) |
|
|
403
|
-
| `6` | 大于(GREATER_THAN) |
|
|
404
|
-
| `7` | 大于等于(GREATER_EQUAL) |
|
|
405
|
-
| `8` | 小于(LESS_THAN) |
|
|
406
|
-
| `9` | 小于等于(LESS_EQUAL) |
|
|
407
|
-
| `10` | 在列表中 / IN |
|
|
408
|
-
| `13` | 为空(EMPTY) |
|
|
409
|
-
| `14` | 不为空(NOT_EMPTY) |
|
|
410
|
-
| `21` | 不在列表中 / NOT_IN |
|
|
411
|
-
|
|
412
|
-
**使用示例**:
|
|
413
|
-
|
|
414
|
-
```tsx
|
|
415
|
-
import React from 'react'
|
|
416
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
417
|
-
|
|
418
|
-
export default class AccountGridWithConditions extends React.Component<{ render: any }> {
|
|
419
|
-
render() {
|
|
420
|
-
return (
|
|
421
|
-
<NeoEntityGrid
|
|
422
|
-
render={this.props.render}
|
|
423
|
-
name="accountList"
|
|
424
|
-
objectApiKey="account"
|
|
425
|
-
pattern="entityView"
|
|
426
|
-
// 推荐:直接写 apiKey,与 BFF conditions 一致
|
|
427
|
-
additionalConditions={[{ apiKey: 'accountName', type: 3, value: '测试客户12' }]}
|
|
428
|
-
// 亦可:用字段 id(需在列表 items 中能解析到对应字段)
|
|
429
|
-
// additionalConditions={[{ item: 123, type: 3, value: '关键词' }]}
|
|
430
|
-
/>
|
|
431
|
-
)
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
---
|
|
437
|
-
|
|
438
|
-
### onRowSelected — 行选中变化回调
|
|
439
|
-
|
|
440
|
-
**触发时机**:用户勾选或取消勾选某行时触发;清空选中时也会以空数组触发。
|
|
441
|
-
|
|
442
|
-
**函数签名**:
|
|
443
|
-
```typescript
|
|
444
|
-
onRowSelected?: (data: Array<{ data: Record }>, event: Event) => void
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
**参数说明**:
|
|
448
|
-
- `data`:当前所有已选中行的数据数组,每一项格式为 `{ data: { ...行字段, id: string, name: string } }`,其中 `name` 字段取自实体的主属性字段
|
|
449
|
-
- `event`:AG-Grid 原生 rowSelected 事件对象
|
|
450
|
-
|
|
451
|
-
**实现逻辑**:
|
|
452
|
-
1. 触发时会重新计算所有已选中的行数据(支持跨页选中)
|
|
453
|
-
2. 在树形模式下,跨页选中通过 `selectedIds` 集合维护
|
|
454
|
-
3. 清空选中操作(点击「清除选中」按钮)时,以 `[]` 调用此回调
|
|
455
|
-
|
|
456
|
-
**使用示例**:
|
|
457
|
-
|
|
458
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
459
|
-
|
|
460
|
-
```tsx
|
|
461
|
-
import React from 'react'
|
|
462
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
463
|
-
|
|
464
|
-
export class AccountGridRowSelectedExample extends React.Component<{ render: any }> {
|
|
465
|
-
render() {
|
|
466
|
-
return (
|
|
467
|
-
<NeoEntityGrid
|
|
468
|
-
render={this.props.render}
|
|
469
|
-
name="accountList"
|
|
470
|
-
objectApiKey="account"
|
|
471
|
-
pattern="entityView"
|
|
472
|
-
onRowSelected={(data, event) => {
|
|
473
|
-
const selectedIds = data.map(({ data }) => data.id)
|
|
474
|
-
const selectedNames = data.map(({ data }) => data.name)
|
|
475
|
-
console.log('已选中条数:', data.length)
|
|
476
|
-
console.log('已选中 ID:', selectedIds)
|
|
477
|
-
}}
|
|
478
|
-
/>
|
|
479
|
-
)
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
---
|
|
485
|
-
|
|
486
|
-
### onSinglerClick — 行单击拦截
|
|
487
|
-
|
|
488
|
-
**触发时机**:用户单击表格某一行时,在执行默认「打开详情抽屉/跳转详情页」逻辑**之前**调用。
|
|
489
|
-
|
|
490
|
-
**函数签名**:
|
|
491
|
-
```typescript
|
|
492
|
-
onSinglerClick?: (clickData: ClickData) => boolean
|
|
493
|
-
```
|
|
494
|
-
|
|
495
|
-
**参数说明**:
|
|
496
|
-
`clickData` 包含被点击行的完整数据,关键字段包括:
|
|
497
|
-
- `id`:记录 ID
|
|
498
|
-
- `objectApiKey`:实体 ApiKey
|
|
499
|
-
- `objectId`:实体对象 ID
|
|
500
|
-
- `entityType`:业务类型 ID
|
|
501
|
-
- `nameField`:是否是主属性字段
|
|
502
|
-
- `i18nTitle`:记录名称(国际化)
|
|
503
|
-
- 其他行字段数据
|
|
504
|
-
|
|
505
|
-
**实现逻辑**:
|
|
506
|
-
- 返回 `true`:拦截默认逻辑,不打开详情页,完全由业务方自定义处理
|
|
507
|
-
- 返回 `false` / `undefined` / 不返回:继续执行默认的打开详情逻辑
|
|
508
|
-
- **注意**:双击行时也会调用 `onSinglerClick`(双击打开详情时同样会先检查此回调)
|
|
509
|
-
|
|
510
|
-
**使用示例**:
|
|
511
|
-
|
|
512
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
513
|
-
|
|
514
|
-
```tsx
|
|
515
|
-
import React from 'react'
|
|
516
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
517
|
-
|
|
518
|
-
export class ContactGridSinglerClickExample extends React.Component<{ render: any }> {
|
|
519
|
-
render() {
|
|
520
|
-
return (
|
|
521
|
-
<NeoEntityGrid
|
|
522
|
-
render={this.props.render}
|
|
523
|
-
name="contactList"
|
|
524
|
-
objectApiKey="contact"
|
|
525
|
-
pattern="entityView"
|
|
526
|
-
onSinglerClick={(clickData) => {
|
|
527
|
-
if (clickData.objectApiKey === 'contact') {
|
|
528
|
-
window.open(`/custom/contact/${clickData.id}`)
|
|
529
|
-
return true
|
|
530
|
-
}
|
|
531
|
-
return false
|
|
532
|
-
}}
|
|
533
|
-
/>
|
|
534
|
-
)
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
---
|
|
540
|
-
|
|
541
|
-
### customEmptyMsg — 自定义空数据提示
|
|
542
|
-
|
|
543
|
-
**作用**:替换列表无数据时的默认提示文本,常用于在特定业务场景下给用户更明确的引导信息。
|
|
544
|
-
|
|
545
|
-
**函数签名**:
|
|
546
|
-
```typescript
|
|
547
|
-
customEmptyMsg?: string
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
**实现逻辑**:
|
|
551
|
-
- 组件内部将 `customEmptyMsg` 传给 `Empty` 组件(AG-Grid 的 `agNoRowsOverlay`)
|
|
552
|
-
- 当列表查询结果为空时,显示此自定义文本;若未配置,则显示默认的「暂无数据」
|
|
553
|
-
- 若列表因筛选条件导致为空,空状态组件会同时展示「清除筛选条件」按钮
|
|
554
|
-
|
|
555
|
-
**使用示例**:
|
|
556
|
-
|
|
557
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
558
|
-
|
|
559
|
-
```tsx
|
|
560
|
-
import React from 'react'
|
|
561
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
562
|
-
|
|
563
|
-
/** 示例 :简单的自定义空状态文案 */
|
|
564
|
-
export class TaskSecondaryCustomEmptyExample extends React.Component<{ render: any }> {
|
|
565
|
-
render() {
|
|
566
|
-
return (
|
|
567
|
-
<NeoEntityGrid
|
|
568
|
-
render={this.props.render}
|
|
569
|
-
name="taskList"
|
|
570
|
-
objectApiKey="task"
|
|
571
|
-
pattern="secondaryList"
|
|
572
|
-
customEmptyMsg="暂无关联任务,请点击「新建」按钮创建"
|
|
573
|
-
/>
|
|
574
|
-
)
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
---
|
|
580
|
-
|
|
581
|
-
## 五、完整使用示例
|
|
582
|
-
|
|
583
|
-
以下示例均在 **React 类组件的 `render` 方法** 中挂载 `NeoEntityGrid`。
|
|
584
|
-
|
|
585
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
586
|
-
> 若父组件为**函数组件**,请使用 `render={props.render}`,与类组件的 `this.props.render` 等价。
|
|
587
|
-
|
|
588
|
-
### 示例 1: 基础大列表
|
|
589
|
-
|
|
590
|
-
```tsx
|
|
591
|
-
import React from 'react'
|
|
592
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
593
|
-
|
|
594
|
-
export default class AccountEntityGridBasic extends React.Component<{ render: any }> {
|
|
595
|
-
render() {
|
|
596
|
-
return (
|
|
597
|
-
<NeoEntityGrid
|
|
598
|
-
render={this.props.render}
|
|
599
|
-
name="accountList"
|
|
600
|
-
objectApiKey="account"
|
|
601
|
-
pattern="entityView"
|
|
602
|
-
// defaultViewId="default_view"
|
|
603
|
-
hiddenHeader={false}
|
|
604
|
-
showView={true}
|
|
605
|
-
enableChangeView={true}
|
|
606
|
-
disableSearch={false}
|
|
607
|
-
canCreate={true}
|
|
608
|
-
canImport={true}
|
|
609
|
-
editable={true}
|
|
610
|
-
withOrder={true}
|
|
611
|
-
withCheck={true}
|
|
612
|
-
enableToolbar={true}
|
|
613
|
-
disableExport={false}
|
|
614
|
-
disablePagination={false}
|
|
615
|
-
paginationPageSize={20}
|
|
616
|
-
autoHeight={false}
|
|
617
|
-
height="500px"
|
|
618
|
-
additionalConditions={[]}
|
|
619
|
-
/>
|
|
620
|
-
)
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
### 示例 2: Picker 列表(选择器)
|
|
626
|
-
|
|
627
|
-
```tsx
|
|
628
|
-
import React from 'react'
|
|
629
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
630
|
-
|
|
631
|
-
export default class ContactPickerGrid extends React.Component<{ render: any }> {
|
|
632
|
-
render() {
|
|
633
|
-
return (
|
|
634
|
-
<NeoEntityGrid
|
|
635
|
-
render={this.props.render}
|
|
636
|
-
name="pickerList"
|
|
637
|
-
objectApiKey="contact"
|
|
638
|
-
pattern="pickView"
|
|
639
|
-
selectionMode="multiple"
|
|
640
|
-
referData={{
|
|
641
|
-
"referObjectApiKey": "opportunity", // 关联表
|
|
642
|
-
"referItemApiKey": "accountId" // 关联表对应的外键字段
|
|
643
|
-
}}
|
|
644
|
-
onSelectedCall={(selectedData) => {
|
|
645
|
-
console.log('选中的数据', selectedData)
|
|
646
|
-
}}
|
|
647
|
-
shouldCloseDialog={true}
|
|
648
|
-
/>
|
|
649
|
-
)
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
### 示例 3: 自定义筛选条件 + 自定义工具栏
|
|
655
|
-
|
|
656
|
-
本示例将 **静态筛选**(`additionalConditions`)与 **工具栏扩展**(`customToolbarButtons`)放在同一张大列表上:筛选逻辑可参考模板 `entityGrid4__c`,工具栏按钮与 `customRender` 可参考模板 `entityGrid2__c`(二者在项目中为独立示例组件,此处合并演示)。
|
|
657
|
-
|
|
658
|
-
- **`additionalConditions`**:在列表初始化时追加条件,与视图条件等合并后参与查询;下例对客户名称做「包含」过滤(`type: 3` 表示包含,与文档「additionalConditions」章节一致)。
|
|
659
|
-
- **`customToolbarButtons`**:`header` 插在默认按钮组前,`footer` 插在后;支持 `icon`、`tooltip`、`onClick` 以及 `customRender` 完全自定义节点。
|
|
660
|
-
|
|
661
|
-
> **说明**:`customRender` 返回的节点需自行包一层带 `key` 的根元素(如 `<li key={button.id}>`),与模板 `entityGrid2__c` 一致。
|
|
662
|
-
|
|
663
|
-
```tsx
|
|
664
|
-
import React from 'react'
|
|
665
|
-
import { Tooltip } from 'antd'
|
|
666
|
-
import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons'
|
|
667
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
668
|
-
|
|
669
|
-
/** 同步状态等可来自 props / 上游状态 */
|
|
670
|
-
const syncStatus: 'ok' | 'fail' = 'ok'
|
|
671
|
-
|
|
672
|
-
export default class AccountGridFilterAndToolbar extends React.Component<{ render: any }> {
|
|
673
|
-
render() {
|
|
674
|
-
return (
|
|
675
|
-
<NeoEntityGrid
|
|
676
|
-
render={this.props.render}
|
|
677
|
-
name="accountList"
|
|
678
|
-
objectApiKey="account"
|
|
679
|
-
pattern="entityView"
|
|
680
|
-
defaultViewId="default_view"
|
|
681
|
-
hiddenHeader={false}
|
|
682
|
-
showView={true}
|
|
683
|
-
enableChangeView={true}
|
|
684
|
-
disableSearch={false}
|
|
685
|
-
canCreate={true}
|
|
686
|
-
canImport={true}
|
|
687
|
-
editable={true}
|
|
688
|
-
withOrder={true}
|
|
689
|
-
withCheck={true}
|
|
690
|
-
enableToolbar={true}
|
|
691
|
-
disableExport={false}
|
|
692
|
-
disablePagination={false}
|
|
693
|
-
paginationPageSize={20}
|
|
694
|
-
autoHeight={false}
|
|
695
|
-
height="500px"
|
|
696
|
-
customEmptyMsg="暂无数据,请点击「新建」按钮创建"
|
|
697
|
-
additionalConditions={[
|
|
698
|
-
{
|
|
699
|
-
apiKey: 'accountName',
|
|
700
|
-
value: '测试客户',
|
|
701
|
-
type: 3, // 3: 包含;1: 等于;详见上文 additionalConditions 章节
|
|
702
|
-
// item: -11100000100014, // 可选:筛选条件 ID(与设计器/元数据一致时使用)
|
|
703
|
-
},
|
|
704
|
-
]}
|
|
705
|
-
customToolbarButtons={{
|
|
706
|
-
header: [
|
|
707
|
-
{
|
|
708
|
-
id: 'approve-btn',
|
|
709
|
-
label: '批量审批',
|
|
710
|
-
icon: 'CheckOne',
|
|
711
|
-
tooltip: '对选中记录批量审批',
|
|
712
|
-
onClick: () => {
|
|
713
|
-
console.log('批量审批')
|
|
714
|
-
},
|
|
715
|
-
},
|
|
716
|
-
],
|
|
717
|
-
footer: [
|
|
718
|
-
{
|
|
719
|
-
id: 'export-pdf-btn',
|
|
720
|
-
label: '导出 PDF',
|
|
721
|
-
icon: 'FilePdf',
|
|
722
|
-
onClick: () => console.log('导出 PDF'),
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
id: 'status-indicator',
|
|
726
|
-
label: '同步状态',
|
|
727
|
-
customRender: (button: any) => {
|
|
728
|
-
const ok = syncStatus === 'ok'
|
|
729
|
-
const tip = ok ? '已同步' : '同步失败'
|
|
730
|
-
const Icon = ok ? CheckCircleOutlined : CloseCircleOutlined
|
|
731
|
-
return (
|
|
732
|
-
<li key={button.id} className="account-grid-filter-toolbar__status">
|
|
733
|
-
<Tooltip title={tip} placement="top" mouseEnterDelay={0.1}>
|
|
734
|
-
<button
|
|
735
|
-
type="button"
|
|
736
|
-
className={ok ? 'is-ok' : 'is-error'}
|
|
737
|
-
aria-label={`同步状态:${tip}`}
|
|
738
|
-
>
|
|
739
|
-
<Icon aria-hidden />
|
|
740
|
-
</button>
|
|
741
|
-
</Tooltip>
|
|
742
|
-
</li>
|
|
743
|
-
)
|
|
744
|
-
},
|
|
745
|
-
},
|
|
746
|
-
],
|
|
747
|
-
}}
|
|
748
|
-
/>
|
|
749
|
-
)
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
```
|
|
753
|
-
|
|
754
|
-
### 示例 4: 自定义数据源
|
|
755
|
-
备注:待完善。
|
|
756
|
-
|
|
757
|
-
**使用注意**
|
|
758
|
-
|
|
759
|
-
- 对象形态需符合 AG Grid `IServerSideDatasource`:**至少实现 `getRows(params)`**。`params.request` 中含 `startRow`、`endRow`、`sortModel`、`filterModel` 等;取数结束后调用 `params.successCallback(行数组, 总行数)`,异常调用 `params.fail()`。
|
|
760
|
-
- 行对象字段需与当前列表**列配置的字段 apiKey** 对齐,否则单元格无法正常展示。
|
|
761
|
-
- 建议同时设置 `dataLoadType="serverSide"`,与自定义服务端分页语义一致(与 `NeoEntityGrid` 其它 props 一致,透传至底层 `entityGrid`)。
|
|
762
|
-
- 业务中完整参考可见:`NeoBpm/approvalWorkBench/components/gridTable.tsx`(`getRows` 内调审批台查询并 `successCallback`)、`NeoBpm/flow/flowDetail/formFields/components/formRelationItem.tsx`(关联子表自定义加载)。
|
|
763
|
-
- 下方 `fetchAccountCustomPage` 的 mock `records` 从同一批 **21 条** account 数据中取 **3 条**(`id` 分别为 `4255673156574812`、`4225737913212487`、`4225737647447519`);示例为可读性省略了大量值为 `null` 的键,真实对接时请按列表列 apiKey 与接口完整结构对齐。
|
|
764
|
-
|
|
765
|
-
**`agGridDataSource`与 `objectApiKey` 的关系**
|
|
766
|
-
|
|
767
|
-
**需要传 `objectApiKey`,且应传与当前列表业务一致的实体 ApiKey**(不要随意省略或随便填)。`agGridDataSource` 只接管 AG Grid **行数据**的 `getRows`,列表组件内部有很多依赖 `objectApiKey` 的逻辑,例如:
|
|
768
|
-
|
|
769
|
-
- **布局初始化**:`loadLayout` 调用 `requestLayout` 时,默认请求体来自计算属性 `layoutParam`,其中包含 `objectApiKey`,用于拉取实体、列表视图、列与筛选元数据等。
|
|
770
|
-
- **权限**:列表职能权限判断会用 `objectApiKey` 在权限数据中匹配 `LIST`(`doPermission`)。
|
|
771
|
-
- **缓存**:部分 localStorage key(如视图、分页条数)会拼接 `objectApiKey`。
|
|
772
|
-
- **其它接口**:导出、批量保存、真实条数、SmartView 详情等仍可能走 `/xobjects/{objectApiKey}/...` 一类路径。
|
|
773
|
-
|
|
774
|
-
```tsx
|
|
775
|
-
import React from 'react'
|
|
776
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
777
|
-
|
|
778
|
-
/**
|
|
779
|
-
* 示例:自有接口分页返回 { records, totalSize },字段需与 objectApiKey 对应实体的列表列一致。
|
|
780
|
-
* fetchAccountCustomPage 仅为示意,请替换为真实请求。
|
|
781
|
-
*/
|
|
782
|
-
async function fetchAccountCustomPage(params: {
|
|
783
|
-
startRow: number
|
|
784
|
-
endRow: number
|
|
785
|
-
sortModel: any[]
|
|
786
|
-
filterModel: any
|
|
787
|
-
}) {
|
|
788
|
-
const pageSize = params.endRow - params.startRow
|
|
789
|
-
const pageNo = Math.floor(params.startRow / pageSize) + 1
|
|
790
|
-
// const res = await getNeoContext().fetcher({ url: '/your/api', method: 'post', data: { pageNo, pageSize, sort: params.sortModel, filter: params.filterModel } })
|
|
791
|
-
// mock:以下 3 条从同一批 21 条 account 列表数据中抽取(测试客户111 / 17 / 160);totalSize 示意服务端总条数便于分页
|
|
792
|
-
const owner = { id: 3256836509097427, name: 'LS' }
|
|
793
|
-
const depart = { id: 3256835676528229, name: '全公司' }
|
|
794
|
-
|
|
795
|
-
return {
|
|
796
|
-
records: [
|
|
797
|
-
{
|
|
798
|
-
id: 4255673156574812,
|
|
799
|
-
accountName: '测试客户111',
|
|
800
|
-
pinyin: 'ceshikehu111',
|
|
801
|
-
entityType: -11010000100001,
|
|
802
|
-
'entityType-label': '默认业务类型',
|
|
803
|
-
'entityType-labelKey': 'XdMDBizTp.account.defaultBusiType',
|
|
804
|
-
accountScore: 80,
|
|
805
|
-
level: 1,
|
|
806
|
-
accountType: 1,
|
|
807
|
-
ownerId: owner,
|
|
808
|
-
'ownerId-icon': icon,
|
|
809
|
-
dimDepart: depart,
|
|
810
|
-
tenantId: 3256219432312412,
|
|
811
|
-
objectId: 1,
|
|
812
|
-
countryId: 1,
|
|
813
|
-
lockStatus: 1,
|
|
814
|
-
highSeaStatus: 1,
|
|
815
|
-
doNotDisturb: 0,
|
|
816
|
-
delFlg: 0,
|
|
817
|
-
duplicateFlg: 0,
|
|
818
|
-
srcFlg: 0,
|
|
819
|
-
newOppFlg: 0,
|
|
820
|
-
approvalStatus: 0,
|
|
821
|
-
isCustomer: '0',
|
|
822
|
-
opportunityCount: '0',
|
|
823
|
-
innerGroupId: 4255673366634048,
|
|
824
|
-
parentAccountId: null,
|
|
825
|
-
phone: null,
|
|
826
|
-
createdAt: 1774510489068,
|
|
827
|
-
updatedAt: 1774510489193,
|
|
828
|
-
createdBy: owner,
|
|
829
|
-
updatedBy: owner,
|
|
830
|
-
},
|
|
831
|
-
{
|
|
832
|
-
id: 4225737913212487,
|
|
833
|
-
accountName: '测试客户17',
|
|
834
|
-
pinyin: 'ceshikehu17',
|
|
835
|
-
entityType: -11010000100003,
|
|
836
|
-
'entityType-label': '企业客户',
|
|
837
|
-
'entityType-labelKey': 'XdMDBizTp.account.defaultScrmBusiType',
|
|
838
|
-
accountScore: 70,
|
|
839
|
-
level: 2,
|
|
840
|
-
accountType: 1,
|
|
841
|
-
ownerId: owner,
|
|
842
|
-
'ownerId-icon': icon,
|
|
843
|
-
dimDepart: depart,
|
|
844
|
-
tenantId: 3256219432312412,
|
|
845
|
-
objectId: 1,
|
|
846
|
-
countryId: 1,
|
|
847
|
-
lockStatus: 1,
|
|
848
|
-
highSeaStatus: 1,
|
|
849
|
-
doNotDisturb: 0,
|
|
850
|
-
delFlg: 0,
|
|
851
|
-
duplicateFlg: 0,
|
|
852
|
-
srcFlg: 0,
|
|
853
|
-
newOppFlg: 0,
|
|
854
|
-
approvalStatus: 0,
|
|
855
|
-
isCustomer: '0',
|
|
856
|
-
opportunityCount: '0',
|
|
857
|
-
innerGroupId: 4225737927466432,
|
|
858
|
-
parentAccountId: { id: 4225737231359452, name: '测试客户14' },
|
|
859
|
-
phone: '15910783333',
|
|
860
|
-
employeeNumber: 100,
|
|
861
|
-
customItem165__c: 1,
|
|
862
|
-
createdAt: 1772683374683,
|
|
863
|
-
updatedAt: 1774439363104,
|
|
864
|
-
createdBy: owner,
|
|
865
|
-
updatedBy: owner,
|
|
866
|
-
},
|
|
867
|
-
{
|
|
868
|
-
id: 4225737647447519,
|
|
869
|
-
accountName: '测试客户160',
|
|
870
|
-
pinyin: 'ceshikehu160',
|
|
871
|
-
entityType: -11010000100003,
|
|
872
|
-
'entityType-label': '企业客户',
|
|
873
|
-
'entityType-labelKey': 'XdMDBizTp.account.defaultScrmBusiType',
|
|
874
|
-
accountScore: 50,
|
|
875
|
-
level: null,
|
|
876
|
-
accountType: 1,
|
|
877
|
-
ownerId: owner,
|
|
878
|
-
'ownerId-icon': icon,
|
|
879
|
-
dimDepart: depart,
|
|
880
|
-
tenantId: 3256219432312412,
|
|
881
|
-
objectId: 1,
|
|
882
|
-
countryId: 1,
|
|
883
|
-
lockStatus: 1,
|
|
884
|
-
highSeaStatus: 1,
|
|
885
|
-
doNotDisturb: 0,
|
|
886
|
-
delFlg: 0,
|
|
887
|
-
duplicateFlg: 0,
|
|
888
|
-
srcFlg: 0,
|
|
889
|
-
newOppFlg: 0,
|
|
890
|
-
approvalStatus: 0,
|
|
891
|
-
isCustomer: '0',
|
|
892
|
-
opportunityCount: '0',
|
|
893
|
-
innerGroupId: 4225737692618304,
|
|
894
|
-
parentAccountId: null,
|
|
895
|
-
phone: '15910781111',
|
|
896
|
-
customItem165__c: 2,
|
|
897
|
-
createdAt: 1772683360350,
|
|
898
|
-
updatedAt: 1774426404632,
|
|
899
|
-
createdBy: owner,
|
|
900
|
-
updatedBy: owner
|
|
901
|
-
},
|
|
902
|
-
] as any[],
|
|
903
|
-
totalSize: 3,
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
export default class AccountGridCustomDataSource extends React.Component<{ render: any }> {
|
|
908
|
-
/** 保留为类属性,避免 render 每次新建函数导致 ag-grid 重复绑定 */
|
|
909
|
-
private agGridDataSource = {
|
|
910
|
-
getRows: (params: any) => {
|
|
911
|
-
const { startRow, endRow, sortModel, filterModel } = params.request
|
|
912
|
-
// 通过接口获取自定义数据(列表数据)
|
|
913
|
-
fetchAccountCustomPage({ startRow, endRow, sortModel, filterModel })
|
|
914
|
-
.then(({ records, totalSize }) => {
|
|
915
|
-
params.successCallback(records, totalSize)
|
|
916
|
-
})
|
|
917
|
-
.catch(() => {
|
|
918
|
-
params.fail()
|
|
919
|
-
})
|
|
920
|
-
},
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
render() {
|
|
924
|
-
return (
|
|
925
|
-
<NeoEntityGrid
|
|
926
|
-
render={this.props.render}
|
|
927
|
-
name="accountListCustomDs"
|
|
928
|
-
objectApiKey="account"
|
|
929
|
-
pattern="entityView"
|
|
930
|
-
dataLoadType="serverSide"
|
|
931
|
-
agGridDataSource={this.agGridDataSource}
|
|
932
|
-
paginationPageSize={20}
|
|
933
|
-
/>
|
|
934
|
-
)
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
```
|
|
938
|
-
|
|
939
|
-
## 六、注意事项
|
|
940
|
-
|
|
941
|
-
### 1. Store 初始化
|
|
942
|
-
|
|
943
|
-
- Store 由 amis 框架根据 `storeType: EntityGridStore.name` 自动创建
|
|
944
|
-
- 无需手动创建 Store 实例
|
|
945
|
-
|
|
946
|
-
### 2. 模式区分
|
|
947
|
-
|
|
948
|
-
- `pattern='entityView'`: 标准大列表
|
|
949
|
-
- `pattern='pickView'`: Picker 选择器
|
|
950
|
-
- `pattern='globalSearchPage'`: 全局搜索结果列表
|
|
951
|
-
|
|
952
|
-
### 3. 必传参数
|
|
953
|
-
|
|
954
|
-
- **所有模式**: `objectApiKey`、`name`、`render={this.props.render}`(Neo 业务组件内嵌列表时,`render` 必须为父组件注入的 `this.props.render`,否则列表无法正常渲染)
|
|
955
|
-
- **Picker**: `referData`(referItemApiKey、referObjectApiKey)、`onSelectedCall`
|
|
956
|
-
|
|
957
|
-
### 4. 树形模式
|
|
958
|
-
|
|
959
|
-
- 需显式设置 `treeData: true`
|
|
960
|
-
- 支持 `treeParentIdField`、`treeInitialLoadCount`、`treeLoadMoreCount` 等配置
|
|
961
|
-
- 超过 1000 条时「展开全部」按钮自动禁用
|
|
962
|
-
|
|
963
|
-
### 5. 性能优化
|
|
964
|
-
|
|
965
|
-
- 服务端模式(serverSide)适合大数据量
|
|
966
|
-
- 客户端模式(clientSide)适合小数据量
|
|
967
|
-
- `dataLoadType: 'auto'` 会根据数据量自动切换
|
|
968
|
-
|
|
969
|
-
### 6. render 必传说明
|
|
970
|
-
|
|
971
|
-
- 在 Neo 业务组件中内嵌 `NeoEntityGrid` 时,**必须**传入由框架注入的渲染函数:`render={this.props.render}`(类组件)或 `render={props.render}`(函数组件)。
|
|
972
|
-
- 该函数用于将列表内部的 amis Schema 渲染为真实 DOM;缺失时头部、表格体、底栏等子区域无法正常展示。
|
|
973
|
-
|
|
974
|
-
## 七、常见问题
|
|
975
|
-
|
|
976
|
-
### Q1: 如何刷新列表数据?
|
|
977
|
-
|
|
978
|
-
**A**: 通过指令或组件方法:
|
|
979
|
-
|
|
980
|
-
```typescript
|
|
981
|
-
// 方式1: amis 指令
|
|
982
|
-
target: 'listviewx?cmd=refresh_grid'
|
|
983
|
-
|
|
984
|
-
// 方式2: 在 onGridReady 中拿到 gridModel,调用 store.reloadGrid(false)
|
|
985
|
-
// gridModel.reloadGrid 会代理到内部 store
|
|
986
|
-
```
|
|
987
|
-
|
|
988
|
-
### Q2: 如何拦截行点击打开详情?
|
|
989
|
-
|
|
990
|
-
**A**: 使用 `onSinglerClick`(需在类组件 `render` 中挂载,并传入 `render={this.props.render}`):
|
|
991
|
-
|
|
992
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
993
|
-
|
|
994
|
-
```tsx
|
|
995
|
-
import React from 'react'
|
|
996
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
997
|
-
|
|
998
|
-
export class AccountGridInterceptExample extends React.Component<{ render: any }> {
|
|
999
|
-
render() {
|
|
1000
|
-
return (
|
|
1001
|
-
<NeoEntityGrid
|
|
1002
|
-
render={this.props.render}
|
|
1003
|
-
name="accountList"
|
|
1004
|
-
objectApiKey="account"
|
|
1005
|
-
pattern="entityView"
|
|
1006
|
-
onSinglerClick={(clickData) => {
|
|
1007
|
-
console.log('点击了', clickData)
|
|
1008
|
-
return true
|
|
1009
|
-
}}
|
|
1010
|
-
/>
|
|
1011
|
-
)
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
```
|
|
1015
|
-
|
|
1016
|
-
### Q3: 如何获取选中的数据?
|
|
1017
|
-
|
|
1018
|
-
**A**: 通过 `onRowSelected` 回调:
|
|
1019
|
-
|
|
1020
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
1021
|
-
|
|
1022
|
-
```tsx
|
|
1023
|
-
import React from 'react'
|
|
1024
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
1025
|
-
|
|
1026
|
-
export class AccountGridSelectionExample extends React.Component<{ render: any }> {
|
|
1027
|
-
render() {
|
|
1028
|
-
return (
|
|
1029
|
-
<NeoEntityGrid
|
|
1030
|
-
render={this.props.render}
|
|
1031
|
-
name="accountList"
|
|
1032
|
-
objectApiKey="account"
|
|
1033
|
-
pattern="entityView"
|
|
1034
|
-
onRowSelected={(data) => {
|
|
1035
|
-
const selectedIds = data.map(({ data }) => data.id)
|
|
1036
|
-
console.log('选中 ID 列表:', selectedIds)
|
|
1037
|
-
}}
|
|
1038
|
-
/>
|
|
1039
|
-
)
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
```
|
|
1043
|
-
|
|
1044
|
-
### Q4: 如何自定义空状态提示?
|
|
1045
|
-
|
|
1046
|
-
**A**: 使用 `customEmptyMsg`:
|
|
1047
|
-
|
|
1048
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
1049
|
-
|
|
1050
|
-
```tsx
|
|
1051
|
-
import React from 'react'
|
|
1052
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
1053
|
-
|
|
1054
|
-
export class TaskGridEmptyMsgExample extends React.Component<{ render: any }> {
|
|
1055
|
-
render() {
|
|
1056
|
-
return (
|
|
1057
|
-
<NeoEntityGrid
|
|
1058
|
-
render={this.props.render}
|
|
1059
|
-
name="taskList"
|
|
1060
|
-
objectApiKey="task"
|
|
1061
|
-
pattern="secondaryList"
|
|
1062
|
-
customEmptyMsg="暂无数据,请先创建"
|
|
1063
|
-
/>
|
|
1064
|
-
)
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
```
|
|
1068
|
-
|
|
1069
|
-
### Q5: 如何禁用某些功能?
|
|
1070
|
-
|
|
1071
|
-
**A**: 使用对应的禁用属性:
|
|
1072
|
-
|
|
1073
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
1074
|
-
|
|
1075
|
-
```tsx
|
|
1076
|
-
import React from 'react'
|
|
1077
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
1078
|
-
|
|
1079
|
-
export class AccountGridDisableFeaturesExample extends React.Component<{ render: any }> {
|
|
1080
|
-
render() {
|
|
1081
|
-
return (
|
|
1082
|
-
<NeoEntityGrid
|
|
1083
|
-
render={this.props.render}
|
|
1084
|
-
name="accountList"
|
|
1085
|
-
objectApiKey="account"
|
|
1086
|
-
pattern="entityView"
|
|
1087
|
-
disableSearch={true}
|
|
1088
|
-
disableExport={true}
|
|
1089
|
-
disablePagination={true}
|
|
1090
|
-
withOrder={false}
|
|
1091
|
-
withCheck={false}
|
|
1092
|
-
editable={false}
|
|
1093
|
-
/>
|
|
1094
|
-
)
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
```
|
|
1098
|
-
|
|
1099
|
-
### Q6: Picker 模式如何获取选中结果?
|
|
1100
|
-
|
|
1101
|
-
**A**: 使用 `onSelectedCall` 回调:
|
|
1102
|
-
|
|
1103
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
1104
|
-
|
|
1105
|
-
```tsx
|
|
1106
|
-
import React from 'react'
|
|
1107
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
1108
|
-
|
|
1109
|
-
function closeDialog() {
|
|
1110
|
-
/* 关闭弹窗 */
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
export class ContactPickerSelectedExample extends React.Component<{ render: any }> {
|
|
1114
|
-
render() {
|
|
1115
|
-
return (
|
|
1116
|
-
<NeoEntityGrid
|
|
1117
|
-
render={this.props.render}
|
|
1118
|
-
name="accountPicker"
|
|
1119
|
-
objectApiKey="account"
|
|
1120
|
-
pattern="pickView" // Picker 列表(选择器)
|
|
1121
|
-
referData={{
|
|
1122
|
-
referObjectApiKey: 'opportunity',
|
|
1123
|
-
referItemApiKey: 'accountId'
|
|
1124
|
-
}}
|
|
1125
|
-
onSelectedCall={(selectedData) => {
|
|
1126
|
-
console.log(selectedData)
|
|
1127
|
-
closeDialog()
|
|
1128
|
-
}}
|
|
1129
|
-
shouldCloseDialog={true}
|
|
1130
|
-
/>
|
|
1131
|
-
)
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
```
|
|
1135
|
-
|
|
1136
|
-
### Q7: 如何添加自定义工具栏按钮?
|
|
1137
|
-
|
|
1138
|
-
**A**: 使用 `customToolbarButtons`(`header` / `footer` 结构,见上文「customToolbarButtons」章节):
|
|
1139
|
-
|
|
1140
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
1141
|
-
|
|
1142
|
-
```tsx
|
|
1143
|
-
import React from 'react'
|
|
1144
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
1145
|
-
|
|
1146
|
-
export class AccountGridCustomToolbarExample extends React.Component<{ render: any }> {
|
|
1147
|
-
render() {
|
|
1148
|
-
return (
|
|
1149
|
-
<NeoEntityGrid
|
|
1150
|
-
render={this.props.render}
|
|
1151
|
-
name="accountList"
|
|
1152
|
-
objectApiKey="account"
|
|
1153
|
-
pattern="entityView"
|
|
1154
|
-
customToolbarButtons={{
|
|
1155
|
-
footer: [
|
|
1156
|
-
{
|
|
1157
|
-
id: 'customBtn',
|
|
1158
|
-
label: '自定义',
|
|
1159
|
-
icon: 'Refresh',
|
|
1160
|
-
onClick: () => console.log('clicked')
|
|
1161
|
-
}
|
|
1162
|
-
]
|
|
1163
|
-
}}
|
|
1164
|
-
/>
|
|
1165
|
-
)
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
```
|
|
1169
|
-
|
|
1170
|
-
### Q8: 无权限时如何自定义展示?
|
|
1171
|
-
|
|
1172
|
-
**A**: 使用 `noPermission`:
|
|
1173
|
-
|
|
1174
|
-
> **说明**:`render` 属性必须为 `this.props.render`,确保列表组件正常渲染。
|
|
1175
|
-
|
|
1176
|
-
```tsx
|
|
1177
|
-
import React from 'react'
|
|
1178
|
-
import { NeoEntityGrid } from 'neo-ui-component-web'
|
|
1179
|
-
|
|
1180
|
-
export class AccountGridNoPermissionExample extends React.Component<{ render: any }> {
|
|
1181
|
-
render() {
|
|
1182
|
-
return (
|
|
1183
|
-
<NeoEntityGrid
|
|
1184
|
-
render={this.props.render}
|
|
1185
|
-
name="accountList"
|
|
1186
|
-
objectApiKey="account"
|
|
1187
|
-
pattern="entityView"
|
|
1188
|
-
noPermission={() => <div>您没有权限查看此列表</div>}
|
|
1189
|
-
/>
|
|
1190
|
-
)
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
```
|
|
1194
|
-
|
|
1195
|
-
## 八、总结
|
|
1196
|
-
|
|
1197
|
-
`EntityGrid` 是 Web 端功能强大的列表组件,基于 AG-Grid 提供了完整的数据展示、筛选、排序、批量操作、单元格编辑、多视图切换等功能。通过 JSX 或 amis Schema 配置即可使用,支持 Nex 扩展和 HOC 透传满足业务线定制需求。
|
|
1198
|
-
|
|
1199
|
-
在使用时需要注意:
|
|
1200
|
-
|
|
1201
|
-
1. 正确设置 `objectApiKey` 和 `name`
|
|
1202
|
-
2. **Neo 业务组件内使用 `NeoEntityGrid` 时,必须传入 `render={this.props.render}`**,确保列表内部 amis Schema 能正常渲染
|
|
1203
|
-
3. 根据业务场景选择合适的 `pattern`
|
|
1204
|
-
4. 合理使用 `onDataRequest` 设置筛选条件
|
|
1205
|
-
5. 树形模式需显式开启 `treeData`
|
|
1206
|
-
6. 通过 `pageInfo` 集成多页签刷新能力
|