@bchr/bchr-front-lib 0.3.110 → 0.3.114
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/AppFormulaFunctions.js +11 -3
- package/lib/base/layout/ui_tpl/form/FormForModify.js +19 -19
- package/lib/base/widgets/stree/LeftOrgTreeRightPersonGridForSelectPsnModal.js +559 -0
- package/lib/services/HttpService.js +1 -4
- package/package.json +1 -1
- package/src/base/AppFormulaFunctions.js +12 -4
- package/src/base/layout/ui_tpl/form/FormForModify.js +20 -19
- package/src/base/widgets/stree/LeftOrgTreeRightPersonGridForSelectPsnModal.js +451 -0
- package/src/services/HttpService.js +1 -5
|
@@ -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)}
|
|
@@ -1113,7 +1113,7 @@ class FormForModify extends React.Component{
|
|
|
1113
1113
|
formulaFunctionValue = eval(formItemValue.replace('#value#', `value`).replace("@", ","));
|
|
1114
1114
|
} else {
|
|
1115
1115
|
let formItemValueList = formItemValue.split("#");
|
|
1116
|
-
if (!formItemValueList || formItemValueList.length
|
|
1116
|
+
if (!formItemValueList || formItemValueList.length < 3) {
|
|
1117
1117
|
console.log("formula error, detail info: formItemCode=" + formItemValue + ", formItemValue=" + formItemValue);
|
|
1118
1118
|
continue;
|
|
1119
1119
|
}
|
|
@@ -1130,13 +1130,14 @@ class FormForModify extends React.Component{
|
|
|
1130
1130
|
realFormulaValue = realFormulaValue + formItemParamOrExp;
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
|
+
|
|
1133
1134
|
}
|
|
1134
1135
|
|
|
1135
|
-
formulaFunctionValue = eval(realFormulaValue.
|
|
1136
|
+
formulaFunctionValue = eval(realFormulaValue.replaceAll("@", ","));
|
|
1136
1137
|
}
|
|
1137
1138
|
|
|
1138
1139
|
if (!formulaFunctionValue) {
|
|
1139
|
-
console.log("formula function return null, detail info:
|
|
1140
|
+
console.log("formula function return null, detail info: formItemValue=" + formItemValue);
|
|
1140
1141
|
continue;
|
|
1141
1142
|
}
|
|
1142
1143
|
|
|
@@ -1220,7 +1221,7 @@ class FormForModify extends React.Component{
|
|
|
1220
1221
|
if (typeof formItemValue === 'number') {
|
|
1221
1222
|
value = formItemValue && formItemValue > 0 ? formItemValue : null;
|
|
1222
1223
|
} else {
|
|
1223
|
-
|
|
1224
|
+
formItemValue = Number(formItemValue);
|
|
1224
1225
|
value = formItemValue && formItemValue > 0 ? formItemValue : null;
|
|
1225
1226
|
}
|
|
1226
1227
|
break;
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import TreeView from "@progress/kendo-treeview-react-wrapper/dist/npm/treeview";
|
|
3
|
+
import {Checkbox, Input, Modal} from "antd";
|
|
4
|
+
import {Grid, GridColumn} from "@progress/kendo-react-grid";
|
|
5
|
+
import {GridRowSequenceNumberCell, SmartMessage, HttpService} 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
|
+
debugger
|
|
50
|
+
let currentState = _this.state;
|
|
51
|
+
|
|
52
|
+
if (currentState.isInitSelectedRootOrg) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!e.response || e.response.length == 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (_this.props.isDefaultSelectedFirstOrg) {
|
|
61
|
+
let expand_pk_path = e.response[0].pk_path.split("/");
|
|
62
|
+
expand_pk_path = expand_pk_path.slice(1, expand_pk_path.length - 1);
|
|
63
|
+
|
|
64
|
+
expand_pk_path.unshift(0);
|
|
65
|
+
|
|
66
|
+
let last_node_pk = expand_pk_path[expand_pk_path.length - 1];
|
|
67
|
+
|
|
68
|
+
const treeView = _this.orgTreeRef.current.widgetInstance;
|
|
69
|
+
|
|
70
|
+
treeView.expandPath(expand_pk_path, function () {
|
|
71
|
+
let nodeDataItem = treeView.dataSource.get(last_node_pk);
|
|
72
|
+
|
|
73
|
+
if (nodeDataItem && nodeDataItem.uid) {
|
|
74
|
+
|
|
75
|
+
let treeNodeEle = treeView.findByUid(nodeDataItem.uid);
|
|
76
|
+
|
|
77
|
+
if (treeNodeEle && treeNodeEle.length > 0) {
|
|
78
|
+
treeView.element.find(".searched").removeClass("searched");
|
|
79
|
+
treeNodeEle.find(".k-in:first").addClass("searched");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_this.scrollTreeView(treeView, nodeDataItem);
|
|
83
|
+
|
|
84
|
+
treeView.select(treeNodeEle);
|
|
85
|
+
|
|
86
|
+
_this.onSelect(nodeDataItem);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_this.setState({
|
|
93
|
+
...currentState,
|
|
94
|
+
isInitSelectedRootOrg:true
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
this.queryPsnList = this.queryPsnList.bind(this);
|
|
100
|
+
this.onOk = this.onOk.bind(this);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
componentDidMount() {
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
getFunctionLetBasePath() {
|
|
107
|
+
if (!this.props.functionLetBasePath) {
|
|
108
|
+
throw new Error("请为组件注入属性【functionLetBasePath】");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return this.props.functionLetBasePath;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
scrollTreeView (treeView, nodeDataItem) {
|
|
115
|
+
let treeNodeEle = treeView.findByUid(nodeDataItem.uid);
|
|
116
|
+
let treeViewHeight = treeView.element.parent().height();
|
|
117
|
+
let treeViewTop = treeView.element.offset().top;
|
|
118
|
+
let treeNodeTop = treeNodeEle.offset().top;
|
|
119
|
+
let scrollTop = treeView.element.parent().scrollTop();
|
|
120
|
+
|
|
121
|
+
scrollTop = treeNodeTop - treeViewTop - (treeViewHeight / 2);
|
|
122
|
+
treeView.element.parent().scrollTop(scrollTop);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Lazy Loading URL
|
|
127
|
+
* @param e
|
|
128
|
+
* @returns {*}
|
|
129
|
+
*/
|
|
130
|
+
buildQueryOrgTreeNodeURL = (e) => {
|
|
131
|
+
let parent_org_node_pk = 0;
|
|
132
|
+
|
|
133
|
+
if (this.orgTreeRef.current && this.orgTreeRef.current.widgetInstance) {
|
|
134
|
+
parent_org_node_pk = e.pk;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
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}`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
http() {
|
|
141
|
+
return new HttpService(this.props.appConfig.back_service_rpc_prefix + this.getFunctionLetBasePath(), this.props.appConfig);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 组织 Node Render
|
|
146
|
+
* @param props
|
|
147
|
+
* @returns {string}
|
|
148
|
+
*/
|
|
149
|
+
treeNodeTemplate = props => {
|
|
150
|
+
if (props.item.org_type == 1) {
|
|
151
|
+
return `<div class="tree-node-box" key={props.item.pk}>
|
|
152
|
+
<span class="iconfont icon-bchr-corporate-repor"></span><span>${props.item.name}</span>
|
|
153
|
+
</div>`
|
|
154
|
+
} else if (props.item.org_type == 2) {
|
|
155
|
+
return `<div class="tree-node-box" key={props.item.pk}>
|
|
156
|
+
<span class="iconfont icon-bchr-virtual-dept"></span><span>${props.item.name}</span>
|
|
157
|
+
</div>`
|
|
158
|
+
} else if (props.item.org_type == 3) {
|
|
159
|
+
return `<div class="tree-node-box" key={props.item.pk}>
|
|
160
|
+
<span class="iconfont icon-bchr-post-manage"></span><span>${props.item.name}</span>
|
|
161
|
+
</div>`
|
|
162
|
+
} else {
|
|
163
|
+
return `<div class="tree-node-box" key={props.item.pk}>
|
|
164
|
+
<span class="iconfont icon-bchr-person1"></span><span>${props.item.name}</span>
|
|
165
|
+
</div>`
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 人员搜索
|
|
171
|
+
*/
|
|
172
|
+
onPersonSearch = (e) => {
|
|
173
|
+
let that = this;
|
|
174
|
+
|
|
175
|
+
Promise.all([
|
|
176
|
+
(function() {
|
|
177
|
+
let currentState = that.state;
|
|
178
|
+
let personNameKeyWords = currentState.personNameKeyWords;
|
|
179
|
+
|
|
180
|
+
if (!e && e.trim() == personNameKeyWords) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
that.setState({
|
|
185
|
+
...currentState,
|
|
186
|
+
personNameKeyWords: e? e.trim() : null
|
|
187
|
+
})
|
|
188
|
+
})()
|
|
189
|
+
]).then(this.queryPsnList)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 选择组织 Node
|
|
194
|
+
* @param event
|
|
195
|
+
*/
|
|
196
|
+
onSelect = (event) => {
|
|
197
|
+
debugger
|
|
198
|
+
let that = this;
|
|
199
|
+
|
|
200
|
+
if (!event) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
Promise.all([
|
|
205
|
+
(function() {
|
|
206
|
+
let selectedOrgNode;
|
|
207
|
+
|
|
208
|
+
if (event.node) {
|
|
209
|
+
selectedOrgNode = that.orgTreeRef.current.widgetInstance.dataItem(event.node);
|
|
210
|
+
} else {
|
|
211
|
+
selectedOrgNode = event;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
let currentState = that.state;
|
|
215
|
+
|
|
216
|
+
let gridOperator = {skip: 0, take: currentState.gridOperator.take};
|
|
217
|
+
|
|
218
|
+
that.setState({
|
|
219
|
+
...currentState,
|
|
220
|
+
selectedOrg: selectedOrgNode,
|
|
221
|
+
gridOperator,
|
|
222
|
+
selectedPsnList: [],
|
|
223
|
+
isAllPsnSelected: false
|
|
224
|
+
})
|
|
225
|
+
})()
|
|
226
|
+
]).then(this.queryPsnList)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* 查询人员数据
|
|
231
|
+
* @returns {Promise<void>}
|
|
232
|
+
*/
|
|
233
|
+
async queryPsnList() {
|
|
234
|
+
try {
|
|
235
|
+
let that = this;
|
|
236
|
+
let currentState = that.state;
|
|
237
|
+
let selectedOrg = currentState.selectedOrg;
|
|
238
|
+
let personNameKeyWords = currentState.personNameKeyWords;
|
|
239
|
+
let gridOperator = currentState.gridOperator;
|
|
240
|
+
let isAllPsnSelected = currentState.isAllPsnSelected;
|
|
241
|
+
let selectedPsnList = currentState.selectedPsnList;
|
|
242
|
+
|
|
243
|
+
let newPagerData = {data: [], total: 0};
|
|
244
|
+
|
|
245
|
+
if (selectedOrg && selectedOrg.pk) {
|
|
246
|
+
let queryOrgPkParems = {
|
|
247
|
+
parent_org_pk: selectedOrg.pk,
|
|
248
|
+
is_implicit_auth: that.props.is_implicit_auth
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
let queryPsnParams = {
|
|
252
|
+
parent_org_pk: selectedOrg.pk,
|
|
253
|
+
is_implicit_auth: that.props.is_implicit_auth,
|
|
254
|
+
person_name_key_words: personNameKeyWords,
|
|
255
|
+
page_index: gridOperator.skip/gridOperator.take + 1,
|
|
256
|
+
page_size: gridOperator.take
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
newPagerData = await that.http().post("queryPersonListByOrgPksAndPersonName", queryPsnParams)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (newPagerData && newPagerData.data && newPagerData.data.length > 0) {
|
|
263
|
+
if (isAllPsnSelected) {
|
|
264
|
+
newPagerData.data.forEach(dataItem => {
|
|
265
|
+
dataItem.selected = isAllPsnSelected;
|
|
266
|
+
})
|
|
267
|
+
} else {
|
|
268
|
+
if (selectedPsnList && selectedPsnList.length > 0) {
|
|
269
|
+
for (let i in selectedPsnList) {
|
|
270
|
+
let selectedPsnItem = selectedPsnList[i];
|
|
271
|
+
|
|
272
|
+
for (let j in newPagerData.data) {
|
|
273
|
+
let dataItem = newPagerData.data[j];
|
|
274
|
+
|
|
275
|
+
if (dataItem.pk == selectedPsnItem.pk) {
|
|
276
|
+
dataItem.selected = true;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
this.setState({
|
|
285
|
+
...currentState,
|
|
286
|
+
pagerData: {...newPagerData}
|
|
287
|
+
})
|
|
288
|
+
} catch (e) {
|
|
289
|
+
this.dealAjaxException(e)
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* 页码&页大小发生变化
|
|
295
|
+
* @param e
|
|
296
|
+
*/
|
|
297
|
+
onDataStateChange(e) {
|
|
298
|
+
let that = this;
|
|
299
|
+
|
|
300
|
+
Promise.all([
|
|
301
|
+
(function() {
|
|
302
|
+
let currentState = that.state;
|
|
303
|
+
|
|
304
|
+
that.setState({
|
|
305
|
+
...currentState,
|
|
306
|
+
gridOperator: {skip: e.data.skip, take: e.data.take}
|
|
307
|
+
})
|
|
308
|
+
})()
|
|
309
|
+
]).then(this.queryPsnList)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Header Select
|
|
314
|
+
*/
|
|
315
|
+
onGridHeaderSelectionChange = () => {
|
|
316
|
+
let currentState = this.state;
|
|
317
|
+
let pagerData = currentState.pagerData;
|
|
318
|
+
let isAllPsnSelected = !currentState.isAllPsnSelected;
|
|
319
|
+
|
|
320
|
+
if (pagerData.data && pagerData.data.length > 0) {
|
|
321
|
+
pagerData.data.forEach(dataItem => {
|
|
322
|
+
dataItem.selected = isAllPsnSelected;
|
|
323
|
+
})
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
this.setState({
|
|
327
|
+
...currentState,
|
|
328
|
+
pagerData,
|
|
329
|
+
isAllPsnSelected,
|
|
330
|
+
selectedPsnList: []
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Row Select
|
|
336
|
+
*/
|
|
337
|
+
onGridRowSelectionChange = (e) => {
|
|
338
|
+
let selectedRowData = e.dataItem;
|
|
339
|
+
|
|
340
|
+
selectedRowData.selected = !selectedRowData.selected;
|
|
341
|
+
|
|
342
|
+
let currentState = this.state;
|
|
343
|
+
let selectedPsnList = [];
|
|
344
|
+
let psnList = currentState.pagerData.data;
|
|
345
|
+
let isAllPsnSelected = true;
|
|
346
|
+
|
|
347
|
+
if (psnList && psnList.length > 0) {
|
|
348
|
+
psnList.forEach(dataItem => {
|
|
349
|
+
if (dataItem.selected) {
|
|
350
|
+
selectedPsnList.push(dataItem);
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (selectedPsnList.length != currentState.pagerData.total) {
|
|
356
|
+
isAllPsnSelected = false;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
this.setState({
|
|
360
|
+
...currentState,
|
|
361
|
+
selectedPsnList,
|
|
362
|
+
isAllPsnSelected
|
|
363
|
+
})
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
onOk() {
|
|
367
|
+
let {selectedPsnList} = this.state;
|
|
368
|
+
|
|
369
|
+
if (!selectedPsnList || selectedPsnList.length == 0) {
|
|
370
|
+
SmartMessage.info("请选择人员");
|
|
371
|
+
|
|
372
|
+
return;
|
|
373
|
+
} else {
|
|
374
|
+
this.props.onOk(selectedPsnList)
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
render() {
|
|
379
|
+
const treeViewMessages = {
|
|
380
|
+
retry: "重新加载",
|
|
381
|
+
requestFailed: "加载失败.",
|
|
382
|
+
loading: "正在加载中..."
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
return (
|
|
386
|
+
<Modal className={`left-org-tree-right-person-grid-modal ${this.props.className? this.props.className : ''}`}
|
|
387
|
+
title="人员参照"
|
|
388
|
+
visible={true}
|
|
389
|
+
centered
|
|
390
|
+
width={'1000px'}
|
|
391
|
+
onCancel={this.props.onCancel}
|
|
392
|
+
onOk={this.onOk}
|
|
393
|
+
>
|
|
394
|
+
|
|
395
|
+
<Search
|
|
396
|
+
className={"person-search-box"}
|
|
397
|
+
placeholder="人员搜索"
|
|
398
|
+
onSearch={this.onPersonSearch}
|
|
399
|
+
/>
|
|
400
|
+
|
|
401
|
+
<div className={"left-org-tree-right-person-grid-container"}>
|
|
402
|
+
<div className={"left-org-tree-box"}>
|
|
403
|
+
<TreeView dataSource={this.dataSource}
|
|
404
|
+
messages={treeViewMessages}
|
|
405
|
+
expandIcons={false}
|
|
406
|
+
dataTextField={"name"}
|
|
407
|
+
template={this.treeNodeTemplate}
|
|
408
|
+
ref={this.orgTreeRef}
|
|
409
|
+
select={this.onSelect}
|
|
410
|
+
/>
|
|
411
|
+
</div>
|
|
412
|
+
|
|
413
|
+
<div className={"right-psn-grid-box"}>
|
|
414
|
+
<Grid
|
|
415
|
+
data={this.state.pagerData.data}
|
|
416
|
+
total={this.state.pagerData.total}
|
|
417
|
+
{...this.state.gridOperator}
|
|
418
|
+
pageable={{ pageSizes: [20, 50, 100, 200], type : 'numeric' }}
|
|
419
|
+
pageSize={20}
|
|
420
|
+
sortable={true}
|
|
421
|
+
resizable={true}
|
|
422
|
+
selectedField="selected"
|
|
423
|
+
onDataStateChange={this.onDataStateChange.bind(this)}
|
|
424
|
+
onSelectionChange={this.onGridRowSelectionChange}
|
|
425
|
+
onHeaderSelectionChange={this.onGridHeaderSelectionChange}
|
|
426
|
+
>
|
|
427
|
+
<GridColumn locked field="selected" title="选择" width="50px" className={"text-center locked"}
|
|
428
|
+
headerClassName={"text-center"} sortable={false} headerCell={props => {
|
|
429
|
+
return <Checkbox checked={this.state.isAllPsnSelected} onChange={this.onGridHeaderSelectionChange}></Checkbox>
|
|
430
|
+
}}
|
|
431
|
+
cell={props => {
|
|
432
|
+
return <td className={"text-center locked_column k-grid-content-sticky"} style={{left: "0px", right: "0px"}}>
|
|
433
|
+
<Checkbox checked={props.dataItem.selected} onChange={this.onGridRowSelectionChange.bind(this, props)}></Checkbox>
|
|
434
|
+
</td>
|
|
435
|
+
}}
|
|
436
|
+
/>
|
|
437
|
+
<GridColumn field="sequence_number" title="序号" width="50px" className={"text-center"} headerClassName={"text-center"} width="55px" sortable={false} cell={GridRowSequenceNumberCell}/>
|
|
438
|
+
<GridColumn field="name" title="姓名" className={"text-center"} headerClassName={"text-center"} width="120px" />
|
|
439
|
+
<GridColumn field="code" title="人员编码" className={"text-center"} headerClassName={"text-center"} width="120px" />
|
|
440
|
+
<GridColumn field="corp_ext_name" title="单位名称" className={"text-center"} headerClassName={"text-center"} width="180px" />
|
|
441
|
+
<GridColumn field="dept_ext_name" title="部门名称" className={"text-center"} headerClassName={"text-center"} width="180px" />
|
|
442
|
+
<GridColumn field="post_ext_name" title="岗位名称" className={"text-center"} headerClassName={"text-center"} width="180px" />
|
|
443
|
+
</Grid>
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
</Modal>
|
|
447
|
+
)
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export default LeftOrgTreeRightPersonGridForSelectPsnModal;
|
|
@@ -341,11 +341,7 @@ class HttpService {
|
|
|
341
341
|
|
|
342
342
|
let containsHTML = /<(br|basefont|hr|input|source|frame|param|area|meta|!--|col|link|option|base|img|wbr|!DOCTYPE).*?>|<(a|abbr|acronym|address|applet|article|aside|audio|b|bdi|bdo|big|blockquote|body|button|canvas|caption|center|cite|code|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frameset|head|header|hgroup|h1|h2|h3|h4|h5|h6|html|i|iframe|ins|kbd|keygen|label|legend|li|map|mark|menu|meter|nav|noframes|noscript|object|ol|optgroup|output|p|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video).*?<\/\2>/i.test(str);
|
|
343
343
|
if (containsHTML) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
p.catch(function() {
|
|
347
|
-
throw new Error("不安全的输入,请检查!");
|
|
348
|
-
});
|
|
344
|
+
throw new Error("不安全的输入,请检查!");
|
|
349
345
|
}
|
|
350
346
|
}
|
|
351
347
|
|