aldehyde 0.2.170 → 0.2.172

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.
@@ -1,54 +1,60 @@
1
- import React, {ReactNode, ReactDOM} from "react";
1
+ import React, { ReactNode, ReactDOM } from "react";
2
2
  import {
3
- Button,
4
- Card,
5
- Checkbox,
6
- Col,
7
- Collapse,
8
- Divider,
9
- Popconfirm,
10
- Popover,
11
- Row,
12
- Space, Drawer, Modal,
13
- Tooltip, message,
3
+ Button,
4
+ Card,
5
+ Checkbox,
6
+ Col,
7
+ Collapse,
8
+ Divider,
9
+ Popconfirm,
10
+ Popover,
11
+ Row,
12
+ Space,
13
+ Drawer,
14
+ Modal,
15
+ Tooltip,
16
+ message,
14
17
  } from "antd";
15
18
  import Table from "./control-table-x-axis-wrapper";
16
19
  import {
17
- AlignCenterOutlined,
18
- AlignLeftOutlined,
19
- CopyOutlined,
20
- DeleteOutlined,
21
- DownloadOutlined,
22
- EditOutlined,
23
- EyeInvisibleOutlined,
24
- EyeOutlined,
25
- FormOutlined,
26
- FundOutlined,
27
- KeyOutlined,
28
- LineChartOutlined,
29
- MenuOutlined,
30
- PlusCircleOutlined,
31
- PlusOutlined,
32
- ReloadOutlined,
33
- RetweetOutlined,
34
- SearchOutlined,
35
- TableOutlined,
36
- UploadOutlined,
20
+ AlignCenterOutlined,
21
+ AlignLeftOutlined,
22
+ CopyOutlined,
23
+ DeleteOutlined,
24
+ DownloadOutlined,
25
+ EditOutlined,
26
+ EyeInvisibleOutlined,
27
+ EyeOutlined,
28
+ FormOutlined,
29
+ FundOutlined,
30
+ KeyOutlined,
31
+ LineChartOutlined,
32
+ MenuOutlined,
33
+ PlusCircleOutlined,
34
+ PlusOutlined,
35
+ ReloadOutlined,
36
+ RetweetOutlined,
37
+ SearchOutlined,
38
+ TableOutlined,
39
+ UploadOutlined,
37
40
  } from "@ant-design/icons";
38
41
  import "./index.css";
39
42
  import {
40
- ActTableMode,
41
- ActTableViewModel,
42
- AddOrUpdate,
43
- BuiltInButtonName,
44
- ClassAddConfig,
45
- ColumnConfig, CustomButton, DoEditParam,
46
- DtmplData,
47
- JumpConfig,
48
- LtmplConfig,
49
- QueryKey,
50
- SelectedRow, ShowViewParam,
51
- TmplBaseProps,
43
+ ActTableMode,
44
+ ActTableViewModel,
45
+ AddOrUpdate,
46
+ BuiltInButtonName,
47
+ ClassAddConfig,
48
+ ColumnConfig,
49
+ CustomButton,
50
+ DoEditParam,
51
+ DtmplData,
52
+ JumpConfig,
53
+ LtmplConfig,
54
+ QueryKey,
55
+ SelectedRow,
56
+ ShowViewParam,
57
+ TmplBaseProps,
52
58
  } from "../tmpl/interface";
53
59
  import TableUnits from "./table-util";
54
60
  import SupportInputTypes from "../tmpl/control-type-supportor";
@@ -58,8 +64,8 @@ import CriteriaForm from "./../form/criteria-form";
58
64
  import ViewControl from "../controls/view-control";
59
65
  import Units from "../units";
60
66
  import ColumnSelector from "./column/column-selector";
61
- import ExportFrame, {ExportType} from "../export/export-frame";
62
- import {SortableHandle} from "react-sortable-hoc";
67
+ import ExportFrame, { ExportType } from "../export/export-frame";
68
+ import { SortableHandle } from "react-sortable-hoc";
63
69
  import L2ActTable from "./l2-act-table";
64
70
 
65
71
  import Action from "../controls/action";
@@ -68,16 +74,16 @@ import ActionUtils from "../controls/action/utils";
68
74
  import CquickButton from "../controls/cquery/cquick-button";
69
75
  import CollapseCard from "../controls/collapse-card";
70
76
  import ToolTipBar from "../detail/tooltipbar";
71
- import {LocaleContext} from "../locale/LocaleProvider";
77
+ import { LocaleContext } from "../locale/LocaleProvider";
72
78
  import BlockMenuTreeDrawer from "../module/block-menu-tree-drawer";
73
79
  import EditButton from "../detail/button/edit-button";
74
80
  import ViewButton from "../detail/button/view-button";
75
81
  import ProgramConfig from "../units";
76
82
 
77
83
  const DragHandle = SortableHandle(() => (
78
- <MenuOutlined style={{cursor: "grab", color: "#999"}}/>
84
+ <MenuOutlined style={{ cursor: "grab", color: "#999" }} />
79
85
  ));
80
- const {Panel} = Collapse;
86
+ const { Panel } = Collapse;
81
87
 
82
88
  type Level = "l1" | "l2";
83
89
 
@@ -85,1441 +91,1517 @@ const defaultDisabledColIds: string[] = ["20000", "10000"];
85
91
  let refresh = true;
86
92
 
87
93
  interface ActTableProps extends TmplBaseProps {
88
- criteriaData: object;
89
- pageNo: number;
90
- pageSize: number;
91
- onChangePage: (pageNo: number, pageSize: number) => void;
92
- ltmplConfig: LtmplConfig;
93
- menuId?: string;
94
- showView?: (showVievParam: ShowViewParam) => void;
95
- doCreate?: (addtmplId: string, toCustomPage: boolean) => void;
96
- customCreatable?: boolean;
97
- doEdit?: (doEditParam: DoEditParam) => void;
98
- customEditable?: boolean;
99
- doDelete?: (code: string) => void;
100
- doSearch?: (params: object) => void;
101
- doRAction?: (ractionId: string, mainCode: string) => void;
102
- level?: Level;
103
- funcMode?: ActTableMode;
104
- title?: ReactNode;
105
- tip?: any;
106
- collapsible?: boolean;
107
- initCollapse?: boolean;
108
- readOnly?: boolean;
94
+ criteriaData: object;
95
+ pageNo: number;
96
+ pageSize: number;
97
+ onChangePage: (pageNo: number, pageSize: number) => void;
98
+ ltmplConfig: LtmplConfig;
99
+ menuId?: string;
100
+ showView?: (showVievParam: ShowViewParam) => void;
101
+ doCreate?: (addtmplId: string, toCustomPage: boolean) => void;
102
+ customCreatable?: boolean;
103
+ doEdit?: (doEditParam: DoEditParam) => void;
104
+ customEditable?: boolean;
105
+ doDelete?: (code: string) => void;
106
+ doSearch?: (params: object) => void;
107
+ doRAction?: (ractionId: string, mainCode: string) => void;
108
+ level?: Level;
109
+ funcMode?: ActTableMode;
110
+ title?: ReactNode;
111
+ tip?: any;
112
+ collapsible?: boolean;
113
+ initCollapse?: boolean;
114
+ readOnly?: boolean;
109
115
  }
110
116
 
111
117
  interface ActTableStat {
112
- //tableColumns?: object[];
113
- sortedColConfigs?: ColumnConfig[];
114
- queryKey?: QueryKey;
115
- loading?: boolean;
116
- selectedRows?: SelectedRow[];
117
- selectedDatas?: DtmplData[];
118
- hiddenColIds?: string[];
119
- drillingColIds?: string[];
120
- disabledColIds?: string[];
121
- hiddenRowCodes?: string[];
122
- viewModels?: ActTableViewModel[];
123
- showL2ActTable?: boolean;
124
- showL2Chart?: boolean;
125
- recordCode?: string;
126
- blockMenuTreeDrawerOpen?: boolean;
127
- showCustomCard?: boolean;
128
- customButton?: CustomButton;
129
- customButtonData?: DtmplData[];
118
+ //tableColumns?: object[];
119
+ sortedColConfigs?: ColumnConfig[];
120
+ queryKey?: QueryKey;
121
+ loading?: boolean;
122
+ selectedRows?: SelectedRow[];
123
+ selectedDatas?: DtmplData[];
124
+ hiddenColIds?: string[];
125
+ drillingColIds?: string[];
126
+ disabledColIds?: string[];
127
+ hiddenRowCodes?: string[];
128
+ viewModels?: ActTableViewModel[];
129
+ showL2ActTable?: boolean;
130
+ showL2Chart?: boolean;
131
+ recordCode?: string;
132
+ blockMenuTreeDrawerOpen?: boolean;
133
+ showCustomCard?: boolean;
134
+ customButton?: CustomButton;
135
+ customButtonData?: DtmplData[];
130
136
  }
131
137
 
132
138
  class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
133
- state = {
134
- //tableColumns: undefined,
135
- sortedColConfigs: undefined,
136
- queryKey: undefined,
137
- loading: true,
138
- disableCols: undefined,
139
- hiddenColIds: defaultDisabledColIds,
140
- selectedRows: [],
141
- selectedDatas: [],
142
- hiddenRowCodes: [],
143
- viewModels: [],
144
- drillingColIds: undefined,
145
- disabledColIds: undefined,
146
- showL2ActTable: false,
147
- showL2Chart: false,
148
- recordCode: undefined,
149
- blockMenuTreeDrawerOpen: false,
150
- showCustomCard: false,
151
- customButtonData: undefined,
152
- customButton: undefined
153
- };
154
-
155
- static contextType = LocaleContext;
156
- context: React.ContextType<typeof LocaleContext>;
157
-
158
- static defaultProps = {
159
- criteriaData: {},
160
- funcMode: "complete",
161
- collapsible: false,
162
- initCollapse: false,
163
- readOnly: false,
164
- };
165
-
166
- loadData = async (
167
- hiddenColIds: string[],
168
- hiddenRowCodes: string[],
169
- sortedColConfigs: ColumnConfig[]
170
- ) => {
171
- const {
172
- sourceId,
173
- criteriaData,
174
- ltmplConfig,
175
- mainCode,
176
- level,
177
- pageNo,
178
- pageSize,
179
- serverKey,
180
- } = this.props;
181
-
182
-
183
- if (!ltmplConfig) {
184
- return;
185
- }
186
-
187
- this.setState({
188
- loading: true,
189
- });
190
- let disabledColIds: string[] = [];
191
- let hiddenColIds_ = [...hiddenColIds];
192
- if (criteriaData && criteriaData["drillingColIds"]) {
193
- let dColIds = [...criteriaData["drillingColIds"]];
194
- ltmplConfig.columns.forEach((item) => {
195
- if (
196
- item.statColType == "dimension" &&
197
- !dColIds.includes(item.id) &&
198
- !hiddenColIds_.includes(item.id)
199
- ) {
200
- hiddenColIds_.push(item.id);
201
- disabledColIds.push(item.id);
202
- }
203
- if (
204
- item.statColType == "dimension" &&
205
- !dColIds.includes(item.id) &&
206
- !disabledColIds.includes(item.id)
207
- ) {
208
- disabledColIds.push(item.id);
209
- }
210
- });
211
- hiddenColIds_ = hiddenColIds_.filter((id) => {
212
- return !dColIds.includes(id);
213
- });
214
- }
215
- ltmplConfig.columns.forEach((item) => {
216
- if (item.hidden) {
217
- hiddenColIds_.push(item.id);
218
- }
219
- });
220
- /** 构建column **/
221
- // let tableColumns = this.buildTableColumns(ltmplConfig, hiddenColIds_, hiddenRowCodes, sortedColConfigs);
222
-
223
- const {defaultPageSize} = ltmplConfig;
224
-
225
- let pageInfo = {
226
- pageNo: pageNo ? pageNo : 1,
227
- pageSize: pageSize ? pageSize : defaultPageSize ? defaultPageSize : 10,
228
- virtualEndPageNo: undefined,
229
- };
139
+ state = {
140
+ //tableColumns: undefined,
141
+ sortedColConfigs: undefined,
142
+ queryKey: undefined,
143
+ loading: true,
144
+ disableCols: undefined,
145
+ hiddenColIds: defaultDisabledColIds,
146
+ selectedRows: [],
147
+ selectedDatas: [],
148
+ hiddenRowCodes: [],
149
+ viewModels: [],
150
+ drillingColIds: undefined,
151
+ disabledColIds: undefined,
152
+ showL2ActTable: false,
153
+ showL2Chart: false,
154
+ recordCode: undefined,
155
+ blockMenuTreeDrawerOpen: false,
156
+ showCustomCard: false,
157
+ customButtonData: undefined,
158
+ customButton: undefined,
159
+ };
160
+
161
+ static contextType = LocaleContext;
162
+ context: React.ContextType<typeof LocaleContext>;
163
+
164
+ static defaultProps = {
165
+ criteriaData: {},
166
+ funcMode: "complete",
167
+ collapsible: false,
168
+ initCollapse: false,
169
+ readOnly: false,
170
+ };
171
+
172
+ loadData = async (
173
+ hiddenColIds: string[],
174
+ hiddenRowCodes: string[],
175
+ sortedColConfigs: ColumnConfig[]
176
+ ) => {
177
+ const {
178
+ sourceId,
179
+ criteriaData,
180
+ ltmplConfig,
181
+ mainCode,
182
+ level,
183
+ pageNo,
184
+ pageSize,
185
+ serverKey,
186
+ } = this.props;
187
+
188
+ if (!ltmplConfig) {
189
+ return;
190
+ }
230
191
 
231
- /** 构建 dataSource **/
232
- //构建过滤条件
233
- let queryKey: QueryKey;
234
- if (level && level == "l2") {
235
- queryKey = await HcserviceV3.requestL2LtmplQueryKey(serverKey, sourceId, {
236
- ...criteriaData,
237
- ...pageInfo,
238
- mainCode,
239
- });
240
- } else {
241
- queryKey = await HcserviceV3.requestLtmplQueryKey(serverKey, sourceId, {
242
- ...criteriaData,
243
- ...pageInfo,
244
- mainCode,
245
- });
192
+ this.setState({
193
+ loading: true,
194
+ });
195
+ let disabledColIds: string[] = [];
196
+ let hiddenColIds_ = [...hiddenColIds];
197
+ if (criteriaData && criteriaData["drillingColIds"]) {
198
+ let dColIds = [...criteriaData["drillingColIds"]];
199
+ ltmplConfig.columns.forEach((item) => {
200
+ if (
201
+ item.statColType == "dimension" &&
202
+ !dColIds.includes(item.id) &&
203
+ !hiddenColIds_.includes(item.id)
204
+ ) {
205
+ hiddenColIds_.push(item.id);
206
+ disabledColIds.push(item.id);
246
207
  }
247
-
248
- if (!queryKey.sourceId || queryKey.sourceId == this.props.sourceId) {
249
- this.setState({
250
- disabledColIds,
251
- hiddenColIds: hiddenColIds_,
252
- hiddenRowCodes,
253
- sortedColConfigs,
254
- queryKey,
255
- showL2Chart: false,
256
- selectedRows: [],
257
- selectedDatas: [],
258
- viewModels:
259
- this.state.viewModels.length > 0 ? this.state.viewModels : ["table"],
260
- });
208
+ if (
209
+ item.statColType == "dimension" &&
210
+ !dColIds.includes(item.id) &&
211
+ !disabledColIds.includes(item.id)
212
+ ) {
213
+ disabledColIds.push(item.id);
261
214
  }
262
- this.setState({
263
- loading: false,
264
- });
215
+ });
216
+ hiddenColIds_ = hiddenColIds_.filter((id) => {
217
+ return !dColIds.includes(id);
218
+ });
219
+ }
220
+ ltmplConfig.columns.forEach((item) => {
221
+ if (item.hidden) {
222
+ hiddenColIds_.push(item.id);
223
+ }
224
+ });
225
+ /** 构建column **/
226
+ // let tableColumns = this.buildTableColumns(ltmplConfig, hiddenColIds_, hiddenRowCodes, sortedColConfigs);
227
+
228
+ const { defaultPageSize } = ltmplConfig;
229
+
230
+ let pageInfo = {
231
+ pageNo: pageNo ? pageNo : 1,
232
+ pageSize: pageSize ? pageSize : defaultPageSize ? defaultPageSize : 10,
233
+ virtualEndPageNo: undefined,
265
234
  };
266
235
 
267
- doCustomButton = (customButton: CustomButton, records: DtmplData[]) => {
268
- let page=ProgramConfig.getCustomPage(customButton.id);
269
- if(!page){
270
- message.error("Not Found Custom Page");
271
- }else{
272
- //if(customButton.){
273
- this.setState({
274
- showCustomCard: true,
275
- customButton,
276
- customButtonData: records
277
- })
278
- // }
279
- }
280
-
236
+ /** 构建 dataSource **/
237
+ //构建过滤条件
238
+ let queryKey: QueryKey;
239
+ if (level && level == "l2") {
240
+ queryKey = await HcserviceV3.requestL2LtmplQueryKey(serverKey, sourceId, {
241
+ ...criteriaData,
242
+ ...pageInfo,
243
+ mainCode,
244
+ });
245
+ } else {
246
+ queryKey = await HcserviceV3.requestLtmplQueryKey(serverKey, sourceId, {
247
+ ...criteriaData,
248
+ ...pageInfo,
249
+ mainCode,
250
+ });
281
251
  }
282
252
 
283
- renderAboveCustomPage=()=>{
284
- return this.renderCustomPage('above-table');
285
- }
286
-
287
- renderOhterCustomPage=()=>{
288
- return <>
289
- {this.renderCustomPage('under-table')}
290
- { this.renderCustomPage('modal-window')}
291
- { this.renderCustomPage('left-drawer')}
292
- { this.renderCustomPage('right-drawer')}
293
- </> ;
294
- }
295
-
296
- renderCustomPage = (windowPosition:'under-table'|'above-table'|'modal-window'|'left-drawer'|'right-drawer') => {
297
- const {translate} = this.context;
298
- const {customButton, customButtonData} = this.state;
299
-
300
- if (!customButton) {
301
- return "";
302
- }
303
- if(windowPosition && windowPosition !=customButton.windowPosition){
304
- return "";
305
- }
306
- let customProps = {'customButton': customButton, "data": customButtonData};
307
- let page=ProgramConfig.getCustomPage(customButton.id);
308
- let customElement= React.createElement(page, customProps);
309
- if (customButton.windowPosition == 'under-table' || customButton.windowPosition == 'above-table') {
310
- return <Card id={"CustomCard"+customButton.id} size={'small'} style={{marginTop: '6px'}}
311
- extra={<Button size={"small"} danger={true}
312
- onClick={() => {
313
- this.setState({customButton: undefined})
314
- }}> {translate("${关闭}")}</Button>}>
315
- {customElement}
316
- </Card>
317
- }else if(customButton.windowPosition == 'left-drawer' || customButton.windowPosition == 'right-drawer'){
318
- return <Drawer open={true} id={"CustomCard"+customButton.id} placement={customButton.windowPosition=='right-drawer'?'right':'left'} width={customButton.windowWidth}
319
- onClose={() => {this.setState({customButton: undefined})}}>
320
- {customElement}
321
- </Drawer>
322
- }else if(customButton.windowPosition == 'modal-window'){
323
-
324
- return <Modal open={true} closable ={true} width={customButton.windowWidth} style={{'height':customButton.windowHeight}}
325
- onCancel={() => {this.setState({customButton: undefined})}}>
326
- {customElement}
327
- </Modal>
328
- }
253
+ if (!queryKey.sourceId || queryKey.sourceId == this.props.sourceId) {
254
+ this.setState({
255
+ disabledColIds,
256
+ hiddenColIds: hiddenColIds_,
257
+ hiddenRowCodes,
258
+ sortedColConfigs,
259
+ queryKey,
260
+ showL2Chart: false,
261
+ selectedRows: [],
262
+ selectedDatas: [],
263
+ viewModels:
264
+ this.state.viewModels.length > 0 ? this.state.viewModels : ["table"],
265
+ });
329
266
  }
330
-
331
- buildTableColumns = (
332
- ltmplConfig: LtmplConfig,
333
- hiddenColIds: string[],
334
- hiddenRowCodes: string[],
335
- sortedColConfigs: ColumnConfig[]
336
- ) => {
337
- const {
338
- showView,
339
- doEdit,
340
- doRAction,
341
- customEditable,
342
- serverKey,
343
- readOnly,
344
- sourceId,
345
- } = this.props;
346
- const {translate} = this.context;
347
- const {buttons, builtInButtons} = ltmplConfig;
348
- let tableColumns = [];
349
- let s = 0;
350
- let colConfigs = sortedColConfigs ? sortedColConfigs : ltmplConfig.columns;
351
-
352
- let currentDataColIndex = 0;
353
-
354
- colConfigs.forEach((item) => {
355
- let column = {};
356
- if (!hiddenColIds || !hiddenColIds.includes(item.id)) {
357
- tableColumns.push(column);
358
- }
359
- column["title"] = item.title;
360
- column["dataIndex"] = item.id;
361
- if (item["colWidth"]) column["width"] = item["colWidth"];
362
- if (item["statColType"]) column["statColType"] = item["statColType"];
363
- if (item["aggFunc"]) column["cal"] = item["aggFunc"];
364
- if (item["order"]) column["order"] = Number(item["order"]);
365
- // column['ellipsis']= true;
366
- s++;
367
- let itemType = SupportInputTypes.getSupportControlType(item);
368
- if (s < 12 && item.title != "操作" && item.title != "序号") {
369
- if (hiddenColIds.includes("10000")) {
370
- TableUnits.sort(column, itemType);
267
+ this.setState({
268
+ loading: false,
269
+ });
270
+ };
271
+
272
+ doCustomButton = (customButton: CustomButton, records: DtmplData[]) => {
273
+ let page = ProgramConfig.getCustomPage(customButton.id);
274
+ if (!page) {
275
+ message.error("Not Found Custom Page");
276
+ } else {
277
+ //if(customButton.){
278
+ this.setState({
279
+ showCustomCard: true,
280
+ customButton,
281
+ customButtonData: records,
282
+ });
283
+ // }
284
+ }
285
+ };
286
+
287
+ renderAboveCustomPage = () => {
288
+ return this.renderCustomPage("above-table");
289
+ };
290
+
291
+ renderOhterCustomPage = () => {
292
+ return (
293
+ <>
294
+ {this.renderCustomPage("under-table")}
295
+ {this.renderCustomPage("modal-window")}
296
+ {this.renderCustomPage("left-drawer")}
297
+ {this.renderCustomPage("right-drawer")}
298
+ </>
299
+ );
300
+ };
301
+
302
+ renderCustomPage = (
303
+ windowPosition:
304
+ | "under-table"
305
+ | "above-table"
306
+ | "modal-window"
307
+ | "left-drawer"
308
+ | "right-drawer"
309
+ ) => {
310
+ const { translate } = this.context;
311
+ const { customButton, customButtonData } = this.state;
312
+
313
+ if (!customButton) {
314
+ return "";
315
+ }
316
+ if (windowPosition && windowPosition != customButton.windowPosition) {
317
+ return "";
318
+ }
319
+ let customProps = { customButton: customButton, data: customButtonData };
320
+ let page = ProgramConfig.getCustomPage(customButton.id);
321
+ let customElement = React.createElement(page, customProps);
322
+ if (
323
+ customButton.windowPosition == "under-table" ||
324
+ customButton.windowPosition == "above-table"
325
+ ) {
326
+ return (
327
+ <Card
328
+ id={"CustomCard" + customButton.id}
329
+ size={"small"}
330
+ style={{ marginTop: "6px" }}
331
+ extra={
332
+ <Button
333
+ size={"small"}
334
+ danger={true}
335
+ onClick={() => {
336
+ this.setState({ customButton: undefined });
337
+ }}
338
+ >
339
+ {" "}
340
+ {translate("${关闭}")}
341
+ </Button>
342
+ }
343
+ >
344
+ {customElement}
345
+ </Card>
346
+ );
347
+ } else if (
348
+ customButton.windowPosition == "left-drawer" ||
349
+ customButton.windowPosition == "right-drawer"
350
+ ) {
351
+ return (
352
+ <Drawer
353
+ open={true}
354
+ id={"CustomCard" + customButton.id}
355
+ placement={
356
+ customButton.windowPosition == "right-drawer" ? "right" : "left"
357
+ }
358
+ width={customButton.windowWidth}
359
+ onClose={() => {
360
+ this.setState({ customButton: undefined });
361
+ }}
362
+ >
363
+ {customElement}
364
+ </Drawer>
365
+ );
366
+ } else if (customButton.windowPosition == "modal-window") {
367
+ return (
368
+ <Modal
369
+ open={true}
370
+ closable={true}
371
+ width={customButton.windowWidth}
372
+ style={{ height: customButton.windowHeight }}
373
+ onCancel={() => {
374
+ this.setState({ customButton: undefined });
375
+ }}
376
+ >
377
+ {customElement}
378
+ </Modal>
379
+ );
380
+ }
381
+ };
382
+
383
+ buildTableColumns = (
384
+ ltmplConfig: LtmplConfig,
385
+ hiddenColIds: string[],
386
+ hiddenRowCodes: string[],
387
+ sortedColConfigs: ColumnConfig[]
388
+ ) => {
389
+ const {
390
+ showView,
391
+ doEdit,
392
+ doRAction,
393
+ customEditable,
394
+ serverKey,
395
+ readOnly,
396
+ sourceId,
397
+ } = this.props;
398
+ const { translate } = this.context;
399
+ const { buttons, builtInButtons } = ltmplConfig;
400
+ let tableColumns = [];
401
+ let s = 0;
402
+ let colConfigs = sortedColConfigs ? sortedColConfigs : ltmplConfig.columns;
403
+
404
+ let currentDataColIndex = 0;
405
+
406
+ colConfigs.forEach((item) => {
407
+ let column = {};
408
+ if (!hiddenColIds || !hiddenColIds.includes(item.id)) {
409
+ tableColumns.push(column);
410
+ }
411
+ column["title"] = item.title;
412
+ column["dataIndex"] = item.id;
413
+ if (item["colWidth"]) column["width"] = item["colWidth"];
414
+ if (item["statColType"]) column["statColType"] = item["statColType"];
415
+ if (item["aggFunc"]) column["cal"] = item["aggFunc"];
416
+ if (item["order"]) column["order"] = Number(item["order"]);
417
+ // column['ellipsis']= true;
418
+ s++;
419
+ let itemType = SupportInputTypes.getSupportControlType(item);
420
+ if (s < 12 && item.title != "操作" && item.title != "序号") {
421
+ if (hiddenColIds.includes("10000")) {
422
+ TableUnits.sort(column, itemType);
423
+ }
424
+ }
425
+ //特殊列处理
426
+ //序号
427
+ if (item.title === "序号") {
428
+ column["width"] = item.colWidth ? item.colWidth : 50;
429
+ column["title"] = translate("${序号}");
430
+ column["align"] = item.valueAlign ? item.valueAlign : "center";
431
+ //item.fixed='left';
432
+ column["render"] = (text, record, index) => <label>{index + 1}</label>;
433
+ item["sorter"] = undefined;
434
+ } else if (item.id == "10000") {
435
+ column["title"] = (
436
+ <Tooltip title={translate("${拖拽排序}")}>
437
+ {translate("${" + item.title + "}")}
438
+ </Tooltip>
439
+ );
440
+ column["width"] = 30;
441
+ column["dataIndex"] = item.id;
442
+ column["className"] = "drag-visible";
443
+ column["render"] = () => <DragHandle />;
444
+ } else if (item.id == "20000") {
445
+ //隐藏
446
+ column["align"] = "center";
447
+ column["width"] = 40;
448
+ column["title"] = (
449
+ <>
450
+ {hiddenRowCodes.length > 0 ? (
451
+ <Tooltip title={translate("${取消隐藏}")}>
452
+ <Button
453
+ style={{ marginRight: "0px" }}
454
+ size="small"
455
+ shape={"circle"}
456
+ icon={<EyeOutlined />}
457
+ type={"text"}
458
+ onClick={() => this.unHiden()}
459
+ ></Button>
460
+ </Tooltip>
461
+ ) : (
462
+ ""
463
+ )}
464
+ </>
465
+ );
466
+ column["render"] = (text, record) => (
467
+ <Tooltip title={translate("${隐藏}")}>
468
+ {" "}
469
+ <Button
470
+ style={{ marginRight: "0px" }}
471
+ icon={<EyeInvisibleOutlined />}
472
+ type="dashed"
473
+ size="small"
474
+ onClick={() => this.onHide(record.code)}
475
+ ></Button>
476
+ </Tooltip>
477
+ );
478
+ } else if (item.title === "操作") {
479
+ column["fixed"] = "right";
480
+ column["align"] = "center";
481
+ column["width"] = item.colWidth ? item.colWidth : 160;
482
+ column["className"] = "opsColumn";
483
+ column["title"] = <>{translate("${操作}")}</>;
484
+ column["render"] = (text, record) => (
485
+ <Space size={[0, 4]} wrap>
486
+ {buttons.includes("detail") &&
487
+ showView &&
488
+ ActionUtils.isShow(
489
+ ltmplConfig.buttonViewAction?.preposes,
490
+ [record],
491
+ undefined
492
+ ) ? (
493
+ <ViewButton
494
+ showView={showView}
495
+ data={record}
496
+ ltmplConfig={ltmplConfig}
497
+ ></ViewButton>
498
+ ) : (
499
+ ""
500
+ )}
501
+ {buttons.includes("customDetail") &&
502
+ showView &&
503
+ ActionUtils.isShow(
504
+ ltmplConfig.buttonViewAction?.preposes,
505
+ [record],
506
+ undefined
507
+ ) ? (
508
+ <Button
509
+ size="small"
510
+ type="primary"
511
+ icon={<AlignLeftOutlined />}
512
+ onClick={() => showView({ code: record.code })}
513
+ ></Button>
514
+ ) : (
515
+ ""
516
+ )}
517
+ {buttons.includes("dtmplEdit") && doEdit && !readOnly ? (
518
+ <EditButton
519
+ doEdit={doEdit}
520
+ data={record}
521
+ ltmplConfig={ltmplConfig}
522
+ ></EditButton>
523
+ ) : (
524
+ ""
525
+ )}
526
+ {builtInButtons?.includes("blockAuthMenuTree") && !readOnly ? (
527
+ <Button
528
+ size="small"
529
+ type="dashed"
530
+ icon={
531
+ <KeyOutlined
532
+ rotate={180}
533
+ style={{ color: "#f5222d", marginRight: "4px" }}
534
+ />
371
535
  }
372
- }
373
- //特殊列处理
374
- //序号
375
- if (item.title === "序号") {
376
- column["width"] = item.colWidth ? item.colWidth : 50;
377
- column["title"] = translate("${序号}");
378
- column["align"] = item.valueAlign ? item.valueAlign : "center";
379
- //item.fixed='left';
380
- column["render"] = (text, record, index) => <label>{index + 1}</label>;
381
- item["sorter"] = undefined;
382
- } else if (item.id == "10000") {
383
- column["title"] = (
384
- <Tooltip title={translate("${拖拽排序}")}>
385
- {translate("${" + item.title + "}")}
386
- </Tooltip>
387
- );
388
- column["width"] = 30;
389
- column["dataIndex"] = item.id;
390
- column["className"] = "drag-visible";
391
- column["render"] = () => <DragHandle/>;
392
- } else if (item.id == "20000") {
393
- //隐藏
394
- column["align"] = "center";
395
- column["width"] = 40;
396
- column["title"] = (
397
- <>
398
- {hiddenRowCodes.length > 0 ? (
399
- <Tooltip title={translate("${取消隐藏}")}>
400
- <Button
401
- style={{marginRight: "0px"}}
402
- size="small"
403
- shape={"circle"}
404
- icon={<EyeOutlined/>}
405
- type={"text"}
406
- onClick={() => this.unHiden()}
407
- ></Button>
408
- </Tooltip>
409
- ) : (
410
- ""
411
- )}
412
- </>
413
- );
414
- column["render"] = (text, record) => (
415
- <Tooltip title={translate("${隐藏}")}>
416
- {" "}
417
- <Button
418
- style={{marginRight: "0px"}}
419
- icon={<EyeInvisibleOutlined/>}
420
- type="dashed"
421
- size="small"
422
- onClick={() => this.onHide(record.code)}
423
- ></Button>
424
- </Tooltip>
425
- );
426
- } else if (item.title === "操作") {
427
- column["fixed"] = "right";
428
- column["align"] = "center";
429
- column["width"] = item.colWidth ? item.colWidth : 160;
430
- column["className"] = "opsColumn";
431
- column["title"] = <>{translate("${操作}")}</>;
432
- column["render"] = (text, record) => (
433
- <Space size={[0, 4]} wrap>
434
- {buttons.includes("detail") && showView && (ActionUtils.isShow(
435
- ltmplConfig.buttonViewAction?.preposes,
436
- [record],
437
- undefined
438
- )) ? (<ViewButton showView={showView} data={record} ltmplConfig={ltmplConfig}></ViewButton>
439
- ) : (
440
- ""
441
- )}
442
- {buttons.includes("customDetail") && showView &&
443
- (ActionUtils.isShow(
444
- ltmplConfig.buttonViewAction?.preposes,
445
- [record],
446
- undefined
447
- )) ?
448
- <Button
449
- size="small"
450
- type="primary"
451
- icon={<AlignLeftOutlined/>}
452
- onClick={() => showView({code: record.code})}
453
- ></Button> :
454
- ""}
455
- {buttons.includes("dtmplEdit") &&
456
- doEdit &&
457
- !readOnly ?
458
- (<EditButton doEdit={doEdit} data={record} ltmplConfig={ltmplConfig}></EditButton>) : (
459
- "")}
460
- {builtInButtons?.includes("blockAuthMenuTree") && !readOnly ? (
461
- <Button
462
- size="small"
463
- type="dashed"
464
- icon={
465
- <KeyOutlined
466
- rotate={180}
467
- style={{color: "#f5222d", marginRight: "4px"}}
468
- />
469
- }
470
- onClick={() =>
471
- this.setState({
472
- blockMenuTreeDrawerOpen: true,
473
- recordCode: record.code,
474
- })
475
- }
476
- ></Button>
477
- ) : (
478
- ""
479
- )}
480
- {(buttons.includes("dtmplCustomEdit") || customEditable) &&
481
- doEdit &&
482
- !readOnly &&
483
- (ActionUtils.isShow(
484
- ltmplConfig.buttonEditAction?.preposes,
485
- [record],
486
- undefined
487
- )) ? (
488
- <Button
489
- size="small"
490
- type="dashed"
491
- icon={<FormOutlined/>}
492
- onClick={() => doEdit({code: record.code, mode: "update", toCustomPage: true})}
493
- ></Button>
494
- ) : (
495
- ""
496
- )}
497
- {buttons.includes("copy") && doEdit && !readOnly ? (
498
- <Tooltip title={translate("${复制}")}>
499
- <Button
500
- size="small"
501
- type="dashed"
502
- icon={<CopyOutlined/>}
503
- onClick={async () => {
504
- //先复制
505
- let toCustomPage = false;
506
- if (buttons.includes("dtmplCustomEdit") || customEditable) {
507
- toCustomPage = true;
508
- }
509
- let code = await HcserviceV3.doCopy(
510
- serverKey,
511
- sourceId,
512
- record.code
513
- );
514
- if (code) {
515
- doEdit({code, mode: "update", toCustomPage});
516
- }
517
- }}
518
- ></Button>
519
- </Tooltip>
520
- ) : (
521
- ""
522
- )}
523
- {ltmplConfig.rowCustomButtons
524
- ? ltmplConfig.rowCustomButtons.map((customButton) => {
525
- return (
526
- <Button
527
- key={customButton.id}
528
- size="small"
529
- type={customButton.buttonType ? customButton.buttonType : 'dashed'}
530
- onClick={() => this.doCustomButton(customButton, [record])}
531
- >
532
- {translate("${" + customButton.title + "}")}
533
- </Button>
534
- );
535
- })
536
- : ""}
537
- {ltmplConfig.ractions && !readOnly
538
- ? ltmplConfig.ractions.map((raction) => {
539
- return (
540
- <Button
541
- key={raction.id}
542
- size="small"
543
- type="dashed"
544
- onClick={() => doRAction(raction.id, record.code)}
545
- >
546
- {translate("${" + raction.title + "}")}
547
- </Button>
548
- );
549
- })
550
- : ""}
551
-
552
- {ltmplConfig.rowActions &&
553
- !readOnly &&
554
- ltmplConfig.rowActions.length > 0
555
- ? ltmplConfig.rowActions.map((action) => {
556
- return (
557
- <Action
558
- serverKey={serverKey}
559
- iconType={"icon"}
560
- key={action.id}
561
- data={[record]}
562
- actionConfig={action}
563
- doAction={this.doRowAction}
564
- buttonSize={"small"}
565
- serial={1}
566
- ></Action>
567
- );
568
- })
569
- : ""}
570
-
571
- {ltmplConfig.rowJumps &&
572
- ltmplConfig.rowJumps.length > 0 &&
573
- !readOnly
574
- ? ltmplConfig.rowJumps.map((jump) => {
575
- return (
576
- <Button
577
- key={jump.id}
578
- size="small"
579
- type="dashed"
580
- onClick={() => this.doRowJump(jump, record)}
581
- >
582
- {translate("${" + jump.title + "}")}
583
- </Button>
584
- );
585
- })
586
- : ""}
587
- {ltmplConfig.rowCQuerys &&
588
- ltmplConfig.rowCQuerys.length > 0 &&
589
- !readOnly
590
- ? ltmplConfig.rowCQuerys.map((cquery) => {
591
- // console.log("record record", record);
592
- return (
593
- <CquickButton
594
- serverKey={serverKey}
595
- key={cquery.id}
596
- size={"small"}
597
- pageType={"drawer"}
598
- // onClick={() => doCQuery(cquery.id)}
599
- cQueryConfig={cquery}
600
- mainCode={
601
- cquery.mainCodeColId
602
- ? record[cquery.mainCodeColId]
603
- : record.code
604
- }
605
- />
606
- );
607
- })
608
- : ""}
609
- {buttons.includes("singleDelete") &&
610
- !readOnly &&
611
- (ActionUtils.isShow(
612
- ltmplConfig.buttonDeleteAction?.preposes,
613
- [record],
614
- undefined
615
- )) ? (
616
- <Popconfirm
617
- placement="rightBottom"
618
- title={translate("${确定要[删除]此数据吗}?")}
619
- onConfirm={() => {
620
- this.doDeleteByCode(record.code);
621
- }}
622
- okText={translate("${确定}")}
623
- cancelText={translate("${取消}")}
624
- okType={"danger"}
625
- >
626
- <Button size="small" type="dashed" danger>
627
- <DeleteOutlined/>
628
- </Button>
629
- </Popconfirm>
630
- ) : (
631
- ""
632
- )}
633
- </Space>
634
- );
635
- } else {
636
- currentDataColIndex++;
637
- column["className"] = "opsColumn";
638
- column["title"] = translate("${" + item.title + "}");
639
- column["width"] = item.colWidth ? item.colWidth : 160;
640
- column["ellipsis"] = {showTitle: true};
641
- column["align"] = item.valueAlign ? item.valueAlign : "left";
642
- if (
643
- ltmplConfig.leftFixedCols &&
644
- ltmplConfig.leftFixedCols >= currentDataColIndex
645
- ) {
646
- column["fixed"] = "left";
647
- } else {
648
- column["fixed"] = item.colFixed
649
- ? item.colFixed == "right"
650
- ? "right"
651
- : "left"
652
- : false;
536
+ onClick={() =>
537
+ this.setState({
538
+ blockMenuTreeDrawerOpen: true,
539
+ recordCode: record.code,
540
+ })
541
+ }
542
+ ></Button>
543
+ ) : (
544
+ ""
545
+ )}
546
+ {(buttons.includes("dtmplCustomEdit") || customEditable) &&
547
+ doEdit &&
548
+ !readOnly &&
549
+ ActionUtils.isShow(
550
+ ltmplConfig.buttonEditAction?.preposes,
551
+ [record],
552
+ undefined
553
+ ) ? (
554
+ <Button
555
+ size="small"
556
+ type="dashed"
557
+ icon={<FormOutlined />}
558
+ onClick={() =>
559
+ doEdit({
560
+ code: record.code,
561
+ mode: "update",
562
+ toCustomPage: true,
563
+ })
653
564
  }
654
- column["render"] = (text, record) => {
655
- return (
656
- <ViewControl
657
- serverKey={serverKey}
658
- fieldConfig={item}
659
- value={record[item.id]}
660
- holderType={"table"}
661
- />
565
+ ></Button>
566
+ ) : (
567
+ ""
568
+ )}
569
+ {buttons.includes("copy") && doEdit && !readOnly ? (
570
+ <Tooltip title={translate("${复制}")}>
571
+ <Button
572
+ size="small"
573
+ type="dashed"
574
+ icon={<CopyOutlined />}
575
+ onClick={async () => {
576
+ //先复制
577
+ let toCustomPage = false;
578
+ if (buttons.includes("dtmplCustomEdit") || customEditable) {
579
+ toCustomPage = true;
580
+ }
581
+ let code = await HcserviceV3.doCopy(
582
+ serverKey,
583
+ sourceId,
584
+ record.code
662
585
  );
663
- };
664
- }
665
- });
666
-
667
- console.log(tableColumns);
668
-
669
- return tableColumns;
670
- };
671
-
672
- async componentDidMount() {
673
- const {ltmplConfig} = this.props;
674
- const {translate} = this.context;
675
- let sortedColConfigs = undefined;
676
- if (ltmplConfig) {
677
- sortedColConfigs = [
678
- {id: "10000", title: translate("${排序}")},
679
- ...ltmplConfig.columns,
680
- {id: "20000", title: translate("${隐藏}")},
681
- ];
682
- }
683
- this.loadData(defaultDisabledColIds, [], sortedColConfigs);
684
- }
685
-
686
- async componentDidUpdate(prevProps) {
687
- const {sourceId, criteriaData, ltmplConfig} = this.props;
688
- const {translate} = this.context;
689
- let {
690
- ltmplConfig: preLtmplConfig,
691
- criteriaData: preCriteriaData,
692
- sourceId: preSourceId,
693
- } = prevProps;
694
-
695
- let {hiddenColIds, sortedColConfigs} = this.state;
696
-
586
+ if (code) {
587
+ doEdit({ code, mode: "update", toCustomPage });
588
+ }
589
+ }}
590
+ ></Button>
591
+ </Tooltip>
592
+ ) : (
593
+ ""
594
+ )}
595
+ {ltmplConfig.rowCustomButtons
596
+ ? ltmplConfig.rowCustomButtons.map((customButton) => {
597
+ return (
598
+ <Button
599
+ key={customButton.id}
600
+ size="small"
601
+ type={
602
+ customButton.buttonType
603
+ ? customButton.buttonType
604
+ : "dashed"
605
+ }
606
+ onClick={() =>
607
+ this.doCustomButton(customButton, [record])
608
+ }
609
+ >
610
+ {translate("${" + customButton.title + "}")}
611
+ </Button>
612
+ );
613
+ })
614
+ : ""}
615
+ {ltmplConfig.ractions && !readOnly
616
+ ? ltmplConfig.ractions.map((raction) => {
617
+ return (
618
+ <Button
619
+ key={raction.id}
620
+ size="small"
621
+ type="dashed"
622
+ onClick={() => doRAction(raction.id, record.code)}
623
+ >
624
+ {translate("${" + raction.title + "}")}
625
+ </Button>
626
+ );
627
+ })
628
+ : ""}
629
+
630
+ {ltmplConfig.rowActions &&
631
+ !readOnly &&
632
+ ltmplConfig.rowActions.length > 0
633
+ ? ltmplConfig.rowActions.map((action) => {
634
+ return (
635
+ <Action
636
+ serverKey={serverKey}
637
+ iconType={"icon"}
638
+ key={action.id}
639
+ data={[record]}
640
+ actionConfig={action}
641
+ doAction={this.doRowAction}
642
+ buttonSize={"small"}
643
+ serial={1}
644
+ ></Action>
645
+ );
646
+ })
647
+ : ""}
648
+
649
+ {ltmplConfig.rowJumps &&
650
+ ltmplConfig.rowJumps.length > 0 &&
651
+ !readOnly
652
+ ? ltmplConfig.rowJumps.map((jump) => {
653
+ return (
654
+ <Button
655
+ key={jump.id}
656
+ size="small"
657
+ type="dashed"
658
+ onClick={() => this.doRowJump(jump, record)}
659
+ >
660
+ {translate("${" + jump.title + "}")}
661
+ </Button>
662
+ );
663
+ })
664
+ : ""}
665
+ {ltmplConfig.rowCQuerys &&
666
+ ltmplConfig.rowCQuerys.length > 0 &&
667
+ !readOnly
668
+ ? ltmplConfig.rowCQuerys.map((cquery) => {
669
+ // console.log("record record", record);
670
+ return (
671
+ <CquickButton
672
+ serverKey={serverKey}
673
+ key={cquery.id}
674
+ size={"small"}
675
+ pageType={"drawer"}
676
+ // onClick={() => doCQuery(cquery.id)}
677
+ cQueryConfig={cquery}
678
+ mainCode={
679
+ cquery.mainCodeColId
680
+ ? record[cquery.mainCodeColId]
681
+ : record.code
682
+ }
683
+ />
684
+ );
685
+ })
686
+ : ""}
687
+ {buttons.includes("singleDelete") &&
688
+ !readOnly &&
689
+ ActionUtils.isShow(
690
+ ltmplConfig.buttonDeleteAction?.preposes,
691
+ [record],
692
+ undefined
693
+ ) ? (
694
+ <Popconfirm
695
+ placement="rightBottom"
696
+ title={translate("${确定要[删除]此数据吗}?")}
697
+ onConfirm={() => {
698
+ this.doDeleteByCode(record.code);
699
+ }}
700
+ okText={translate("${确定}")}
701
+ cancelText={translate("${取消}")}
702
+ okType={"danger"}
703
+ >
704
+ <Button size="small" type="dashed" danger>
705
+ <DeleteOutlined />
706
+ </Button>
707
+ </Popconfirm>
708
+ ) : (
709
+ ""
710
+ )}
711
+ </Space>
712
+ );
713
+ } else {
714
+ currentDataColIndex++;
715
+ column["className"] = "opsColumn";
716
+ column["title"] = translate("${" + item.title + "}");
717
+ column["width"] = item.colWidth ? item.colWidth : 160;
718
+ column["ellipsis"] = { showTitle: true };
719
+ column["align"] = item.valueAlign ? item.valueAlign : "left";
697
720
  if (
698
- (sourceId && preSourceId != sourceId) ||
699
- (ltmplConfig &&
700
- (!preLtmplConfig || ltmplConfig.id != preLtmplConfig.id)) ||
701
- Units.transQueryParamsToStr(criteriaData, false, [
702
- "pageSize",
703
- "pageNo",
704
- ]) !=
705
- Units.transQueryParamsToStr(preCriteriaData, false, [
706
- "pageSize",
707
- "pageNo",
708
- ])
721
+ ltmplConfig.leftFixedCols &&
722
+ ltmplConfig.leftFixedCols >= currentDataColIndex
709
723
  ) {
710
- //5秒后允许再次请求数据
711
- //refresh=false;
712
-
713
- if (preLtmplConfig && ltmplConfig.id == preLtmplConfig.id) {
714
- await this.loadData(hiddenColIds, [], sortedColConfigs);
715
- } else {
716
- let sColConfigs = undefined;
717
- if (ltmplConfig) {
718
- sColConfigs = [
719
- {id: "10000", title: translate("${排序}")},
720
- ...ltmplConfig.columns,
721
- {id: "20000", title: translate("${隐藏}")},
722
- ];
723
- }
724
- this.setState({
725
- viewModels: ["table"],
726
- });
727
- await this.loadData(defaultDisabledColIds, [], sColConfigs);
728
- }
729
- // setTimeout( function() {
730
- // refresh=true;
731
- // },112000);
724
+ column["fixed"] = "left";
725
+ } else {
726
+ column["fixed"] = item.colFixed
727
+ ? item.colFixed == "right"
728
+ ? "right"
729
+ : "left"
730
+ : false;
732
731
  }
732
+ column["render"] = (text, record) => {
733
+ return (
734
+ <ViewControl
735
+ serverKey={serverKey}
736
+ fieldConfig={item}
737
+ value={record[item.id]}
738
+ holderType={"table"}
739
+ />
740
+ );
741
+ };
742
+ }
743
+ });
744
+
745
+ console.log(tableColumns);
746
+
747
+ return tableColumns;
748
+ };
749
+
750
+ async componentDidMount() {
751
+ const { ltmplConfig } = this.props;
752
+ const { translate } = this.context;
753
+ let sortedColConfigs = undefined;
754
+ if (ltmplConfig) {
755
+ sortedColConfigs = [
756
+ { id: "10000", title: translate("${排序}") },
757
+ ...ltmplConfig.columns,
758
+ { id: "20000", title: translate("${隐藏}") },
759
+ ];
733
760
  }
761
+ this.loadData(defaultDisabledColIds, [], sortedColConfigs);
762
+ }
734
763
 
735
- handleShowChart = () => {
736
- this.setState({
737
- showL2Chart: !this.state.showL2Chart,
738
- });
739
- };
740
-
741
- handleDataAnalysis = () => {
742
- this.setState({
743
- showL2ActTable: !this.state.showL2ActTable,
744
- });
745
- };
746
-
747
- unHiden = () => {
748
- const {ltmplConfig} = this.props;
749
- const {hiddenColIds, sortedColConfigs} = this.state;
750
- this.setState({
751
- hiddenRowCodes: [],
752
- // tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, [], sortedColConfigs),
753
- });
754
- };
755
-
756
- onHide = (code: string) => {
757
- const {ltmplConfig} = this.props;
758
- const {hiddenRowCodes, hiddenColIds, sortedColConfigs} = this.state;
759
- let hiddenCodes = [...hiddenRowCodes, code];
760
- this.setState({
761
- hiddenRowCodes: hiddenCodes,
762
- // tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, hiddenCodes, sortedColConfigs),
763
- });
764
- };
765
-
766
- changeViewModel = (viewModels) => {
767
- this.setState({
768
- viewModels,
769
- });
770
- };
771
-
772
- changeHiddenColumns = (hiddenColIds: string[]) => {
773
- const {} = this.props;
774
- const {} = this.state;
775
- this.setState({
776
- showL2Chart: false,
777
- hiddenColIds,
778
- // tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, hiddenRowCodes, sortedColConfigs),
779
- });
780
- };
781
-
782
- doSelectedAction = async (actionId: string, codes, params: object) => {
783
- const {selectedRows} = this.state;
784
- this.doAction(actionId, selectedRows, params);
785
- };
786
-
787
- doAction = async (actionId: string, selectedRows: SelectedRow[], params) => {
788
- const {serverKey} = this.props;
789
- const {hiddenColIds, hiddenRowCodes, sortedColConfigs} = this.state;
790
- this.setState({
791
- loading: true,
792
- });
793
- let result: boolean = await HcserviceV3.postActions(
794
- serverKey,
795
- actionId,
796
- selectedRows,
797
- params
798
- );
799
- if (result) {
800
- //重新加载数据
801
- this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
802
- } else {
803
- this.setState({
804
- loading: false,
805
- });
764
+ async componentDidUpdate(prevProps) {
765
+ const { sourceId, criteriaData, ltmplConfig } = this.props;
766
+ const { translate } = this.context;
767
+ let {
768
+ ltmplConfig: preLtmplConfig,
769
+ criteriaData: preCriteriaData,
770
+ sourceId: preSourceId,
771
+ } = prevProps;
772
+
773
+ let { hiddenColIds, sortedColConfigs } = this.state;
774
+
775
+ if (
776
+ (sourceId && preSourceId != sourceId) ||
777
+ (ltmplConfig &&
778
+ (!preLtmplConfig || ltmplConfig.id != preLtmplConfig.id)) ||
779
+ Units.transQueryParamsToStr(criteriaData, false, [
780
+ "pageSize",
781
+ "pageNo",
782
+ ]) !=
783
+ Units.transQueryParamsToStr(preCriteriaData, false, [
784
+ "pageSize",
785
+ "pageNo",
786
+ ])
787
+ ) {
788
+ //5秒后允许再次请求数据
789
+ //refresh=false;
790
+
791
+ if (preLtmplConfig && ltmplConfig.id == preLtmplConfig.id) {
792
+ await this.loadData(hiddenColIds, [], sortedColConfigs);
793
+ } else {
794
+ let sColConfigs = undefined;
795
+ if (ltmplConfig) {
796
+ sColConfigs = [
797
+ { id: "10000", title: translate("${排序}") },
798
+ ...ltmplConfig.columns,
799
+ { id: "20000", title: translate("${隐藏}") },
800
+ ];
806
801
  }
807
- };
808
-
809
- doRowAction = async (actionId: string, codes: string[], params: object) => {
810
- this.doAction(actionId, [{title: undefined, code: codes[0]}], params);
811
- };
812
-
813
- doDelete = async () => {
814
- const {sourceId, serverKey} = this.props;
815
- const {
816
- selectedRows,
817
- hiddenColIds,
818
- hiddenRowCodes,
819
- sortedColConfigs,
820
- } = this.state;
821
802
  this.setState({
822
- loading: true,
803
+ viewModels: ["table"],
823
804
  });
824
- let result: boolean = await HcserviceV3.deleteData(
825
- serverKey,
826
- sourceId,
827
- selectedRows
828
- );
829
- if (result) {
830
- //重新加载数据
831
- this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
832
- } else {
833
- this.setState({
834
- loading: false,
835
- });
836
- }
837
- };
805
+ await this.loadData(defaultDisabledColIds, [], sColConfigs);
806
+ }
807
+ // setTimeout( function() {
808
+ // refresh=true;
809
+ // },112000);
810
+ }
811
+ }
838
812
 
839
- doDeleteByCode = async (code: string) => {
840
- const {sourceId, serverKey} = this.props;
841
- const {hiddenColIds, hiddenRowCodes, sortedColConfigs} = this.state;
842
- this.setState({
843
- loading: true,
844
- });
845
- let result: boolean = await HcserviceV3.deleteByCode(serverKey, sourceId, [
846
- code,
847
- ]);
848
- if (result) {
849
- //重新加载数据
850
- this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
851
- } else {
852
- this.setState({
853
- loading: false,
854
- });
855
- }
856
- };
813
+ handleShowChart = () => {
814
+ this.setState({
815
+ showL2Chart: !this.state.showL2Chart,
816
+ });
817
+ };
818
+
819
+ handleDataAnalysis = () => {
820
+ this.setState({
821
+ showL2ActTable: !this.state.showL2ActTable,
822
+ });
823
+ };
824
+
825
+ unHiden = () => {
826
+ const { ltmplConfig } = this.props;
827
+ const { hiddenColIds, sortedColConfigs } = this.state;
828
+ this.setState({
829
+ hiddenRowCodes: [],
830
+ // tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, [], sortedColConfigs),
831
+ });
832
+ };
833
+
834
+ onHide = (code: string) => {
835
+ const { ltmplConfig } = this.props;
836
+ const { hiddenRowCodes, hiddenColIds, sortedColConfigs } = this.state;
837
+ let hiddenCodes = [...hiddenRowCodes, code];
838
+ this.setState({
839
+ hiddenRowCodes: hiddenCodes,
840
+ // tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, hiddenCodes, sortedColConfigs),
841
+ });
842
+ };
843
+
844
+ changeViewModel = (viewModels) => {
845
+ this.setState({
846
+ viewModels,
847
+ });
848
+ };
849
+
850
+ changeHiddenColumns = (hiddenColIds: string[]) => {
851
+ const {} = this.props;
852
+ const {} = this.state;
853
+ this.setState({
854
+ showL2Chart: false,
855
+ hiddenColIds,
856
+ // tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, hiddenRowCodes, sortedColConfigs),
857
+ });
858
+ };
859
+
860
+ doSelectedAction = async (actionId: string, codes, params: object) => {
861
+ const { selectedRows } = this.state;
862
+ this.doAction(actionId, selectedRows, params);
863
+ };
864
+
865
+ doAction = async (actionId: string, selectedRows: SelectedRow[], params) => {
866
+ const { serverKey } = this.props;
867
+ const { hiddenColIds, hiddenRowCodes, sortedColConfigs } = this.state;
868
+ this.setState({
869
+ loading: true,
870
+ });
871
+ let result: boolean = await HcserviceV3.postActions(
872
+ serverKey,
873
+ actionId,
874
+ selectedRows,
875
+ params
876
+ );
877
+ if (result) {
878
+ //重新加载数据
879
+ this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
880
+ } else {
881
+ this.setState({
882
+ loading: false,
883
+ });
884
+ }
885
+ };
886
+
887
+ doRowAction = async (actionId: string, codes: string[], params: object) => {
888
+ this.doAction(actionId, [{ title: undefined, code: codes[0] }], params);
889
+ };
890
+
891
+ doDelete = async () => {
892
+ const { sourceId, serverKey } = this.props;
893
+ const {
894
+ selectedRows,
895
+ hiddenColIds,
896
+ hiddenRowCodes,
897
+ sortedColConfigs,
898
+ } = this.state;
899
+ this.setState({
900
+ loading: true,
901
+ });
902
+ let result: boolean = await HcserviceV3.deleteData(
903
+ serverKey,
904
+ sourceId,
905
+ selectedRows
906
+ );
907
+ if (result) {
908
+ //重新加载数据
909
+ this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
910
+ } else {
911
+ this.setState({
912
+ loading: false,
913
+ });
914
+ }
915
+ };
916
+
917
+ doDeleteByCode = async (code: string) => {
918
+ const { sourceId, serverKey } = this.props;
919
+ const { hiddenColIds, hiddenRowCodes, sortedColConfigs } = this.state;
920
+ this.setState({
921
+ loading: true,
922
+ });
923
+ let result: boolean = await HcserviceV3.deleteByCode(serverKey, sourceId, [
924
+ code,
925
+ ]);
926
+ if (result) {
927
+ //重新加载数据
928
+ this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs);
929
+ } else {
930
+ this.setState({
931
+ loading: false,
932
+ });
933
+ }
934
+ };
857
935
 
858
- doSelectedCQuery = async (cqueryId: string) => {
859
- };
936
+ doSelectedCQuery = async (cqueryId: string) => {};
860
937
 
861
- doJump = async (jump: JumpConfig, record_: DtmplData) => {
862
- let record = record_.fieldMap ? record_.fieldMap : record_;
938
+ doJump = async (jump: JumpConfig, record_: DtmplData) => {
939
+ let record = record_.fieldMap ? record_.fieldMap : record_;
863
940
 
864
- let url = null;
941
+ let url = null;
865
942
 
866
- let path = jump.path;
867
- if (!path) {
868
- path = "/";
869
- }
870
- //是否以http开头
871
- if (path.indexOf("#") == 0 || url.indexOf("/#") == 0) {
872
- url = "";
873
- } else if (
874
- path.indexOf("http://") == 0 ||
875
- path.indexOf("HTTP://") == 0 ||
876
- path.indexOf("https://") == 0 ||
877
- path.indexOf("HTTPS://") == 0
878
- ) {
879
- url = path.split("//")[0] + "//";
880
- path = path.split("//")[1];
881
- } else {
882
- url = new URL(window.location.href).pathname;
883
- }
884
- //处理路由参数
885
- let paths = path.split("/");
886
-
887
- let routeParamConfigs = jump.routeParams;
888
- if (routeParamConfigs) {
889
- for (let i = 0; i < paths.length; i++) {
890
- if (paths[i].indexOf(":") == 0) {
891
- let pa = paths[i].substring(1);
892
- //根据参数名匹配参数
893
- for (let p of routeParamConfigs) {
894
- if (p && pa == p.title) {
895
- //赋值替换
896
- let v = record[p.id] ? record[p.id] : p.defaultValue;
897
- paths[i] = v;
898
- break;
899
- }
900
- }
901
- }
943
+ let path = jump.path;
944
+ if (!path) {
945
+ path = "/";
946
+ }
947
+ //是否以http开头
948
+ if (path.indexOf("#") == 0 || url.indexOf("/#") == 0) {
949
+ url = "";
950
+ } else if (
951
+ path.indexOf("http://") == 0 ||
952
+ path.indexOf("HTTP://") == 0 ||
953
+ path.indexOf("https://") == 0 ||
954
+ path.indexOf("HTTPS://") == 0
955
+ ) {
956
+ url = path.split("//")[0] + "//";
957
+ path = path.split("//")[1];
958
+ } else {
959
+ url = new URL(window.location.href).pathname;
960
+ }
961
+ //处理路由参数
962
+ let paths = path.split("/");
963
+
964
+ let routeParamConfigs = jump.routeParams;
965
+ if (routeParamConfigs) {
966
+ for (let i = 0; i < paths.length; i++) {
967
+ if (paths[i].indexOf(":") == 0) {
968
+ let pa = paths[i].substring(1);
969
+ //根据参数名匹配参数
970
+ for (let p of routeParamConfigs) {
971
+ if (p && pa == p.title) {
972
+ //赋值替换
973
+ let v = record[p.id] ? record[p.id] : p.defaultValue;
974
+ paths[i] = v;
975
+ break;
902
976
  }
903
- url = Units.joinPath(url, paths.join("/"));
904
- } else {
905
- url = Units.joinPath(url, path);
977
+ }
906
978
  }
979
+ }
980
+ url = Units.joinPath(url, paths.join("/"));
981
+ } else {
982
+ url = Units.joinPath(url, path);
983
+ }
907
984
 
908
- //处理search 参数
909
- let searchParamConfigs = jump.searchParams;
910
- let searchs = [];
911
- //放入token
912
- if (jump.tokenName) {
913
- searchs[0] = jump.tokenName + "=" + Units.hydrocarbonToken();
914
- }
985
+ //处理search 参数
986
+ let searchParamConfigs = jump.searchParams;
987
+ let searchs = [];
988
+ //放入token
989
+ if (jump.tokenName) {
990
+ searchs[0] = jump.tokenName + "=" + Units.hydrocarbonToken();
991
+ }
915
992
 
916
- if (searchParamConfigs) {
917
- let initSearchLength = searchs.length;
918
- for (let i = 0; i < searchParamConfigs.length; i++) {
919
- let p = searchParamConfigs[i];
920
- let v = record[p.id] ? record[p.id] : p.defaultValue;
921
- if (!v && p.title == "code") {
922
- v = record_.code;
923
- }
924
- searchs[initSearchLength + i] = p.title + "=" + v;
925
- }
926
- }
927
- if (searchs.length > 0) {
928
- if (url.indexOf("?") != url.length - 1) {
929
- url = url + "?";
930
- }
931
- url = url + searchs.join("&");
993
+ if (searchParamConfigs) {
994
+ let initSearchLength = searchs.length;
995
+ for (let i = 0; i < searchParamConfigs.length; i++) {
996
+ let p = searchParamConfigs[i];
997
+ let v = record[p.id] ? record[p.id] : p.defaultValue;
998
+ if (!v && p.title == "code") {
999
+ v = record_.code;
932
1000
  }
933
- if (
934
- url.indexOf("#") == 0 ||
935
- url.indexOf("/#") == 0 ||
936
- url.indexOf("//#") == 0
937
- ) {
938
- window.location.hash = url.substring(url.indexOf("#") + 1);
939
- } else {
940
- window.open(url);
1001
+ searchs[initSearchLength + i] = p.title + "=" + v;
1002
+ }
1003
+ }
1004
+ if (searchs.length > 0) {
1005
+ if (url.indexOf("?") != url.length - 1) {
1006
+ url = url + "?";
1007
+ }
1008
+ url = url + searchs.join("&");
1009
+ }
1010
+ if (
1011
+ url.indexOf("#") == 0 ||
1012
+ url.indexOf("/#") == 0 ||
1013
+ url.indexOf("//#") == 0
1014
+ ) {
1015
+ window.location.hash = url.substring(url.indexOf("#") + 1);
1016
+ } else {
1017
+ window.open(url);
1018
+ }
1019
+ };
1020
+
1021
+ doRowJump = async (jump: JumpConfig, record: DtmplData) => {
1022
+ this.doJump(jump, record);
1023
+ };
1024
+
1025
+ renderExportButton = (title, type: ExportType, sourceId?: string) => {
1026
+ const { pageNo, pageSize, serverKey, ltmplConfig, readOnly } = this.props;
1027
+
1028
+ let buttons = ltmplConfig?.buttons;
1029
+
1030
+ const { queryKey } = this.state;
1031
+ const { translate } = this.context;
1032
+ return (
1033
+ <Popover
1034
+ content={
1035
+ <ExportFrame //导出组件
1036
+ currentPage={{
1037
+ pageNo: pageNo ? pageNo : 1,
1038
+ pageSize: pageSize ? pageSize : ltmplConfig.defaultPageSize,
1039
+ }}
1040
+ type={type}
1041
+ serverKey={serverKey}
1042
+ queryKey={queryKey}
1043
+ sourceId={sourceId}
1044
+ title={translate(
1045
+ "${" + ltmplConfig.title + "}" + "-" + "${" + title + "}"
1046
+ )}
1047
+ />
941
1048
  }
942
- };
943
-
944
- doRowJump = async (jump: JumpConfig, record: DtmplData) => {
945
- this.doJump(jump, record);
946
- };
947
-
948
-
949
- renderExportButton = (title, type: ExportType, sourceId?: string) => {
950
- const {pageNo, pageSize, serverKey, ltmplConfig, readOnly} = this.props;
951
-
952
- let buttons = ltmplConfig?.buttons;
1049
+ title={translate("${" + title + "}")}
1050
+ placement="bottomRight"
1051
+ trigger="click"
1052
+ >
1053
+ <Tooltip title={translate("${" + title + "}")}>
1054
+ <Button
1055
+ style={{
1056
+ // display:
1057
+ // buttons.includes("exportLtmplExcel") && !readOnly
1058
+ // ? "inline"
1059
+ // : "none",
1060
+ marginLeft: "5px",
1061
+ }} //为了点击到没有导出模块,使组件不致销毁,丢失导出数据
1062
+ >
1063
+ {type == "ltmpl-data-excel" ? <DownloadOutlined /> : title}
1064
+ </Button>
1065
+ </Tooltip>
1066
+ </Popover>
1067
+ );
1068
+ };
1069
+
1070
+ renderFileExportButton = () => {
1071
+ const { ltmplConfig } = this.props;
1072
+ let fileExports = ltmplConfig?.topFileExports;
1073
+ if (fileExports) {
1074
+ return fileExports.map((fileExport) => {
1075
+ return this.renderExportButton(
1076
+ fileExport.title,
1077
+ "ltmpl-data-filedata",
1078
+ fileExport.id
1079
+ );
1080
+ });
1081
+ } else {
1082
+ return <></>;
1083
+ }
1084
+ };
953
1085
 
954
- const {queryKey,} = this.state;
955
- const {translate} = this.context;
956
- return <Popover
1086
+ doSelectedJump = async (jump: JumpConfig) => {
1087
+ const { selectedDatas } = this.state;
1088
+ if (selectedDatas.length == 1) {
1089
+ this.doJump(jump, selectedDatas[0]);
1090
+ }
1091
+ };
1092
+
1093
+ changeRowSelection = (
1094
+ selectedRows: SelectedRow[],
1095
+ selectedDatas: DtmplData[]
1096
+ ) => {
1097
+ this.setState({
1098
+ selectedRows,
1099
+ selectedDatas,
1100
+ });
1101
+ };
1102
+
1103
+ onChangeColSort = (sortedColConfigs: ColumnConfig[]) => {
1104
+ const { ltmplConfig } = this.props;
1105
+ const { hiddenRowCodes, hiddenColIds } = this.state;
1106
+ this.setState({
1107
+ sortedColConfigs,
1108
+ // tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, hiddenRowCodes, sortedColConfigs),
1109
+ });
1110
+ };
1111
+
1112
+ getAddTmplButton = (classAddConfigs: ClassAddConfig[]) => {
1113
+ const { translate } = this.context;
1114
+ if (classAddConfigs && classAddConfigs.length < 1) {
1115
+ return translate("${没有分类添加按钮}");
1116
+ }
1117
+ return classAddConfigs.map((config) => {
1118
+ return (
1119
+ <p>
1120
+ <Button
1121
+ size={"small"}
1122
+ type={"text"}
1123
+ onClick={() => this.props.doCreate(config.id, false)}
1124
+ >
1125
+ {config.title}
1126
+ </Button>
1127
+ </p>
1128
+ );
1129
+ });
1130
+ };
1131
+
1132
+ renderHeaderButtons = () => {
1133
+ let {
1134
+ hiddenColIds,
1135
+ queryKey,
1136
+ viewModels,
1137
+ sortedColConfigs,
1138
+ disabledColIds,
1139
+ showL2Chart,
1140
+ showL2ActTable,
1141
+ } = this.state;
1142
+ const {
1143
+ ltmplConfig,
1144
+ sourceId,
1145
+ doCreate,
1146
+ doSearch,
1147
+ menuId,
1148
+ funcMode,
1149
+ customCreatable,
1150
+ serverKey,
1151
+ readOnly,
1152
+ pageNo,
1153
+ pageSize,
1154
+ } = this.props;
1155
+ const { translate } = this.context;
1156
+ let { buttons } = ltmplConfig;
1157
+
1158
+ return (
1159
+ <>
1160
+ <Space>
1161
+ {funcMode == "common" && this.criteriaFormUseful() ? (
1162
+ <Popover trigger="click" content={this.renderCriteriaForm()}>
1163
+ <Button>
1164
+ <SearchOutlined />
1165
+ </Button>
1166
+ </Popover>
1167
+ ) : null}
1168
+ {buttons.includes("dtmplAdd") && doCreate && !readOnly ? (
1169
+ ltmplConfig.classAddConfigs &&
1170
+ ltmplConfig.classAddConfigs.length > 0 ? (
1171
+ <Popover
1172
+ arrow={false}
1173
+ content={this.getAddTmplButton(ltmplConfig.classAddConfigs)}
1174
+ placement="bottomRight"
1175
+ >
1176
+ <Tooltip>
1177
+ <Button>
1178
+ <PlusOutlined />
1179
+ </Button>
1180
+ </Tooltip>
1181
+ </Popover>
1182
+ ) : (
1183
+ <Tooltip title={translate("${创建}")}>
1184
+ <Button onClick={() => doCreate(null, false)}>
1185
+ <PlusOutlined />
1186
+ </Button>{" "}
1187
+ </Tooltip>
1188
+ )
1189
+ ) : (
1190
+ ""
1191
+ )}
1192
+ {(buttons.includes("dtmplCustomAdd") || customCreatable) &&
1193
+ doCreate &&
1194
+ !readOnly ? (
1195
+ <Tooltip title={translate("${创建}")}>
1196
+ <Button onClick={() => doCreate(null, true)}>
1197
+ <PlusCircleOutlined />
1198
+ </Button>
1199
+ </Tooltip>
1200
+ ) : (
1201
+ ""
1202
+ )}
1203
+ {buttons.includes("importLtmplExcel") && !readOnly ? (
1204
+ <Tooltip title={translate("${导入}")}>
1205
+ {" "}
1206
+ <Button
1207
+ href={`#/v2/${sourceId}/importer?menuId=${menuId}`}
1208
+ target={"_blank"}
1209
+ >
1210
+ <UploadOutlined />
1211
+ </Button>
1212
+ </Tooltip>
1213
+ ) : (
1214
+ ""
1215
+ )}
1216
+ {buttons.includes("exportLtmplExcel") && !readOnly
1217
+ ? this.renderExportButton("导出", "ltmpl-data-excel")
1218
+ : ""}
1219
+ {this.renderFileExportButton()}
1220
+ {buttons.includes("showChart") ? (
1221
+ <Tooltip
1222
+ title={
1223
+ showL2Chart
1224
+ ? translate("${隐藏}${图表}")
1225
+ : translate("${展示}${图表}")
1226
+ }
1227
+ >
1228
+ <Button onClick={this.handleShowChart}>
1229
+ <LineChartOutlined />
1230
+ </Button>
1231
+ </Tooltip>
1232
+ ) : (
1233
+ ""
1234
+ )}
1235
+ {buttons.includes("analysis") ? (
1236
+ <Tooltip
1237
+ title={
1238
+ showL2ActTable
1239
+ ? translate("${隐藏}${数据分析}")
1240
+ : translate("${展示}${数据分析}")
1241
+ }
1242
+ >
1243
+ <Button onClick={this.handleDataAnalysis}>
1244
+ <FundOutlined />
1245
+ </Button>
1246
+ </Tooltip>
1247
+ ) : (
1248
+ ""
1249
+ )}
1250
+ {buttons.includes("reStat") && !readOnly ? (
1251
+ <Restat
1252
+ serverKey={serverKey}
1253
+ fields={ltmplConfig.reStatParams}
1254
+ sourceId={sourceId}
1255
+ onfinish={() => doSearch(null)}
1256
+ ></Restat>
1257
+ ) : (
1258
+ ""
1259
+ )}
1260
+ <Popover
957
1261
  content={
958
- <ExportFrame //导出组件
959
- currentPage={{
960
- pageNo: pageNo ? pageNo : 1,
961
- pageSize: pageSize ? pageSize : ltmplConfig.defaultPageSize,
962
- }}
963
- type={type}
964
- serverKey={serverKey}
965
- queryKey={queryKey}
966
- sourceId={sourceId}
967
- title={translate("${" + ltmplConfig.title + "}" + "-" + "${" + title + "}")}
968
- />
1262
+ <Checkbox.Group
1263
+ value={viewModels}
1264
+ onChange={this.changeViewModel}
1265
+ >
1266
+ <Row style={{ width: "120px" }}>
1267
+ <Col span={24}>
1268
+ <Checkbox value={"table"}>{translate("${表格}")}</Checkbox>
1269
+ </Col>
1270
+ <Col span={24}>
1271
+ <Checkbox value={"verticalList"}>
1272
+ {translate("${纵向列表}")}
1273
+ </Checkbox>
1274
+ </Col>
1275
+ {/*<Col span={24}><Checkbox value={'horizontalList'}>横向列表</Checkbox></Col>*/}
1276
+ </Row>
1277
+ </Checkbox.Group>
969
1278
  }
970
- title={translate("${" + title + "}")}
1279
+ title={translate("${视图}")}
971
1280
  placement="bottomRight"
972
1281
  trigger="click"
973
- >
974
- <Tooltip title={translate("${" + title + "}")}>
975
- <Button
976
- style={{
977
- // display:
978
- // buttons.includes("exportLtmplExcel") && !readOnly
979
- // ? "inline"
980
- // : "none",
981
- marginLeft: "5px",
982
- }} //为了点击到没有导出模块,使组件不致销毁,丢失导出数据
983
- >
984
- {type == "ltmpl-data-excel" ? <DownloadOutlined/> : title}
985
- </Button>
1282
+ >
1283
+ <Tooltip title={translate("${选择视图}")}>
1284
+ <Button>
1285
+ <RetweetOutlined />
1286
+ </Button>
1287
+ </Tooltip>
1288
+ </Popover>
1289
+ <Popover
1290
+ content={
1291
+ <ColumnSelector
1292
+ columns={sortedColConfigs}
1293
+ disabledColIds={disabledColIds}
1294
+ hiddenColIds={hiddenColIds}
1295
+ onChangeColSort={this.onChangeColSort}
1296
+ onChangeHiddenCols={this.changeHiddenColumns}
1297
+ />
1298
+ }
1299
+ title={translate("${排序和选择列}")}
1300
+ placement="bottomRight"
1301
+ trigger="click"
1302
+ >
1303
+ <Tooltip title={translate("${点击排序和选择列}")}>
1304
+ <Button>
1305
+ <TableOutlined />
1306
+ </Button>
986
1307
  </Tooltip>
987
- </Popover>
1308
+ </Popover>
1309
+ {doSearch ? (
1310
+ <Button
1311
+ className="hoverbig"
1312
+ title={translate("${刷新}")}
1313
+ onClick={() => {
1314
+ doSearch(null);
1315
+ }}
1316
+ >
1317
+ <ReloadOutlined />
1318
+ </Button>
1319
+ ) : (
1320
+ ""
1321
+ )}
1322
+ </Space>
1323
+ </>
1324
+ );
1325
+ };
1326
+
1327
+ criteriaFormUseful = () => {
1328
+ const { ltmplConfig } = this.props;
1329
+ let { buttons, criterias, updrillButtonConfigs } = ltmplConfig;
1330
+ if (
1331
+ ((buttons.includes("query") ||
1332
+ (updrillButtonConfigs && updrillButtonConfigs.length > 0)) &&
1333
+ ((criterias && criterias.length > 0) ||
1334
+ buttons.includes("drilling"))) ||
1335
+ this.checkBoxUseful()
1336
+ ) {
1337
+ return true;
1338
+ } else {
1339
+ return false;
988
1340
  }
989
-
990
- renderFileExportButton = () => {
991
- const {ltmplConfig} = this.props;
992
- let fileExports = ltmplConfig?.topFileExports;
993
- if (fileExports) {
994
- return fileExports.map((fileExport) => {
995
- return this.renderExportButton(fileExport.title, "ltmpl-data-filedata", fileExport.id);
996
- });
997
- } else {
998
- return <></>
999
- }
1000
-
1341
+ };
1342
+
1343
+ checkBoxUseful = () => {
1344
+ const { ltmplConfig } = this.props;
1345
+ let { buttons, jumps, actions } = ltmplConfig;
1346
+ if (
1347
+ buttons.includes("batchDelete") ||
1348
+ (actions && actions.length > 0) ||
1349
+ (jumps && jumps.length > 0)
1350
+ ) {
1351
+ return true;
1352
+ } else {
1353
+ return false;
1354
+ }
1355
+ };
1356
+
1357
+ renderCriteriaForm = () => {
1358
+ let { loading, selectedRows, selectedDatas } = this.state;
1359
+ let { ltmplConfig, doSearch, criteriaData, serverKey } = this.props;
1360
+ return (
1361
+ <CriteriaForm
1362
+ serverKey={serverKey}
1363
+ loading={loading}
1364
+ selectedDatas={selectedDatas}
1365
+ selectedRows={selectedRows}
1366
+ doCustomButton={this.doCustomButton}
1367
+ ltmplConfig={ltmplConfig}
1368
+ data={criteriaData}
1369
+ doCQuery={this.doSelectedCQuery}
1370
+ doAction={this.doSelectedAction}
1371
+ doDelete={this.doDelete}
1372
+ doJump={this.doSelectedJump}
1373
+ doSearch={doSearch}
1374
+ />
1375
+ );
1376
+ };
1377
+
1378
+ renderContent = () => {
1379
+ let {
1380
+ queryKey,
1381
+ loading,
1382
+ selectedRows,
1383
+ hiddenRowCodes,
1384
+ viewModels,
1385
+ sortedColConfigs,
1386
+ hiddenColIds,
1387
+ showL2ActTable,
1388
+ } = this.state;
1389
+ let {
1390
+ sourceId,
1391
+ ltmplConfig,
1392
+ funcMode,
1393
+ title,
1394
+ collapsible,
1395
+ pageSize,
1396
+ pageNo,
1397
+ onChangePage,
1398
+ serverKey,
1399
+ } = this.props;
1400
+ const { translate } = this.context;
1401
+
1402
+ if (!ltmplConfig || !sourceId) {
1403
+ return (
1404
+ <>
1405
+ <Card loading={loading}></Card>
1406
+ <Table loading={loading}></Table>
1407
+ </>
1408
+ );
1001
1409
  }
1002
1410
 
1003
- doSelectedJump = async (jump: JumpConfig) => {
1004
- const {selectedDatas} = this.state;
1005
- if (selectedDatas.length == 1) {
1006
- this.doJump(jump, selectedDatas[0]);
1007
- }
1008
- };
1009
-
1010
- changeRowSelection = (
1011
- selectedRows: SelectedRow[],
1012
- selectedDatas: DtmplData[]
1013
- ) => {
1014
- this.setState({
1015
- selectedRows,
1016
- selectedDatas,
1017
- });
1018
- };
1019
-
1020
- onChangeColSort = (sortedColConfigs: ColumnConfig[]) => {
1021
- const {ltmplConfig} = this.props;
1022
- const {hiddenRowCodes, hiddenColIds} = this.state;
1023
- this.setState({
1024
- sortedColConfigs,
1025
- // tableColumns: this.buildTableColumns(ltmplConfig, hiddenColIds, hiddenRowCodes, sortedColConfigs),
1026
- });
1027
- };
1028
-
1029
- getAddTmplButton = (classAddConfigs: ClassAddConfig[]) => {
1030
- const {translate} = this.context;
1031
- if (classAddConfigs && classAddConfigs.length < 1) {
1032
- return translate("${没有分类添加按钮}");
1033
- }
1034
- return classAddConfigs.map((config) => {
1035
- return (
1036
- <p>
1037
- <Button
1038
- size={"small"}
1039
- type={"text"}
1040
- onClick={() => this.props.doCreate(config.id, false)}
1041
- >
1042
- {config.title}
1043
- </Button>
1044
- </p>
1045
- );
1046
- });
1047
- };
1048
-
1049
- renderHeaderButtons = () => {
1050
- let {
1051
- hiddenColIds,
1052
- queryKey,
1053
- viewModels,
1054
- sortedColConfigs,
1055
- disabledColIds,
1056
- showL2Chart,
1057
- showL2ActTable,
1058
- } = this.state;
1059
- const {
1060
- ltmplConfig,
1061
- sourceId,
1062
- doCreate,
1063
- doSearch,
1064
- menuId,
1065
- funcMode,
1066
- customCreatable,
1067
- serverKey,
1068
- readOnly,
1069
- pageNo,
1070
- pageSize,
1071
- } = this.props;
1072
- const {translate} = this.context;
1073
- let {buttons} = ltmplConfig;
1074
-
1075
- return (
1076
- <>
1077
- <Space>
1078
- {funcMode == "common" && this.criteriaFormUseful() ? (
1079
- <Popover trigger="click" content={this.renderCriteriaForm()}>
1080
- <Button>
1081
- <SearchOutlined/>
1082
- </Button>
1083
- </Popover>
1084
- ) : null}
1085
- {buttons.includes("dtmplAdd") && doCreate && !readOnly ? (
1086
- ltmplConfig.classAddConfigs &&
1087
- ltmplConfig.classAddConfigs.length > 0 ? (
1088
- <Popover
1089
- arrow={false}
1090
- content={this.getAddTmplButton(
1091
- ltmplConfig.classAddConfigs
1092
- )}
1093
- placement="bottomRight"
1094
- >
1095
- <Tooltip>
1096
- <Button>
1097
- <PlusOutlined/>
1098
- </Button>
1099
- </Tooltip>
1100
- </Popover>
1101
- ) : (
1102
- <Tooltip title={translate("${创建}")}>
1103
- <Button onClick={() => doCreate(null, false)}>
1104
- <PlusOutlined/>
1105
- </Button>{" "}
1106
- </Tooltip>
1107
- )
1108
- ) : (
1109
- ""
1110
- )}
1111
- {(buttons.includes("dtmplCustomAdd") || customCreatable) &&
1112
- doCreate &&
1113
- !readOnly ? (
1114
- <Tooltip title={translate("${创建}")}>
1115
- <Button onClick={() => doCreate(null, true)}>
1116
- <PlusCircleOutlined/>
1117
- </Button>
1118
- </Tooltip>
1119
- ) : (
1120
- ""
1121
- )}
1122
- {buttons.includes("importLtmplExcel") && !readOnly ? (
1123
- <Tooltip title={translate("${导入}")}>
1124
- {" "}
1125
- <Button
1126
- href={`#/${sourceId}/importer?menuId=${menuId}`}
1127
- target={"_blank"}
1128
- >
1129
- <UploadOutlined/>
1130
- </Button>
1131
- </Tooltip>
1132
- ) : (
1133
- ""
1134
- )}
1135
- {buttons.includes("exportLtmplExcel") && !readOnly ? (
1136
- this.renderExportButton("导出", "ltmpl-data-excel")
1137
- ) : (
1138
- ""
1139
- )}
1140
- {this.renderFileExportButton()}
1141
- {buttons.includes("showChart") ? (
1142
- <Tooltip
1143
- title={
1144
- showL2Chart
1145
- ? translate("${隐藏}${图表}")
1146
- : translate("${展示}${图表}")
1147
- }
1148
- >
1149
- <Button onClick={this.handleShowChart}>
1150
- <LineChartOutlined/>
1151
- </Button>
1152
- </Tooltip>
1153
- ) : (
1154
- ""
1155
- )}
1156
- {buttons.includes("analysis") ? (
1157
- <Tooltip
1158
- title={
1159
- showL2ActTable
1160
- ? translate("${隐藏}${数据分析}")
1161
- : translate("${展示}${数据分析}")
1162
- }
1163
- >
1164
- <Button onClick={this.handleDataAnalysis}>
1165
- <FundOutlined/>
1166
- </Button>
1167
- </Tooltip>
1168
- ) : (
1169
- ""
1170
- )}
1171
- {buttons.includes("reStat") && !readOnly ? (
1172
- <Restat
1173
- serverKey={serverKey}
1174
- fields={ltmplConfig.reStatParams}
1175
- sourceId={sourceId}
1176
- onfinish={() => doSearch(null)}
1177
- ></Restat>
1178
- ) : (
1179
- ""
1180
- )}
1181
- <Popover
1182
- content={
1183
- <Checkbox.Group
1184
- value={viewModels}
1185
- onChange={this.changeViewModel}
1186
- >
1187
- <Row style={{width: "120px"}}>
1188
- <Col span={24}>
1189
- <Checkbox value={"table"}>{translate("${表格}")}</Checkbox>
1190
- </Col>
1191
- <Col span={24}>
1192
- <Checkbox value={"verticalList"}>
1193
- {translate("${纵向列表}")}
1194
- </Checkbox>
1195
- </Col>
1196
- {/*<Col span={24}><Checkbox value={'horizontalList'}>横向列表</Checkbox></Col>*/}
1197
- </Row>
1198
- </Checkbox.Group>
1199
- }
1200
- title={translate("${视图}")}
1201
- placement="bottomRight"
1202
- trigger="click"
1203
- >
1204
- <Tooltip title={translate("${选择视图}")}>
1205
- <Button>
1206
- <RetweetOutlined/>
1207
- </Button>
1208
- </Tooltip>
1209
- </Popover>
1210
- <Popover
1211
- content={
1212
- <ColumnSelector
1213
- columns={sortedColConfigs}
1214
- disabledColIds={disabledColIds}
1215
- hiddenColIds={hiddenColIds}
1216
- onChangeColSort={this.onChangeColSort}
1217
- onChangeHiddenCols={this.changeHiddenColumns}
1218
- />
1219
- }
1220
- title={translate("${排序和选择列}")}
1221
- placement="bottomRight"
1222
- trigger="click"
1223
- >
1224
- <Tooltip title={translate("${点击排序和选择列}")}>
1225
- <Button>
1226
- <TableOutlined/>
1227
- </Button>
1228
- </Tooltip>
1229
- </Popover>
1230
- {doSearch ? (
1231
- <Button
1232
- className="hoverbig"
1233
- title={translate("${刷新}")}
1234
- onClick={() => {
1235
- doSearch(null);
1236
- }}
1237
- >
1238
- <ReloadOutlined/>
1239
- </Button>
1240
- ) : (
1241
- ""
1242
- )}
1243
- </Space>
1244
- </>
1245
- );
1246
- };
1411
+ let tableColumns = this.buildTableColumns(
1412
+ ltmplConfig,
1413
+ hiddenColIds,
1414
+ hiddenRowCodes,
1415
+ sortedColConfigs
1416
+ );
1417
+
1418
+ let { buttons } = ltmplConfig;
1419
+ let displayCriteriaCard: boolean = false;
1420
+ if (funcMode == "simple" || funcMode == "common") {
1421
+ displayCriteriaCard = false;
1422
+ } else if (this.criteriaFormUseful()) {
1423
+ displayCriteriaCard = true;
1424
+ }
1247
1425
 
1248
- criteriaFormUseful = () => {
1249
- const {ltmplConfig} = this.props;
1250
- let {buttons, criterias, updrillButtonConfigs} = ltmplConfig;
1251
- if (
1252
- ((buttons.includes("query") ||
1253
- (updrillButtonConfigs && updrillButtonConfigs.length > 0)) &&
1254
- ((criterias && criterias.length > 0) ||
1255
- buttons.includes("drilling"))) ||
1256
- this.checkBoxUseful()
1257
- ) {
1258
- return true;
1259
- } else {
1260
- return false;
1426
+ let columnConfigs = [];
1427
+ if (sortedColConfigs) {
1428
+ for (let colConfig of sortedColConfigs) {
1429
+ if (!hiddenColIds.includes(colConfig.id)) {
1430
+ columnConfigs.push(colConfig);
1261
1431
  }
1262
- };
1263
-
1264
- checkBoxUseful = () => {
1265
- const {ltmplConfig} = this.props;
1266
- let {buttons, jumps, actions} = ltmplConfig;
1267
- if (
1268
- buttons.includes("batchDelete") ||
1269
- (actions && actions.length > 0) ||
1270
- (jumps && jumps.length > 0)
1271
- ) {
1272
- return true;
1273
- } else {
1274
- return false;
1275
- }
1276
- };
1277
-
1278
- renderCriteriaForm = () => {
1279
- let {loading, selectedRows, selectedDatas} = this.state;
1280
- let {ltmplConfig, doSearch, criteriaData, serverKey} = this.props;
1281
- return (
1282
- <CriteriaForm
1283
- serverKey={serverKey}
1284
- loading={loading}
1285
- selectedDatas={selectedDatas}
1286
- selectedRows={selectedRows}
1287
- doCustomButton={this.doCustomButton}
1288
- ltmplConfig={ltmplConfig}
1289
- data={criteriaData}
1290
- doCQuery={this.doSelectedCQuery}
1291
- doAction={this.doSelectedAction}
1292
- doDelete={this.doDelete}
1293
- doJump={this.doSelectedJump}
1294
- doSearch={doSearch}
1432
+ }
1433
+ }
1434
+ return (
1435
+ <>
1436
+ {/*暂时不支持L2chart 后续用echart*/}
1437
+ {/*{buttons.includes("showChart") && showL2Chart ? <div>*/}
1438
+ {/* <StatViewL2Chart queryKey={queryKey.key} ltmplConfig={ltmplConfig} hiddenColIds={hiddenColIds}*/}
1439
+ {/* hiddenRowCodes={hiddenRowCodes}/>*/}
1440
+ {/* /!*<Divider dashed style={{borderTopColor: "#40a9ff",}} plain></Divider>*!/*/}
1441
+ {/*</div> : ""*/}
1442
+ {/*}*/}
1443
+ {buttons.includes("analysis") && showL2ActTable ? (
1444
+ <div>
1445
+ <L2ActTable
1446
+ serverKey={serverKey}
1447
+ innerQueryKey={queryKey.key}
1448
+ sourceId={sourceId}
1295
1449
  />
1296
- );
1297
- };
1298
-
1299
- renderContent = () => {
1300
- let {
1301
- queryKey,
1302
- loading,
1303
- selectedRows,
1304
- hiddenRowCodes,
1305
- viewModels,
1306
- sortedColConfigs,
1307
- hiddenColIds,
1308
- showL2ActTable,
1309
- } = this.state;
1310
- let {
1311
- sourceId,
1312
- ltmplConfig,
1313
- funcMode,
1314
- title,
1315
- collapsible,
1316
- pageSize,
1317
- pageNo,
1318
- onChangePage,
1319
- serverKey,
1320
- } = this.props;
1321
- const {translate} = this.context;
1322
-
1323
- if (!ltmplConfig || !sourceId) {
1324
- return (
1325
- <>
1326
- <Card loading={loading}></Card>
1327
- <Table loading={loading}></Table>
1328
- </>
1329
- );
1330
- }
1331
-
1332
- let tableColumns = this.buildTableColumns(
1333
- ltmplConfig,
1334
- hiddenColIds,
1335
- hiddenRowCodes,
1336
- sortedColConfigs
1337
- );
1338
-
1339
- let {buttons} = ltmplConfig;
1340
- let displayCriteriaCard: boolean = false;
1341
- if (funcMode == "simple" || funcMode == "common") {
1342
- displayCriteriaCard = false;
1343
- } else if (this.criteriaFormUseful()) {
1344
- displayCriteriaCard = true;
1345
- }
1346
-
1347
- let columnConfigs = [];
1348
- if (sortedColConfigs) {
1349
- for (let colConfig of sortedColConfigs) {
1350
- if (!hiddenColIds.includes(colConfig.id)) {
1351
- columnConfigs.push(colConfig);
1352
- }
1353
- }
1354
- }
1355
- return (
1356
- <>
1357
- {/*暂时不支持L2chart 后续用echart*/}
1358
- {/*{buttons.includes("showChart") && showL2Chart ? <div>*/}
1359
- {/* <StatViewL2Chart queryKey={queryKey.key} ltmplConfig={ltmplConfig} hiddenColIds={hiddenColIds}*/}
1360
- {/* hiddenRowCodes={hiddenRowCodes}/>*/}
1361
- {/* /!*<Divider dashed style={{borderTopColor: "#40a9ff",}} plain></Divider>*!/*/}
1362
- {/*</div> : ""*/}
1363
- {/*}*/}
1364
- {buttons.includes("analysis") && showL2ActTable ? (
1365
- <div>
1366
- <L2ActTable
1367
- serverKey={serverKey}
1368
- innerQueryKey={queryKey.key}
1369
- sourceId={sourceId}
1370
- />
1371
- <Divider
1372
- dashed
1373
- style={{borderTopColor: "#40a9ff"}}
1374
- plain
1375
- ></Divider>
1376
- </div>
1377
- ) : (
1378
- ""
1379
- )}
1380
- <div className="actTable">
1381
- {funcMode == "complete" || funcMode == "common" ? (
1382
- collapsible ? null : (
1383
- <span>
1450
+ <Divider
1451
+ dashed
1452
+ style={{ borderTopColor: "#40a9ff" }}
1453
+ plain
1454
+ ></Divider>
1455
+ </div>
1456
+ ) : (
1457
+ ""
1458
+ )}
1459
+ <div className="actTable">
1460
+ {funcMode == "complete" || funcMode == "common" ? (
1461
+ collapsible ? null : (
1462
+ <span>
1384
1463
  {ltmplConfig.header ? (
1385
- <div
1386
- style={{padding: "6px"}}
1387
- dangerouslySetInnerHTML={{__html: ltmplConfig.header}}
1388
- ></div>
1464
+ <div
1465
+ style={{ padding: "6px" }}
1466
+ dangerouslySetInnerHTML={{ __html: ltmplConfig.header }}
1467
+ ></div>
1389
1468
  ) : null}
1390
- <h3>
1469
+ <h3>
1391
1470
  {" "}
1392
- {!title
1393
- ? translate("${" + ltmplConfig.title + "}")
1394
- : typeof title == "string"
1395
- ? translate("${" + title + "}")
1396
- : title}
1397
- {/*{translate("${" + (title ? title : ltmplConfig.title) + "}")}*/}
1398
- <p className="fr">{this.renderHeaderButtons()}</p>
1471
+ {!title
1472
+ ? translate("${" + ltmplConfig.title + "}")
1473
+ : typeof title == "string"
1474
+ ? translate("${" + title + "}")
1475
+ : title}
1476
+ {/*{translate("${" + (title ? title : ltmplConfig.title) + "}")}*/}
1477
+ <p className="fr">{this.renderHeaderButtons()}</p>
1399
1478
  </h3>
1400
1479
  </span>
1401
- )
1402
- ) : null}
1403
- {displayCriteriaCard ? this.renderCriteriaForm() : null}
1404
- {loading ? (
1405
- <Table loading={loading}></Table>
1406
- ) : (
1407
- <QueryTable
1408
- serverKey={serverKey}
1409
- onChangePage={onChangePage}
1410
- viewModels={viewModels}
1411
- primaryColumn={ltmplConfig.primaryColumn}
1412
- columnConfigs={columnConfigs}
1413
- summaryConfigs={ltmplConfig.totalColumnConfigs}
1414
- maxSelectedRows={this.checkBoxUseful() ? 10000 : -1}
1415
- selectedRows={selectedRows}
1416
- columns={tableColumns}
1417
- hiddenRowCodes={hiddenRowCodes}
1418
- pageInfo={{
1419
- pageNo: pageNo ? pageNo : 1,
1420
- pageSize: pageSize ? pageSize : ltmplConfig.defaultPageSize,
1421
- }}
1422
- queryKey={queryKey}
1423
- onChangeRowSelection={this.changeRowSelection}
1424
- subtotalXColumn={
1425
- ltmplConfig.subtotalXColumn == null ||
1426
- ltmplConfig.subtotalXColumn.length <= 0
1427
- ? null
1428
- : ltmplConfig.subtotalXColumn
1429
- }
1430
- subtotalYColumn={
1431
- ltmplConfig.subtotalYColumn == null ||
1432
- ltmplConfig.subtotalYColumn.length <= 0
1433
- ? null
1434
- : ltmplConfig.subtotalYColumn
1435
- }
1436
- groupIColumns={ltmplConfig.groupIColumns}
1437
- />
1438
- )}
1439
- {/*此处放页脚*/}
1440
- {ltmplConfig.footer ? (
1441
- <div
1442
- style={{padding: "6px"}}
1443
- dangerouslySetInnerHTML={{__html: ltmplConfig.footer}}
1444
- ></div>
1445
- ) : null}
1446
- </div>
1447
- </>
1448
- );
1449
- };
1450
-
1451
- render() {
1452
- let {
1453
- queryKey, loading, blockMenuTreeDrawerOpen, recordCode
1454
- , showCustomCard, customButton, customButtonData
1455
- } = this.state;
1456
- let {
1457
- sourceId,
1458
- ltmplConfig,
1459
- title,
1460
- collapsible,
1461
- initCollapse,
1462
- tip,
1463
- } = this.props;
1464
- const {translate} = this.context;
1465
-
1466
-
1467
- if (!ltmplConfig || !sourceId) {
1468
- return (
1469
- <>
1470
- <Card loading={loading}></Card>
1471
- <Table loading={loading}></Table>
1472
- </>
1473
- );
1474
- }
1480
+ )
1481
+ ) : null}
1482
+ {displayCriteriaCard ? this.renderCriteriaForm() : null}
1483
+ {loading ? (
1484
+ <Table loading={loading}></Table>
1485
+ ) : (
1486
+ <QueryTable
1487
+ serverKey={serverKey}
1488
+ onChangePage={onChangePage}
1489
+ viewModels={viewModels}
1490
+ primaryColumn={ltmplConfig.primaryColumn}
1491
+ columnConfigs={columnConfigs}
1492
+ summaryConfigs={ltmplConfig.totalColumnConfigs}
1493
+ maxSelectedRows={this.checkBoxUseful() ? 10000 : -1}
1494
+ selectedRows={selectedRows}
1495
+ columns={tableColumns}
1496
+ hiddenRowCodes={hiddenRowCodes}
1497
+ pageInfo={{
1498
+ pageNo: pageNo ? pageNo : 1,
1499
+ pageSize: pageSize ? pageSize : ltmplConfig.defaultPageSize,
1500
+ }}
1501
+ queryKey={queryKey}
1502
+ onChangeRowSelection={this.changeRowSelection}
1503
+ subtotalXColumn={
1504
+ ltmplConfig.subtotalXColumn == null ||
1505
+ ltmplConfig.subtotalXColumn.length <= 0
1506
+ ? null
1507
+ : ltmplConfig.subtotalXColumn
1508
+ }
1509
+ subtotalYColumn={
1510
+ ltmplConfig.subtotalYColumn == null ||
1511
+ ltmplConfig.subtotalYColumn.length <= 0
1512
+ ? null
1513
+ : ltmplConfig.subtotalYColumn
1514
+ }
1515
+ groupIColumns={ltmplConfig.groupIColumns}
1516
+ />
1517
+ )}
1518
+ {/*此处放页脚*/}
1519
+ {ltmplConfig.footer ? (
1520
+ <div
1521
+ style={{ padding: "6px" }}
1522
+ dangerouslySetInnerHTML={{ __html: ltmplConfig.footer }}
1523
+ ></div>
1524
+ ) : null}
1525
+ </div>
1526
+ </>
1527
+ );
1528
+ };
1529
+
1530
+ render() {
1531
+ let {
1532
+ queryKey,
1533
+ loading,
1534
+ blockMenuTreeDrawerOpen,
1535
+ recordCode,
1536
+ showCustomCard,
1537
+ customButton,
1538
+ customButtonData,
1539
+ } = this.state;
1540
+ let {
1541
+ sourceId,
1542
+ ltmplConfig,
1543
+ title,
1544
+ collapsible,
1545
+ initCollapse,
1546
+ tip,
1547
+ } = this.props;
1548
+ const { translate } = this.context;
1549
+
1550
+ if (!ltmplConfig || !sourceId) {
1551
+ return (
1552
+ <>
1553
+ <Card loading={loading}></Card>
1554
+ <Table loading={loading}></Table>
1555
+ </>
1556
+ );
1557
+ }
1475
1558
 
1476
- return (
1477
- <>
1478
- {" "}
1479
- {this.renderAboveCustomPage()}
1480
- {collapsible ? (
1481
- <CollapseCard
1482
- initCollapse={initCollapse}
1483
- title={
1484
- <>{!title ? ltmplConfig.title
1485
- : title}
1486
- <ToolTipBar
1487
- content={tip ? tip : ltmplConfig ? ltmplConfig.tip : null}
1488
- />
1489
- </>
1490
- }
1491
- id={queryKey + ltmplConfig.id}
1492
- className={`hoverable`}
1493
- headStyle={{background: "#f2f4f5"}}
1494
- loading={loading}
1495
- bodyStyle={{padding: "6px"}}
1496
- //暂时注释掉,后续要支持配置。
1497
- extra={this.renderHeaderButtons()}
1498
- >
1499
- {this.renderContent()}
1500
- </CollapseCard>
1501
- ) : (
1502
- <>{this.renderContent()}</>
1503
- )}
1504
-
1505
- {this.renderOhterCustomPage()}
1506
- <BlockMenuTreeDrawer
1507
- onOk={() => {
1508
- this.setState({
1509
- blockMenuTreeDrawerOpen: false,
1510
- });
1511
- }}
1512
- onCancel={() => {
1513
- this.setState({
1514
- blockMenuTreeDrawerOpen: false,
1515
- });
1516
- }}
1517
- open={blockMenuTreeDrawerOpen}
1518
- roleCode={recordCode}
1559
+ return (
1560
+ <>
1561
+ {" "}
1562
+ {this.renderAboveCustomPage()}
1563
+ {collapsible ? (
1564
+ <CollapseCard
1565
+ initCollapse={initCollapse}
1566
+ title={
1567
+ <>
1568
+ {!title ? ltmplConfig.title : title}
1569
+ <ToolTipBar
1570
+ content={tip ? tip : ltmplConfig ? ltmplConfig.tip : null}
1519
1571
  />
1520
- </>
1521
- );
1522
- }
1572
+ </>
1573
+ }
1574
+ id={queryKey + ltmplConfig.id}
1575
+ className={`hoverable`}
1576
+ headStyle={{ background: "#f2f4f5" }}
1577
+ loading={loading}
1578
+ bodyStyle={{ padding: "6px" }}
1579
+ //暂时注释掉,后续要支持配置。
1580
+ extra={this.renderHeaderButtons()}
1581
+ >
1582
+ {this.renderContent()}
1583
+ </CollapseCard>
1584
+ ) : (
1585
+ <>{this.renderContent()}</>
1586
+ )}
1587
+ {this.renderOhterCustomPage()}
1588
+ <BlockMenuTreeDrawer
1589
+ onOk={() => {
1590
+ this.setState({
1591
+ blockMenuTreeDrawerOpen: false,
1592
+ });
1593
+ }}
1594
+ onCancel={() => {
1595
+ this.setState({
1596
+ blockMenuTreeDrawerOpen: false,
1597
+ });
1598
+ }}
1599
+ open={blockMenuTreeDrawerOpen}
1600
+ roleCode={recordCode}
1601
+ />
1602
+ </>
1603
+ );
1604
+ }
1523
1605
  }
1524
1606
 
1525
1607
  export default ActTable;