|
@@ -1,14 +1,18 @@
|
|
|
|
|
+/**
|
|
|
|
|
+ * 人员选择器
|
|
|
|
|
+ */
|
|
|
import React from 'react'
|
|
import React from 'react'
|
|
|
import { Modal, Row, Col, Select, Spin } from 'antd'
|
|
import { Modal, Row, Col, Select, Spin } from 'antd'
|
|
|
import * as service from '../../services/index'
|
|
import * as service from '../../services/index'
|
|
|
import URLS from '../../constants/url'
|
|
import URLS from '../../constants/url'
|
|
|
const SelectOption = Select.Option
|
|
const SelectOption = Select.Option
|
|
|
|
|
|
|
|
-class TransferBox extends React.Component {
|
|
|
|
|
|
|
+class AddGroupMemberBox extends React.Component {
|
|
|
|
|
+
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
this.state = {
|
|
this.state = {
|
|
|
- selected: null,
|
|
|
|
|
|
|
+ selectedUser: null,
|
|
|
userData: [],
|
|
userData: [],
|
|
|
fetching: false
|
|
fetching: false
|
|
|
}
|
|
}
|
|
@@ -53,15 +57,16 @@ class TransferBox extends React.Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
- const { visibleTransferBox, hideBox, onOk } = this.props;
|
|
|
|
|
|
|
+ const { visibleBox, title, hideBox, okHandler, multiple } = this.props;
|
|
|
const { userData, fetching } = this.state;
|
|
const { userData, fetching } = this.state;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <Modal
|
|
|
|
|
- visible={visibleTransferBox}
|
|
|
|
|
- title='选择移交对象'
|
|
|
|
|
|
|
+ <Modal
|
|
|
|
|
+ className='addmember-box'
|
|
|
|
|
+ title={title}
|
|
|
|
|
+ visible={visibleBox}
|
|
|
onOk={() => {
|
|
onOk={() => {
|
|
|
- onOk(this.state.selected);
|
|
|
|
|
|
|
+ okHandler(this.state.selectedUser);
|
|
|
hideBox();
|
|
hideBox();
|
|
|
}}
|
|
}}
|
|
|
onCancel={hideBox}
|
|
onCancel={hideBox}
|
|
@@ -72,20 +77,11 @@ class TransferBox extends React.Component {
|
|
|
<Col span={24}>
|
|
<Col span={24}>
|
|
|
<Select
|
|
<Select
|
|
|
style={{ width: '100%' }}
|
|
style={{ width: '100%' }}
|
|
|
- // mode='multiple'
|
|
|
|
|
|
|
+ mode={ multiple ? 'multiple' : 'sigle'}
|
|
|
showSearch
|
|
showSearch
|
|
|
filterOption={false}
|
|
filterOption={false}
|
|
|
labelInValue={true}
|
|
labelInValue={true}
|
|
|
notFoundContent={fetching ? <Spin size="small" /> : '无'}
|
|
notFoundContent={fetching ? <Spin size="small" /> : '无'}
|
|
|
- onFocus={(value) => {
|
|
|
|
|
- const timeout = this.state.timeout;
|
|
|
|
|
- timeout && window.clearTimeout(timeout);
|
|
|
|
|
- this.setState({
|
|
|
|
|
- timeout: window.setTimeout(() => {
|
|
|
|
|
- this.fetchUserData(value)
|
|
|
|
|
- }, 500)
|
|
|
|
|
- });
|
|
|
|
|
- }}
|
|
|
|
|
onSearch={(value) => {
|
|
onSearch={(value) => {
|
|
|
const timeout = this.state.timeout;
|
|
const timeout = this.state.timeout;
|
|
|
timeout && window.clearTimeout(timeout);
|
|
timeout && window.clearTimeout(timeout);
|
|
@@ -95,10 +91,12 @@ class TransferBox extends React.Component {
|
|
|
}, 500)
|
|
}, 500)
|
|
|
});
|
|
});
|
|
|
}}
|
|
}}
|
|
|
|
|
+ onFocus={() => {
|
|
|
|
|
+ this.fetchUserData('');
|
|
|
|
|
+ }}
|
|
|
onChange={(value) => {
|
|
onChange={(value) => {
|
|
|
- console.log(value);
|
|
|
|
|
this.setState({
|
|
this.setState({
|
|
|
- selected: {
|
|
|
|
|
|
|
+ selectedUser: {
|
|
|
code: value.key,
|
|
code: value.key,
|
|
|
name: value.label
|
|
name: value.label
|
|
|
}
|
|
}
|
|
@@ -112,8 +110,8 @@ class TransferBox extends React.Component {
|
|
|
</Col>
|
|
</Col>
|
|
|
</Row>
|
|
</Row>
|
|
|
</Modal>
|
|
</Modal>
|
|
|
- )
|
|
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export default TransferBox
|
|
|
|
|
|
|
+export default AddGroupMemberBox;
|