|
@@ -1,5 +1,5 @@
|
|
|
import React from 'react';
|
|
|
-import { Radio, Icon, Button, Cascader, Input, Select, Tabs, Spin, Popconfirm, Popover, Table, Switch, message, DatePicker, Modal, Upload, Form, Row, Col, TimePicker } from 'antd';
|
|
|
+import { Radio, Icon, Button, AutoComplete,Cascader, Input, Select, Tabs, Spin, Popconfirm, Popover, Table, Switch, message, DatePicker, Modal, Upload, Form, Row, Col, TimePicker } from 'antd';
|
|
|
import ajax from 'jquery/src/ajax/xhr.js';
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
import moment from 'moment';
|
|
@@ -1860,6 +1860,100 @@ const MyClient = Form.create()(React.createClass({
|
|
|
});
|
|
|
}.bind(this));
|
|
|
},
|
|
|
+ //指定转交人自动补全
|
|
|
+ supervisor(e){
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + "/api/admin/customer/listAdminByName",
|
|
|
+ data:{
|
|
|
+ adminName:e
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ let thedata=data.data;
|
|
|
+ if (!thedata) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ thedata = {};
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ customerArr:thedata,
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ }).always(function () {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ //上级主管输入框失去焦点是判断客户是否存在
|
|
|
+ selectAuto(value,options){
|
|
|
+ this.setState({
|
|
|
+ auto:value
|
|
|
+ })
|
|
|
+ },
|
|
|
+ blurChange(e){
|
|
|
+ console.log(e)
|
|
|
+ let theType='';
|
|
|
+ let contactLists=this.state.customerArr||[];
|
|
|
+ if (e) {
|
|
|
+ contactLists.map(function (item) {
|
|
|
+ if (item.name == e.toString()) {
|
|
|
+ theType = item.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ theTypes:theType
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //值改变时请求客户名称
|
|
|
+ httpChange(e){
|
|
|
+ if(e.length>=1){
|
|
|
+ this.supervisor(e);
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ auto:e
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //转交
|
|
|
+ changeAssigner() {
|
|
|
+ this.setState({
|
|
|
+ selectedRowKeys: [],
|
|
|
+ });
|
|
|
+ let changeIds;
|
|
|
+ for(let idx = 0; idx < this.state.selectedRows.length; idx++) {
|
|
|
+ let rowItem = this.state.selectedRows[idx];
|
|
|
+ if(rowItem.id) {
|
|
|
+ changeIds = rowItem.id;
|
|
|
+
|
|
|
+ };
|
|
|
+ };
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + "/api/admin/customer/transferToOther",
|
|
|
+ data: {
|
|
|
+ uid: changeIds, //这一行数据的ID
|
|
|
+ aid: this.state.theTypes, //指定转交人的ID
|
|
|
+ }
|
|
|
+ }).done(function(data) {
|
|
|
+ if(!data.error.length) {
|
|
|
+ message.success('转交成功!');
|
|
|
+ this.setState({
|
|
|
+ auto:'',
|
|
|
+ loading: false,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ this.loadData();
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
if(!this.props.visible && nextProps.visible) {
|
|
|
if(nextProps.data && nextProps.data.id) {
|
|
@@ -1917,6 +2011,10 @@ const MyClient = Form.create()(React.createClass({
|
|
|
wrapperCol: { span: 14 },
|
|
|
};
|
|
|
const contacts = this.state.contacts || '';
|
|
|
+ const dataSources=this.state.customerArr || [];
|
|
|
+ const options = dataSources.map((group) =>
|
|
|
+ <Select.Option key={group.id} value={group.name}>{group.name}</Select.Option>
|
|
|
+ )
|
|
|
return(
|
|
|
<div className="user-content" >
|
|
|
<div className="content-title">
|
|
@@ -1968,6 +2066,25 @@ const MyClient = Form.create()(React.createClass({
|
|
|
>删除<Icon type="minus" />
|
|
|
</Button>
|
|
|
</Popconfirm>
|
|
|
+ <AutoComplete
|
|
|
+ className="certain-category-search"
|
|
|
+ dropdownClassName="certain-category-search-dropdown"
|
|
|
+ dropdownMatchSelectWidth={false}
|
|
|
+ dropdownStyle={{ width: 120 }}
|
|
|
+
|
|
|
+ style={{ width: '120px'}}
|
|
|
+ dataSource={options}
|
|
|
+ placeholder="输入转交人姓名"
|
|
|
+ value={this.state.auto}
|
|
|
+ onChange={this.httpChange}
|
|
|
+ filterOption={true}
|
|
|
+ onBlur={this.blurChange}
|
|
|
+ onSelect={this.selectAuto}
|
|
|
+ disabled={!hasSelected}
|
|
|
+ >
|
|
|
+ <Input />
|
|
|
+ </AutoComplete>
|
|
|
+ <Button type="primary" onClick={this.changeAssigner} disabled={!hasSelected} >转交</Button>
|
|
|
<Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
|
|
|
disabled={!hasSelected}
|
|
|
onClick={this.changeRow}>转为公共客户<Icon /></Button>
|