aldehyde 0.2.99 → 0.2.101
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/controls/action/index.d.ts.map +1 -1
- package/lib/controls/action/index.js +6 -5
- package/lib/controls/action/index.js.map +1 -1
- package/lib/controls/collapse-card/index.d.ts +11 -2
- package/lib/controls/collapse-card/index.d.ts.map +1 -1
- package/lib/controls/collapse-card/index.js +18 -16
- package/lib/controls/collapse-card/index.js.map +1 -1
- package/lib/controls/entry-control.d.ts.map +1 -1
- package/lib/controls/entry-control.js +2 -1
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/detail/button/fix-right-submit-button-bar.js +1 -1
- package/lib/detail/button/fix-right-submit-button-bar.js.map +1 -1
- package/lib/detail/view/act-dtmpl-view.js +1 -1
- package/lib/detail/view/act-dtmpl-view.js.map +1 -1
- package/lib/detail/view/field-view-group.d.ts +10 -1
- package/lib/detail/view/field-view-group.d.ts.map +1 -1
- package/lib/detail/view/field-view-group.js +17 -11
- package/lib/detail/view/field-view-group.js.map +1 -1
- package/lib/form/criteria-form.js +3 -3
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/form/form-Item-group.js +1 -1
- package/lib/form/form-Item-group.js.map +1 -1
- package/lib/layout/MainPage.js +1 -1
- package/lib/layout/MainPage.js.map +1 -1
- package/lib/layout/header/index.js +3 -3
- package/lib/layout/header/index.js.map +1 -1
- package/lib/layout/menu/block.css +11 -0
- package/lib/layout/menu/block.d.ts +13 -1
- package/lib/layout/menu/block.d.ts.map +1 -1
- package/lib/layout/menu/block.js +66 -8
- package/lib/layout/menu/block.js.map +1 -1
- package/lib/layout/menu/menu-2layers.d.ts +10 -0
- package/lib/layout/menu/menu-2layers.d.ts.map +1 -1
- package/lib/layout/menu/menu-2layers.js +32 -9
- package/lib/layout/menu/menu-2layers.js.map +1 -1
- package/lib/layout/sidebar/index.d.ts.map +1 -1
- package/lib/layout/sidebar/index.js +3 -1
- package/lib/layout/sidebar/index.js.map +1 -1
- package/lib/locale/LocaleProvider.d.ts.map +1 -1
- package/lib/locale/LocaleProvider.js +10 -8
- package/lib/locale/LocaleProvider.js.map +1 -1
- package/lib/locale/translate.d.ts.map +1 -1
- package/lib/locale/translate.js +10 -8
- package/lib/locale/translate.js.map +1 -1
- package/lib/routable/ltmpl-route.d.ts +2 -2
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +22 -21
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +18 -8
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-selector.d.ts.map +1 -1
- package/lib/table/column/column-selector.js +20 -18
- package/lib/table/column/column-selector.js.map +1 -1
- package/lib/table/query-table.d.ts +10 -1
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +47 -41
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/relation-table.js +4 -4
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tree/tmpl-tree.d.ts.map +1 -1
- package/lib/tree/tmpl-tree.js +18 -0
- package/lib/tree/tmpl-tree.js.map +1 -1
- package/lib/tree/tree-node.d.ts.map +1 -1
- package/lib/tree/tree-node.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/action/index.tsx +6 -5
- package/src/aldehyde/controls/collapse-card/index.tsx +96 -54
- package/src/aldehyde/controls/entry-control.tsx +2 -1
- package/src/aldehyde/detail/button/fix-right-submit-button-bar.tsx +1 -1
- package/src/aldehyde/detail/view/act-dtmpl-view.tsx +1 -1
- package/src/aldehyde/detail/view/field-view-group.tsx +62 -47
- package/src/aldehyde/form/criteria-form.tsx +3 -3
- package/src/aldehyde/form/form-Item-group.tsx +1 -1
- package/src/aldehyde/layout/MainPage.tsx +1 -1
- package/src/aldehyde/layout/header/index.tsx +4 -4
- package/src/aldehyde/layout/menu/block.css +11 -0
- package/src/aldehyde/layout/menu/block.tsx +132 -72
- package/src/aldehyde/layout/menu/menu-2layers.tsx +99 -64
- package/src/aldehyde/layout/sidebar/index.tsx +5 -1
- package/src/aldehyde/locale/LocaleProvider.tsx +10 -9
- package/src/aldehyde/locale/translate.ts +10 -7
- package/src/aldehyde/routable/ltmpl-route.tsx +220 -196
- package/src/aldehyde/table/act-table.tsx +26 -9
- package/src/aldehyde/table/column/column-selector.tsx +111 -72
- package/src/aldehyde/table/query-table.tsx +354 -304
- package/src/aldehyde/table/relation-table.tsx +4 -4
- package/src/aldehyde/tree/tmpl-tree.tsx +19 -3
- package/src/aldehyde/tree/tree-node.tsx +0 -3
|
@@ -1,350 +1,400 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {Card, Collapse, Descriptions, List} from
|
|
3
|
-
import { Table } from
|
|
4
|
-
import "./index.css"
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Card, Collapse, Descriptions, List } from "antd";
|
|
3
|
+
import { Table } from "./control-table-x-axis-wrapper";
|
|
4
|
+
import "./index.css";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
ActTableViewModel,
|
|
7
|
+
ColumnConfig,
|
|
8
|
+
DtmplData,
|
|
9
|
+
FieldConfig,
|
|
10
|
+
PageInfo,
|
|
11
|
+
QueryData,
|
|
12
|
+
QueryKey,
|
|
13
|
+
SelectedRow,
|
|
13
14
|
} from "../tmpl/interface";
|
|
14
15
|
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
15
|
-
import Pagination from
|
|
16
|
-
import {TableRowSelection} from "antd/lib/table/interface";
|
|
17
|
-
import {SortableContainer, SortableElement} from "react-sortable-hoc";
|
|
18
|
-
import {arrayMoveImmutable} from
|
|
16
|
+
import Pagination from "./pagination";
|
|
17
|
+
import { TableRowSelection } from "antd/lib/table/interface";
|
|
18
|
+
import { SortableContainer, SortableElement } from "react-sortable-hoc";
|
|
19
|
+
import { arrayMoveImmutable } from "array-move";
|
|
19
20
|
import ViewControl from "../controls/view-control";
|
|
20
|
-
import Scrollbars from
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
21
|
+
import Scrollbars from "react-custom-scrollbars";
|
|
22
|
+
import { LocaleContext } from "../locale/LocaleProvider";
|
|
23
|
+
const { Panel } = Collapse;
|
|
24
|
+
const SortableItem = SortableElement((props) => <tr {...props} />);
|
|
25
|
+
const SortableBody = SortableContainer((props) => <tbody {...props} />);
|
|
25
26
|
|
|
26
27
|
interface CacheData {
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
dataSource: object[];
|
|
29
|
+
pageInfo: PageInfo;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
interface QueryTableProps {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
33
|
+
viewModels?: ActTableViewModel[];
|
|
34
|
+
// defaultPageSize?: number;
|
|
35
|
+
pageInfo: {
|
|
36
|
+
pageNo: number;
|
|
37
|
+
pageSize: number;
|
|
38
|
+
};
|
|
39
|
+
primaryColumn?: ColumnConfig;
|
|
40
|
+
columns: any[];
|
|
41
|
+
serverKey?: string;
|
|
42
|
+
queryKey: QueryKey;
|
|
43
|
+
onChangePage: (pageNo: number, pageSize: number) => void;
|
|
44
|
+
onChangeRowSelection?: (
|
|
45
|
+
selectedRows: SelectedRow[],
|
|
46
|
+
selectedDatas: DtmplData[],
|
|
47
|
+
allRowKeys: string[]
|
|
48
|
+
) => void;
|
|
49
|
+
maxSelectedRows?: number;
|
|
50
|
+
selectedRows?: SelectedRow[];
|
|
51
|
+
hiddenRowCodes?: string[];
|
|
52
|
+
viewModel?: string;
|
|
53
|
+
columnConfigs?: FieldConfig[];
|
|
54
|
+
}
|
|
51
55
|
|
|
52
56
|
interface QueryTableStat {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
57
|
+
queryDataCache?: Map<string, CacheData>;
|
|
58
|
+
virtualEndPageNo?: number;
|
|
59
|
+
dataSource?: object[];
|
|
60
|
+
loading?: boolean;
|
|
61
|
+
touchEnd?: boolean;
|
|
62
|
+
total?: number;
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
66
|
+
static defaultProps = {
|
|
67
|
+
pageInfo: {
|
|
68
|
+
pageNo: 1,
|
|
69
|
+
pageSize: 10,
|
|
70
|
+
virtualEndPageNo: undefined,
|
|
71
|
+
},
|
|
72
|
+
hiddenRowCodes: [],
|
|
73
|
+
selectedRows: [],
|
|
74
|
+
viewModels: ["table"],
|
|
75
|
+
};
|
|
62
76
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
viewModels: ['table']
|
|
72
|
-
}
|
|
77
|
+
state = {
|
|
78
|
+
queryDataCache: undefined,
|
|
79
|
+
virtualEndPageNo: undefined,
|
|
80
|
+
dataSource: undefined,
|
|
81
|
+
loading: true,
|
|
82
|
+
touchEnd: undefined,
|
|
83
|
+
total: undefined,
|
|
84
|
+
};
|
|
73
85
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
static contextType = LocaleContext;
|
|
87
|
+
context: React.ContextType<typeof LocaleContext>;
|
|
88
|
+
|
|
89
|
+
async componentDidMount() {
|
|
90
|
+
const { queryKey, pageInfo } = this.props;
|
|
91
|
+
// let pageInfo = {
|
|
92
|
+
// pageNo: 1,
|
|
93
|
+
// pageSize: defaultPageSize ? defaultPageSize : 10,
|
|
94
|
+
// virtualEndPageNo: undefined,
|
|
95
|
+
// }
|
|
96
|
+
if (queryKey) {
|
|
97
|
+
await this.loadData(queryKey.key, pageInfo);
|
|
81
98
|
}
|
|
99
|
+
}
|
|
82
100
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
componentWillUnmount() {
|
|
102
|
+
this.setState = () => false;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async componentDidUpdate(prevProps) {
|
|
106
|
+
const { queryKey: preQueryKey, pageInfo: prePageInfo } = prevProps;
|
|
107
|
+
const { queryKey, pageInfo } = this.props;
|
|
108
|
+
const { total } = this.state;
|
|
109
|
+
if (queryKey) {
|
|
110
|
+
if (preQueryKey?.key != queryKey.key) {
|
|
111
|
+
await this.loadData(queryKey.key, pageInfo, true);
|
|
112
|
+
} else if (
|
|
113
|
+
prePageInfo?.pageNo != pageInfo.pageNo ||
|
|
114
|
+
prePageInfo?.pageSize != pageInfo.pageSize
|
|
115
|
+
) {
|
|
116
|
+
await this.loadData(queryKey.key, pageInfo, false);
|
|
117
|
+
}
|
|
93
118
|
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
DraggableContainer = (props) => (
|
|
122
|
+
<SortableBody
|
|
123
|
+
useDragHandle
|
|
124
|
+
disableAutoscroll
|
|
125
|
+
helperClass="row-dragging"
|
|
126
|
+
onSortEnd={this.onSortEnd}
|
|
127
|
+
{...props}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
94
130
|
|
|
95
|
-
|
|
96
|
-
|
|
131
|
+
DraggableBodyRow = ({ className, style, ...restProps }) => {
|
|
132
|
+
const { dataSource } = this.state;
|
|
133
|
+
if (dataSource) {
|
|
134
|
+
const index = dataSource.findIndex(
|
|
135
|
+
(x) => x.key === restProps["data-row-key"]
|
|
136
|
+
);
|
|
137
|
+
return <SortableItem key={index} index={index} {...restProps} />;
|
|
138
|
+
} else {
|
|
139
|
+
return <></>;
|
|
97
140
|
}
|
|
141
|
+
};
|
|
98
142
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
143
|
+
onSortEnd = ({ oldIndex, newIndex }) => {
|
|
144
|
+
const { dataSource } = this.state;
|
|
145
|
+
if (oldIndex !== newIndex) {
|
|
146
|
+
const newData = arrayMoveImmutable(
|
|
147
|
+
[].concat(dataSource),
|
|
148
|
+
oldIndex,
|
|
149
|
+
newIndex
|
|
150
|
+
).filter((el) => !!el);
|
|
151
|
+
//console.log('Sorted items: ', newData);
|
|
152
|
+
this.setState({ dataSource: newData });
|
|
110
153
|
}
|
|
154
|
+
};
|
|
111
155
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
156
|
+
loadData = async (
|
|
157
|
+
queryKey: string,
|
|
158
|
+
pageInfo: PageInfo,
|
|
159
|
+
cleanCache?: boolean
|
|
160
|
+
) => {
|
|
161
|
+
this.setState({
|
|
162
|
+
loading: true,
|
|
163
|
+
});
|
|
164
|
+
let { queryDataCache } = this.state;
|
|
121
165
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
166
|
+
let { serverKey } = this.props;
|
|
167
|
+
let queryCache: Map<string, CacheData>;
|
|
168
|
+
if (cleanCache || !queryDataCache) {
|
|
169
|
+
queryCache = new Map<string, CacheData>();
|
|
170
|
+
this.setState({ total: undefined });
|
|
171
|
+
} else {
|
|
172
|
+
queryCache = queryDataCache;
|
|
173
|
+
}
|
|
174
|
+
if (queryCache.has(pageInfo.pageNo + "_" + pageInfo.pageSize)) {
|
|
175
|
+
let cacheData = queryCache.get(pageInfo.pageNo + "_" + pageInfo.pageSize);
|
|
176
|
+
this.setState({
|
|
177
|
+
dataSource: cacheData.dataSource,
|
|
178
|
+
virtualEndPageNo: cacheData.pageInfo.virtualEndPageNo,
|
|
179
|
+
loading: false,
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
let queryData: QueryData = await HcserviceV3.requestQueryData(
|
|
183
|
+
serverKey,
|
|
184
|
+
queryKey,
|
|
185
|
+
pageInfo
|
|
186
|
+
);
|
|
187
|
+
let dataSource: object[] = [];
|
|
188
|
+
pageInfo = queryData.pageInfo;
|
|
189
|
+
queryData.entities.forEach((item, index) => {
|
|
190
|
+
let row = {
|
|
191
|
+
key: item.code,
|
|
192
|
+
code: item.code, //增加code,为了删除操作
|
|
193
|
+
...item.fieldMap,
|
|
194
|
+
index,
|
|
195
|
+
};
|
|
196
|
+
dataSource.push(row);
|
|
197
|
+
});
|
|
198
|
+
let touchEnd = queryData.touchEnd;
|
|
199
|
+
//缓存数据
|
|
200
|
+
queryCache.set(pageInfo.pageNo + "_" + pageInfo.pageSize, {
|
|
201
|
+
dataSource,
|
|
202
|
+
pageInfo,
|
|
203
|
+
});
|
|
204
|
+
this.setState({
|
|
205
|
+
dataSource,
|
|
206
|
+
virtualEndPageNo: pageInfo.virtualEndPageNo,
|
|
207
|
+
queryDataCache: queryCache,
|
|
208
|
+
touchEnd,
|
|
209
|
+
loading: false,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
};
|
|
130
213
|
|
|
214
|
+
pageTo = async (pageNo: number, pageSize: number) => {
|
|
215
|
+
const { onChangePage } = this.props;
|
|
216
|
+
const { virtualEndPageNo } = this.state;
|
|
217
|
+
let pageInfo = {
|
|
218
|
+
pageNo,
|
|
219
|
+
pageSize: pageSize ? pageSize : 10,
|
|
220
|
+
virtualEndPageNo,
|
|
131
221
|
};
|
|
222
|
+
const { queryKey } = this.props;
|
|
223
|
+
await this.loadData(queryKey.key, pageInfo);
|
|
224
|
+
onChangePage(pageNo, pageSize);
|
|
225
|
+
};
|
|
132
226
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
this.setState({dataSource: newData});
|
|
141
|
-
}
|
|
142
|
-
};
|
|
227
|
+
queryTotal = async () => {
|
|
228
|
+
const { queryKey, serverKey } = this.props;
|
|
229
|
+
let total = await HcserviceV3.requestQueryCount(serverKey, queryKey.key);
|
|
230
|
+
this.setState({
|
|
231
|
+
total,
|
|
232
|
+
});
|
|
233
|
+
};
|
|
143
234
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
235
|
+
getRowSelection = () => {
|
|
236
|
+
const {
|
|
237
|
+
columns,
|
|
238
|
+
onChangeRowSelection,
|
|
239
|
+
selectedRows,
|
|
240
|
+
maxSelectedRows,
|
|
241
|
+
primaryColumn,
|
|
242
|
+
} = this.props;
|
|
243
|
+
let { dataSource } = this.state;
|
|
244
|
+
let selectedRowKeys = [];
|
|
149
245
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (cleanCache || !queryDataCache) {
|
|
153
|
-
queryCache = new Map<string, CacheData>();
|
|
154
|
-
this.setState({total: undefined,})
|
|
155
|
-
} else {
|
|
156
|
-
queryCache = queryDataCache;
|
|
157
|
-
}
|
|
158
|
-
if (queryCache.has(pageInfo.pageNo + "_" + pageInfo.pageSize)) {
|
|
159
|
-
let cacheData = queryCache.get(pageInfo.pageNo + "_" + pageInfo.pageSize);
|
|
160
|
-
this.setState({
|
|
161
|
-
dataSource: cacheData.dataSource,
|
|
162
|
-
virtualEndPageNo: cacheData.pageInfo.virtualEndPageNo,
|
|
163
|
-
loading: false,
|
|
164
|
-
})
|
|
165
|
-
} else {
|
|
166
|
-
let queryData: QueryData = await HcserviceV3.requestQueryData(serverKey,queryKey, pageInfo);
|
|
167
|
-
let dataSource: object[] = [];
|
|
168
|
-
pageInfo = queryData.pageInfo;
|
|
169
|
-
queryData.entities.forEach((item, index) => {
|
|
170
|
-
let row = {
|
|
171
|
-
key: item.code,
|
|
172
|
-
code: item.code,//增加code,为了删除操作
|
|
173
|
-
...item.fieldMap,
|
|
174
|
-
index,
|
|
175
|
-
};
|
|
176
|
-
dataSource.push(row);
|
|
177
|
-
})
|
|
178
|
-
let touchEnd = queryData.touchEnd;
|
|
179
|
-
//缓存数据
|
|
180
|
-
queryCache.set(pageInfo.pageNo + "_" + pageInfo.pageSize, {dataSource, pageInfo});
|
|
181
|
-
this.setState({
|
|
182
|
-
dataSource,
|
|
183
|
-
virtualEndPageNo: pageInfo.virtualEndPageNo,
|
|
184
|
-
queryDataCache: queryCache,
|
|
185
|
-
touchEnd,
|
|
186
|
-
loading: false,
|
|
187
|
-
})
|
|
188
|
-
}
|
|
246
|
+
for (let row of selectedRows) {
|
|
247
|
+
selectedRowKeys.push(row.code);
|
|
189
248
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
pageNo,
|
|
196
|
-
pageSize: pageSize ? pageSize : 10,
|
|
197
|
-
virtualEndPageNo,
|
|
198
|
-
}
|
|
199
|
-
const {queryKey} = this.props;
|
|
200
|
-
await this.loadData(queryKey.key, pageInfo);
|
|
201
|
-
onChangePage(pageNo,pageSize);
|
|
249
|
+
const allRowKeys: string[] = [];
|
|
250
|
+
if (dataSource) {
|
|
251
|
+
for (let d of dataSource) {
|
|
252
|
+
allRowKeys.push(d.code);
|
|
253
|
+
}
|
|
202
254
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const {queryKey,serverKey} = this.props;
|
|
206
|
-
let total = await HcserviceV3.requestQueryCount(serverKey,queryKey.key);
|
|
207
|
-
this.setState({
|
|
208
|
-
total
|
|
209
|
-
});
|
|
255
|
+
if (maxSelectedRows == -1) {
|
|
256
|
+
return null;
|
|
210
257
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
258
|
+
const rowSelection: TableRowSelection<any> = {
|
|
259
|
+
fixed: true,
|
|
260
|
+
type: maxSelectedRows == 1 ? "radio" : "checkbox",
|
|
261
|
+
selectedRowKeys,
|
|
262
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
263
|
+
//console.log('selectedRowKeys:', selectedRowKeys);
|
|
264
|
+
// console.log('selectedRows:', selectedRows);
|
|
265
|
+
let selectedRows_: SelectedRow[] = [];
|
|
266
|
+
let selectedDatas: DtmplData[] = [];
|
|
267
|
+
let titleColId = primaryColumn?.id;
|
|
268
|
+
if (!titleColId) {
|
|
269
|
+
columns.forEach((col) => {
|
|
270
|
+
if (col.title != "序号" && titleColId == null) {
|
|
271
|
+
titleColId = col.dataIndex;
|
|
272
|
+
return;
|
|
225
273
|
}
|
|
274
|
+
});
|
|
226
275
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
selectedRowKeys,
|
|
234
|
-
onChange: (selectedRowKeys, selectedRows) => {
|
|
235
|
-
//console.log('selectedRowKeys:', selectedRowKeys);
|
|
236
|
-
// console.log('selectedRows:', selectedRows);
|
|
237
|
-
let selectedRows_: SelectedRow[] = [];
|
|
238
|
-
let selectedDatas: DtmplData[] = [];
|
|
239
|
-
let titleColId =primaryColumn?.id;
|
|
240
|
-
if(!titleColId){
|
|
241
|
-
columns.forEach((col) => {
|
|
242
|
-
if (col.title != '序号' && titleColId == null) {
|
|
243
|
-
titleColId = col.dataIndex;
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
})
|
|
247
|
-
}
|
|
248
|
-
selectedRows.forEach((item) => {
|
|
249
|
-
selectedRows_.push({code: item['code'], title: item[titleColId]});
|
|
250
|
-
selectedDatas.push(item);
|
|
251
|
-
})
|
|
252
|
-
if (onChangeRowSelection) {
|
|
253
|
-
onChangeRowSelection(selectedRows_, selectedDatas, allRowKeys);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
276
|
+
selectedRows.forEach((item) => {
|
|
277
|
+
selectedRows_.push({ code: item["code"], title: item[titleColId] });
|
|
278
|
+
selectedDatas.push(item);
|
|
279
|
+
});
|
|
280
|
+
if (onChangeRowSelection) {
|
|
281
|
+
onChangeRowSelection(selectedRows_, selectedDatas, allRowKeys);
|
|
256
282
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
return rowSelection;
|
|
286
|
+
};
|
|
260
287
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
}
|
|
288
|
+
getUnHidenDataSource = () => {
|
|
289
|
+
const { dataSource } = this.state;
|
|
290
|
+
const { hiddenRowCodes } = this.props;
|
|
291
|
+
let ds: object[] = [];
|
|
292
|
+
if (dataSource) {
|
|
293
|
+
for (let d of dataSource) {
|
|
294
|
+
if (!hiddenRowCodes.includes(d.code)) {
|
|
295
|
+
ds.push(d);
|
|
271
296
|
}
|
|
272
|
-
|
|
297
|
+
}
|
|
273
298
|
}
|
|
299
|
+
return ds;
|
|
300
|
+
};
|
|
274
301
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
302
|
+
initViewList = (data) => {
|
|
303
|
+
//console.log("data:",data);
|
|
304
|
+
const { translate } = this.context;
|
|
305
|
+
const { columns, columnConfigs, serverKey } = this.props;
|
|
306
|
+
const formItemList = [];
|
|
307
|
+
if (columnConfigs.length > 0) {
|
|
308
|
+
columnConfigs.forEach((item, index) => {
|
|
309
|
+
if (item.id != "10000" && item.title != "操作" && item.id != "20000") {
|
|
310
|
+
const title = item.title;
|
|
311
|
+
let fieldValue = data ? data[item.id] : undefined;
|
|
312
|
+
if (title == "序号") {
|
|
313
|
+
fieldValue = data.index;
|
|
314
|
+
}
|
|
315
|
+
//fieldValue 没有值时不能为null 要为 undefined。antd input所限制
|
|
316
|
+
fieldValue = fieldValue
|
|
317
|
+
? fieldValue
|
|
318
|
+
: item.defaultValue
|
|
319
|
+
? item.defaultValue
|
|
320
|
+
: undefined;
|
|
321
|
+
const fieldKey = item.id + Math.random() * 100;
|
|
290
322
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
323
|
+
const formItem = (
|
|
324
|
+
<Descriptions.Item
|
|
325
|
+
label={translate("${" + item.title + "}")}
|
|
326
|
+
key={index}
|
|
327
|
+
className="labelcss"
|
|
328
|
+
>
|
|
329
|
+
<ViewControl
|
|
330
|
+
serverKey={serverKey}
|
|
331
|
+
holderType={"table"}
|
|
332
|
+
value={fieldValue}
|
|
333
|
+
fieldConfig={item}
|
|
334
|
+
/>
|
|
335
|
+
</Descriptions.Item>
|
|
336
|
+
);
|
|
337
|
+
formItemList.push(formItem);
|
|
299
338
|
}
|
|
300
|
-
|
|
301
|
-
|
|
339
|
+
});
|
|
302
340
|
}
|
|
341
|
+
return formItemList;
|
|
342
|
+
};
|
|
303
343
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
return (
|
|
308
|
-
<>
|
|
309
|
-
{viewModels.includes('table') ?
|
|
310
|
-
<Table size={'middle'}
|
|
311
|
-
rowSelection={this.getRowSelection()}
|
|
312
|
-
columns={columns ? columns : []}
|
|
313
|
-
dataSource={this.getUnHidenDataSource()}
|
|
314
|
-
bordered
|
|
315
|
-
pagination={false}
|
|
316
|
-
style={{display: columns ? "block" : "none" }}
|
|
317
|
-
loading={loading}
|
|
318
|
-
components={{
|
|
319
|
-
body: {
|
|
320
|
-
wrapper: this.DraggableContainer,
|
|
321
|
-
row: this.DraggableBodyRow,
|
|
322
|
-
},
|
|
323
|
-
}}
|
|
324
|
-
>
|
|
325
|
-
</Table>
|
|
326
|
-
: ""}
|
|
327
|
-
<Pagination touchEnd={touchEnd} pageInfo={{...pageInfo, virtualEndPageNo}} pageTo={this.pageTo}
|
|
328
|
-
queryTotal={this.queryTotal}
|
|
329
|
-
total={total}/>
|
|
330
|
-
{viewModels.includes('verticalList') ?
|
|
331
|
-
<Card style={{marginTop: '10px'}}>
|
|
332
|
-
<List
|
|
333
|
-
dataSource={this.getUnHidenDataSource()}
|
|
334
|
-
renderItem={item => (
|
|
335
|
-
<List.Item key={item['id']}>
|
|
336
|
-
<Card size={'small'} bodyStyle={{padding: '4px'}}><Descriptions column={4}>
|
|
337
|
-
{this.initViewList(item)}
|
|
338
|
-
</Descriptions></Card>
|
|
339
|
-
</List.Item>
|
|
340
|
-
)}
|
|
341
|
-
/>
|
|
342
|
-
</Card> : ""
|
|
343
|
-
}
|
|
344
|
-
</>
|
|
345
|
-
);
|
|
346
|
-
}
|
|
344
|
+
render() {
|
|
345
|
+
const { pageInfo, columns, viewModels } = this.props;
|
|
346
|
+
const { touchEnd, total, loading, virtualEndPageNo } = this.state;
|
|
347
347
|
|
|
348
|
+
return (
|
|
349
|
+
<>
|
|
350
|
+
{viewModels.includes("table") ? (
|
|
351
|
+
<Table
|
|
352
|
+
size={"middle"}
|
|
353
|
+
rowSelection={this.getRowSelection()}
|
|
354
|
+
columns={columns ? columns : []}
|
|
355
|
+
dataSource={this.getUnHidenDataSource()}
|
|
356
|
+
bordered
|
|
357
|
+
pagination={false}
|
|
358
|
+
style={{ display: columns ? "block" : "none" }}
|
|
359
|
+
loading={loading}
|
|
360
|
+
components={{
|
|
361
|
+
body: {
|
|
362
|
+
wrapper: this.DraggableContainer,
|
|
363
|
+
row: this.DraggableBodyRow,
|
|
364
|
+
},
|
|
365
|
+
}}
|
|
366
|
+
></Table>
|
|
367
|
+
) : (
|
|
368
|
+
""
|
|
369
|
+
)}
|
|
370
|
+
<Pagination
|
|
371
|
+
touchEnd={touchEnd}
|
|
372
|
+
pageInfo={{ ...pageInfo, virtualEndPageNo }}
|
|
373
|
+
pageTo={this.pageTo}
|
|
374
|
+
queryTotal={this.queryTotal}
|
|
375
|
+
total={total}
|
|
376
|
+
/>
|
|
377
|
+
{viewModels.includes("verticalList") ? (
|
|
378
|
+
<Card style={{ marginTop: "10px" }}>
|
|
379
|
+
<List
|
|
380
|
+
dataSource={this.getUnHidenDataSource()}
|
|
381
|
+
renderItem={(item) => (
|
|
382
|
+
<List.Item key={item["id"]}>
|
|
383
|
+
<Card size={"small"} bodyStyle={{ padding: "4px" }}>
|
|
384
|
+
<Descriptions column={4}>
|
|
385
|
+
{this.initViewList(item)}
|
|
386
|
+
</Descriptions>
|
|
387
|
+
</Card>
|
|
388
|
+
</List.Item>
|
|
389
|
+
)}
|
|
390
|
+
/>
|
|
391
|
+
</Card>
|
|
392
|
+
) : (
|
|
393
|
+
""
|
|
394
|
+
)}
|
|
395
|
+
</>
|
|
396
|
+
);
|
|
397
|
+
}
|
|
348
398
|
}
|
|
349
399
|
|
|
350
|
-
export default QueryTable;
|
|
400
|
+
export default QueryTable;
|