@bchr/bchr-front-lib 0.3.112 → 0.3.116
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/layout/ui_tpl/form/FormForModify.js +15 -15
- package/lib/base/widgets/stree/LeftOrgTreeRightPersonGridForSelectPsnModal.js +601 -0
- package/package.json +1 -1
- package/src/base/layout/ui_tpl/form/FormForModify.js +15 -15
- package/src/base/widgets/stree/LeftOrgTreeRightPersonGridForSelectPsnModal.js +487 -0
|
@@ -358,7 +358,7 @@ class FormForModify extends React.Component{
|
|
|
358
358
|
|
|
359
359
|
switch (ui_render_type) {
|
|
360
360
|
case UI_RENDER_TYPE.INPUT:
|
|
361
|
-
component =
|
|
361
|
+
component = b_readonly ? (
|
|
362
362
|
<div>
|
|
363
363
|
<span>{displayValue}</span>
|
|
364
364
|
</div>
|
|
@@ -376,7 +376,7 @@ class FormForModify extends React.Component{
|
|
|
376
376
|
);
|
|
377
377
|
break;
|
|
378
378
|
case UI_RENDER_TYPE.INPUT_NUMBER:
|
|
379
|
-
component =
|
|
379
|
+
component = b_readonly ? (
|
|
380
380
|
<div>
|
|
381
381
|
<span>{displayValue}</span>
|
|
382
382
|
</div>
|
|
@@ -395,7 +395,7 @@ class FormForModify extends React.Component{
|
|
|
395
395
|
);
|
|
396
396
|
break;
|
|
397
397
|
case UI_RENDER_TYPE.INPUT_PASSWORD:
|
|
398
|
-
component =
|
|
398
|
+
component = b_readonly ? (
|
|
399
399
|
<div>
|
|
400
400
|
<InputPassword ui_render_type={'browse'} initValue={displayValue}/>
|
|
401
401
|
</div>
|
|
@@ -413,7 +413,7 @@ class FormForModify extends React.Component{
|
|
|
413
413
|
);
|
|
414
414
|
break;
|
|
415
415
|
case UI_RENDER_TYPE.TEXT_AREA:
|
|
416
|
-
component =
|
|
416
|
+
component = b_readonly ? (
|
|
417
417
|
<div>
|
|
418
418
|
<span>{displayValue}</span>
|
|
419
419
|
</div>
|
|
@@ -434,7 +434,7 @@ class FormForModify extends React.Component{
|
|
|
434
434
|
initialValue = (initialValue ? moment(initialValue) : "");
|
|
435
435
|
displayValue = (displayValue ? moment(displayValue).format("YYYY-MM-DD") : "");
|
|
436
436
|
|
|
437
|
-
component =
|
|
437
|
+
component = b_readonly ? (
|
|
438
438
|
<div>
|
|
439
439
|
<span>{displayValue}</span>
|
|
440
440
|
</div>
|
|
@@ -455,7 +455,7 @@ class FormForModify extends React.Component{
|
|
|
455
455
|
initialValue = (initialValue ? moment(initialValue, 'YYYY') : "");
|
|
456
456
|
displayValue = (displayValue ? moment(displayValue, 'YYYY').format("YYYY") : "");
|
|
457
457
|
|
|
458
|
-
component =
|
|
458
|
+
component = b_readonly ? (
|
|
459
459
|
<div>
|
|
460
460
|
<span>{displayValue}</span>
|
|
461
461
|
</div>
|
|
@@ -477,7 +477,7 @@ class FormForModify extends React.Component{
|
|
|
477
477
|
initialValue = (initialValue ? moment(initialValue, 'YYYYMM') : "");
|
|
478
478
|
displayValue = (displayValue ? moment(displayValue, 'YYYYMM').format("YYYY-MM") : "");
|
|
479
479
|
|
|
480
|
-
component =
|
|
480
|
+
component = b_readonly ? (
|
|
481
481
|
<div>
|
|
482
482
|
<span>{displayValue}</span>
|
|
483
483
|
</div>
|
|
@@ -499,7 +499,7 @@ class FormForModify extends React.Component{
|
|
|
499
499
|
initialValue = (initialValue ? moment(initialValue) : "");
|
|
500
500
|
displayValue = (displayValue ? moment(displayValue).format("YYYY-MM-DD hh:mm:ss") : "");
|
|
501
501
|
|
|
502
|
-
component =
|
|
502
|
+
component = b_readonly ? (
|
|
503
503
|
<div>
|
|
504
504
|
<span>{displayValue}</span>
|
|
505
505
|
</div>
|
|
@@ -533,7 +533,7 @@ class FormForModify extends React.Component{
|
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
|
|
536
|
-
component =
|
|
536
|
+
component = b_readonly ? (
|
|
537
537
|
<div>
|
|
538
538
|
<span>{displayValue}</span>
|
|
539
539
|
</div>
|
|
@@ -568,7 +568,7 @@ class FormForModify extends React.Component{
|
|
|
568
568
|
initialValue = data[code] && data[code] > 0 ? data[code] + "" : null;
|
|
569
569
|
}
|
|
570
570
|
|
|
571
|
-
component =
|
|
571
|
+
component = b_readonly ? (
|
|
572
572
|
<div>
|
|
573
573
|
<span>{displayValue}</span>
|
|
574
574
|
</div>
|
|
@@ -598,7 +598,7 @@ class FormForModify extends React.Component{
|
|
|
598
598
|
initialValue = displayValue;
|
|
599
599
|
code = display_code;
|
|
600
600
|
|
|
601
|
-
component =
|
|
601
|
+
component = b_readonly ? (
|
|
602
602
|
<div>
|
|
603
603
|
<span>{displayValue}</span>
|
|
604
604
|
</div>
|
|
@@ -617,7 +617,7 @@ class FormForModify extends React.Component{
|
|
|
617
617
|
);
|
|
618
618
|
break;
|
|
619
619
|
case UI_RENDER_TYPE.UPLOAD:
|
|
620
|
-
component =
|
|
620
|
+
component = b_readonly ? (
|
|
621
621
|
<div>
|
|
622
622
|
<span>{displayValue}</span>
|
|
623
623
|
{
|
|
@@ -660,7 +660,7 @@ class FormForModify extends React.Component{
|
|
|
660
660
|
displayValue = (initialValue ? "是" : "否");
|
|
661
661
|
}
|
|
662
662
|
|
|
663
|
-
component =
|
|
663
|
+
component = b_readonly ? (
|
|
664
664
|
<div>
|
|
665
665
|
<span>{displayValue}</span>
|
|
666
666
|
</div>
|
|
@@ -677,7 +677,7 @@ class FormForModify extends React.Component{
|
|
|
677
677
|
);
|
|
678
678
|
break;
|
|
679
679
|
default:
|
|
680
|
-
component =
|
|
680
|
+
component = b_readonly ? (
|
|
681
681
|
<div>
|
|
682
682
|
<span>{displayValue}</span>
|
|
683
683
|
</div>
|
|
@@ -728,7 +728,7 @@ class FormForModify extends React.Component{
|
|
|
728
728
|
name={code}
|
|
729
729
|
initialValue={initialValue}
|
|
730
730
|
rules={[
|
|
731
|
-
{required: (!dataItem.
|
|
731
|
+
{required: (!dataItem.b_readonly && b_required), message: ("请填写" + name), whitespace: true, validator: this.validator.bind(this, (!dataItem.b_disabled && b_required), ui_render_type)},
|
|
732
732
|
{required: false, message: (name + "格式不正确"), whitespace: true, validator: this.formatValidator.bind(this), pattern: regexp_pattern}
|
|
733
733
|
]}
|
|
734
734
|
hasFeedback={(!dataItem.b_disabled && b_required)}
|
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import TreeView from "@progress/kendo-treeview-react-wrapper/dist/npm/treeview";
|
|
3
|
+
import Radio, {Checkbox, Input, Modal} from "antd";
|
|
4
|
+
import {Grid, GridColumn} from "@progress/kendo-react-grid";
|
|
5
|
+
import {GridRowSequenceNumberCell, SmartMessage, HttpService, SModal} from "@bchr/bchr-front-lib";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const Search = Input.Search;
|
|
10
|
+
|
|
11
|
+
class LeftOrgTreeRightPersonGridForSelectPsnModal extends React.Component {
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props);
|
|
14
|
+
|
|
15
|
+
this.orgTreeRef = React.createRef();
|
|
16
|
+
const _this = this;
|
|
17
|
+
|
|
18
|
+
this.state = {
|
|
19
|
+
selectedOrg: null,
|
|
20
|
+
gridOperator: {
|
|
21
|
+
skip: 0,
|
|
22
|
+
take: 20,
|
|
23
|
+
},
|
|
24
|
+
pagerData: {
|
|
25
|
+
data: [],
|
|
26
|
+
total: 0
|
|
27
|
+
},
|
|
28
|
+
personNameKeyWords: null,
|
|
29
|
+
isAllPsnSelected: false,
|
|
30
|
+
selectedPsnList: [],
|
|
31
|
+
isInitSelectedRootOrg: false,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
this.dataSource = {
|
|
35
|
+
transport: {
|
|
36
|
+
read: {
|
|
37
|
+
url: this.buildQueryOrgTreeNodeURL,
|
|
38
|
+
dataType: "json",
|
|
39
|
+
Type: "POST"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
schema: {
|
|
43
|
+
model: {
|
|
44
|
+
id: "pk",
|
|
45
|
+
hasChildren: "b_has_child"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
requestEnd: function (e) {
|
|
49
|
+
let currentState = _this.state;
|
|
50
|
+
|
|
51
|
+
if (currentState.isInitSelectedRootOrg) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!e.response || e.response.length == 0) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (_this.props.isDefaultSelectedFirstOrg) {
|
|
60
|
+
let expand_pk_path = e.response[0].pk_path.split("/");
|
|
61
|
+
expand_pk_path = expand_pk_path.slice(1, expand_pk_path.length - 1);
|
|
62
|
+
|
|
63
|
+
expand_pk_path.unshift(0);
|
|
64
|
+
|
|
65
|
+
let last_node_pk = expand_pk_path[expand_pk_path.length - 1];
|
|
66
|
+
|
|
67
|
+
const treeView = _this.orgTreeRef.current.widgetInstance;
|
|
68
|
+
|
|
69
|
+
treeView.expandPath(expand_pk_path, function () {
|
|
70
|
+
let nodeDataItem = treeView.dataSource.get(last_node_pk);
|
|
71
|
+
|
|
72
|
+
if (nodeDataItem && nodeDataItem.uid) {
|
|
73
|
+
|
|
74
|
+
let treeNodeEle = treeView.findByUid(nodeDataItem.uid);
|
|
75
|
+
|
|
76
|
+
if (treeNodeEle && treeNodeEle.length > 0) {
|
|
77
|
+
treeView.element.find(".searched").removeClass("searched");
|
|
78
|
+
treeNodeEle.find(".k-in:first").addClass("searched");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_this.scrollTreeView(treeView, nodeDataItem);
|
|
82
|
+
|
|
83
|
+
treeView.select(treeNodeEle);
|
|
84
|
+
|
|
85
|
+
_this.onSelect(nodeDataItem);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
_this.setState({
|
|
92
|
+
...currentState,
|
|
93
|
+
isInitSelectedRootOrg:true
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
this.queryPsnList = this.queryPsnList.bind(this);
|
|
99
|
+
this.onOk = this.onOk.bind(this);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
componentDidMount() {
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
getFunctionLetBasePath() {
|
|
106
|
+
if (!this.props.functionLetBasePath) {
|
|
107
|
+
throw new Error("请为组件注入属性【functionLetBasePath】");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return this.props.functionLetBasePath;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
scrollTreeView (treeView, nodeDataItem) {
|
|
114
|
+
let treeNodeEle = treeView.findByUid(nodeDataItem.uid);
|
|
115
|
+
let treeViewHeight = treeView.element.parent().height();
|
|
116
|
+
let treeViewTop = treeView.element.offset().top;
|
|
117
|
+
let treeNodeTop = treeNodeEle.offset().top;
|
|
118
|
+
let scrollTop = treeView.element.parent().scrollTop();
|
|
119
|
+
|
|
120
|
+
scrollTop = treeNodeTop - treeViewTop - (treeViewHeight / 2);
|
|
121
|
+
treeView.element.parent().scrollTop(scrollTop);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Lazy Loading URL
|
|
126
|
+
* @param e
|
|
127
|
+
* @returns {*}
|
|
128
|
+
*/
|
|
129
|
+
buildQueryOrgTreeNodeURL = (e) => {
|
|
130
|
+
let parent_org_node_pk = 0;
|
|
131
|
+
|
|
132
|
+
if (this.orgTreeRef.current && this.orgTreeRef.current.widgetInstance) {
|
|
133
|
+
parent_org_node_pk = e.pk;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return this.http().getRequestPath(`queryOrgDataByCurrentUserAuthOfLazyLoad?&parent_org_pk=${parent_org_node_pk}&org_expanded_level=${this.props.org_expanded_level}&is_implicit_auth=${this.props.is_implicit_auth}`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
http() {
|
|
140
|
+
return new HttpService(this.props.appConfig.back_service_rpc_prefix + this.getFunctionLetBasePath(), this.props.appConfig);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 组织 Node Render
|
|
145
|
+
* @param props
|
|
146
|
+
* @returns {string}
|
|
147
|
+
*/
|
|
148
|
+
treeNodeTemplate = props => {
|
|
149
|
+
if (props.item.org_type == 1) {
|
|
150
|
+
return `<div class="tree-node-box" key={props.item.pk}>
|
|
151
|
+
<span class="iconfont icon-bchr-corporate-repor"></span><span>${props.item.name}</span>
|
|
152
|
+
</div>`
|
|
153
|
+
} else if (props.item.org_type == 2) {
|
|
154
|
+
return `<div class="tree-node-box" key={props.item.pk}>
|
|
155
|
+
<span class="iconfont icon-bchr-virtual-dept"></span><span>${props.item.name}</span>
|
|
156
|
+
</div>`
|
|
157
|
+
} else if (props.item.org_type == 3) {
|
|
158
|
+
return `<div class="tree-node-box" key={props.item.pk}>
|
|
159
|
+
<span class="iconfont icon-bchr-post-manage"></span><span>${props.item.name}</span>
|
|
160
|
+
</div>`
|
|
161
|
+
} else {
|
|
162
|
+
return `<div class="tree-node-box" key={props.item.pk}>
|
|
163
|
+
<span class="iconfont icon-bchr-person1"></span><span>${props.item.name}</span>
|
|
164
|
+
</div>`
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 人员搜索
|
|
170
|
+
*/
|
|
171
|
+
onPersonSearch = (e) => {
|
|
172
|
+
let that = this;
|
|
173
|
+
|
|
174
|
+
Promise.all([
|
|
175
|
+
(function() {
|
|
176
|
+
let currentState = that.state;
|
|
177
|
+
let personNameKeyWords = currentState.personNameKeyWords;
|
|
178
|
+
|
|
179
|
+
if (!e && e.trim() == personNameKeyWords) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
that.setState({
|
|
184
|
+
...currentState,
|
|
185
|
+
personNameKeyWords: e? e.trim() : null
|
|
186
|
+
})
|
|
187
|
+
})()
|
|
188
|
+
]).then(this.queryPsnList)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* 选择组织 Node
|
|
193
|
+
* @param event
|
|
194
|
+
*/
|
|
195
|
+
onSelect = (event) => {
|
|
196
|
+
let that = this;
|
|
197
|
+
|
|
198
|
+
if (!event) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
Promise.all([
|
|
203
|
+
(function() {
|
|
204
|
+
let selectedOrgNode;
|
|
205
|
+
|
|
206
|
+
if (event.node) {
|
|
207
|
+
selectedOrgNode = that.orgTreeRef.current.widgetInstance.dataItem(event.node);
|
|
208
|
+
} else {
|
|
209
|
+
selectedOrgNode = event;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
let currentState = that.state;
|
|
213
|
+
|
|
214
|
+
let gridOperator = {skip: 0, take: currentState.gridOperator.take};
|
|
215
|
+
|
|
216
|
+
that.setState({
|
|
217
|
+
...currentState,
|
|
218
|
+
selectedOrg: selectedOrgNode,
|
|
219
|
+
gridOperator,
|
|
220
|
+
selectedPsnList: [],
|
|
221
|
+
isAllPsnSelected: false
|
|
222
|
+
})
|
|
223
|
+
})()
|
|
224
|
+
]).then(this.queryPsnList)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* 查询人员数据
|
|
229
|
+
* @returns {Promise<void>}
|
|
230
|
+
*/
|
|
231
|
+
async queryPsnList() {
|
|
232
|
+
try {
|
|
233
|
+
let that = this;
|
|
234
|
+
let currentState = that.state;
|
|
235
|
+
let selectedOrg = currentState.selectedOrg;
|
|
236
|
+
let personNameKeyWords = currentState.personNameKeyWords;
|
|
237
|
+
let gridOperator = currentState.gridOperator;
|
|
238
|
+
let isAllPsnSelected = currentState.isAllPsnSelected;
|
|
239
|
+
let selectedPsnList = currentState.selectedPsnList;
|
|
240
|
+
|
|
241
|
+
let newPagerData = {data: [], total: 0};
|
|
242
|
+
|
|
243
|
+
if (selectedOrg && selectedOrg.pk) {
|
|
244
|
+
let queryOrgPkParems = {
|
|
245
|
+
parent_org_pk: selectedOrg.pk,
|
|
246
|
+
is_implicit_auth: that.props.is_implicit_auth
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
let queryPsnParams = {
|
|
250
|
+
parent_org_pk: selectedOrg.pk,
|
|
251
|
+
is_implicit_auth: that.props.is_implicit_auth,
|
|
252
|
+
person_name_key_words: personNameKeyWords,
|
|
253
|
+
page_index: gridOperator.skip/gridOperator.take + 1,
|
|
254
|
+
page_size: gridOperator.take
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
newPagerData = await that.http().post("queryPersonListByOrgPksAndPersonName", queryPsnParams)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (newPagerData && newPagerData.data && newPagerData.data.length > 0) {
|
|
261
|
+
if (isAllPsnSelected) {
|
|
262
|
+
newPagerData.data.forEach(dataItem => {
|
|
263
|
+
dataItem.selected = isAllPsnSelected;
|
|
264
|
+
})
|
|
265
|
+
} else {
|
|
266
|
+
if (selectedPsnList && selectedPsnList.length > 0) {
|
|
267
|
+
for (let i in selectedPsnList) {
|
|
268
|
+
let selectedPsnItem = selectedPsnList[i];
|
|
269
|
+
|
|
270
|
+
for (let j in newPagerData.data) {
|
|
271
|
+
let dataItem = newPagerData.data[j];
|
|
272
|
+
|
|
273
|
+
if (dataItem.pk == selectedPsnItem.pk) {
|
|
274
|
+
dataItem.selected = true;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
this.setState({
|
|
283
|
+
...currentState,
|
|
284
|
+
pagerData: {...newPagerData}
|
|
285
|
+
})
|
|
286
|
+
} catch (e) {
|
|
287
|
+
this.dealAjaxException(e)
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 页码&页大小发生变化
|
|
293
|
+
* @param e
|
|
294
|
+
*/
|
|
295
|
+
onDataStateChange(e) {
|
|
296
|
+
let that = this;
|
|
297
|
+
|
|
298
|
+
Promise.all([
|
|
299
|
+
(function() {
|
|
300
|
+
let currentState = that.state;
|
|
301
|
+
|
|
302
|
+
that.setState({
|
|
303
|
+
...currentState,
|
|
304
|
+
gridOperator: {skip: e.data.skip, take: e.data.take}
|
|
305
|
+
})
|
|
306
|
+
})()
|
|
307
|
+
]).then(this.queryPsnList)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Header Select
|
|
312
|
+
*/
|
|
313
|
+
onGridHeaderSelectionChange = () => {
|
|
314
|
+
let currentState = this.state;
|
|
315
|
+
let pagerData = currentState.pagerData;
|
|
316
|
+
let isAllPsnSelected = !currentState.isAllPsnSelected;
|
|
317
|
+
|
|
318
|
+
if (pagerData.data && pagerData.data.length > 0) {
|
|
319
|
+
pagerData.data.forEach(dataItem => {
|
|
320
|
+
dataItem.selected = isAllPsnSelected;
|
|
321
|
+
})
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
this.setState({
|
|
325
|
+
...currentState,
|
|
326
|
+
pagerData,
|
|
327
|
+
isAllPsnSelected,
|
|
328
|
+
selectedPsnList: []
|
|
329
|
+
})
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Row Select
|
|
334
|
+
*/
|
|
335
|
+
onGridRowSelectionChange = (e) => {
|
|
336
|
+
let selectedRowData = e.dataItem;
|
|
337
|
+
|
|
338
|
+
selectedRowData.selected = !selectedRowData.selected;
|
|
339
|
+
|
|
340
|
+
let currentState = this.state;
|
|
341
|
+
let selectedPsnList = [];
|
|
342
|
+
let psnList = currentState.pagerData.data;
|
|
343
|
+
let isAllPsnSelected = true;
|
|
344
|
+
|
|
345
|
+
if (psnList && psnList.length > 0) {
|
|
346
|
+
psnList.forEach(dataItem => {
|
|
347
|
+
if (dataItem.selected) {
|
|
348
|
+
selectedPsnList.push(dataItem);
|
|
349
|
+
}
|
|
350
|
+
})
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (selectedPsnList.length != currentState.pagerData.total) {
|
|
354
|
+
isAllPsnSelected = false;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
this.setState({
|
|
358
|
+
...currentState,
|
|
359
|
+
selectedPsnList,
|
|
360
|
+
isAllPsnSelected
|
|
361
|
+
})
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
selectPsnRadiosChange = (e) => {
|
|
365
|
+
let currentState = this.state;
|
|
366
|
+
let selectedPsnList = [];
|
|
367
|
+
let psnList = currentState.pagerData.data;
|
|
368
|
+
|
|
369
|
+
if (psnList && psnList.length > 0) {
|
|
370
|
+
psnList.forEach(dataItem => {
|
|
371
|
+
if (dataItem.pk == e.dataItem.pk) {
|
|
372
|
+
dataItem['selected'] = true;
|
|
373
|
+
selectedPsnList.push(dataItem)
|
|
374
|
+
} else {
|
|
375
|
+
dataItem['selected'] = false;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
this.setState({
|
|
380
|
+
...currentState,
|
|
381
|
+
selectedPsnList
|
|
382
|
+
})
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
onOk() {
|
|
387
|
+
let {selectedPsnList} = this.state;
|
|
388
|
+
|
|
389
|
+
if (!selectedPsnList || selectedPsnList.length == 0) {
|
|
390
|
+
SmartMessage.info("请选择人员");
|
|
391
|
+
|
|
392
|
+
return;
|
|
393
|
+
} else {
|
|
394
|
+
this.props.onOk(selectedPsnList)
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
render() {
|
|
399
|
+
const treeViewMessages = {
|
|
400
|
+
retry: "重新加载",
|
|
401
|
+
requestFailed: "加载失败.",
|
|
402
|
+
loading: "正在加载中..."
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
return (
|
|
406
|
+
<SModal className={`left-org-tree-right-person-grid-modal ${this.props.className? this.props.className : ''}`}
|
|
407
|
+
title="人员参照"
|
|
408
|
+
visible={true}
|
|
409
|
+
centered
|
|
410
|
+
width={'1000px'}
|
|
411
|
+
onCancel={this.props.onCancel}
|
|
412
|
+
onOk={this.onOk}
|
|
413
|
+
>
|
|
414
|
+
|
|
415
|
+
<Search
|
|
416
|
+
className={"person-search-box"}
|
|
417
|
+
placeholder="人员搜索"
|
|
418
|
+
onSearch={this.onPersonSearch}
|
|
419
|
+
/>
|
|
420
|
+
|
|
421
|
+
<div className={"left-org-tree-right-person-grid-container"}>
|
|
422
|
+
<div className={"left-org-tree-box"}>
|
|
423
|
+
<TreeView dataSource={this.dataSource}
|
|
424
|
+
messages={treeViewMessages}
|
|
425
|
+
expandIcons={false}
|
|
426
|
+
dataTextField={"name"}
|
|
427
|
+
template={this.treeNodeTemplate}
|
|
428
|
+
ref={this.orgTreeRef}
|
|
429
|
+
select={this.onSelect}
|
|
430
|
+
/>
|
|
431
|
+
</div>
|
|
432
|
+
|
|
433
|
+
<div className={"right-psn-grid-box"}>
|
|
434
|
+
<Grid
|
|
435
|
+
data={this.state.pagerData.data}
|
|
436
|
+
total={this.state.pagerData.total}
|
|
437
|
+
{...this.state.gridOperator}
|
|
438
|
+
pageable={{ pageSizes: [20, 50, 100, 200], type : 'numeric' }}
|
|
439
|
+
pageSize={20}
|
|
440
|
+
sortable={true}
|
|
441
|
+
resizable={true}
|
|
442
|
+
selectedField="selected"
|
|
443
|
+
onDataStateChange={this.onDataStateChange.bind(this)}
|
|
444
|
+
onSelectionChange={this.onGridRowSelectionChange}
|
|
445
|
+
onHeaderSelectionChange={this.onGridHeaderSelectionChange}
|
|
446
|
+
>
|
|
447
|
+
{
|
|
448
|
+
this.props.selectType && this.props.selectType ==='single' ? <GridColumn field="selected" title="选择" width="55px" className={"text-center"}
|
|
449
|
+
sortable={false}
|
|
450
|
+
headerCell={props => {
|
|
451
|
+
return (<span>选择</span>)
|
|
452
|
+
}}
|
|
453
|
+
cell={(props) => {
|
|
454
|
+
return (
|
|
455
|
+
<td className={"text-center"}>
|
|
456
|
+
<Radio name='selectDef' defaultChecked={props.dataItem.selected}
|
|
457
|
+
className={"grid-radio"} key={props.dataIndex}
|
|
458
|
+
onChange={this.selectPsnRadiosChange.bind(this, props)}
|
|
459
|
+
></Radio>
|
|
460
|
+
</td>)
|
|
461
|
+
}}/> : <GridColumn locked field="selected" title="选择" width="50px" className={"text-center locked"}
|
|
462
|
+
headerClassName={"text-center"} sortable={false} headerCell={props => {
|
|
463
|
+
return <Checkbox checked={this.state.isAllPsnSelected} onChange={this.onGridHeaderSelectionChange}></Checkbox>
|
|
464
|
+
}}
|
|
465
|
+
cell={props => {
|
|
466
|
+
return <td className={"text-center locked_column k-grid-content-sticky"} style={{left: "0px", right: "0px"}}>
|
|
467
|
+
<Checkbox checked={props.dataItem.selected} onChange={this.onGridRowSelectionChange.bind(this, props)}></Checkbox>
|
|
468
|
+
</td>
|
|
469
|
+
}}
|
|
470
|
+
/>
|
|
471
|
+
|
|
472
|
+
}
|
|
473
|
+
<GridColumn field="sequence_number" title="序号" width="50px" className={"text-center"} headerClassName={"text-center"} width="55px" sortable={false} cell={GridRowSequenceNumberCell}/>
|
|
474
|
+
<GridColumn field="name" title="姓名" className={"text-center"} headerClassName={"text-center"} width="120px" />
|
|
475
|
+
<GridColumn field="code" title="人员编码" className={"text-center"} headerClassName={"text-center"} width="120px" />
|
|
476
|
+
<GridColumn field="corp_ext_name" title="单位名称" className={"text-center"} headerClassName={"text-center"} width="180px" />
|
|
477
|
+
<GridColumn field="dept_ext_name" title="部门名称" className={"text-center"} headerClassName={"text-center"} width="180px" />
|
|
478
|
+
<GridColumn field="post_ext_name" title="岗位名称" className={"text-center"} headerClassName={"text-center"} width="180px" />
|
|
479
|
+
</Grid>
|
|
480
|
+
</div>
|
|
481
|
+
</div>
|
|
482
|
+
</SModal>
|
|
483
|
+
)
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export default LeftOrgTreeRightPersonGridForSelectPsnModal;
|