123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- import React from 'react';
- import ajax from 'jquery/src/ajax/xhr.js';
- import $ from 'jquery/src/ajax';
- import "./statistics.less";
- import { Button, Select, Table, Spin, message, Tabs, DatePicker } from 'antd';
- const TabPane = Tabs.TabPane;
- import moment from 'moment';
- import { intentionalService,newFollow } from '../../../dataDic.js';
- import {ChooseList} from "../../order/orderNew/chooseList";
- const FollowStatistics = React.createClass({
- loadData(pageNo, nub) {
- this.state.data = [];
- this.setState({
- loading: true
- });
- let urls = '';
- switch(nub) {
- case "1":
- urls = "";
- break; //日
- case "2":
- urls = "daySpan";
- break; //日
- case "3":
- urls = "weekSpan";
- break; //周
- case "4":
- urls = "monthSpan";
- break; //月
- case "5":
- urls = "quarterSpan";
- break; //季
- case "6":
- urls = "yearSpan";
- break; //年
- default:
- urls ='';
- }
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/customer/businessStatistic",
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize,
- startDate: this.state.releaseDate[0],
- endDate: this.state.releaseDate[1],
- timeSpan:this.state.releaseDate[0]?'':urls,
- depId:this.state.depId,
- businessGlossoryId:this.state.followSearch,
- depNo:this.state.departmentt
- },
- success: function(data) {
- let theArr = [];
- if(!data.data || !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,
- id: thisdata.id,
- adminName: thisdata.adminName,
- departmentName: thisdata.departmentName,
- sendMaterialNo: thisdata.sendMaterialNo,
- interviewNo: thisdata.interviewNo,
- sendProspectusNo: thisdata.sendProspectusNo,
- quoteNo: thisdata.quoteNo,
- sendContractNo: thisdata.sendContractNo ,
- signContractNo: thisdata.signContractNo,
- onVisaNo: thisdata.onVisaNo,
- visaNo: thisdata.visaNo,
- });
- };
- this.state.pagination.current = data.data.pageNo;
- this.state.pagination.total = data.data.totalCount;
- };
- if(!data.data.list.length){
- this.state.pagination.current=0;
- this.state.pagination.total=0;
- }
- this.setState({
- dataSource: theArr,
- pagination: this.state.pagination,
- });
- }.bind(this),
- }).always(function() {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- getInitialState() {
- return {
- releaseDate: [],
- loading: false,
- callnub:'1',
- pagination: {
- defaultCurrent: 1,
- defaultPageSize: 10,
- showQuickJumper: true,
- pageSize: 10,
- onChange: function(page) {
- this.call(page)
- }.bind(this),
- showTotal: function(total) {
- return '共' + total + '条数据';
- }
- },
- columns: [{
- title: '营销员',
- dataIndex: 'adminName',
- key: 'adminName',
- }, {
- title: '部门',
- dataIndex: 'departmentName',
- key: 'departmentName',
- }, {
- title: '已发项目介绍资料',
- dataIndex: 'sendMaterialNo',
- key: 'sendMaterialNo',
- }, {
- title: '已约面谈',
- dataIndex: 'interviewNo',
- key: 'interviewNo',
- }, {
- title: '已发合同计划书',
- dataIndex: 'sendProspectusNo',
- key: 'sendProspectusNo',
- }, {
- title: '已报价',
- dataIndex: 'quoteNo',
- key: 'quoteNo',
- }, {
- title: '已发合同',
- dataIndex: 'sendContractNo',
- key: 'sendContractNo',
- }, {
- title: '已签合同',
- dataIndex: 'signContractNo',
- key: 'signContractNo',
- }, {
- title: '面谈中',
- dataIndex: 'onVisaNo',
- key: 'onVisaNo',
- }, {
- title: '已面签',
- dataIndex: 'visaNo',
- key: 'visaNo',
- }]
- }
- },
- //部门
- departmentList() {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- 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,
- depNo:item.depNo
- })
- })
- }
- this.setState({
- departmentArr:theArr,
- })
- }.bind(this),
- }).always(function() {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- callback(e) {
- this.setState({
- callnub: e,
- releaseDate:[]
- })
- this.loadData(1, e)
- },
- call(a){
- this.loadData(a, this.state.callnub)
- },
- search() {
- if(this.state.releaseDate[0]){
- this.setState({
- callnub:'1'
- })
- }else{
- this.state.releaseDate=[]
- }
- this.loadData(1, this.state.callnub)
- },
- reset() {
- this.state.departmentt=undefined;
- this.state.releaseDate = [];
- this.state.followSearch=undefined;
- this.loadData(1, this.state.callnub);
- },
- changeList(arr) {
- const newArr = [];
- this.state.columns.forEach(item => {
- arr.forEach(val => {
- if (val === item.title) {
- newArr.push(item);
- }
- });
- });
- this.setState({
- changeList: newArr
- });
- },
- componentWillMount() {
- this.loadData();
- this.departmentList()
- },
- render() {
- const { RangePicker } = DatePicker;
- let departmentArr = this.state.departmentArr || [];
- return <div className="visitContant">
- <div className="visitTitle">
- <Tabs defaultActiveKey="1" className="test">
- <TabPane tab="搜索" key="1">
- <div className="user-search" style={{paddingTop:'11px'}}>
- <span className="titleTime">起止时间</span>
- <RangePicker
- value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
- this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
- onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
- <span style={{marginRight:'15px',marginLeft:'15px'}}>业务类型:</span>
- <Select placeholder="业务类型" value={this.state.followSearch} onChange={(e) => {
- this.setState({followSearch:e})}} style={{width:'150px'}}>
- {
- intentionalService.map(function (item) {
- return <Select.Option key={item.value} >{item.key}</Select.Option>
- })
- }
- </Select>
- <span style={{marginRight:'15px',marginLeft:'15px'}}>部门:</span>
- <Select placeholder="选择部门" style={{width:'150px'}}
- value={this.state.departmentt}
- onChange={(e) => { this.setState({ departmentt: e }) }}>
- {
- departmentArr.map(function (item) {
- return <Select.Option key={item.depNo} >{item.name}</Select.Option>
- })
- }
- </Select>
- <Button onClick={this.search} className="blue" style={{background:'red',color:'#ffffff',border:'none'}}>统计</Button>
- <Button onClick={this.reset} className="green" style={{background:'green',color:'#ffffff',border:'none'}}>重置</Button>
- </div>
- </TabPane>
- <TabPane tab="更改表格显示数据" key="2">
- <div style={{ marginLeft: 10 }}>
- <ChooseList
- columns={this.state.columns}
- changeFn={this.changeList}
- changeList={this.state.changeList}
- top={55}
- margin={11}
- />
- </div>
- </TabPane>
- </Tabs>
-
- <div className="clearfix" style={{marginTop:'30px',marginLeft:'20px'}}>
- <Tabs onChange={this.callback} type="card" activeKey={this.state.callnub}>
- <TabPane tab="所有业务跟进进度" key="1"></TabPane>
- <TabPane tab="本日业务跟进进度" key="2"></TabPane>
- <TabPane tab="本周业务跟进进度" key="3"></TabPane>
- <TabPane tab="本月业务跟进进度" key="4"></TabPane>
- <TabPane tab="本季业务跟进进度" key="5"></TabPane>
- <TabPane tab="本年业务跟进进度" key="6"></TabPane>
- </Tabs>
- </div>
- <div className="clearfix">
- <div className="maintitle">业务跟进进度情况统计表</div>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table size="middle" columns={
- this.state.changeList
- ? this.state.changeList
- : this.state.columns
- }
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- onRowClick={this.tableRowClick} />
- </Spin>
- </div>
- </div>
-
- </div>
- </div>
- }
- });
- export default FollowStatistics;
|