|
@@ -1,5 +1,5 @@
|
|
|
import React from 'react';
|
|
|
-import { Select, Spin, Input, Table, Button ,message} from 'antd';
|
|
|
+import { Select, Spin, Input, Table, Button ,message,DatePicker} from 'antd';
|
|
|
import ajax from 'jquery/src/ajax/xhr.js';
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
import './report.less';
|
|
@@ -7,80 +7,81 @@ import { post } from '../../../dataDic.js';
|
|
|
|
|
|
const PersonalReport = React.createClass({
|
|
|
loadData(totalArr,pageNo) {
|
|
|
-// console.log(totalArr);
|
|
|
- let total=totalArr.data[0];
|
|
|
+ if(this.state.selTime){
|
|
|
+ var newTime=this.state.selTime;
|
|
|
+ var timeArr=newTime.split('-');
|
|
|
+ var txtTime=timeArr[0]+'年'+timeArr[1]+'月'+timeArr[2]+'日';
|
|
|
+ this.setState({
|
|
|
+ timeState:true,
|
|
|
+ txtTime:txtTime,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ let total=totalArr;
|
|
|
this.setState({
|
|
|
loading: true
|
|
|
});
|
|
|
-// console.log(pageNo)
|
|
|
$.ajax({
|
|
|
- method: "post",
|
|
|
+ method: "get",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
- url: globalConfig.context + "/api/admin/order/listPublicOrder",
|
|
|
+ url: globalConfig.context + "/api/admin/report/sales/personal",
|
|
|
data: {
|
|
|
- pageNo: pageNo || 1,
|
|
|
- pageSize: this.state.pagination.pageSize,
|
|
|
+ pNo: pageNo || 1,
|
|
|
+ pSize: 9,
|
|
|
+ date:this.state.selTime?(this.state.selTime+' '+'00:00:00'):'',
|
|
|
+ depName:this.state.departmentSearch,
|
|
|
+ name:this.state.uesrNameSearch,
|
|
|
},
|
|
|
success: function(data) {
|
|
|
-// console.log(data)
|
|
|
- let thedata = data.data.list;
|
|
|
+ let thedata = data.data;
|
|
|
let theArr = [];
|
|
|
if(!data.data) {
|
|
|
if(data.error && data.error.length) {
|
|
|
message.warning(data.error[0].message);
|
|
|
};
|
|
|
+ this.state.pagination.current=0
|
|
|
+ this.state.pagination.total=0
|
|
|
thedata = {};
|
|
|
} else {
|
|
|
thedata.map(function(item, index) {
|
|
|
+ var yTime=new Date(item.enrollTime).toLocaleDateString();
|
|
|
let nub=index+1;
|
|
|
theArr.push({
|
|
|
key: index,
|
|
|
theNumber:false,
|
|
|
nub:nub,
|
|
|
- name: item.name,
|
|
|
id: item.id,
|
|
|
-// departmentName:item.departmentName,//部门
|
|
|
-// position:item.position, //职务
|
|
|
-// enrollTime:item.enrollTime,// 入职时间
|
|
|
-// dailyOrderCount:values.daily.orderCount,//日签单业绩
|
|
|
-// dailyOrderAmount:values.daily.orderAmount,//日签单业绩
|
|
|
-// weeklyOrderCount:values.weekly.orderCount,//周签单业绩
|
|
|
-// weeklyOrderAmount:values.weekly.orderAmount,//周签单业绩
|
|
|
-// monthlyOrderCount:values.monthly.orderCount,//月签单业绩
|
|
|
-// monthlyOrderAmount:values.monthly.orderAmount,//月签单业绩
|
|
|
-// quarterlyOrderCount:values.quarterly.orderCount,//季签单业绩
|
|
|
-// quarterlyOrderAmount:values.quarterly.orderAmount,//季签单业绩
|
|
|
-// annuallyOrderCount:values. annually.orderCount,//年签单业绩
|
|
|
-// annuallyOrderAmount:values. annually.orderAmount,//年签单业绩
|
|
|
- departmentName:item.name,//部门
|
|
|
- position:item.name, //职务
|
|
|
- enrollTime:item.name,// 入职时间
|
|
|
- dailyOrderCount:nub,//日签单业绩
|
|
|
- dailyOrderAmount:nub,//日签单业绩
|
|
|
- weeklyOrderCount:nub,//周签单业绩
|
|
|
- weeklyOrderAmount:nub,//周签单业绩
|
|
|
- monthlyOrderCount:nub,//月签单业绩
|
|
|
- monthlyOrderAmount:nub,//月签单业绩
|
|
|
- quarterlyOrderCount:nub,//季签单业绩
|
|
|
- quarterlyOrderAmount:nub,//季签单业绩
|
|
|
- annuallyOrderCount:nub,//年签单业绩
|
|
|
- annuallyOrderAmount:nub,//年签单业绩
|
|
|
+ name:item.name, //姓名
|
|
|
+ departmentName:item.departmentName,//部门
|
|
|
+ position:item.position, //职务
|
|
|
+ enrollTime:yTime,// 入职时间
|
|
|
+ dailyOrderCount:item.values.daily.orderCount,//日签单业绩
|
|
|
+ dailyOrderAmount:item.values.daily.orderAmount,//日签单业绩
|
|
|
+ weeklyOrderCount:item.values.weekly.orderCount,//周签单业绩
|
|
|
+ weeklyOrderAmount:item.values.weekly.orderAmount,//周签单业绩
|
|
|
+ monthlyOrderCount:item.values.monthly.orderCount,//月签单业绩
|
|
|
+ monthlyOrderAmount:item.values.monthly.orderAmount,//月签单业绩
|
|
|
+ quarterlyOrderCount:item.values.quarterly.orderCount,//季签单业绩
|
|
|
+ quarterlyOrderAmount:item.values.quarterly.orderAmount,//季签单业绩
|
|
|
+ annuallyOrderCount:item.values.annually.orderCount,//年签单业绩
|
|
|
+ annuallyOrderAmount:item.values.annually.orderAmount,//年签单业绩
|
|
|
})
|
|
|
})
|
|
|
- this.state.pagination.current = data.data.pageNo;
|
|
|
- this.state.pagination.total = data.data.totalCount;
|
|
|
- }
|
|
|
-// if(!data.data.length){
|
|
|
-// this.state.pagination.current=0
|
|
|
-// this.state.pagination.total=0
|
|
|
-// }
|
|
|
+ this.state.pagination.current =pageNo;
|
|
|
+ this.state.pagination.total=30
|
|
|
+ };
|
|
|
+ if(!data.data.length){
|
|
|
+ this.state.pagination.total=0;
|
|
|
+ };
|
|
|
theArr.push(
|
|
|
{
|
|
|
key:9999999,
|
|
|
theNumber:true,
|
|
|
- nub:11,
|
|
|
- name:'合计',
|
|
|
+ nub:data.data.length+1,
|
|
|
+ name:'',
|
|
|
+ position:'', //职务
|
|
|
+ enrollTime:'',// 入职时间
|
|
|
+ departmentName:'合计',
|
|
|
dailyOrderCount:total.dailyTotalCount,//日签单业绩
|
|
|
dailyOrderAmount:total.dailyTotalAmount,//日签单业绩
|
|
|
weeklyOrderCount:total.weeklyTotalCount,//周签单业绩
|
|
@@ -93,9 +94,7 @@ const PersonalReport = React.createClass({
|
|
|
annuallyOrderAmount:total.annuallyTotalAmount,//年签单业绩
|
|
|
}
|
|
|
)
|
|
|
- console.log(theArr)
|
|
|
this.setState({
|
|
|
- pageNo:pageNo,
|
|
|
dataSource: theArr,
|
|
|
pagination: this.state.pagination,
|
|
|
})
|
|
@@ -107,24 +106,19 @@ const PersonalReport = React.createClass({
|
|
|
}.bind(this));
|
|
|
},
|
|
|
totalData(page) {
|
|
|
- console.log(page)
|
|
|
this.setState({
|
|
|
loading: true
|
|
|
});
|
|
|
$.ajax({
|
|
|
- method: "post",
|
|
|
+ method: "get",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
- url: globalConfig.context + "/api/admin/organization/selectSuperId",
|
|
|
+ url: globalConfig.context + "/api/admin/report/sales/total",
|
|
|
data: {
|
|
|
|
|
|
},
|
|
|
success: function(data) {
|
|
|
- //let thedata = data.data;
|
|
|
- let thedata = {data:[
|
|
|
- {dailyTotalCount:1227,dailyTotalAmount:1233,weeklyTotalCount:1025,weeklyTotalAmount:127,monthlyTotalCount:122,
|
|
|
- monthlyTotalAmount:922,quarterlyTotalCount:772,quarterlyTotalAmount:122,annuallyTotalCount:522,annuallyTotalAmount:2222,}
|
|
|
- ]}
|
|
|
+ let thedata = data.data;
|
|
|
let theArr = [];
|
|
|
if(!thedata) {
|
|
|
if(data.error && data.error.length) {
|
|
@@ -133,9 +127,6 @@ const PersonalReport = React.createClass({
|
|
|
thedata = {};
|
|
|
}
|
|
|
this.loadData(thedata,page)
|
|
|
- this.setState({
|
|
|
- totals:thedata[0]
|
|
|
- })
|
|
|
}.bind(this),
|
|
|
}).always(function() {
|
|
|
this.setState({
|
|
@@ -190,6 +181,7 @@ const PersonalReport = React.createClass({
|
|
|
loading: false,
|
|
|
visible: false,
|
|
|
showDesc: false,
|
|
|
+ timeState:false,
|
|
|
pagination: {
|
|
|
defaultCurrent: 1,
|
|
|
defaultPageSize: 10,
|
|
@@ -216,7 +208,7 @@ const PersonalReport = React.createClass({
|
|
|
return {
|
|
|
children: text,
|
|
|
props: {
|
|
|
- colSpan:0
|
|
|
+ colSpan:1
|
|
|
},
|
|
|
}
|
|
|
|
|
@@ -237,7 +229,7 @@ const PersonalReport = React.createClass({
|
|
|
return {
|
|
|
children: text,
|
|
|
props: {
|
|
|
- colSpan:5
|
|
|
+ colSpan:0
|
|
|
},
|
|
|
}
|
|
|
|
|
@@ -248,6 +240,7 @@ const PersonalReport = React.createClass({
|
|
|
title: '部门',
|
|
|
dataIndex: 'departmentName',
|
|
|
width:100,
|
|
|
+ fixed:true,
|
|
|
key: 'departmentName',
|
|
|
render:(text,record)=>{
|
|
|
if(!record.theNumber){
|
|
@@ -256,7 +249,7 @@ const PersonalReport = React.createClass({
|
|
|
return {
|
|
|
children: text,
|
|
|
props: {
|
|
|
- colSpan:0
|
|
|
+ colSpan:4
|
|
|
},
|
|
|
}
|
|
|
|
|
@@ -268,6 +261,7 @@ const PersonalReport = React.createClass({
|
|
|
title: '职务',
|
|
|
dataIndex: 'position',
|
|
|
key: 'position',
|
|
|
+ fixed:true,
|
|
|
width:100,
|
|
|
render:(text,record)=>{
|
|
|
if(!record.theNumber){
|
|
@@ -286,6 +280,7 @@ const PersonalReport = React.createClass({
|
|
|
},{
|
|
|
title: '入职时间',
|
|
|
width:100,
|
|
|
+ fixed:true,
|
|
|
dataIndex: 'enrollTime',
|
|
|
key: 'enrollTime',
|
|
|
render:(text,record)=>{
|
|
@@ -464,8 +459,18 @@ const PersonalReport = React.createClass({
|
|
|
this.state.departmentSearch = undefined;
|
|
|
this.state.postSearch = undefined;
|
|
|
this.state.uesrNameSearch = '';
|
|
|
- this.totalData()
|
|
|
+ this.state.Dtime = undefined;
|
|
|
+ this.state.selTime='';
|
|
|
+ this.state.timeState=false;
|
|
|
+ this.totalData();
|
|
|
},
|
|
|
+ //时间选择
|
|
|
+ selTime(value,index){
|
|
|
+ this.setState({
|
|
|
+ Dtime:value,
|
|
|
+ selTime:index
|
|
|
+ })
|
|
|
+ },
|
|
|
componentWillMount() {
|
|
|
this.departmentList();
|
|
|
this.totalData();
|
|
@@ -479,7 +484,7 @@ const PersonalReport = React.createClass({
|
|
|
let departmentArr = this.state.departmentArr || [];
|
|
|
return(
|
|
|
<div className='set-content'>
|
|
|
- <span style={{fontSize:'16px'}}>个人业绩统计报表</span>
|
|
|
+ <span style={{fontSize:'20px'}}>个人业绩统计报表</span>
|
|
|
<div className="clearfix">
|
|
|
<Select placeholder="部门机构"
|
|
|
style={{ width: 150 ,marginRight:'10px',marginTop:'10px',marginBottom:'10px'}}
|
|
@@ -487,27 +492,19 @@ const PersonalReport = React.createClass({
|
|
|
onChange={(e) => { this.setState({ departmentSearch: e }) }}>
|
|
|
{
|
|
|
departmentArr.map(function (item) {
|
|
|
- return <Select.Option key={item.id} >{item.name}</Select.Option>
|
|
|
+ return <Select.Option key={item.name} >{item.name}</Select.Option>
|
|
|
})
|
|
|
}
|
|
|
</Select>
|
|
|
- <Input value={this.state.uesrNameSearch} placeholder="用户姓名" style={{width:'150px'}}
|
|
|
+ <Input value={this.state.uesrNameSearch} placeholder="用户姓名" style={{width:'150px',marginRight:'5px'}}
|
|
|
onChange={(e)=>{this.setState({uesrNameSearch:e.target.value})}} />
|
|
|
- <Select placeholder="职务"
|
|
|
- style={{ width: 150 ,marginRight:'10px',marginLeft:'10px'}}
|
|
|
- value={this.state.postSearch}
|
|
|
- onChange={(e) => { this.setState({ postSearch: e }) }}>
|
|
|
- {
|
|
|
- post.map(function (item) {
|
|
|
- return <Select.Option key={item.value} >{item.key}</Select.Option>
|
|
|
- })
|
|
|
- }
|
|
|
- </Select>
|
|
|
+ <span style={{fontSize:'16px'}}>选择日期 : </span>
|
|
|
+ <DatePicker onChange={this.selTime} value={this.state.Dtime}/>
|
|
|
<Button type="primary" onClick={this.search} style={{marginLeft:'10px',marginRight:'10px'}}>搜索</Button>
|
|
|
<Button onClick={this.reset}>重置</Button>
|
|
|
</div>
|
|
|
<div className="surfaceTitle">
|
|
|
- <span className="nowtime">{this.state.Nowtime}</span>
|
|
|
+ <span className="nowtime">{this.state.timeState?this.state.txtTime:this.state.Nowtime}</span>
|
|
|
<span>个人营销业绩统计表</span>
|
|
|
</div>
|
|
|
<div className="patent-table">
|