neo-cmp-cli 1.13.17 → 1.13.19
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 +23 -3
- 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/filterBar__c/common.scss +1 -1
- package/template/neo-bi-cmps/src/components/filterBar__c/index.tsx +18 -10
- package/template/neo-bi-cmps/src/components/filterBar__c/model.ts +8 -2
- package/template/neo-bi-cmps/src/components/targetNumber__c/model.ts +1 -1
- package/template/neo-bi-cmps/src/utils/common.ts +18 -20
- package/template/neo-bi-cmps/src/utils/filter2chartFilter.ts +4 -6
- package/template/neo-bi-cmps/src/utils/pipelineFunnel.ts +4 -2
- package/template/neo-bi-cmps/src/utils/simpleTable.tsx +21 -16
- 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 +22 -12
- 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 +24 -22
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/model.ts +31 -18
- package/template/neo-pipeline-cmps/src/components/pipelineFunnel__c/reset.scss +4 -0
- 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 +29 -16
- 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 +34 -19
- 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-entity-grid/src/components/createForm__c/index.tsx +271 -259
- package/template/neo-web-entity-grid/src/components/createForm__c/model.ts +17 -3
- package/template/neo-web-entity-grid/src/components/createForm__c/resetAntd.scss +0 -1
- package/template/neo-web-entity-grid/src/components/createForm__c/style.scss +1 -1
- package/template/neo-web-entity-grid/src/components/entityGrid2__c/index.tsx +5 -1
- package/template/neo-web-entity-grid/src/components/entityGrid2__c/model.ts +4 -3
- package/template/neo-web-entity-grid/src/components/entityGrid3__c/index.tsx +1 -1
- package/template/neo-web-entity-grid/src/components/searchForm__c/index.tsx +4 -3
- package/template/neo-web-entity-grid/src/components/searchForm__c/model.ts +9 -4
- package/template/neo-web-entity-grid/src/components/searchForm__c/style.scss +2 -1
- package/template/neo-web-form/package.json +1 -1
- package/template/neo-web-form/src/components/batchAddTable__c/index.tsx +179 -59
- package/template/neo-web-form/src/components/batchAddTable__c/model.ts +12 -14
- package/template/neo-web-form/src/components/listSummary__c/index.tsx +6 -5
- 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,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}
|
|
@@ -1,72 +1,72 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file XObject
|
|
3
|
-
* @description
|
|
2
|
+
* @file XObject table component editor descriptor file (simplified version)
|
|
3
|
+
* @description Defines the component configuration for the Neo platform editor
|
|
4
4
|
* @author Neo Custom Widget CLI
|
|
5
5
|
* @version 1.0.0
|
|
6
6
|
*/
|
|
7
7
|
export class SimpleTableModel {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Component type identifier
|
|
10
|
+
* Used to uniquely identify the component; automatically generated from the current component directory name during build
|
|
11
|
+
* Note: This field is automatically replaced during build and does not need to be set manually
|
|
12
12
|
*/
|
|
13
13
|
// cmpType: string = 'simpleTable';
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
label: string = '
|
|
15
|
+
/** Component name, displayed in the editor's left component panel */
|
|
16
|
+
label: string = 'Opportunity List';
|
|
17
17
|
|
|
18
|
-
/**
|
|
18
|
+
/** Component description, displayed in the editor's left component panel */
|
|
19
19
|
description: string =
|
|
20
|
-
'
|
|
20
|
+
'Data table component based on XObject, supports data display only, does not support CRUD operations';
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
// tags: string[] = ['
|
|
22
|
+
/** Category tags, determines which category the component appears under in the editor's left component panel */
|
|
23
|
+
// tags: string[] = ['Custom Components'];
|
|
24
24
|
|
|
25
|
-
/**
|
|
25
|
+
/** Component icon, displayed in the editor's left component panel */
|
|
26
26
|
iconUrl: string = 'https://custom-widgets.bj.bcebos.com/table.svg';
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Sets the page types supported by the component
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
* all: 1
|
|
33
|
-
* entityFormPage: 4
|
|
34
|
-
* customPage: 6
|
|
31
|
+
* Page types available in the current NeoCRM platform:
|
|
32
|
+
* all: 1 All pages
|
|
33
|
+
* entityFormPage: 4 Entity form page
|
|
34
|
+
* customPage: 6 Custom page
|
|
35
35
|
*/
|
|
36
36
|
targetPage: string[] = ['all'];
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Sets the device types supported by the component
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
* web:
|
|
43
|
-
* mobile:
|
|
41
|
+
* Device types available in the current NeoCRM platform:
|
|
42
|
+
* web: Web
|
|
43
|
+
* mobile: Mobile
|
|
44
44
|
*/
|
|
45
45
|
targetDevice: string = 'web';
|
|
46
46
|
|
|
47
|
-
/**
|
|
47
|
+
/** Default property data when first inserted into a page */
|
|
48
48
|
defaultComProps = {
|
|
49
49
|
title: 'Opportunity List',
|
|
50
50
|
activeStage: 'Prospecting',
|
|
51
51
|
description: 'Filtered by Close Date, Opportunity Owner, Business Type',
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
//
|
|
54
|
+
// List of functions supported by the current component (other components can trigger these functions)
|
|
55
55
|
functions = [
|
|
56
56
|
{
|
|
57
57
|
apiKey: 'loadData',
|
|
58
|
-
label: '
|
|
59
|
-
helpTextKey: '
|
|
58
|
+
label: 'Refresh Table',
|
|
59
|
+
helpTextKey: 'Refresh the current table data',
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
apiKey: 'setFilter',
|
|
63
|
-
label: '
|
|
63
|
+
label: 'Set Filter Conditions',
|
|
64
64
|
helpTextKey:
|
|
65
|
-
'
|
|
65
|
+
'Set filter conditions consistent with the chart (closeDate / ownerId / entityType), and re-query the table',
|
|
66
66
|
funcInParams: [
|
|
67
67
|
{
|
|
68
68
|
apiKey: 'filter',
|
|
69
|
-
label: '
|
|
69
|
+
label: 'Filter condition data',
|
|
70
70
|
type: 'Object',
|
|
71
71
|
required: false,
|
|
72
72
|
},
|
|
@@ -74,12 +74,12 @@ export class SimpleTableModel {
|
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
apiKey: 'updateActiveStage',
|
|
77
|
-
label: '
|
|
78
|
-
helpTextKey: '
|
|
77
|
+
label: 'Update Active Stage',
|
|
78
|
+
helpTextKey: 'Set the currently active sales stage',
|
|
79
79
|
funcInParams: [
|
|
80
80
|
{
|
|
81
81
|
apiKey: 'activeStage',
|
|
82
|
-
label: '
|
|
82
|
+
label: 'Current active stage',
|
|
83
83
|
type: 'String',
|
|
84
84
|
required: false,
|
|
85
85
|
},
|
|
@@ -88,33 +88,33 @@ export class SimpleTableModel {
|
|
|
88
88
|
];
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
91
|
+
* Component property configuration schema
|
|
92
|
+
* Supports static configuration: propsSchema, with lower priority than propsSchemaCreator
|
|
93
|
+
* Defines the configurable properties of the component in the editor
|
|
94
94
|
*/
|
|
95
95
|
propsSchema = [
|
|
96
96
|
{
|
|
97
97
|
type: 'panelInput',
|
|
98
98
|
name: 'title',
|
|
99
|
-
label: '
|
|
100
|
-
placeholder: '
|
|
99
|
+
label: 'Table Title',
|
|
100
|
+
placeholder: 'Enter table title',
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
type: 'panelInput',
|
|
104
104
|
name: 'description',
|
|
105
|
-
label: '
|
|
106
|
-
placeholder: '
|
|
105
|
+
label: 'Table Description',
|
|
106
|
+
placeholder: 'Description text displayed below the title',
|
|
107
107
|
},
|
|
108
108
|
/*
|
|
109
109
|
{
|
|
110
|
-
type: 'xObjectDataApi', //
|
|
110
|
+
type: 'xObjectDataApi', // Configuration item for fetching entity business data list
|
|
111
111
|
name: 'xObjectDataApi',
|
|
112
|
-
label: '
|
|
112
|
+
label: 'Entity Data Source',
|
|
113
113
|
value: {
|
|
114
114
|
xObjectApiKey: 'customContact__c',
|
|
115
115
|
fields: ['name', 'phone__c'],
|
|
116
116
|
},
|
|
117
|
-
placeholder: '
|
|
117
|
+
placeholder: 'Select entity data source',
|
|
118
118
|
custom: true,
|
|
119
119
|
},
|
|
120
120
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Table header AI icon: same usage as openChatPageBtn's openChatPageBtn-icon (background image) */
|
|
2
2
|
.simpleTable-th-title-with-ai-icon {
|
|
3
3
|
display: inline-flex;
|
|
4
4
|
align-items: center;
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
color: #fff;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
//
|
|
160
|
+
// Responsive design
|
|
161
161
|
@media (max-width: 768px) {
|
|
162
162
|
.panel-header {
|
|
163
163
|
padding: 12px;
|
|
@@ -190,4 +190,3 @@
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# StageSwitch
|
|
1
|
+
# StageSwitch Component
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Stage switch card component that toggles between different sales stage data.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
import StageSwitch from './components/stageSwitch__c';
|
|
@@ -19,18 +19,18 @@ import StageSwitch from './components/stageSwitch__c';
|
|
|
19
19
|
|
|
20
20
|
## Props
|
|
21
21
|
|
|
22
|
-
|
|
|
23
|
-
|
|
24
|
-
| stages |
|
|
25
|
-
| activeStage |
|
|
26
|
-
| onStageChange |
|
|
22
|
+
| Property | Description | Type | Default |
|
|
23
|
+
|----------|-------------|------|---------|
|
|
24
|
+
| stages | Stage data | StageTab[] | [] |
|
|
25
|
+
| activeStage | Current stage | string | First stage |
|
|
26
|
+
| onStageChange | Stage switch callback | (stage: StageTab) => void | - |
|
|
27
27
|
|
|
28
28
|
## StageTab
|
|
29
29
|
|
|
30
|
-
|
|
|
31
|
-
|
|
32
|
-
| key |
|
|
33
|
-
| name |
|
|
34
|
-
| amount |
|
|
35
|
-
| count |
|
|
36
|
-
| changes |
|
|
30
|
+
| Property | Description | Type |
|
|
31
|
+
|----------|-------------|------|
|
|
32
|
+
| key | Unique identifier | string |
|
|
33
|
+
| name | Stage name | string |
|
|
34
|
+
| amount | Amount | string |
|
|
35
|
+
| count | Count | number |
|
|
36
|
+
| changes | Change data | { amount, amountDirection, count, countDirection } |
|