| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 | 
							- import React from 'react';
 
- import {Form,Button,Spin,message,Table,Popconfirm} from 'antd';
 
- import ajax from 'jquery/src/ajax/xhr.js';
 
- import $ from 'jquery/src/ajax';
 
- import {getContactType} from '@/tools.js';
 
- import VisitDetail from './visitDetail.jsx';
 
- const Visit = React.createClass({
 
- 	getInitialState(){
 
- 		return{
 
- 			visitArrList:[],
 
- 			loading:false,
 
- 			visitModul:false,
 
- 			paginations: {
 
- 				defaultCurrent: 1,
 
- 				defaultPageSize: 10,
 
- 				showQuickJumper: true,
 
- 				pageSize: 10,
 
- 				onChange: function(page) {
 
- 					this.loadVisit(page);
 
- 				}.bind(this),
 
- 				showTotal: function(total) {
 
- 					return '共' + total + '条数据';
 
- 				}
 
- 			},
 
- 			visitsList: [{
 
- 				title: '拜访时间',
 
- 				dataIndex: 'followTime',
 
- 				key: 'followTime'
 
- 			}, {
 
- 				title: '客户名称',
 
- 				dataIndex: 'identifyName',
 
- 				key: 'identifyName'
 
- 			}, {
 
- 				title: '拜访方式',
 
- 				dataIndex: 'contactType',
 
- 				key: 'contactType',
 
- 				render: text => { return getContactType(text) }
 
- 			}, {
 
- 				title: '联系人',
 
- 				dataIndex: 'contacts',
 
- 				key: 'contacts',
 
- 				render:(text,record)=>{
 
- 					return  <div>{record.readOnly?
 
- 								<span>***</span>:
 
- 								<span>{text}</span>}
 
- 							</div>
 
- 				}
 
- 			}, {
 
- 				title: '联系电话',
 
- 				dataIndex: 'contactMobile',
 
- 				key: 'contactMobile',
 
- 				render:(text,record)=>{
 
- 					return  <div>{record.readOnly?
 
- 								<span>***</span>:
 
- 								<span>{text}</span>}
 
- 							</div>
 
- 				}
 
- 			}, {
 
- 				title: '拜访人',
 
- 				dataIndex: 'adminName',
 
- 				key: 'adminName'
 
- 			}, {
 
- 				title: '拜访说明',
 
- 				dataIndex: 'result',
 
- 				key: 'result'
 
- 			}, {
 
- 				title: '操作',
 
- 				dataIndex: 'ttt',
 
- 				key: 'ttt',
 
- 				render: (text, record, index) => {
 
- 					return <div>
 
-                             {!record.readOnly&&<Popconfirm title="是否删除?" onConfirm={(e)=>{this.visitDelet(record)}} okText="删除" cancelText="不删除">
 
- 							    <Button style={{marginRight:'10px',color:'#ffffff',background:'#f00',border:'none'}} onClick={(e)=>{e.stopPropagation()}}>删除</Button>
 
- 							</Popconfirm>}
 
-                         </div>
 
- 				}
 
- 			}],
 
- 		}
 
- 	},
 
- 	//拜访记录删除
 
- 	visitDelet(e) {
 
- 		this.setState({
 
- 			visitModul:false,
 
- 			loading: true
 
- 		});
 
- 		$.ajax({
 
- 			method: "get",
 
- 			dataType: "json",
 
- 			crossDomain: false,
 
- 			url: globalConfig.context + "/api/admin/customer/deleteFollow",
 
- 			data: {
 
- 				followId: e.followId, //删除的ID    
 
- 			}
 
- 		}).done(function(data) {
 
- 			if(!data.error.length) {
 
- 				message.success('删除成功!');
 
- 				this.setState({
 
- 					loading: false,
 
- 				});
 
- 			} else {
 
- 				message.warning(data.error[0].message);
 
- 			};
 
- 			this.loadVisit();
 
- 		}.bind(this));
 
- 	},
 
- 	//查看跟进记录列表
 
- 	loadVisit(pageNo) {
 
- 		this.setState({
 
- 			loading: true
 
- 		});
 
- 		$.ajax({
 
- 			method: "get",
 
- 			dataType: "json",
 
- 			crossDomain: false,
 
- 			url: globalConfig.context + '/api/admin/customer/listFollowHistory',
 
- 			data: {
 
- 				pageNo: pageNo || 1,
 
- 				pageSize: this.state.paginations.pageSize,
 
- 				uid: this.props.data.id, //名称1
 
- 			},
 
- 			success: function(data) {
 
- 				let theArr = [];
 
- 				if(data.error.length || data.data.list == "") {
 
- 					if(data.error && data.error.length) {
 
- 						message.warning(data.error[0].message);
 
- 					};
 
- 				} else {
 
- 					for(let i = 0; i < data.data.list.length; i++) {
 
- 						let thisdata = data.data.list[i];
 
- 						theArr.push({
 
- 							readOnly:thisdata.readOnly,
 
- 							followId: thisdata.followId,
 
- 							followTime: thisdata.followTime,
 
- 							identifyName: thisdata.identifyName,
 
- 							contacts: thisdata.contacts,
 
- 							contactMobile: thisdata.contactMobile,
 
- 							result: thisdata.result,
 
- 							adminName: thisdata.adminName,
 
- 							followSituation: thisdata.followSituation,
 
- 							customerStatus: thisdata.customerStatus,
 
- 							contactType: thisdata.contactType
 
- 						});
 
- 					};
 
- 					this.state.paginations.current = data.data.pageNo;
 
- 					this.state.paginations.total = data.data.totalCount;
 
- 				};
 
- 				if(data.data.list&&!data.data.list.length){
 
- 					this.state.paginations.current =0;
 
- 					this.state.paginations.total =0;
 
- 				};
 
- 				this.setState({
 
- 					visitArrList: theArr,
 
- 					paginations: this.state.paginations
 
- 				});
 
- 			}.bind(this),
 
- 		}).always(function() {
 
- 			this.setState({
 
- 				loading: false
 
- 			});
 
- 		}.bind(this));
 
- 	},
 
- 	componentWillMount(){
 
- 		this.loadVisit();
 
- 	},
 
- 	detailsModal(){
 
- 		this.props.closeDetail(false, false)
 
- 	},
 
- 	//点击整行
 
- 	VisitRowClick(record){
 
- 		this.setState({
 
- 			followData: record,
 
- 			visitModul:true,
 
- 		})
 
- 	},
 
- 	closeDesc(e,s){
 
- 		this.state.visitModul=e
 
- 		if(s){
 
- 			this.loadVisit()
 
- 		}
 
- 	},
 
- 	componentWillReceiveProps(nextProps) {
 
- 		if(nextProps.data.id&&nextProps.visitState){
 
- 			this.loadVisit()
 
- 		}
 
- 		this.setState({
 
- 			visitModul:false
 
- 		})
 
- 	},
 
- 	render(){
 
- 		return(
 
- 			<div className="clearfix">
 
- 			    <Spin spinning={this.state.loading}>
 
- 			      <Table 
 
- 	            	 pagination={this.state.paginations}
 
- 	            	 columns={this.state.visitsList} 
 
- 	            	 dataSource={this.state.visitArrList}
 
- 	            	 onRowClick={this.VisitRowClick}
 
- 	            	 />
 
- 			    </Spin> 
 
- 			    <VisitDetail 
 
- 			    	categoryArr={this.props.categoryArr}
 
- 			    	followData={this.state.followData}
 
- 			    	visitModul={this.state.visitModul}
 
- 			    	closeDesc={this.closeDesc}
 
- 			    	mid={this.props.data.id}
 
- 			    />
 
- 			</div>	
 
- 		)
 
- 	}
 
- })
 
- export default Visit;
 
 
  |