123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- 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 {getfllowSituation,getcustomerStatue} from '@/tools.js';
- import BusinessDetail from './businessDetail.jsx';
- const Business = React.createClass({
- getInitialState(){
- return{
- loading:false,
- dataBusiness:[],
- followData:{},
- paginationt: {
- defaultCurrent: 1,
- defaultPageSize: 10,
- showQuickJumper: true,
- pageSize: 10,
- onChange: function(page) {
- this.BusinessList(page, false);
- }.bind(this),
- showTotal: function(total) {
- return '共' + total + '条数据';
- }
- },
- businessIntentionList: [{
- title: '意向时间',
- dataIndex: 'createTime',
- key: 'createTime'
- }, {
- title: '客户名称',
- dataIndex: 'identifyName',
- key: 'identifyName'
- }, {
- title: '业务名',
- dataIndex: 'businessName',
- key: 'businessName'
- }, {
- title: '营销员',
- dataIndex: 'adminName',
- key: 'adminName'
- }, {
- title: '业务意向进度',
- dataIndex: 'followSituation',
- key: 'followSituation',
- render: text => { return getfllowSituation(text) }
- }, {
- title: '客户状态',
- dataIndex: 'customerStatus',
- key: 'customerStatus',
- render: text => { return getcustomerStatue(text) }
- }, {
- title: '操作',
- dataIndex: 'ooo',
- key: 'ooo',
- render: (text, record) => { return(<Button onClick={(e)=>{this.businessIntentionDetails(record)}}>查看</Button>) }
- }],
- }
- },
- businessIntentionDetails(record){
- this.setState({
- followData: record,
- businessModul:true
- })
- },
- //业务意向
- BusinessList(pageNo) {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + '/api/admin/customer/listBusiness',
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.paginationt.pageSize,
- uid: this.props.data.id
- },
- 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({
- key: i,
- businessId: thisdata.businessId,
- businessProjectId:thisdata.businessProjectId,
- businessName: thisdata.businessName,
- identifyName: thisdata.identifyName,
- followSituation: thisdata.followSituation,
- customerStatus: thisdata.customerStatus,
- adminName: thisdata.adminName,
- createTime: thisdata.createTime
- });
- };
- this.state.paginationt.current = data.data.pageNo;
- this.state.paginationt.total = data.data.totalCount;
- };
- if(data.data&&data.data.list&&!data.data.list.length){
- this.state.paginationt.current=0
- this.state.paginationt.total=0
- }
- this.setState({
- dataBusiness: theArr,
- paginationt: this.state.paginationt||[]
- });
- }.bind(this),
- }).always(function() {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- componentWillMount(){
- this.BusinessList();
- },
- detailsModal(){
- this.props.closeDetail(false, false)
- },
- componentWillReceiveProps(nextProps) {
- if(nextProps.data.id&&nextProps.businessState){
- this.BusinessList();
- }
- this.setState({
- businessModul:false
- })
- },
- render(){
- return(
- <div className="clearfix">
- <Spin spinning={this.state.loading}>
- <Table
- pagination={this.state.paginationt}
- columns={this.state.businessIntentionList}
- dataSource={this.state.dataBusiness}
- />
- </Spin>
- <BusinessDetail
- ids={this.props.data.id}
- data={this.state.followData}
- businessModul={this.state.businessModul}
- />
- </div>
- )
- }
- })
- export default Business;
|