@bchr/bchr-front-lib 0.5.8 → 0.5.10
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/base/BaseAppUtils.js +10 -2
- package/lib/base/layout/ActionButton.js +6 -0
- package/lib/base/layout/FormRefInput.js +248 -0
- package/lib/base/layout/GridSelectModal.js +507 -0
- package/lib/base/layout/InputRefAddonBtn.js +300 -0
- package/lib/base/layout/KendoGridCellRenders.js +1170 -0
- package/lib/base/layout/RefInput.js +262 -0
- package/lib/base/utils/TableDataProcessors.js +103 -0
- package/lib/services/KendoGridAPI.js +392 -0
- package/lib/services/http.js +605 -0
- package/package.json +1 -1
- package/src/base/BaseAppUtils.js +10 -1
- package/src/base/layout/ActionButton.js +7 -1
- package/src/base/layout/FormRefInput.js +144 -0
- package/src/base/layout/GridSelectModal.js +329 -0
- package/src/base/layout/InputRefAddonBtn.js +120 -0
- package/src/base/layout/KendoGridCellRenders.js +790 -0
- package/src/base/layout/RefInput.js +148 -0
- package/src/base/utils/TableDataProcessors.js +87 -0
- package/src/services/KendoGridAPI.js +298 -0
- package/src/services/http.js +611 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React, {Fragment} from "react";
|
|
2
|
+
import InputRefAddonBtn from "./InputRefAddonBtn";
|
|
3
|
+
import {Values} from "../utils";
|
|
4
|
+
import Strings from "../utils/Strings";
|
|
5
|
+
import lodash from "lodash";
|
|
6
|
+
import {Input} from "antd";
|
|
7
|
+
|
|
8
|
+
class RefInput extends React.Component {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
super(props);
|
|
11
|
+
this.modalRef = React.createRef();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
buildHiddenFieldNames = (field) => {
|
|
15
|
+
if (Values.isBlankString(field)) {
|
|
16
|
+
throw new Error("参照输入控件缺少【field】关键属性");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (field.endsWith("_ext_name")) {
|
|
20
|
+
let index = field.indexOf("_ext_name");
|
|
21
|
+
let fieldPrefix = field.substring(0, index)
|
|
22
|
+
return [fieldPrefix + "_pk", fieldPrefix + "_ext_code"];
|
|
23
|
+
}
|
|
24
|
+
else if (field.endsWith("_name")) {
|
|
25
|
+
let index = field.indexOf("_name");
|
|
26
|
+
let fieldPrefix = field.substring(0, index)
|
|
27
|
+
return [fieldPrefix + "_pk", fieldPrefix + "_code"];
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new Error("参照输入控件缺少【field】关键属性的名称需要以【_ext_name】结尾");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onInputChange = (value) => {
|
|
35
|
+
const { data, field } = this.props;
|
|
36
|
+
if (data) {
|
|
37
|
+
let [field_pk, field_code] = this.buildHiddenFieldNames(field);
|
|
38
|
+
data[field] = value;
|
|
39
|
+
data[field_pk] = null;
|
|
40
|
+
data[field_code] = null;
|
|
41
|
+
|
|
42
|
+
this.forceUpdate();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
onOk = (selectedData) => {
|
|
47
|
+
const {multiple, field, data, okCallback} = this.props;
|
|
48
|
+
if (data) {
|
|
49
|
+
let [field_pk, field_code] = this.buildHiddenFieldNames(field);
|
|
50
|
+
|
|
51
|
+
if (!multiple) {
|
|
52
|
+
data[field] = selectedData[0].name;
|
|
53
|
+
data[field_pk] = selectedData[0].pk;
|
|
54
|
+
data[field_code] = selectedData[0].code;
|
|
55
|
+
} else {
|
|
56
|
+
let fieldNameData = [];
|
|
57
|
+
let fieldPkData = [];
|
|
58
|
+
let fieldCodeData = [];
|
|
59
|
+
|
|
60
|
+
selectedData.forEach(item => {
|
|
61
|
+
fieldNameData.push(item.name);
|
|
62
|
+
fieldPkData.push(item.pk);
|
|
63
|
+
fieldCodeData.push(item.code);
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
data[field] = fieldPkData.join(',');
|
|
67
|
+
data[field_pk] = fieldCodeData.join(',');
|
|
68
|
+
data[field_code] = fieldNameData.join(',');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.forceUpdate();
|
|
72
|
+
}
|
|
73
|
+
if (okCallback && typeof okCallback === 'function') {
|
|
74
|
+
if (!multiple) {
|
|
75
|
+
okCallback(selectedData[0], data);
|
|
76
|
+
} else {
|
|
77
|
+
okCallback(selectedData, data);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
onClear = () => {
|
|
83
|
+
const {field, data, clearCallback} = this.props;
|
|
84
|
+
let [field_pk, field_code] = this.buildHiddenFieldNames(field);
|
|
85
|
+
|
|
86
|
+
data[field_pk] = null;
|
|
87
|
+
data[field_code] = null;
|
|
88
|
+
data[field] = null;
|
|
89
|
+
|
|
90
|
+
this.forceUpdate();
|
|
91
|
+
|
|
92
|
+
if (clearCallback && typeof clearCallback === 'function') {
|
|
93
|
+
clearCallback(null);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
render() {
|
|
98
|
+
let inputProps = {...this.props};
|
|
99
|
+
let {
|
|
100
|
+
disabled, refCode, refDialogWidth, refDialogHeight, field, data, multiple, rules, isNotData, customGridData, customRefUIConfig,
|
|
101
|
+
onBeforeClick, readonly
|
|
102
|
+
} = inputProps;
|
|
103
|
+
|
|
104
|
+
delete inputProps.addonAfter;
|
|
105
|
+
delete inputProps.refCode;
|
|
106
|
+
delete inputProps.refDialogWidth;
|
|
107
|
+
delete inputProps.refDialogHeight;
|
|
108
|
+
delete inputProps.formRef;
|
|
109
|
+
delete inputProps.multiple;
|
|
110
|
+
delete inputProps.rules;
|
|
111
|
+
delete inputProps.okCallback;
|
|
112
|
+
delete inputProps.isNotData;
|
|
113
|
+
delete inputProps.customGridData;
|
|
114
|
+
delete inputProps.customRefUIConfig;
|
|
115
|
+
delete inputProps.onBeforeClick;
|
|
116
|
+
delete inputProps.readonly;
|
|
117
|
+
|
|
118
|
+
if (lodash.isPlainObject(refCode) && Strings.isNotBlankString(refCode.dictCode)) {
|
|
119
|
+
refCode = refCode.dictCode
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let [field_pk, field_code] = this.buildHiddenFieldNames(field);
|
|
123
|
+
|
|
124
|
+
return <Fragment>
|
|
125
|
+
{field_pk && <input type={"hidden"} name={field_pk}></input>}
|
|
126
|
+
{field_code && <input type={"hidden"} name={field_code}></input>}
|
|
127
|
+
<Input {...inputProps} className={`ref-input ${inputProps.className || ''}`}
|
|
128
|
+
value={data[field]}
|
|
129
|
+
readonly={readonly === undefined || readonly}
|
|
130
|
+
onClear={this.onClear}
|
|
131
|
+
onChange={this.onInputChange}
|
|
132
|
+
addonAfter={!disabled && <InputRefAddonBtn ref={this.modalRef}
|
|
133
|
+
isNotData={isNotData}
|
|
134
|
+
customGridData={customGridData}
|
|
135
|
+
customRefUIConfig={customRefUIConfig}
|
|
136
|
+
rules={rules}
|
|
137
|
+
refCode={refCode}
|
|
138
|
+
multiple={multiple}
|
|
139
|
+
onOk={this.onOk}
|
|
140
|
+
onBeforeClick={onBeforeClick}
|
|
141
|
+
refDialogWidth={refDialogWidth}
|
|
142
|
+
refDialogHeight={refDialogHeight}/>}/>
|
|
143
|
+
</Fragment>
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export default RefInput;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import Values from "./Values";
|
|
2
|
+
|
|
3
|
+
const buildTableTreeDataSource = function(flatArrayData, recordIDFieldName, recordParentIDFieldName) {
|
|
4
|
+
if (typeof recordIDFieldName !== "string") {
|
|
5
|
+
throw new Error("Invalid parameter value: recordIDFieldName.");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (typeof recordParentIDFieldName !== "string") {
|
|
9
|
+
throw new Error("Invalid parameter value: recordParentIDFieldName.");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (!flatArrayData) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!Array.isArray(flatArrayData)) {
|
|
17
|
+
throw new Error("The original data source is not array!");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (flatArrayData.length === 0) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let topRecords = [];
|
|
25
|
+
let recordPK2RecordVOMap = new Map();
|
|
26
|
+
for (let i = 0, len = flatArrayData.length; i < len; i++) {
|
|
27
|
+
let record = flatArrayData[i];
|
|
28
|
+
if (record) {
|
|
29
|
+
let recordIDValue = record[recordIDFieldName];
|
|
30
|
+
if (recordIDValue) {
|
|
31
|
+
|
|
32
|
+
if (!record[recordParentIDFieldName]) {
|
|
33
|
+
topRecords.push(record);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
recordPK2RecordVOMap.set(recordIDValue, record);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (let i = 0, len = flatArrayData.length; i < len; i++) {
|
|
42
|
+
let record = flatArrayData[i];
|
|
43
|
+
if (record) {
|
|
44
|
+
let recordIDValue = record[recordIDFieldName];
|
|
45
|
+
if (recordIDValue) {
|
|
46
|
+
let recordParentIDValue = record[recordParentIDFieldName];
|
|
47
|
+
if (recordParentIDValue) {
|
|
48
|
+
let parentRecord = recordPK2RecordVOMap.get(recordParentIDValue);
|
|
49
|
+
if (parentRecord) {
|
|
50
|
+
if (!parentRecord.children) {
|
|
51
|
+
parentRecord.children = [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
parentRecord.children.push(record);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return topRecords;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const buildQueryParameters = function (gridOperator) {
|
|
65
|
+
let param = {
|
|
66
|
+
pageIndex : (gridOperator.skip / gridOperator.take) + 1,
|
|
67
|
+
pageSize : gridOperator.take,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let filters = gridOperator.filter?.filters || [];
|
|
71
|
+
if (Values.isNotEmptyArray(filters)) {
|
|
72
|
+
let filter = {};
|
|
73
|
+
|
|
74
|
+
for (let i = 0; i < filters.length; i++) {
|
|
75
|
+
filter[filters[i].field] = filters[i].value;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
param.filter = filter;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return param;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
buildTableTreeDataSource,
|
|
86
|
+
buildQueryParameters
|
|
87
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import lodash from "lodash";
|
|
3
|
+
import Values from "../base/utils/Values";
|
|
4
|
+
import DateTimes from "../base/utils/DateTimes";
|
|
5
|
+
import uuid from 'react-uuid';
|
|
6
|
+
import {message} from "antd";
|
|
7
|
+
|
|
8
|
+
class KendoGridAPI {
|
|
9
|
+
constructor(kendoGridRef, state, setState) {
|
|
10
|
+
this.gridTableRef = kendoGridRef;
|
|
11
|
+
|
|
12
|
+
if (state) {
|
|
13
|
+
if (Values.isNotEmpty(state)) {
|
|
14
|
+
this.state = state;
|
|
15
|
+
this.setState = setState;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
throw new Error("Invalid state for create KendoGridAPI");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
this.defaultPagerGridModelObj = {
|
|
23
|
+
skip: 0,
|
|
24
|
+
take: 20,
|
|
25
|
+
filters: [],
|
|
26
|
+
pageable: {
|
|
27
|
+
pageSizes: [20, 50, 100, 200],
|
|
28
|
+
type: 'numeric'
|
|
29
|
+
},
|
|
30
|
+
total: 0,
|
|
31
|
+
filterable: true,
|
|
32
|
+
resizable: true,
|
|
33
|
+
sortable: {mode: 'multiple'},
|
|
34
|
+
data: []
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static of(gridTableRef, state, setState) {
|
|
39
|
+
return new KendoGridAPI(gridTableRef, state, setState);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
getTableRef() {
|
|
43
|
+
return this.gridTableRef;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
buildPagerGridModel(modelOptions) {
|
|
47
|
+
let model = null;
|
|
48
|
+
|
|
49
|
+
if (lodash.isPlainObject(modelOptions)) {
|
|
50
|
+
model = Object.assign({...this.defaultPagerGridModelObj}, modelOptions);
|
|
51
|
+
} else {
|
|
52
|
+
model = {...this.defaultPagerGridModelObj};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
this.setState({
|
|
56
|
+
refTableModel: {...model}
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
return this.state.refTableModel;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
buildNotPagerGridModel(modelOptions) {
|
|
63
|
+
let model = null;
|
|
64
|
+
|
|
65
|
+
if (lodash.isPlainObject(modelOptions)) {
|
|
66
|
+
model = Object.assign({...this.defaultPagerGridModelObj, pageable: false}, modelOptions);
|
|
67
|
+
} else {
|
|
68
|
+
model = {...this.defaultPagerGridModelObj, pageable: false};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.setState({
|
|
72
|
+
refTableModel: {...model}
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
return this.state.refTableModel;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
setTableFilter(field, filterInfo) {
|
|
79
|
+
if (!this.state.refTableModel.filters) {
|
|
80
|
+
this.state.refTableModel.filters = [];
|
|
81
|
+
}
|
|
82
|
+
let filters = this.state.refTableModel?.filters;
|
|
83
|
+
let hasFieldIndex = filters?.findIndex(item => item.field === field);
|
|
84
|
+
|
|
85
|
+
if (Values.isNotEmpty(filterInfo)) {
|
|
86
|
+
if (hasFieldIndex !== -1) {
|
|
87
|
+
this.state.refTableModel.filters[hasFieldIndex] = filterInfo;
|
|
88
|
+
} else {
|
|
89
|
+
this.state.refTableModel.filters.unshift({...filterInfo, field});
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
this.state.refTableModel.filters = filters.filter(item => item.field !== field);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
this.setState({
|
|
96
|
+
refTableModel: {...this.state.refTableModel}
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
return this.state.refTableModel;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
setTableDataWithNoPageable(allData) {
|
|
103
|
+
let dataArray = allData || [];
|
|
104
|
+
if (lodash.isEmpty(this.state.refTableModel)) {
|
|
105
|
+
throw new Error("please create buildPagerTableModel first, then set table data.");
|
|
106
|
+
}
|
|
107
|
+
this.state.refTableModel.data = dataArray;
|
|
108
|
+
|
|
109
|
+
this.setState({
|
|
110
|
+
refTableModel: {...this.state.refTableModel}
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
return this.state.refTableModel;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
setAllDataWithPage(allData) {
|
|
117
|
+
let dataArray = allData || [];
|
|
118
|
+
this.setOnePageData({
|
|
119
|
+
data: dataArray,
|
|
120
|
+
total: dataArray.length
|
|
121
|
+
}, this.getCurrentPageIndex(), this.getPageSize())
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
setOnePageData(onePageResultData, pageIndex, pageSize) {
|
|
125
|
+
if (lodash.isEmpty(this.state.refTableModel)) {
|
|
126
|
+
throw new Error("please create buildPagerTableModel first, then set table data.");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (Values.isEmpty(onePageResultData)) {
|
|
130
|
+
throw new Error("please check pageData value.");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this.state.refTableModel.data = onePageResultData?.data;
|
|
134
|
+
this.state.refTableModel.skip = pageIndex;
|
|
135
|
+
this.state.refTableModel.take = pageSize
|
|
136
|
+
this.state.refTableModel.total = onePageResultData?.total;
|
|
137
|
+
|
|
138
|
+
this.setState({
|
|
139
|
+
refTableModel: {...this.state.refTableModel}
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
return this.state.refTableModel;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
getRowData(row) {
|
|
146
|
+
if (row.uid) {
|
|
147
|
+
return this.state.refTableModel.data.filter(item => item.uid === row.uid)[0];
|
|
148
|
+
}
|
|
149
|
+
return this.state.refTableModel.data.filter(item => item.pk === row.pk)[0];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
insertRow(row) {
|
|
153
|
+
let addItem = {
|
|
154
|
+
uid: uuid(),
|
|
155
|
+
inEditState: true,
|
|
156
|
+
}
|
|
157
|
+
if (lodash.isPlainObject(row)) {
|
|
158
|
+
addItem = {...addItem, ...row}
|
|
159
|
+
}
|
|
160
|
+
if (Values.isEmpty(this.state.refTableModel.data)) {
|
|
161
|
+
this.state.refTableModel.data = [];
|
|
162
|
+
}
|
|
163
|
+
this.state.refTableModel.data.push({...addItem});
|
|
164
|
+
|
|
165
|
+
this.setState({
|
|
166
|
+
refTableModel: {...this.state.refTableModel}
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
return this
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
insertOneRow(row) {
|
|
173
|
+
if (Values.isNotEmptyArray(this.state.refTableModel.data)) {
|
|
174
|
+
let findData = this.state.refTableModel.data.find(item => Values.isNotNull(item.uid) || item.inEditState);
|
|
175
|
+
|
|
176
|
+
if (Values.isNull(findData)) {
|
|
177
|
+
this.insertRow(row);
|
|
178
|
+
} else {
|
|
179
|
+
message.warning("有未保存的数据,请先保存或取消");
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
this.insertRow(row);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
removeRow(row) {
|
|
187
|
+
let filterGridData = this.state.refTableModel.data.filter(item => item.pk ? item.pk !== row.pk : item.uid !== row.uid);
|
|
188
|
+
this.state.refTableModel.data = [...filterGridData];
|
|
189
|
+
|
|
190
|
+
this.setState({
|
|
191
|
+
refTableModel: {...this.state.refTableModel}
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
updateRow(row) {
|
|
196
|
+
let rowIndex = this.state.refTableModel.data.findIndex(item => item.pk === row.pk);
|
|
197
|
+
|
|
198
|
+
if (row.uid) {
|
|
199
|
+
rowIndex = this.state.refTableModel.data.findIndex(item => item.uid === row.uid);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (rowIndex !== -1) {
|
|
203
|
+
let dataItem = this.state.refTableModel.data[rowIndex];
|
|
204
|
+
this.state.refTableModel.data[rowIndex] = {...dataItem, ...row};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
this.setState({
|
|
208
|
+
refTableModel: {...this.state.refTableModel}
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
setRowInEditState(row, state = true) {
|
|
215
|
+
this.state.refTableModel.data?.forEach((item, index) => {
|
|
216
|
+
if (item.pk === row.pk) {
|
|
217
|
+
if (!state) {
|
|
218
|
+
this.state.refTableModel.data[index] = {...row};
|
|
219
|
+
this.state.refTableModel.data[index].inEditState = state;
|
|
220
|
+
} else {
|
|
221
|
+
item.inEditState = state;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
this.setState({
|
|
227
|
+
refTableModel: {...this.state.refTableModel}
|
|
228
|
+
})
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
setAllRowInEditState(state = true) {
|
|
233
|
+
this.state.refTableModel.data?.forEach(item => {
|
|
234
|
+
item.inEditState = state;
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
this.setState({
|
|
238
|
+
refTableModel: {...this.state.refTableModel}
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
renderBooleanColumnAsText(rowIndex, column) {
|
|
245
|
+
return this.state.refTableModel.data[rowIndex][column.dataIndex] ? "是" : "否";
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
renderDateColumnAsDate10Text(rowIndex, column) {
|
|
249
|
+
return DateTimes.strDateOfLen10(this.state.refTableModel.data[rowIndex][column.dataIndex]);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
renderDateColumnAsDateTime19Text(rowIndex, column) {
|
|
253
|
+
return DateTimes.strDateTimeOfLen19(this.state.refTableModel.data[rowIndex][column.dataIndex]);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
rowIndex(rowIndex) {
|
|
257
|
+
return (this.state.refTableModel.skip - 1) * this.state.refTableModel.take + rowIndex + 1;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
showTotalRow() {
|
|
261
|
+
this.state.refTableModel.showTotal = true;
|
|
262
|
+
this.setState({
|
|
263
|
+
refTableModel: {...this.state.refTableModel}
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
hideTotalRow() {
|
|
268
|
+
this.state.refTableModel.showTotal = false;
|
|
269
|
+
this.setState({
|
|
270
|
+
refTableModel: {...this.state.refTableModel}
|
|
271
|
+
})
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
setPageSize(size) {
|
|
275
|
+
this.state.refTableModel.take = size;
|
|
276
|
+
this.setState({
|
|
277
|
+
refTableModel: {...this.state.refTableModel}
|
|
278
|
+
})
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
getPageSize() {
|
|
282
|
+
return this.state.refTableModel.take;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
setCurrentPageIndex(index) {
|
|
286
|
+
this.state.refTableModel.skip = index;
|
|
287
|
+
this.setState({
|
|
288
|
+
refTableModel: {...this.state.refTableModel}
|
|
289
|
+
})
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
getCurrentPageIndex() {
|
|
293
|
+
return this.state.refTableModel.skip;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export default KendoGridAPI;
|