neo-cmp-cli 1.13.17 → 1.13.18
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/neo/env.js +1 -1
- package/dist/neo/pushCmp.js +1 -1
- package/dist/package.json.js +1 -1
- package/package.json +3 -2
- package/template/asset-manage-template/docs/README.md +1 -232
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/neo-bi-cmps/package.json +1 -1
- package/template/neo-bi-cmps/src/components/targetNumber__c/model.ts +1 -1
- package/template/neo-custom-cmp-template/docs/README.md +0 -231
- package/template/neo-custom-cmp-template/package.json +1 -1
- package/template/neo-h5-cmps/src/components/entityList__c/index.tsx +1 -2
- package/template/neo-h5-cmps/src/components/entityTabs__c/index.tsx +1 -1
- package/template/neo-h5-cmps/src/components/globalSearchInput__c/index.tsx +1 -1
- package/template/neo-h5-cmps/src/components/openChatPageBtn__c/index.tsx +1 -2
- package/template/neo-pipeline-cmps/neo.config.js +11 -0
- package/template/neo-pipeline-cmps/src/assets/css/common.scss +16 -16
- package/template/neo-pipeline-cmps/src/assets/css/mixin.scss +5 -5
- package/template/neo-pipeline-cmps/src/components/filterBar__c/README.md +9 -9
- package/template/neo-pipeline-cmps/src/components/filterBar__c/common.scss +5 -5
- package/template/neo-pipeline-cmps/src/components/filterBar__c/index.tsx +47 -46
- package/template/neo-pipeline-cmps/src/components/filterBar__c/model.ts +13 -11
- package/template/neo-pipeline-cmps/src/components/filterBar__c/style.scss +1 -1
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/README.md +17 -17
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/index.tsx +23 -22
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/model.ts +18 -17
- package/template/neo-pipeline-cmps/src/components/showHealthResult__c/index.tsx +33 -26
- package/template/neo-pipeline-cmps/src/components/showHealthResult__c/model.ts +9 -9
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/README.md +53 -54
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/common.scss +5 -5
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/index.tsx +70 -68
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/model.ts +41 -41
- package/template/neo-pipeline-cmps/src/components/simpleTable__c/style.scss +2 -3
- package/template/neo-pipeline-cmps/src/components/stageSwitch__c/README.md +15 -15
- package/template/neo-pipeline-cmps/src/components/stageSwitch__c/index.tsx +35 -33
- package/template/neo-pipeline-cmps/src/components/stageSwitch__c/model.ts +16 -15
- package/template/neo-pipeline-cmps/src/components/stageTimeChart__c/README.md +18 -18
- package/template/neo-pipeline-cmps/src/components/stageTimeChart__c/index.tsx +20 -20
- package/template/neo-pipeline-cmps/src/components/stageTimeChart__c/model.ts +21 -18
- package/template/neo-pipeline-cmps/src/utils/common.ts +14 -14
- package/template/neo-pipeline-cmps/src/utils/filter2chartFilter.ts +21 -23
- package/template/neo-pipeline-cmps/src/utils/filterBar.ts +14 -14
- package/template/neo-pipeline-cmps/src/utils/pipelineFunnel.ts +5 -5
- package/template/neo-pipeline-cmps/src/utils/queryByCustomSQL.ts +26 -22
- package/template/neo-pipeline-cmps/src/utils/requestDebounce.ts +3 -3
- package/template/neo-pipeline-cmps/src/utils/simpleTable.tsx +31 -26
- package/template/neo-pipeline-cmps/src/utils/stageSwitch.ts +1 -1
- package/template/neo-pipeline-cmps/src/utils/stageTimeChart.ts +5 -5
- package/template/neo-pipeline-cmps/src/utils/targetNumber.ts +2 -2
- package/template/neo-web-form/package.json +1 -1
- package/template/neo-web-form/src/components/batchAddTable__c/index.tsx +161 -41
- package/template/neo-web-form/src/components/batchAddTable__c/model.ts +4 -2
- package/template/react-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/src/utils/axiosFetcher.ts +0 -37
- package/template/asset-manage-template/src/utils/queryObjectData.ts +0 -112
- package/template/asset-manage-template/src/utils/xobjects.ts +0 -162
- package/template/neo-custom-cmp-template/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-custom-cmp-template/src/utils/queryObjectData.ts +0 -112
- package/template/neo-custom-cmp-template/src/utils/xobjects.ts +0 -162
- package/template/neo-h5-cmps/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-h5-cmps/src/utils/queryObjectData.ts +0 -112
- package/template/neo-h5-cmps/src/utils/xobjects.ts +0 -167
- package/template/neo-order-cmps/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-order-cmps/src/utils/queryObjectData.ts +0 -112
- package/template/neo-order-cmps/src/utils/xobjects.ts +0 -162
- package/template/neo-web-entity-grid/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-web-entity-grid/src/utils/queryObjectData.ts +0 -112
- package/template/neo-web-entity-grid/src/utils/xobjects.ts +0 -167
- package/template/neo-web-form/src/utils/axiosFetcher.ts +0 -37
- package/template/neo-web-form/src/utils/queryObjectData.ts +0 -112
- package/template/neo-web-form/src/utils/xobjects.ts +0 -167
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
# XObject
|
|
1
|
+
# XObject Data Table Component (Simplified)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
An XObject-based data table component that only supports data display. Table columns are dynamically generated based on fields returned by `xObject.getDesc`.
|
|
4
|
+
Note: Uses methods provided by the Neo Open API SDK (neo-open-api) to implement data object query operations.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Features
|
|
7
7
|
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
8
|
+
- **Dynamic Table Columns**: Automatically generates table columns based on XObject field descriptions
|
|
9
|
+
- **Data Display**: Supports displaying XObject entity data
|
|
10
|
+
- **Responsive Design**: Adapts to different screen sizes
|
|
11
|
+
- **Property Configuration**: Supports configuring component properties through the editor
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Component Properties
|
|
14
14
|
|
|
15
|
-
|
|
|
16
|
-
|
|
17
|
-
| title | string | '
|
|
18
|
-
| xObjectDataApi | object | - |
|
|
19
|
-
| xObjectDataApi.xObjectApiKey | string | '' |
|
|
20
|
-
| xObjectDataApi.fields | string[] | [] |
|
|
15
|
+
| Property | Type | Default | Description |
|
|
16
|
+
|----------|------|---------|-------------|
|
|
17
|
+
| title | string | 'Data Table' | Table title |
|
|
18
|
+
| xObjectDataApi | object | - | Entity data source configuration |
|
|
19
|
+
| xObjectDataApi.xObjectApiKey | string | '' | Data object API Key |
|
|
20
|
+
| xObjectDataApi.fields | string[] | [] | List of fields to display |
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Usage
|
|
23
23
|
|
|
24
|
-
### 1.
|
|
24
|
+
### 1. Using in the Editor
|
|
25
25
|
|
|
26
|
-
1.
|
|
27
|
-
2.
|
|
28
|
-
3.
|
|
29
|
-
4.
|
|
26
|
+
1. Drag the "Entity Data Table (Simplified)" component from the component panel to the page
|
|
27
|
+
2. Select the data object to operate on in the right property panel
|
|
28
|
+
3. Configure the fields to display (optional)
|
|
29
|
+
4. Save and preview
|
|
30
30
|
|
|
31
|
-
### 2.
|
|
31
|
+
### 2. Using in Code
|
|
32
32
|
|
|
33
33
|
```tsx
|
|
34
34
|
import SimpleTable from './components/simpleTable__c';
|
|
35
35
|
|
|
36
|
-
//
|
|
36
|
+
// Use the component
|
|
37
37
|
<SimpleTable
|
|
38
38
|
xObjectDataApi={{
|
|
39
39
|
xObjectApiKey: 'customContact__c',
|
|
@@ -42,49 +42,48 @@ import SimpleTable from './components/simpleTable__c';
|
|
|
42
42
|
/>
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
##
|
|
45
|
+
## Technical Implementation
|
|
46
46
|
|
|
47
|
-
###
|
|
47
|
+
### Core Dependencies
|
|
48
48
|
|
|
49
|
-
- **Ant Design
|
|
50
|
-
- **React
|
|
51
|
-
- **TypeScript
|
|
49
|
+
- **Ant Design**: UI component library
|
|
50
|
+
- **React**: Frontend framework
|
|
51
|
+
- **TypeScript**: Type support
|
|
52
52
|
|
|
53
|
-
###
|
|
53
|
+
### Data Flow
|
|
54
54
|
|
|
55
|
-
1.
|
|
56
|
-
2.
|
|
57
|
-
3.
|
|
55
|
+
1. **Initialization**: Fetches field descriptions when the component mounts
|
|
56
|
+
2. **Column Generation**: Dynamically generates table columns based on field descriptions
|
|
57
|
+
3. **Data Loading**: Uses `xObject.query` to fetch data list
|
|
58
58
|
|
|
59
|
-
##
|
|
59
|
+
## Style Customization
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
The component provides complete SCSS style files, supporting the following customizations:
|
|
62
62
|
|
|
63
|
-
-
|
|
64
|
-
-
|
|
63
|
+
- Table styles (borders, hover effects, etc.)
|
|
64
|
+
- Responsive design (mobile adaptation)
|
|
65
65
|
|
|
66
|
-
##
|
|
66
|
+
## Notes
|
|
67
67
|
|
|
68
|
-
1.
|
|
69
|
-
2.
|
|
70
|
-
3.
|
|
68
|
+
1. **Permission Requirements**: Ensure the user has read access to the corresponding XObject
|
|
69
|
+
2. **Field Types**: Supports display of all basic field types
|
|
70
|
+
3. **Error Handling**: The component has built-in comprehensive error handling and user prompts
|
|
71
71
|
|
|
72
|
-
##
|
|
72
|
+
## Differences from Full Version
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
This simplified version compared to the full `entityTable__c` component:
|
|
75
75
|
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
76
|
+
- **No Create**: Removed record creation functionality
|
|
77
|
+
- **No Edit**: Removed record editing functionality
|
|
78
|
+
- **No Delete**: Removed record deletion functionality
|
|
79
|
+
- **No Refresh**: Removed manual refresh button
|
|
80
|
+
- **No Pagination**: Removed pagination, displays all data
|
|
81
|
+
- **Display Only**: Focused on data display functionality
|
|
82
82
|
|
|
83
|
-
##
|
|
83
|
+
## Extension Development
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
1. **添加字段类型支持**:在 `generateColumns()` 方法中添加字段格式化逻辑
|
|
88
|
-
2. **自定义样式**:修改 `style.scss` 文件定制组件外观
|
|
89
|
-
3. **添加排序功能**:扩展表格功能支持列排序
|
|
85
|
+
To extend functionality, you can:
|
|
90
86
|
|
|
87
|
+
1. **Add Field Type Support**: Add field formatting logic in the `generateColumns()` method
|
|
88
|
+
2. **Custom Styles**: Modify the `style.scss` file to customize component appearance
|
|
89
|
+
3. **Add Sorting**: Extend table functionality to support column sorting
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
//
|
|
1
|
+
// CSS variables
|
|
2
2
|
:root {
|
|
3
3
|
--background-color: #f5f6fa;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// SASS variables
|
|
7
7
|
$background-color: #f5f6fa;
|
|
8
|
-
//
|
|
8
|
+
// Custom common styles
|
|
9
9
|
|
|
10
|
-
/* AI Win Rate
|
|
10
|
+
/* AI Win Rate: hover card (aligned with demo.html #winRateTooltip) */
|
|
11
11
|
.simpleTable-winrate-trigger {
|
|
12
12
|
cursor: pointer;
|
|
13
13
|
border: none !important;
|
|
@@ -31,7 +31,7 @@ $background-color: #f5f6fa;
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/*
|
|
34
|
+
/* Health score column hover: embedded showHealthResult__c */
|
|
35
35
|
.simpleTable-health-popover-trigger {
|
|
36
36
|
cursor: pointer;
|
|
37
37
|
display: inline-block;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file XObject
|
|
3
|
-
* @description
|
|
2
|
+
* @file XObject data table component (simplified version)
|
|
3
|
+
* @description XObject entity data table component based on the Neo platform, supports data display only
|
|
4
4
|
*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { Table, Spin, Empty, Popover } from 'antd';
|
|
@@ -9,11 +9,11 @@ import { xObject } from 'neo-open-api'; // Neo Open API
|
|
|
9
9
|
// @ts-ignore
|
|
10
10
|
import isEqual from 'lodash/isEqual';
|
|
11
11
|
|
|
12
|
-
// Neo Open API//
|
|
12
|
+
// Neo Open API// Import neo-ui-common / BaseCmp
|
|
13
13
|
// @ts-ignore
|
|
14
14
|
import { BaseCmp } from 'neo-ui-common';
|
|
15
15
|
|
|
16
|
-
//
|
|
16
|
+
// Import neo-ui-common / NeoEvent
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
import { NeoEvent } from 'neo-ui-common';
|
|
19
19
|
|
|
@@ -51,7 +51,7 @@ import './style.scss';
|
|
|
51
51
|
|
|
52
52
|
export type { HistoryOppSnap } from '../../utils/simpleTable';
|
|
53
53
|
|
|
54
|
-
/**
|
|
54
|
+
/** Opportunity detail page hash route (consistent with platform neoweb) */
|
|
55
55
|
function buildOpportunityDetailUrl(id: string, objectApiKey: string): string {
|
|
56
56
|
const q = new URLSearchParams({
|
|
57
57
|
objectApiKey,
|
|
@@ -60,7 +60,7 @@ function buildOpportunityDetailUrl(id: string, objectApiKey: string): string {
|
|
|
60
60
|
return `/bff/neoweb#/entityDetail/opportunity/${id}?${q.toString()}`;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/**
|
|
63
|
+
/** Fields not displayed in the table (can still be fetched via xObjectDataApi.fields, used for hover cards / tooltips) */
|
|
64
64
|
const HIDDEN_TABLE_COLUMN_KEYS = new Set([
|
|
65
65
|
'customItem244__c',
|
|
66
66
|
'customItem241__c',
|
|
@@ -68,15 +68,15 @@ const HIDDEN_TABLE_COLUMN_KEYS = new Set([
|
|
|
68
68
|
'customItem246__c',
|
|
69
69
|
'customItem247__c',
|
|
70
70
|
'customItem245__c',
|
|
71
|
-
// 'objectId', //
|
|
72
|
-
// 'businessTypeId' //
|
|
71
|
+
// 'objectId', // Needed for navigating to detail page
|
|
72
|
+
// 'businessTypeId' // Needed for navigating to detail page
|
|
73
73
|
]);
|
|
74
74
|
|
|
75
|
-
/**
|
|
75
|
+
/** Historical opportunity SQL consistent with stageSwitch; field order must match query fields (array rows parsed by column index) */
|
|
76
76
|
const HISTORY_OPPORTUNITY_BI_KEY = 'biCustomModel_397169_20260401104916618';
|
|
77
77
|
const HISTORY_QUERY_FIELDS = [
|
|
78
|
-
// 'id', //
|
|
79
|
-
'opportunity_1__id', //
|
|
78
|
+
// 'id', // Historical version ID
|
|
79
|
+
'opportunity_1__id', // Opportunity ID
|
|
80
80
|
'opportunity_1_closeDate',
|
|
81
81
|
'opportunity_1_opportunityName',
|
|
82
82
|
'opportunity_1_saleStageId',
|
|
@@ -86,76 +86,76 @@ const HISTORY_QUERY_FIELDS = [
|
|
|
86
86
|
const defaultXObjectDataApi = {
|
|
87
87
|
xObjectApiKey: 'opportunity',
|
|
88
88
|
fields: [
|
|
89
|
-
'opportunityName', // OpportunityStageName
|
|
89
|
+
'opportunityName', // OpportunityStageName Opportunity Name
|
|
90
90
|
'money', // Amount
|
|
91
91
|
'closeDate', // Close Date
|
|
92
92
|
'customItem248__c', // Stage
|
|
93
93
|
// 'oppHealthAssessmentScore',
|
|
94
94
|
'recentActivityRecordTime',
|
|
95
|
-
'oppHealthAssessmentLevel', // 1.AI Score; hover
|
|
96
|
-
'customItem239__c', // 2.AI Win Rate: hover
|
|
95
|
+
'oppHealthAssessmentLevel', // 1.AI Score; hover card: calls opportunity health assessment API
|
|
96
|
+
'customItem239__c', // 2.AI Win Rate: 3 fields shown in hover card (baseline, positiveFactors, negativeFactors)
|
|
97
97
|
'customItem244__c', // baseline
|
|
98
98
|
'customItem241__c', // positiveFactors
|
|
99
99
|
'customItem242__c', // negativeFactors
|
|
100
100
|
'customItem246__c', // AmoutChanged
|
|
101
101
|
'customItem247__c', // ClosedDateChanged
|
|
102
102
|
'customItem245__c', // StageChanged
|
|
103
|
-
// 'objectId', //
|
|
104
|
-
// 'businessTypeId' //
|
|
103
|
+
// 'objectId', // Needed for navigating to detail page
|
|
104
|
+
// 'businessTypeId' // Needed for navigating to detail page
|
|
105
105
|
],
|
|
106
106
|
page: 1,
|
|
107
107
|
pageSize: 50,
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* Component props interface
|
|
111
111
|
*/
|
|
112
112
|
interface SimpleTableProps {
|
|
113
|
-
/** XObject
|
|
113
|
+
/** XObject entity API Key, used to identify the data object to operate on */
|
|
114
114
|
xObjectDataApi: {
|
|
115
115
|
xObjectApiKey: string;
|
|
116
116
|
fields: string[];
|
|
117
117
|
fieldDescList?: any[];
|
|
118
118
|
autoFetchData?: boolean;
|
|
119
119
|
};
|
|
120
|
-
/** Neo
|
|
120
|
+
/** Neo platform data, including system information */
|
|
121
121
|
data?: any;
|
|
122
|
-
entityData?: any; // Neo
|
|
123
|
-
/**
|
|
122
|
+
entityData?: any; // Entity data automatically fetched by Neo platform
|
|
123
|
+
/** Whether it is a custom entity object */
|
|
124
124
|
custom?: boolean;
|
|
125
|
-
/**
|
|
125
|
+
/** Component class name */
|
|
126
126
|
className?: string;
|
|
127
|
-
/**
|
|
127
|
+
/** Table title, takes priority */
|
|
128
128
|
title?: string;
|
|
129
|
-
/**
|
|
129
|
+
/** Description text below the title */
|
|
130
130
|
description?: string;
|
|
131
|
-
/**
|
|
131
|
+
/** Currently active sales stage */
|
|
132
132
|
activeStage?: string;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
* Component state interface
|
|
137
137
|
*/
|
|
138
138
|
interface SimpleTableState {
|
|
139
|
-
/**
|
|
139
|
+
/** Table title */
|
|
140
140
|
title?: string;
|
|
141
141
|
fieldList: FieldInfo[];
|
|
142
|
-
/**
|
|
142
|
+
/** Table data source */
|
|
143
143
|
dataSource: any[];
|
|
144
|
-
/**
|
|
144
|
+
/** Loading state */
|
|
145
145
|
loading: boolean;
|
|
146
|
-
/**
|
|
146
|
+
/** Error message */
|
|
147
147
|
error: string | null;
|
|
148
|
-
activeStage: string; //
|
|
148
|
+
activeStage: string; // Currently active sales stage
|
|
149
149
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
150
|
+
* Consistent with FilterBar event payload (closeDateCustomRange / opportunityOwner / businessType, etc.);
|
|
151
|
+
* Default value is defaultFilter, getFilterWhere only reads from it
|
|
152
152
|
*/
|
|
153
153
|
filter: any;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
|
-
* XObject
|
|
158
|
-
*
|
|
157
|
+
* XObject data table component (simplified version)
|
|
158
|
+
* Supports data display only, does not support CRUD operations
|
|
159
159
|
*/
|
|
160
160
|
export default class SimpleTable extends BaseCmp<
|
|
161
161
|
SimpleTableProps,
|
|
@@ -164,7 +164,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
164
164
|
constructor(props: SimpleTableProps) {
|
|
165
165
|
super(props);
|
|
166
166
|
|
|
167
|
-
//
|
|
167
|
+
// Initialize component state
|
|
168
168
|
this.state = {
|
|
169
169
|
fieldList: [],
|
|
170
170
|
dataSource: [],
|
|
@@ -190,38 +190,38 @@ export default class SimpleTable extends BaseCmp<
|
|
|
190
190
|
const { xObjectApiKey } = defaultXObjectDataApi;
|
|
191
191
|
|
|
192
192
|
if (xObjectApiKey) {
|
|
193
|
-
//
|
|
193
|
+
// Initialize field list and load data
|
|
194
194
|
this.loadFieldList();
|
|
195
195
|
this.loadData();
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/*
|
|
199
|
-
//
|
|
199
|
+
// Broadcast event: update FilterBar filter
|
|
200
200
|
NeoEvent.listen('updateFilterData', (filterData: any) => {
|
|
201
|
-
console.log('SimpleTable
|
|
201
|
+
console.log('SimpleTable received a broadcast event updateFilterData: ', filterData);
|
|
202
202
|
this.setFilter(filterData);
|
|
203
203
|
});
|
|
204
204
|
|
|
205
|
-
//
|
|
205
|
+
// Broadcast event: update the currently active sales stage
|
|
206
206
|
NeoEvent.listen('updateActiveStage', (activeStage: string) => {
|
|
207
|
-
console.log('SimpleTable
|
|
207
|
+
console.log('SimpleTable received a broadcast event updateActiveStage: ', activeStage);
|
|
208
208
|
this.updateActiveStage(activeStage);
|
|
209
209
|
});
|
|
210
210
|
*/
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
214
|
+
* Load field list
|
|
215
|
+
* Fetch XObject field description information from the Neo platform
|
|
216
216
|
*/
|
|
217
217
|
async loadFieldList() {
|
|
218
218
|
const xObjectDataApi: any = defaultXObjectDataApi;
|
|
219
219
|
|
|
220
|
-
//
|
|
220
|
+
// Method 1: Get field descriptions directly from props.xObjectDetailApi
|
|
221
221
|
if (xObjectDataApi && xObjectDataApi.fieldDescList) {
|
|
222
222
|
this.setState({ fieldList: xObjectDataApi.fieldDescList });
|
|
223
223
|
} else {
|
|
224
|
-
//
|
|
224
|
+
// Method 2: Fetch field descriptions via OpenAPI SDK
|
|
225
225
|
if (!xObjectDataApi.xObjectApiKey) return;
|
|
226
226
|
try {
|
|
227
227
|
const resultData = await xObject.getDesc(xObjectDataApi.xObjectApiKey);
|
|
@@ -231,13 +231,13 @@ export default class SimpleTable extends BaseCmp<
|
|
|
231
231
|
this.setState({ fieldList, title: result.label });
|
|
232
232
|
}
|
|
233
233
|
} catch (error) {
|
|
234
|
-
console.error('
|
|
234
|
+
console.error('Failed to get field list:', error);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
/**
|
|
240
|
-
*
|
|
240
|
+
* Current visible field list for the table (consistent with column configuration)
|
|
241
241
|
*/
|
|
242
242
|
getCurFieldList(): FieldInfo[] {
|
|
243
243
|
// const { xObjectDataApi } = this.props;
|
|
@@ -256,7 +256,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
|
-
*
|
|
259
|
+
* Money field apiKey for summary (consistent with the money column, takes the first currency field)
|
|
260
260
|
*/
|
|
261
261
|
getMoneyFieldApiKey(): string | null {
|
|
262
262
|
const moneyField = this.getCurFieldList().find((f) => isMoneyField(f));
|
|
@@ -264,8 +264,8 @@ export default class SimpleTable extends BaseCmp<
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
/**
|
|
267
|
-
*
|
|
268
|
-
* @returns
|
|
267
|
+
* Generate table column configuration
|
|
268
|
+
* @returns Array of table column configurations
|
|
269
269
|
*/
|
|
270
270
|
generateColumns() {
|
|
271
271
|
const xObjectDataApi: any = defaultXObjectDataApi;
|
|
@@ -274,7 +274,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
274
274
|
(field) => !HIDDEN_TABLE_COLUMN_KEYS.has(field.apiKey),
|
|
275
275
|
);
|
|
276
276
|
|
|
277
|
-
//
|
|
277
|
+
// Generate base column configuration from field list
|
|
278
278
|
const columns: any[] = curFieldList.map((field) => {
|
|
279
279
|
const col: any = {
|
|
280
280
|
title: field.label,
|
|
@@ -396,7 +396,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
/**
|
|
399
|
-
*
|
|
399
|
+
* Convert FilterBar structured filter to xObject.query where string array (consistent with stageSwitch, SDK concatenates with AND in order)
|
|
400
400
|
*/
|
|
401
401
|
getFilterWhere(): string[] {
|
|
402
402
|
const raw = this.state.filter;
|
|
@@ -424,9 +424,9 @@ export default class SimpleTable extends BaseCmp<
|
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
/*
|
|
427
|
-
//
|
|
427
|
+
// If activeStage exists, add stage filter condition
|
|
428
428
|
if (this.state.activeStage) {
|
|
429
|
-
// customItem248__c
|
|
429
|
+
// customItem248__c is the sales stage field
|
|
430
430
|
where.push(`customItem248__c = '${this.state.activeStage}'`);
|
|
431
431
|
}
|
|
432
432
|
*/
|
|
@@ -434,9 +434,11 @@ export default class SimpleTable extends BaseCmp<
|
|
|
434
434
|
return where;
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
-
/**
|
|
437
|
+
/** Consistent with stageSwitch: historical opportunity custom SQL where (opportunity_1_* fields) */
|
|
438
438
|
getHistoryOpportunityQueryFilter(): string[] {
|
|
439
439
|
const raw = this.state.filter;
|
|
440
|
+
const defaultFilter = getDefaultFilterByProps(this.props);
|
|
441
|
+
|
|
440
442
|
const curFilter: Record<string, unknown> =
|
|
441
443
|
raw && typeof raw === 'object' && !Array.isArray(raw)
|
|
442
444
|
? Object.keys(raw as object).length > 0
|
|
@@ -472,7 +474,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
472
474
|
return where;
|
|
473
475
|
}
|
|
474
476
|
|
|
475
|
-
/**
|
|
477
|
+
/** Query historical opportunity list for the period (same source as stageSwitch.fetchHistoryOpportunityList, fields extended as needed) */
|
|
476
478
|
async fetchHistoryOpportunityList(): Promise<unknown[]> {
|
|
477
479
|
const result = await queryByCustomSQL({
|
|
478
480
|
xObjectApiKey: HISTORY_OPPORTUNITY_BI_KEY,
|
|
@@ -486,7 +488,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
486
488
|
}
|
|
487
489
|
|
|
488
490
|
/**
|
|
489
|
-
*
|
|
491
|
+
* Load table data
|
|
490
492
|
*/
|
|
491
493
|
@NeoEvent.function
|
|
492
494
|
async loadData() {
|
|
@@ -519,7 +521,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
519
521
|
|
|
520
522
|
console.log('[SimpleTable__c] records:', records, historyRows);
|
|
521
523
|
|
|
522
|
-
//
|
|
524
|
+
// Filter data by stage
|
|
523
525
|
if (this.state.activeStage) {
|
|
524
526
|
records = records.filter((record: any) => {
|
|
525
527
|
return record.customItem248__c === this.state.activeStage;
|
|
@@ -543,20 +545,20 @@ export default class SimpleTable extends BaseCmp<
|
|
|
543
545
|
});
|
|
544
546
|
} else {
|
|
545
547
|
this.setState({
|
|
546
|
-
error: result?.msg || '
|
|
548
|
+
error: result?.msg || 'Failed to fetch data',
|
|
547
549
|
loading: false,
|
|
548
550
|
});
|
|
549
551
|
}
|
|
550
552
|
} catch (error: any) {
|
|
551
553
|
this.setState({
|
|
552
|
-
error: error.message || '
|
|
554
|
+
error: error.message || 'Failed to fetch data',
|
|
553
555
|
loading: false,
|
|
554
556
|
});
|
|
555
557
|
}
|
|
556
558
|
}
|
|
557
559
|
|
|
558
560
|
/**
|
|
559
|
-
*
|
|
561
|
+
* Consistent with stageSwitch: update FilterBar filter and re-fetch table data.
|
|
560
562
|
*/
|
|
561
563
|
@NeoEvent.function
|
|
562
564
|
setFilter(filter?: any) {
|
|
@@ -570,7 +572,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
570
572
|
}
|
|
571
573
|
|
|
572
574
|
/**
|
|
573
|
-
*
|
|
575
|
+
* Update the currently active sales stage
|
|
574
576
|
*/
|
|
575
577
|
@NeoEvent.function
|
|
576
578
|
updateActiveStage(activeStage?: string) {
|
|
@@ -584,8 +586,8 @@ export default class SimpleTable extends BaseCmp<
|
|
|
584
586
|
}
|
|
585
587
|
|
|
586
588
|
/**
|
|
587
|
-
*
|
|
588
|
-
* @returns
|
|
589
|
+
* Render component
|
|
590
|
+
* @returns Component JSX element
|
|
589
591
|
*/
|
|
590
592
|
render() {
|
|
591
593
|
const { title: stateTitle, dataSource, loading, error } = this.state;
|
|
@@ -594,8 +596,8 @@ export default class SimpleTable extends BaseCmp<
|
|
|
594
596
|
const { xObjectApiKey } = defaultXObjectDataApi;
|
|
595
597
|
const columns = this.generateColumns();
|
|
596
598
|
|
|
597
|
-
//
|
|
598
|
-
const displayTitle = propsTitle || stateTitle || '
|
|
599
|
+
// Use props.title first, then state.title, and finally the default value
|
|
600
|
+
const displayTitle = propsTitle || stateTitle || 'Data Table';
|
|
599
601
|
|
|
600
602
|
const moneyKey = this.getMoneyFieldApiKey();
|
|
601
603
|
const totalAmount = moneyKey ? sumMoneyRows(dataSource, moneyKey) : 0;
|
|
@@ -613,7 +615,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
613
615
|
);
|
|
614
616
|
|
|
615
617
|
return (
|
|
616
|
-
<div className={`simpleTable__c ${className}`} data-time="2026.4.
|
|
618
|
+
<div className={`simpleTable__c ${className}`} data-time="2026.4.17 01">
|
|
617
619
|
<div className="table-wrapper">
|
|
618
620
|
<div className="panel-header">
|
|
619
621
|
<div className="panel-header-text">
|
|
@@ -634,7 +636,7 @@ export default class SimpleTable extends BaseCmp<
|
|
|
634
636
|
</div>
|
|
635
637
|
</div>
|
|
636
638
|
<div className="table-container">
|
|
637
|
-
<Spin spinning={loading} tip="
|
|
639
|
+
<Spin spinning={loading} tip="Loading data...">
|
|
638
640
|
{error ? (
|
|
639
641
|
<Empty
|
|
640
642
|
image={Empty.PRESENTED_IMAGE_SIMPLE}
|