dengzhiguo 6 years ago
parent
commit
406428feb7

+ 0 - 18
js/component/manageCenter/customer/NEW/crm/crmAll.jsx

@@ -792,24 +792,6 @@ const IntentionCustomer = Form.create()(React.createClass({
                         onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} /> 
                     <Button type="primary" onClick={this.search}>搜索</Button>
                     <Button onClick={this.reset}>重置</Button>                      
-                    <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>  
                 </div>                                               
                 <div className="patent-table">
                     <Spin spinning={this.state.loading}>

+ 138 - 13
js/component/manageCenter/customer/NEW/query/queryCutomer.jsx

@@ -1,5 +1,5 @@
 import React from 'react';
-import { Button,Cascader,Input, Select, Spin, Table, message, Form } from 'antd';
+import { Button,Cascader,Input, Select, Spin, Table, message, Form ,AutoComplete} from 'antd';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 
@@ -24,8 +24,8 @@ const QueryCustomer = React.createClass({
 				pageNo: pageNo || 1,
 				pageSize: this.state.pagination.pageSize,
 				name: this.state.nameSearch,
-				province: !(this.state.addressSearch).length ? this.state.provinceSearch : this.state.addressSearch[0],
-				city: !(this.state.addressSearch).length ? '' : this.state.addressSearch[1],
+				departmentId: this.state.departmenttSearch,
+				aid: this.state.theTypes,
 			},
 			success: function(data) {
 				let theArr = [];
@@ -66,11 +66,52 @@ const QueryCustomer = React.createClass({
 			});
 		}.bind(this));
 	},
+	//部门
+	departmentList() {
+		this.setState({
+			loading: true
+		});
+		$.ajax({
+			method: "post",
+			dataType: "json",
+			crossDomain: false,
+			url: globalConfig.context + "/api/admin/organization/selectSuperId",
+			data: {
+
+			},
+			success: function(data) {
+				let thedata = data.data;
+				let theArr = [];
+				if(!thedata) {
+					if(data.error && data.error.length) {
+						message.warning(data.error[0].message);
+					};
+					thedata = {};
+				} else {
+					thedata.map(function(item, index) {
+						theArr.push({
+							key: index,
+							name: item.name,
+							id: item.id,
+						})
+					})
+				}
+				this.setState({
+					departmentArr: theArr,
+				})
+			}.bind(this),
+		}).always(function() {
+			this.setState({
+				loading: false
+			});
+		}.bind(this));
+	},
 	getInitialState(){
 		return {
 			addressSearch: [],
 			dataSource:[],
 			loading:false,
+			departmentArr: [],
 			selectedRowKeys: [],
 			selectedRowKey: [],
 			selectedRows: [],
@@ -136,11 +177,15 @@ const QueryCustomer = React.createClass({
 	},
 	reset() {
 		this.state.nameSearch='';
+		this.state.departmenttSearch=undefined;
+		this.state.theTypes='';
+		this.state.auto='';
 		this.state.provinceSearch=undefined;
 		this.state.addressSearch=[];
 		this.loadData()
 	},
 	componentWillReceiveProps(nextProps) {
+		
 		if(nextProps.ApiUrl!=this.props.ApiUrl) {
 			this.state.nameSearch='';
 			this.state.provinceSearch=undefined;
@@ -148,7 +193,9 @@ const QueryCustomer = React.createClass({
 			this.loadData(null,nextProps.ApiUrl);
 		};
 	},
+	
 	componentWillMount() {
+		this.departmentList();
 		//城市
 		let Province = [];
 		provinceList.map(function(item) {
@@ -160,7 +207,65 @@ const QueryCustomer = React.createClass({
 		this.state.Provinces = Province;
 		this.loadData();
 	},
+	//指定转交人自动补全
+	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){
+		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
+		})
+	},
 	render(){
+		let departmentArr = this.state.departmentArr || [];
 		const intentionState=this.props.intentionState;
 		const FormItem = Form.Item;
 		const rowSelection = {
@@ -179,6 +284,10 @@ const QueryCustomer = React.createClass({
 				})
 			},
 		};
+		const dataSources=this.state.customerArr || [];
+		const options = dataSources.map((group) =>
+				      <Select.Option key={group.id} value={group.name}>{group.name}</Select.Option>
+				     )
 		const hasSelected = this.state.selectedRowKeys.length > 0;
 		return(
 			<div className="user-content" >
@@ -189,16 +298,32 @@ const QueryCustomer = React.createClass({
                     <Input placeholder="客户名称"
                         value={this.state.nameSearch}
                         onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />    
-                    <Select placeholder="省"
-                            style={{ width: 80 }}
-                            value={this.state.provinceSearch}
-                            onChange={(e) => {this.setState({ provinceSearch: e});}}>
-                            {this.state.Provinces}
-                    </Select> 
-                    <span style={{marginRight:'10px'}}>                   
-	                     <Cascader options={citySelect()}  value={this.state.addressSearch} placeholder="选择城市"
-    						onChange={(e,pre) => { this.setState({ addressSearch: e }) }} />	                 
-                    </span>
+                   <Select placeholder="选择部门"
+                            style={{ width: 150 ,marginRight:'10px',marginLeft:'10px'}}
+                            value={this.state.departmenttSearch}
+                            onChange={(e) => { this.setState({ departmenttSearch: e }) }}>
+                            {
+                                departmentArr.map(function (item) {
+                                        return <Select.Option key={item.id} >{item.name}</Select.Option>
+                                })
+                            }
+                    </Select>  
+                    <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}
+				    >
+				        <Input />
+				    </AutoComplete>  
                     <Button type="primary" onClick={this.search}>搜索</Button>
                     <Button onClick={this.reset}>重置</Button> 
                 </div>