aldehyde 0.2.418 → 0.2.419
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/lib/form/dtmpl-form.js +2 -2
- package/lib/form/dtmpl-form.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts +3 -0
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +28 -6
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/routable/splitview-ltmpl-route.d.ts +2 -1
- package/lib/routable/splitview-ltmpl-route.d.ts.map +1 -1
- package/lib/routable/splitview-ltmpl-route.js +20 -2
- package/lib/routable/splitview-ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts +12 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +94 -38
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts +3 -0
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +4 -1
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +2 -2
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/report-table.js +2 -2
- package/lib/table/report-table.js.map +1 -1
- package/lib/table/resizable-table.d.ts.map +1 -1
- package/lib/table/resizable-table.js +4 -5
- package/lib/table/resizable-table.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +1 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +16 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +8 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tree/navigation-tree.d.ts +8 -0
- package/lib/tree/navigation-tree.d.ts.map +1 -0
- package/lib/tree/navigation-tree.js +30 -0
- package/lib/tree/navigation-tree.js.map +1 -0
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/tree/tmpl-tree.js +6 -3
- package/lib/tree/tmpl-tree.js.map +1 -1
- package/lib/units/index.d.ts +5 -0
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +49 -0
- package/lib/units/index.js.map +1 -1
- package/lib/welcome/components/page-card.d.ts +1 -1
- package/lib/welcome/components/page-card.d.ts.map +1 -1
- package/lib/welcome/components/page-card.js +3 -3
- package/lib/welcome/components/page-card.js.map +1 -1
- package/lib/welcome/components/page-card.less +1 -1
- package/package.json +1 -1
- package/src/aldehyde/form/dtmpl-form.tsx +2 -2
- package/src/aldehyde/index.tsx +4 -1
- package/src/aldehyde/routable/ltmpl-route.tsx +33 -8
- package/src/aldehyde/routable/splitview-ltmpl-route.tsx +30 -4
- package/src/aldehyde/table/act-table.tsx +93 -36
- package/src/aldehyde/table/column/column-builder.tsx +7 -2
- package/src/aldehyde/table/query-table.tsx +3 -1
- package/src/aldehyde/table/report-table.tsx +4 -4
- package/src/aldehyde/table/resizable-table.tsx +19 -18
- package/src/aldehyde/tmpl/hcservice-v3.tsx +13 -0
- package/src/aldehyde/tmpl/interface.tsx +5 -1
- package/src/aldehyde/tree/navigation-tree.tsx +34 -0
- package/src/aldehyde/tree/tmpl-tree.tsx +7 -6
- package/src/aldehyde/units/index.tsx +43 -0
- package/src/aldehyde/welcome/components/page-card.less +1 -1
- package/src/aldehyde/welcome/components/page-card.tsx +3 -3
|
@@ -412,7 +412,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
412
412
|
serverKey={serverKey}
|
|
413
413
|
valueMap={dtmplData ? dtmplData.fieldMap : undefined}
|
|
414
414
|
/> :
|
|
415
|
-
<FormItemGroup layout={HcserviceV3.isForeignLanguageMode() ? "vertical" : "horizontal"}
|
|
415
|
+
<FormItemGroup layout={HcserviceV3.isForeignLanguageMode() ? "vertical" : (dtmplConfig.formLayout || "horizontal")}
|
|
416
416
|
serverKey={serverKey}
|
|
417
417
|
formRef={formRef}
|
|
418
418
|
mainCode={mainCode}
|
|
@@ -509,7 +509,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
509
509
|
</Card>
|
|
510
510
|
) : null}
|
|
511
511
|
<AntdForm
|
|
512
|
-
layout={HcserviceV3.isForeignLanguageMode() ? "vertical" : "horizontal"}
|
|
512
|
+
layout={HcserviceV3.isForeignLanguageMode() ? "vertical" : (dtmplConfig.formLayout || "horizontal")}
|
|
513
513
|
scrollToFirstError={true}
|
|
514
514
|
labelWrap={true}
|
|
515
515
|
ref={formRef}
|
package/src/aldehyde/index.tsx
CHANGED
|
@@ -147,6 +147,8 @@ import SplitViewLtmplRoute from "./routable/splitview-ltmpl-route";
|
|
|
147
147
|
|
|
148
148
|
import SsoLogin from "./sso-Login";
|
|
149
149
|
|
|
150
|
+
import NavigationTree from "./tree/navigation-tree";
|
|
151
|
+
|
|
150
152
|
export {
|
|
151
153
|
ActTable,
|
|
152
154
|
SelectTable,
|
|
@@ -205,5 +207,6 @@ export {
|
|
|
205
207
|
DtmplViewModal,
|
|
206
208
|
DtmplViewDrawer,
|
|
207
209
|
SplitViewLtmplRoute,
|
|
208
|
-
SsoLogin
|
|
210
|
+
SsoLogin,
|
|
211
|
+
NavigationTree
|
|
209
212
|
};
|
|
@@ -40,6 +40,7 @@ export interface LtmplRouteState {
|
|
|
40
40
|
viewSourceId?: string;
|
|
41
41
|
editSourceId?: string;
|
|
42
42
|
toCustomPage?: boolean;
|
|
43
|
+
userPageConfig?: { [key: string]: any };
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
@@ -66,10 +67,12 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
66
67
|
viewSourceId: undefined,
|
|
67
68
|
editSourceId: undefined,
|
|
68
69
|
toCustomPage: false,
|
|
70
|
+
userPageConfig: undefined,
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
async componentDidMount() {
|
|
72
74
|
this.loadData();
|
|
75
|
+
this.getUserPageConfig();
|
|
73
76
|
}
|
|
74
77
|
Z
|
|
75
78
|
get computedLayoutPath() {
|
|
@@ -78,6 +81,30 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
78
81
|
return "";
|
|
79
82
|
}
|
|
80
83
|
|
|
84
|
+
// 获取用户页面配置
|
|
85
|
+
getUserPageConfig = () => {
|
|
86
|
+
const { params } = this.props;
|
|
87
|
+
const { sourceId } = params;
|
|
88
|
+
const config = Units.getUserPageConfig(sourceId);
|
|
89
|
+
this.setState({ userPageConfig: config });
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// 设置用户页面配置
|
|
93
|
+
setUserPageConfig = (config: { [key: string]: any }) => {
|
|
94
|
+
const { params } = this.props;
|
|
95
|
+
const { sourceId } = params;
|
|
96
|
+
const temConfig = Units.setUserPageConfig(sourceId, config);
|
|
97
|
+
this.setState({ userPageConfig: temConfig });
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// 重置本地缓存页面配置
|
|
101
|
+
resetUserPageConfig = () => {
|
|
102
|
+
const { params } = this.props;
|
|
103
|
+
const { sourceId } = params;
|
|
104
|
+
Units.resetUserPageConfig(sourceId);
|
|
105
|
+
this.setState({ userPageConfig: undefined });
|
|
106
|
+
}
|
|
107
|
+
|
|
81
108
|
onRoute = (path) => {
|
|
82
109
|
this.props.navigate(path);
|
|
83
110
|
};
|
|
@@ -110,10 +137,7 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
110
137
|
null,
|
|
111
138
|
sourceId
|
|
112
139
|
);
|
|
113
|
-
|
|
114
|
-
this.setState({
|
|
115
|
-
ltmplConfigRes: ltmplConfigRes,
|
|
116
|
-
});
|
|
140
|
+
this.setState({ ltmplConfigRes: ltmplConfigRes });
|
|
117
141
|
};
|
|
118
142
|
|
|
119
143
|
async componentDidUpdate(prevProps) {
|
|
@@ -319,14 +343,14 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
319
343
|
let params = Units.transQueryStrToParams(search, null);
|
|
320
344
|
params["pageNo"] = pageNo;
|
|
321
345
|
params["pageSize"] = pageSize;
|
|
322
|
-
|
|
323
346
|
this.doSearch(params);
|
|
347
|
+
this.setUserPageConfig({ pageSize });
|
|
324
348
|
};
|
|
325
349
|
|
|
326
350
|
render() {
|
|
327
351
|
const {
|
|
328
352
|
ltmplConfigRes, showDraw, showWindowType, ractionId, selectedCode,
|
|
329
|
-
showViewDrawer, showViewModal, showEdit, editSourceId, viewSourceId, toCustomPage
|
|
353
|
+
showViewDrawer, showViewModal, showEdit, editSourceId, viewSourceId, toCustomPage, userPageConfig
|
|
330
354
|
} = this.state;
|
|
331
355
|
const { location, params, tableType, rowOperatable, defShowType } = this.props;
|
|
332
356
|
const { sourceId } = params;
|
|
@@ -338,7 +362,7 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
338
362
|
search,
|
|
339
363
|
ltmplConfigRes?.ltmplConfig
|
|
340
364
|
);
|
|
341
|
-
let pageSize = criteriaData["pageSize"];
|
|
365
|
+
let pageSize = userPageConfig?.["pageSize"] || criteriaData["pageSize"];
|
|
342
366
|
let pageNo = criteriaData["pageNo"];
|
|
343
367
|
|
|
344
368
|
if (search.indexOf("mainCode") > 0) {
|
|
@@ -369,7 +393,8 @@ class LtmplRoute extends React.PureComponent<LtmplRouteProps, LtmplRouteState> {
|
|
|
369
393
|
mainCode={mainCode} showView={this.showView} doSearch={this.onChangeSearch} doEdit={this.doEdit}
|
|
370
394
|
doCreate={this.doCreate} sourceId={sourceId}
|
|
371
395
|
criteriaData={criteriaData} ltmplConfig={ltmplConfig} doRAction={this.doRAction}
|
|
372
|
-
defShowType={defShowType}
|
|
396
|
+
defShowType={defShowType} userPageConfig={userPageConfig} setUserPageConfig={this.setUserPageConfig}
|
|
397
|
+
resetUserPageConfig={this.resetUserPageConfig}
|
|
373
398
|
/>
|
|
374
399
|
{showDraw ? (
|
|
375
400
|
<Drawer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState, useMemo } from "react";
|
|
2
2
|
import { useParams, useLocation, useNavigate } from "react-router-dom";
|
|
3
|
-
import { DoEditParam, LtmplConfig, LtmplConfigRes, PageType, RouterCompProps, ShowViewParam } from "../tmpl/interface";
|
|
3
|
+
import { DoEditParam, LtmplConfig, LtmplConfigRes, PageType, RouterCompProps, ShowViewParam, ActTableViewModel } from "../tmpl/interface";
|
|
4
4
|
import Units from "../units";
|
|
5
5
|
import ActTable from "../table/act-table";
|
|
6
6
|
import HCDataSource from "../tmpl/hc-data-source";
|
|
@@ -19,10 +19,11 @@ export interface Props extends RouterCompProps {
|
|
|
19
19
|
layoutRootPath?: string;
|
|
20
20
|
tableType?: "common" | "report";
|
|
21
21
|
rowOperatable?: boolean;
|
|
22
|
+
defShowType?: ActTableViewModel;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const Index = (props: Props) => {
|
|
25
|
-
const { layoutRootPath, tableType, rowOperatable, basePath = "" } = props;
|
|
26
|
+
const { layoutRootPath, tableType, rowOperatable, basePath = "", defShowType } = props;
|
|
26
27
|
const [pageInfo, setPageInfo] = useState<{ pageNo: number, pageSize: number }>();
|
|
27
28
|
const [ltmplConfig, setLtmplConfig] = useState<LtmplConfig>();
|
|
28
29
|
const [splitterSize, setSplitterSize] = useState<number | string>("50%");
|
|
@@ -36,6 +37,7 @@ const Index = (props: Props) => {
|
|
|
36
37
|
const [toCustomPage, setToCustomPage] = useState<boolean>(false);
|
|
37
38
|
const [viewSourceId, setViewSourceId] = useState<string>();
|
|
38
39
|
const [editSourceId, setEditSourceId] = useState<string>();
|
|
40
|
+
const [userPageConfig, setUserPageConfig] = useState<{ [key: string]: any }>();
|
|
39
41
|
const { sourceId } = useParams();
|
|
40
42
|
const { search } = useLocation();
|
|
41
43
|
const { translate } = useLocale();
|
|
@@ -57,9 +59,28 @@ const Index = (props: Props) => {
|
|
|
57
59
|
setPageLayout(ltmplConfig?.pageLayout || "none");
|
|
58
60
|
};
|
|
59
61
|
|
|
62
|
+
// 获取用户页面配置
|
|
63
|
+
const getUserPageConfig = () => {
|
|
64
|
+
const config = Units.getUserPageConfig(sourceId);
|
|
65
|
+
setUserPageConfig(config);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// 设置用户页面配置
|
|
69
|
+
const handleSetUserPageConfig = (config: { [key: string]: any }) => {
|
|
70
|
+
const temConfig = Units.setUserPageConfig(sourceId, config);
|
|
71
|
+
setUserPageConfig(temConfig);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// 重置本地缓存页面配置
|
|
75
|
+
const resetUserPageConfig = () => {
|
|
76
|
+
Units.resetUserPageConfig(sourceId);
|
|
77
|
+
setUserPageConfig(undefined);
|
|
78
|
+
}
|
|
79
|
+
|
|
60
80
|
useEffect(() => {
|
|
61
81
|
if (sourceId) {
|
|
62
82
|
getLtmplConfig();
|
|
83
|
+
getUserPageConfig();
|
|
63
84
|
}
|
|
64
85
|
}, [sourceId]);
|
|
65
86
|
|
|
@@ -79,6 +100,7 @@ const Index = (props: Props) => {
|
|
|
79
100
|
params["pageSize"] = pageSize;
|
|
80
101
|
setPageInfo({ pageNo, pageSize });
|
|
81
102
|
doSearch(params);
|
|
103
|
+
handleSetUserPageConfig({ pageSize });
|
|
82
104
|
};
|
|
83
105
|
|
|
84
106
|
const onShowView = (showViewParam: ShowViewParam) => {
|
|
@@ -172,13 +194,17 @@ const Index = (props: Props) => {
|
|
|
172
194
|
const renderActTable = () => {
|
|
173
195
|
let criteriaData = Units.transQueryStrToParams(search, ltmplConfig);
|
|
174
196
|
return <ActTable key={"acttable" + sourceId}
|
|
175
|
-
tableType={tableType} serverKey={null} pageSize={pageInfo?.pageSize} pageNo={pageInfo?.pageNo} onChangePage={onChangePage}
|
|
197
|
+
tableType={tableType} serverKey={null} pageSize={userPageConfig?.pageSize || pageInfo?.pageSize} pageNo={pageInfo?.pageNo} onChangePage={onChangePage}
|
|
176
198
|
menuId={menuId} operatable={rowOperatable}
|
|
177
199
|
mainCode={mainCode} showView={onShowView} doSearch={onChangeSearch} doEdit={doEdit}
|
|
178
200
|
doCreate={doCreate} sourceId={sourceId}
|
|
179
201
|
criteriaData={criteriaData} ltmplConfig={ltmplConfig || null} doRAction={doRAction}
|
|
180
202
|
doDelete={() => pageLayout !== "none" && doCreate(editSourceId)}
|
|
181
|
-
|
|
203
|
+
defShowType={defShowType}
|
|
204
|
+
userPageConfig={userPageConfig}
|
|
205
|
+
setUserPageConfig={handleSetUserPageConfig}
|
|
206
|
+
resetUserPageConfig={resetUserPageConfig}
|
|
207
|
+
/>;
|
|
182
208
|
};
|
|
183
209
|
|
|
184
210
|
const doSubmited = (code?: string, isContinueSave?: boolean) => {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
ExportOutlined, FundOutlined, LineChartOutlined,
|
|
8
8
|
PlusCircleOutlined, PlusOutlined, ReloadOutlined, RetweetOutlined, SearchOutlined,
|
|
9
|
-
TableOutlined, ImportOutlined,
|
|
9
|
+
TableOutlined, ImportOutlined, SyncOutlined
|
|
10
10
|
} from "@ant-design/icons";
|
|
11
11
|
import "./index.css";
|
|
12
12
|
import {
|
|
@@ -72,6 +72,9 @@ interface ActTableProps extends TmplBaseProps {
|
|
|
72
72
|
defShowType?: ActTableViewModel; // 默认视图
|
|
73
73
|
showPagination?: boolean; // 是否显示分页
|
|
74
74
|
showAggregates?: boolean; // 是否显示统计数据
|
|
75
|
+
userPageConfig?: { [key: string]: any }; // 用户页面配置本地缓存
|
|
76
|
+
setUserPageConfig?: (config: { [key: string]: any }) => void; // 更新用户页面配置本地缓存
|
|
77
|
+
resetUserPageConfig?: () => void; // 重置用户页面配置本地缓存
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
interface ActTableStat {
|
|
@@ -154,36 +157,47 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
154
157
|
};
|
|
155
158
|
|
|
156
159
|
// 获取标签选项
|
|
157
|
-
getTabsOptions = () => {
|
|
158
|
-
const { ltmplConfig, criteriaData } = this.props;
|
|
160
|
+
getTabsOptions = async () => {
|
|
161
|
+
const { ltmplConfig, criteriaData, sourceId } = this.props;
|
|
159
162
|
const { translate } = this.context;
|
|
160
|
-
|
|
163
|
+
const { split2TabCriterias, showSplitTabDataCount } = ltmplConfig || {};
|
|
164
|
+
if (!split2TabCriterias) {
|
|
161
165
|
return;
|
|
162
166
|
}
|
|
163
167
|
const allIds = [];
|
|
164
|
-
|
|
168
|
+
let groupCount = [];
|
|
169
|
+
if (showSplitTabDataCount) {
|
|
170
|
+
groupCount = await HcserviceV3.getLtmplDataGroupCount(sourceId);
|
|
171
|
+
}
|
|
172
|
+
const options = split2TabCriterias.map(fieldConfig => {
|
|
165
173
|
const id = `c_${fieldConfig.id}`;
|
|
166
174
|
allIds.push(id);
|
|
167
175
|
if (enumTypes.includes(fieldConfig.controlType || fieldConfig.extControlType)) {
|
|
168
176
|
const items = HCDataSource.getEnums(fieldConfig.mstrucId);
|
|
169
|
-
const options = items.map((item) =>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
const options = items.map((item) => {
|
|
178
|
+
const count = groupCount.find(r => r[0]?.fieldId === fieldConfig.id && r[0]?.value === item.title)?.[1]?.value;
|
|
179
|
+
const countVal = (count || count === 0) ? ` (${count})` : "";
|
|
180
|
+
return {
|
|
181
|
+
label: <span style={{ padding: "0 10px" }}>{translate("${" + item.title + "}")}{countVal}</span>,
|
|
182
|
+
key: item.value,
|
|
183
|
+
id,
|
|
184
|
+
title: translate("${" + item.title + "}") + countVal,
|
|
185
|
+
value: item.value
|
|
186
|
+
};
|
|
187
|
+
});
|
|
176
188
|
if (fieldConfig.relDeduplication && fieldConfig.exceptCodes?.length) {
|
|
177
189
|
return options.filter(item => !fieldConfig.exceptCodes.includes(item.key));
|
|
178
190
|
}
|
|
179
191
|
return options;
|
|
180
192
|
}
|
|
181
193
|
if ([fieldConfig.controlType, fieldConfig.extControlType].includes("single-checkbox")) {
|
|
194
|
+
const count = groupCount.find(r => r[0]?.fieldId === fieldConfig.id)?.[1]?.value;
|
|
195
|
+
const countVal = (count || count === 0) ? ` (${count})` : "";
|
|
182
196
|
return [{
|
|
183
|
-
label: <span style={{ padding: "0 10px" }}>{translate("${" + fieldConfig.title + "}")}</span>,
|
|
197
|
+
label: <span style={{ padding: "0 10px" }}>{translate("${" + fieldConfig.title + "}")}{countVal}</span>,
|
|
184
198
|
key: "1",
|
|
185
199
|
id,
|
|
186
|
-
title: translate("${" + fieldConfig.title + "}"),
|
|
200
|
+
title: translate("${" + fieldConfig.title + "}") + countVal,
|
|
187
201
|
value: "1",
|
|
188
202
|
}];
|
|
189
203
|
}
|
|
@@ -208,7 +222,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
208
222
|
) => {
|
|
209
223
|
const {
|
|
210
224
|
sourceId, criteriaData, ltmplConfig,
|
|
211
|
-
mainCode, level, pageNo, pageSize, serverKey, defShowType
|
|
225
|
+
mainCode, level, pageNo, pageSize, serverKey, defShowType, userPageConfig
|
|
212
226
|
} = this.props;
|
|
213
227
|
|
|
214
228
|
if (!this.isSameSourceQuery(sourceId, criteriaData)) {
|
|
@@ -219,10 +233,12 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
219
233
|
if (!ltmplConfig) {
|
|
220
234
|
return;
|
|
221
235
|
}
|
|
222
|
-
|
|
236
|
+
// 处理菜单切换,查询条件清空,重置tab拆解条件选中项
|
|
237
|
+
const tabActiveKey = ltmplConfig.split2TabCriterias?.find(r => criteriaData[`c_${r.id}`])?.id;
|
|
223
238
|
this.setState({
|
|
224
239
|
loading: true,
|
|
225
240
|
userCriteriaData: criteriaData,
|
|
241
|
+
tabActiveKey: tabActiveKey ? criteriaData[`c_${tabActiveKey}`] : "all"
|
|
226
242
|
});
|
|
227
243
|
let disabledColIds: string[] = [];
|
|
228
244
|
let hiddenColIds_ = [...hiddenColIds];
|
|
@@ -258,11 +274,11 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
258
274
|
const { defaultPageSize, showType } = ltmplConfig;
|
|
259
275
|
|
|
260
276
|
let pageInfo = {
|
|
261
|
-
pageNo: pageNo
|
|
262
|
-
pageSize: pageSize
|
|
277
|
+
pageNo: pageNo || 1,
|
|
278
|
+
pageSize: pageSize || defaultPageSize || 10,
|
|
263
279
|
virtualEndPageNo: undefined,
|
|
264
280
|
};
|
|
265
|
-
const viewModels = this.state.viewModels.length > 0 ? this.state.viewModels : [defShowType || showType || "table"];
|
|
281
|
+
const viewModels = this.state.viewModels.length > 0 ? this.state.viewModels : (userPageConfig?.["viewModels"] || [defShowType || showType || "table"]);
|
|
266
282
|
|
|
267
283
|
/** 构建 dataSource **/
|
|
268
284
|
//构建过滤条件
|
|
@@ -449,7 +465,8 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
449
465
|
|
|
450
466
|
|
|
451
467
|
async componentDidMount() {
|
|
452
|
-
const { ltmplConfig, tableType } = this.props;
|
|
468
|
+
const { ltmplConfig, tableType, userPageConfig } = this.props;
|
|
469
|
+
const { sortedColIds } = userPageConfig || {};
|
|
453
470
|
const { translate } = this.context;
|
|
454
471
|
let sortedColConfigs = undefined;
|
|
455
472
|
if (ltmplConfig) {
|
|
@@ -458,13 +475,16 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
458
475
|
{ id: "20000", title: translate("${隐藏}"), originalId: "20000" },
|
|
459
476
|
...ltmplConfig.columns,
|
|
460
477
|
];
|
|
478
|
+
if (sortedColIds) { // 使用缓存的列排序
|
|
479
|
+
sortedColConfigs.sort((a, b) => sortedColIds.indexOf(a.id) - sortedColIds.indexOf(b.id));
|
|
480
|
+
}
|
|
481
|
+
this.loadData(userPageConfig?.hiddenColIds || defaultDisabledColIds, [], sortedColConfigs);
|
|
461
482
|
}
|
|
462
483
|
this.getTabsOptions();
|
|
463
|
-
this.loadData(defaultDisabledColIds, [], sortedColConfigs);
|
|
464
484
|
}
|
|
465
485
|
|
|
466
486
|
async componentDidUpdate(prevProps, prevState) {
|
|
467
|
-
const { sourceId, criteriaData, ltmplConfig, tableType, pageSize, pageNo } = this.props;
|
|
487
|
+
const { sourceId, criteriaData, ltmplConfig, tableType, pageSize, pageNo, userPageConfig } = this.props;
|
|
468
488
|
// const {userCriteriaData:preUserCriteriaData}=prevState;
|
|
469
489
|
const { userCriteriaData } = this.state;
|
|
470
490
|
const { translate } = this.context;
|
|
@@ -504,16 +524,18 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
504
524
|
await this.loadData(hiddenColIds, [], sortedColConfigs);
|
|
505
525
|
} else {
|
|
506
526
|
let sColConfigs = undefined;
|
|
527
|
+
const { sortedColIds } = userPageConfig || {};
|
|
507
528
|
if (ltmplConfig) {
|
|
508
|
-
sColConfigs = tableType ==
|
|
529
|
+
sColConfigs = tableType == 'report' ? ltmplConfig.columns : [
|
|
509
530
|
{ id: "10000", title: translate("${排序}"), originalId: "10000" },
|
|
510
531
|
{ id: "20000", title: translate("${隐藏}"), originalId: "20000" },
|
|
511
532
|
...ltmplConfig.columns,
|
|
512
|
-
|
|
513
533
|
];
|
|
534
|
+
if (sortedColIds) { // 使用缓存的列排序
|
|
535
|
+
sColConfigs.sort((a, b) => sortedColIds.indexOf(a.id) - sortedColIds.indexOf(b.id));
|
|
536
|
+
}
|
|
514
537
|
}
|
|
515
|
-
this.
|
|
516
|
-
await this.loadData(defaultDisabledColIds, [], sColConfigs);
|
|
538
|
+
await this.loadData(userPageConfig?.hiddenColIds || defaultDisabledColIds, [], sColConfigs);
|
|
517
539
|
}
|
|
518
540
|
|
|
519
541
|
} else {
|
|
@@ -559,7 +581,9 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
559
581
|
};
|
|
560
582
|
|
|
561
583
|
changeViewModel = (viewModels) => {
|
|
584
|
+
const { setUserPageConfig } = this.props;
|
|
562
585
|
const { hiddenColIds, hiddenRowCodes, sortedColConfigs, viewModels: oldViewModels } = this.state;
|
|
586
|
+
setUserPageConfig({ viewModels });
|
|
563
587
|
this.setState({ viewModels }, () => {
|
|
564
588
|
if (viewModels.length && viewModels.includes("ganttChart") !== oldViewModels.includes("ganttChart")) {
|
|
565
589
|
this.loadData(hiddenColIds, hiddenRowCodes, sortedColConfigs); // 前后选择是否存在甘特图,刷新数据
|
|
@@ -568,10 +592,9 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
568
592
|
};
|
|
569
593
|
|
|
570
594
|
changeHiddenColumns = (hiddenColIds: string[]) => {
|
|
571
|
-
this.
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
});
|
|
595
|
+
const { setUserPageConfig } = this.props;
|
|
596
|
+
this.setState({ showL2Chart: false, hiddenColIds });
|
|
597
|
+
setUserPageConfig({ hiddenColIds });
|
|
575
598
|
};
|
|
576
599
|
|
|
577
600
|
doSelectedAction = async (actionId: string, codes, params: object) => {
|
|
@@ -841,11 +864,19 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
841
864
|
};
|
|
842
865
|
|
|
843
866
|
onChangeColSort = (sortedColConfigs: ColumnConfig[]) => {
|
|
844
|
-
this.
|
|
845
|
-
|
|
846
|
-
|
|
867
|
+
const { setUserPageConfig } = this.props;
|
|
868
|
+
this.setState({ sortedColConfigs });
|
|
869
|
+
const sortedColIds = sortedColConfigs.map(r => r.id);
|
|
870
|
+
setUserPageConfig({ sortedColIds });
|
|
847
871
|
};
|
|
848
872
|
|
|
873
|
+
// 更新本地缓存列宽度
|
|
874
|
+
onChangeResize = (colResize: { [key: string]: number }) => {
|
|
875
|
+
const { setUserPageConfig, userPageConfig } = this.props;
|
|
876
|
+
const oldColResize = userPageConfig?.colResize || {};
|
|
877
|
+
setUserPageConfig({ colResize: { ...oldColResize, ...colResize } });
|
|
878
|
+
}
|
|
879
|
+
|
|
849
880
|
getAddTmplButton = (classAddConfigs: ClassAddConfig[]) => {
|
|
850
881
|
const { translate } = this.context;
|
|
851
882
|
if (classAddConfigs && classAddConfigs.length < 1) {
|
|
@@ -866,6 +897,22 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
866
897
|
});
|
|
867
898
|
};
|
|
868
899
|
|
|
900
|
+
// 重置当前页面配置
|
|
901
|
+
handleResetUserPageConfig = () => {
|
|
902
|
+
const { resetUserPageConfig, ltmplConfig, tableType, defShowType } = this.props;
|
|
903
|
+
const { translate } = this.context;
|
|
904
|
+
let sortedColConfigs = undefined;
|
|
905
|
+
if (ltmplConfig) {
|
|
906
|
+
sortedColConfigs = tableType === 'report' ? ltmplConfig.columns : [
|
|
907
|
+
{ id: "10000", title: translate("${排序}"), originalId: "10000" },
|
|
908
|
+
{ id: "20000", title: translate("${隐藏}"), originalId: "20000" },
|
|
909
|
+
...ltmplConfig.columns,
|
|
910
|
+
];
|
|
911
|
+
}
|
|
912
|
+
this.setState({ viewModels: [defShowType || ltmplConfig.showType || "table"], hiddenColIds: defaultDisabledColIds, sortedColConfigs });
|
|
913
|
+
resetUserPageConfig();
|
|
914
|
+
}
|
|
915
|
+
|
|
869
916
|
renderHeaderButtons = () => {
|
|
870
917
|
let {
|
|
871
918
|
hiddenColIds, viewModels, sortedColConfigs, disabledColIds, showL2Chart,
|
|
@@ -873,7 +920,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
873
920
|
} = this.state;
|
|
874
921
|
const {
|
|
875
922
|
ltmplConfig, sourceId, doCreate, doSearch, menuId,
|
|
876
|
-
funcMode, customCreatable, serverKey, readOnly,
|
|
923
|
+
funcMode, customCreatable, serverKey, readOnly, userPageConfig
|
|
877
924
|
} = this.props;
|
|
878
925
|
const { translate } = this.context;
|
|
879
926
|
let { buttons } = ltmplConfig;
|
|
@@ -882,6 +929,13 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
882
929
|
return (
|
|
883
930
|
<>
|
|
884
931
|
<Space>
|
|
932
|
+
{userPageConfig ? // 本地缓存重置按钮
|
|
933
|
+
<Tooltip title={translate("${重置}")}>
|
|
934
|
+
<Button onClick={() => this.handleResetUserPageConfig()}>
|
|
935
|
+
<SyncOutlined />
|
|
936
|
+
</Button>
|
|
937
|
+
</Tooltip>
|
|
938
|
+
: ""}
|
|
885
939
|
{funcMode == "common" && this.criteriaFormUseful() ? (
|
|
886
940
|
<Popover trigger="click" content={this.renderCriteriaForm()}>
|
|
887
941
|
<Button>
|
|
@@ -1371,7 +1425,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1371
1425
|
mainCode, sourceId, ltmplConfig, funcMode, operatable,
|
|
1372
1426
|
title, collapsible,
|
|
1373
1427
|
onChangePage, serverKey, criteriaData,
|
|
1374
|
-
showView, doEdit, doRAction, customEditable, readOnly, tableType, showPagination, showAggregates
|
|
1428
|
+
showView, doEdit, doRAction, customEditable, readOnly, tableType, showPagination, showAggregates, userPageConfig
|
|
1375
1429
|
} = this.props;
|
|
1376
1430
|
const { translate } = this.context;
|
|
1377
1431
|
|
|
@@ -1396,7 +1450,8 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1396
1450
|
blockMenuTreeDrawerOpen: this.blockMenuTreeDrawerOpen,
|
|
1397
1451
|
doRowAction: this.doRowAction, doDeleteByCode: this.doDeleteByCode, sortColumns: criteriaData["sortColIds"],
|
|
1398
1452
|
editings, editRowEdit: this.editRowEdit, cancelRowEdit: this.cancelRowEdit, saveRowData: this.saveRowData,
|
|
1399
|
-
doDelModalOpen: this.doDelModalOpen, mainCode, criteriaData: userCriteriaData, actTableDoSearch: this.actTableDoSearch
|
|
1453
|
+
doDelModalOpen: this.doDelModalOpen, mainCode, criteriaData: userCriteriaData, actTableDoSearch: this.actTableDoSearch,
|
|
1454
|
+
columnResize: userPageConfig?.colResize
|
|
1400
1455
|
}
|
|
1401
1456
|
);
|
|
1402
1457
|
|
|
@@ -1435,6 +1490,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1435
1490
|
selectedRows={selectedRows} queryKey={queryKey}
|
|
1436
1491
|
onChangeRowSelection={this.changeRowSelection}
|
|
1437
1492
|
leftFixedCols={ltmplConfig.leftFixedCols}
|
|
1493
|
+
onChangeResize={this.onChangeResize}
|
|
1438
1494
|
/> :
|
|
1439
1495
|
<QueryTable key={"querytable" + sourceId} sourceId={sourceId}
|
|
1440
1496
|
// queryTotal={this.queryTotal}
|
|
@@ -1464,6 +1520,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
|
|
|
1464
1520
|
showView={showView}
|
|
1465
1521
|
showPagination={showPagination}
|
|
1466
1522
|
onChangeAggregateVO={(val) => this.setState({ aggregateVO: val })}
|
|
1523
|
+
onChangeResize={this.onChangeResize}
|
|
1467
1524
|
/>);
|
|
1468
1525
|
|
|
1469
1526
|
// tab拆解条件渲染
|
|
@@ -54,7 +54,8 @@ interface ColumnBuilderProps extends ActionRenderProps {
|
|
|
54
54
|
operatable?: boolean,
|
|
55
55
|
mainCode?: string,
|
|
56
56
|
criteriaData?: object,
|
|
57
|
-
actTableDoSearch?: (data: object) => void
|
|
57
|
+
actTableDoSearch?: (data: object) => void,
|
|
58
|
+
columnResize?: { [key: string]: number }
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
interface ReportColumnBuilderProps {
|
|
@@ -78,7 +79,8 @@ export default {
|
|
|
78
79
|
sortedColConfigs, unHiden,
|
|
79
80
|
onHide, translate,
|
|
80
81
|
sortColumns, serverKey,
|
|
81
|
-
editings, mainCode, criteriaData, actTableDoSearch, showView
|
|
82
|
+
editings, mainCode, criteriaData, actTableDoSearch, showView,
|
|
83
|
+
columnResize
|
|
82
84
|
} = props;
|
|
83
85
|
|
|
84
86
|
const { primaryColumn, primaryColumnLabel } = ltmplConfig
|
|
@@ -247,6 +249,9 @@ export default {
|
|
|
247
249
|
</div>);
|
|
248
250
|
column["filteredValue"] = searchVal || undefined;
|
|
249
251
|
}
|
|
252
|
+
if (columnResize?.[item.id]) { // 本地缓存存在列宽配置
|
|
253
|
+
column["width"] = columnResize[item.id];
|
|
254
|
+
}
|
|
250
255
|
});
|
|
251
256
|
return tableColumns;
|
|
252
257
|
},
|
|
@@ -433,7 +433,8 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
433
433
|
cardListConfig,
|
|
434
434
|
ltmplConfig,
|
|
435
435
|
showView,
|
|
436
|
-
showPagination
|
|
436
|
+
showPagination,
|
|
437
|
+
onChangeResize
|
|
437
438
|
} = this.props;
|
|
438
439
|
//debugger
|
|
439
440
|
const { touchEnd, aggregateVO, loading, virtualEndPageNo, dataSource, errorText } = this.state;
|
|
@@ -592,6 +593,7 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
592
593
|
}
|
|
593
594
|
}
|
|
594
595
|
} : undefined}
|
|
596
|
+
onChangeResize={onChangeResize}
|
|
595
597
|
/>
|
|
596
598
|
) : (
|
|
597
599
|
""
|
|
@@ -7,13 +7,11 @@ import ColumnBuilder from "./column/column-builder";
|
|
|
7
7
|
import ResizableTable from "./resizable-table";
|
|
8
8
|
|
|
9
9
|
const ReportTable = (props: ReportTableProps) => {
|
|
10
|
-
|
|
11
10
|
const [loading, setLoading] = useState<boolean>(false);
|
|
12
11
|
const [dataSource, setDataSource] = useState<object[]>(undefined);
|
|
13
12
|
const [reportData, setReportData] = useState<ReportData>(undefined);
|
|
14
|
-
|
|
15
13
|
const { getServiceLangStr, translate } = useLocale();
|
|
16
|
-
const { tableProps, columns, queryKey, serverKey, leftFixedCols, hiddenColIds } = props
|
|
14
|
+
const { tableProps, columns, queryKey, serverKey, leftFixedCols, hiddenColIds, onChangeResize } = props
|
|
17
15
|
|
|
18
16
|
useEffect(() => {
|
|
19
17
|
const queryData = async () => {
|
|
@@ -118,7 +116,9 @@ const ReportTable = (props: ReportTableProps) => {
|
|
|
118
116
|
}
|
|
119
117
|
bordered
|
|
120
118
|
pagination={false}
|
|
121
|
-
style={{ display: columns ? "block" : "none", marginBottom: "12px" }}
|
|
119
|
+
style={{ display: columns ? "block" : "none", marginBottom: "12px" }}
|
|
120
|
+
onChangeResize={onChangeResize}
|
|
121
|
+
/>
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export default ReportTable;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, {useEffect, useState} from 'react';
|
|
2
|
-
import {Table} from "antd";
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Table } from "antd";
|
|
3
3
|
import { Resizable } from 'react-resizable';
|
|
4
4
|
import "./index.css";
|
|
5
|
+
|
|
5
6
|
const ResizableTitle = props => {
|
|
6
7
|
const { onResize, width, ...restProps } = props;
|
|
7
8
|
// useEffect(() => {
|
|
@@ -26,7 +27,7 @@ const ResizableTitle = props => {
|
|
|
26
27
|
return (
|
|
27
28
|
<Resizable draggableOpts={{ enableUserSelectHack: false }}
|
|
28
29
|
width={width}
|
|
29
|
-
|
|
30
|
+
minConstraints={[40, 0]}
|
|
30
31
|
height={0} // 不需要调整高度,设为 0
|
|
31
32
|
onResize={onResize}
|
|
32
33
|
handle={
|
|
@@ -42,7 +43,7 @@ const ResizableTitle = props => {
|
|
|
42
43
|
|
|
43
44
|
const ResizableTable = props => {
|
|
44
45
|
|
|
45
|
-
const {columns:columns_,components:components_
|
|
46
|
+
const { columns: columns_, components: components_, onChangeResize, ...other } = props
|
|
46
47
|
// const [columns, setColumns] = useState(columns_.map((col) => {
|
|
47
48
|
// col['onHeaderCell']=(col) => ({
|
|
48
49
|
// ...col['onHeaderCell'],
|
|
@@ -53,22 +54,22 @@ const ResizableTable = props => {
|
|
|
53
54
|
// }
|
|
54
55
|
// ));
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
const [columns, setColumns] = useState([]);
|
|
57
58
|
// 每一列增加 width, onResize 作为 ResizableTitle 的 props
|
|
58
59
|
|
|
59
60
|
useEffect(() => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
columns_.forEach((col) => (
|
|
62
|
+
col['onHeaderCell'] = (col) => ({
|
|
63
|
+
width: col.width,
|
|
64
|
+
onResize: handleResize(col.dataIndex),
|
|
65
|
+
})
|
|
66
|
+
)
|
|
66
67
|
);
|
|
67
68
|
setColumns(columns_);
|
|
68
69
|
}, [columns_]);
|
|
69
70
|
|
|
70
71
|
// 拖动时更新表格列
|
|
71
|
-
|
|
72
|
+
let handleResize = dataIndex => (e, { size }) => {
|
|
72
73
|
setColumns((columns) => (
|
|
73
74
|
columns.map((column) => {
|
|
74
75
|
if (column.dataIndex === dataIndex) {
|
|
@@ -80,16 +81,16 @@ const ResizableTable = props => {
|
|
|
80
81
|
return column;
|
|
81
82
|
}
|
|
82
83
|
})
|
|
83
|
-
))
|
|
84
|
+
));
|
|
85
|
+
onChangeResize && onChangeResize({ [dataIndex]: size.width }); // 列尺寸缓存本地
|
|
84
86
|
};
|
|
85
87
|
|
|
86
|
-
const components={
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
88
|
+
const components = {
|
|
89
|
+
...components_,
|
|
90
|
+
header: { cell: ResizableTitle }
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
return <Table components={components}
|
|
93
|
+
return <Table components={components} columns={columns} {...other} size="small" />;
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
export default ResizableTable;
|