|
@@ -1,4 +1,4 @@
|
|
|
-import React,{Component} from 'react';
|
|
|
+import React, { Component } from 'react';
|
|
|
import {
|
|
|
Button, DatePicker,
|
|
|
Input,
|
|
@@ -11,19 +11,18 @@ import './index.less';
|
|
|
import $ from "jquery/src/ajax";
|
|
|
import CustomerDetails from './customerDetails';
|
|
|
import moment from "moment";
|
|
|
-import {ChooseList} from "../../../order/orderNew/chooseList";
|
|
|
+import { ChooseList } from "../../../order/orderNew/chooseList";
|
|
|
|
|
|
const { RangePicker } = DatePicker;
|
|
|
const { TabPane } = Tabs;
|
|
|
|
|
|
-class DepartmentStatistics extends Component{
|
|
|
+class DepartmentStatistics extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
- this.state={
|
|
|
- superId:undefined,
|
|
|
+ this.state = {
|
|
|
+ superId: undefined,
|
|
|
nameSearch: '',
|
|
|
- releaseDate: [],
|
|
|
-
|
|
|
+ releaseDate: [moment(Date.now() - 777600000).format('YYYY-MM-DD'), moment(Date.now()).format('YYYY-MM-DD')],
|
|
|
columns: [
|
|
|
{
|
|
|
title: "部门",
|
|
@@ -41,8 +40,8 @@ class DepartmentStatistics extends Component{
|
|
|
return (
|
|
|
<div
|
|
|
className={record.aid ? 'receiveCount' : ''}
|
|
|
- onClick={(e)=>{
|
|
|
- if(record.aid){
|
|
|
+ onClick={(e) => {
|
|
|
+ if (record.aid) {
|
|
|
e.stopPropagation();
|
|
|
this.setState({
|
|
|
customerVisible: true,
|
|
@@ -67,8 +66,8 @@ class DepartmentStatistics extends Component{
|
|
|
return (
|
|
|
<div
|
|
|
className={record.aid ? 'receiveCount' : ''}
|
|
|
- onClick={(e)=>{
|
|
|
- if(record.aid){
|
|
|
+ onClick={(e) => {
|
|
|
+ if (record.aid) {
|
|
|
e.stopPropagation();
|
|
|
this.setState({
|
|
|
customerVisible: true,
|
|
@@ -93,8 +92,8 @@ class DepartmentStatistics extends Component{
|
|
|
return (
|
|
|
<div
|
|
|
className={record.aid ? 'receiveCount' : ''}
|
|
|
- onClick={(e)=>{
|
|
|
- if(record.aid){
|
|
|
+ onClick={(e) => {
|
|
|
+ if (record.aid) {
|
|
|
e.stopPropagation();
|
|
|
this.setState({
|
|
|
customerVisible: true,
|
|
@@ -119,8 +118,8 @@ class DepartmentStatistics extends Component{
|
|
|
return (
|
|
|
<div
|
|
|
className={record.aid ? 'receiveCount' : ''}
|
|
|
- onClick={(e)=>{
|
|
|
- if(record.aid){
|
|
|
+ onClick={(e) => {
|
|
|
+ if (record.aid) {
|
|
|
e.stopPropagation();
|
|
|
this.setState({
|
|
|
customerVisible: true,
|
|
@@ -145,8 +144,8 @@ class DepartmentStatistics extends Component{
|
|
|
return (
|
|
|
<div
|
|
|
className={record.aid ? 'receiveCount' : ''}
|
|
|
- onClick={(e)=>{
|
|
|
- if(record.aid){
|
|
|
+ onClick={(e) => {
|
|
|
+ if (record.aid) {
|
|
|
e.stopPropagation();
|
|
|
this.setState({
|
|
|
customerVisible: true,
|
|
@@ -171,8 +170,8 @@ class DepartmentStatistics extends Component{
|
|
|
return (
|
|
|
<div
|
|
|
className={record.aid ? 'receiveCount' : ''}
|
|
|
- onClick={(e)=>{
|
|
|
- if(record.aid){
|
|
|
+ onClick={(e) => {
|
|
|
+ if (record.aid) {
|
|
|
e.stopPropagation();
|
|
|
this.setState({
|
|
|
customerVisible: true,
|
|
@@ -197,8 +196,8 @@ class DepartmentStatistics extends Component{
|
|
|
return (
|
|
|
<div
|
|
|
className={record.aid ? 'receiveCount' : ''}
|
|
|
- onClick={(e)=>{
|
|
|
- if(record.aid){
|
|
|
+ onClick={(e) => {
|
|
|
+ if (record.aid) {
|
|
|
e.stopPropagation();
|
|
|
this.setState({
|
|
|
customerVisible: true,
|
|
@@ -223,8 +222,8 @@ class DepartmentStatistics extends Component{
|
|
|
return (
|
|
|
<div
|
|
|
className={record.aid ? 'receiveCount' : ''}
|
|
|
- onClick={(e)=>{
|
|
|
- if(record.aid){
|
|
|
+ onClick={(e) => {
|
|
|
+ if (record.aid) {
|
|
|
e.stopPropagation();
|
|
|
this.setState({
|
|
|
customerVisible: true,
|
|
@@ -240,13 +239,12 @@ class DepartmentStatistics extends Component{
|
|
|
},
|
|
|
},
|
|
|
],
|
|
|
- contactsOption:null,
|
|
|
+ contactsOption: null,
|
|
|
loading: false,
|
|
|
ispage: 1,
|
|
|
-
|
|
|
- aid:'',
|
|
|
- type:'',
|
|
|
- visible:false,
|
|
|
+ aid: '',
|
|
|
+ type: '',
|
|
|
+ visible: false,
|
|
|
};
|
|
|
this.loadData = this.loadData.bind(this);
|
|
|
this.reset = this.reset.bind(this);
|
|
@@ -259,7 +257,7 @@ class DepartmentStatistics extends Component{
|
|
|
}
|
|
|
|
|
|
loadData() {
|
|
|
- if(!this.state.superId){
|
|
|
+ if (!this.state.superId) {
|
|
|
message.warning('请选择部门后再搜索')
|
|
|
return;
|
|
|
}
|
|
@@ -268,16 +266,16 @@ class DepartmentStatistics extends Component{
|
|
|
});
|
|
|
let api = '/api/admin/customer/selectAllUser';
|
|
|
let data = {};
|
|
|
- if(this.state.superId){
|
|
|
+ if (this.state.superId) {
|
|
|
data.depId = this.state.superId;
|
|
|
}
|
|
|
- if(this.state.nameSearch){
|
|
|
+ if (this.state.nameSearch) {
|
|
|
data.aName = this.state.nameSearch;
|
|
|
}
|
|
|
- if(this.state.releaseDate[0]){
|
|
|
+ if (this.state.releaseDate[0]) {
|
|
|
data.startTime = this.state.releaseDate[0]
|
|
|
}
|
|
|
- if(this.state.releaseDate[1]){
|
|
|
+ if (this.state.releaseDate[1]) {
|
|
|
data.endTime = this.state.releaseDate[1]
|
|
|
}
|
|
|
$.ajax({
|
|
@@ -313,19 +311,19 @@ class DepartmentStatistics extends Component{
|
|
|
};
|
|
|
|
|
|
//表格数据处理
|
|
|
- handleTabsInfor(infor){
|
|
|
- for(let i=0;i<infor.length;i++){
|
|
|
- if(!infor[i].key){
|
|
|
+ handleTabsInfor(infor) {
|
|
|
+ for (let i = 0; i < infor.length; i++) {
|
|
|
+ if (!infor[i].key) {
|
|
|
infor[i].key = infor[i].id ? infor[i].id : (infor[i].aid ? infor[i].aid : i)
|
|
|
}
|
|
|
- if(infor[i].children){
|
|
|
- for(let c=0;c<infor[i].children.length;c++){
|
|
|
+ if (infor[i].children) {
|
|
|
+ for (let c = 0; c < infor[i].children.length; c++) {
|
|
|
infor[i].children[c].key = infor[i].children[c].id;
|
|
|
infor[i].children[c].children = infor[i].children[c].list;
|
|
|
- if(infor[i].children[c].aName){infor[i].children[c].name = infor[i].children[c].aName}
|
|
|
- if(infor[i].children[c].aList && Array.isArray(infor[i].children[c].aList) && infor[i].children[c].aList.length){
|
|
|
- if(infor[i].children[c].children && Array.isArray(infor[i].children[c].children)){
|
|
|
- for(let t of infor[i].children[c].aList){
|
|
|
+ if (infor[i].children[c].aName) { infor[i].children[c].name = infor[i].children[c].aName }
|
|
|
+ if (infor[i].children[c].aList && Array.isArray(infor[i].children[c].aList) && infor[i].children[c].aList.length) {
|
|
|
+ if (infor[i].children[c].children && Array.isArray(infor[i].children[c].children)) {
|
|
|
+ for (let t of infor[i].children[c].aList) {
|
|
|
t.key = t.aid;
|
|
|
t.name = t.aName;
|
|
|
}
|
|
@@ -339,11 +337,11 @@ class DepartmentStatistics extends Component{
|
|
|
return infor;
|
|
|
}
|
|
|
|
|
|
- reset(){
|
|
|
+ reset() {
|
|
|
this.setState({
|
|
|
nameSearch: '',
|
|
|
- releaseDate: [],
|
|
|
- },()=>{
|
|
|
+ releaseDate: [moment(Date.now() - 777600000).format('YYYY-MM-DD'), moment(Date.now()).format('YYYY-MM-DD')],
|
|
|
+ }, () => {
|
|
|
this.loadData();
|
|
|
});
|
|
|
};
|
|
@@ -356,36 +354,36 @@ class DepartmentStatistics extends Component{
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
url: globalConfig.context + "/api/admin/organization/selectSuperId",
|
|
|
- data:{},
|
|
|
+ data: {},
|
|
|
success: function (data) {
|
|
|
let theArr = [];
|
|
|
- let theId=[];//用于保存上级组织的ID和名称
|
|
|
- let thedata=data.data;
|
|
|
+ let theId = [];//用于保存上级组织的ID和名称
|
|
|
+ let thedata = data.data;
|
|
|
if (!thedata) {
|
|
|
if (data.error && data.error.length) {
|
|
|
message.warning(data.error[0].message);
|
|
|
};
|
|
|
thedata = {};
|
|
|
};
|
|
|
- for(var i=0;i<data.data.length;i++){
|
|
|
+ for (var i = 0; i < data.data.length; i++) {
|
|
|
let theData = data.data[i];
|
|
|
theArr.push(
|
|
|
<Select.Option value={theData.id} key={theData.id}>{theData.name}</Select.Option>
|
|
|
);
|
|
|
theId.push(
|
|
|
- [theData.id,theData.name]
|
|
|
+ [theData.id, theData.name]
|
|
|
);
|
|
|
};
|
|
|
this.setState({
|
|
|
- SuperArr:thedata,
|
|
|
+ SuperArr: thedata,
|
|
|
contactsOption: theArr,
|
|
|
theId: theId,
|
|
|
- orderStatusOptions:data.data,
|
|
|
+ orderStatusOptions: data.data,
|
|
|
});
|
|
|
- if(!this.state.superId){
|
|
|
+ if (!this.state.superId) {
|
|
|
this.setState({
|
|
|
- superId:data.data[0].id
|
|
|
- },()=>{
|
|
|
+ superId: data.data[0].id
|
|
|
+ }, () => {
|
|
|
this.loadData();
|
|
|
})
|
|
|
}
|
|
@@ -413,7 +411,7 @@ class DepartmentStatistics extends Component{
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- return(
|
|
|
+ return (
|
|
|
<div className="user-content">
|
|
|
<div className="content-title">
|
|
|
<span>部门统计</span>
|
|
@@ -422,11 +420,11 @@ class DepartmentStatistics extends Component{
|
|
|
defaultActiveKey="1"
|
|
|
className="test">
|
|
|
<TabPane tab="搜索" key="1">
|
|
|
- <div className="user-search" style={{display:'flex',alignItems:'center'}}>
|
|
|
+ <div className="user-search" style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
<div>
|
|
|
<Select
|
|
|
placeholder="请选择部门"
|
|
|
- style={{ width:200,marginLeft:10}}
|
|
|
+ style={{ width: 200, marginLeft: 10 }}
|
|
|
value={this.state.superId}
|
|
|
onChange={(e) => { this.setState({ superId: e }) }}
|
|
|
notFoundContent="未获取到上级组织列表">
|
|
@@ -445,6 +443,11 @@ class DepartmentStatistics extends Component{
|
|
|
marginTop: '10px',
|
|
|
}}>
|
|
|
<RangePicker
|
|
|
+ allowClear={window.adminData.shiroList.indexOf("11") == -1}
|
|
|
+ disabledDate={(current) => {//“运营管理”角色只能查看部分时间段(暂时10天)的数据
|
|
|
+ let iskeep = window.adminData.shiroList.indexOf("11") != -1
|
|
|
+ return iskeep && current && current.valueOf() < Date.now() - 864000000;
|
|
|
+ }}
|
|
|
value={[
|
|
|
this.state.releaseDate[0]
|
|
|
? moment(this.state.releaseDate[0])
|
|
@@ -461,7 +464,7 @@ class DepartmentStatistics extends Component{
|
|
|
<Button
|
|
|
type="primary"
|
|
|
style={{ marginLeft: "10px", marginRight: 10 }}
|
|
|
- onClick={()=>{
|
|
|
+ onClick={() => {
|
|
|
this.loadData();
|
|
|
}}
|
|
|
>
|
|
@@ -504,14 +507,14 @@ class DepartmentStatistics extends Component{
|
|
|
startTime={this.state.releaseDate[0]}
|
|
|
endTime={this.state.releaseDate[1]}
|
|
|
visible={this.state.customerVisible}
|
|
|
- onCancel={()=>{
|
|
|
+ onCancel={() => {
|
|
|
this.setState({
|
|
|
customerVisible: false,
|
|
|
aid: '',
|
|
|
type: '',
|
|
|
})
|
|
|
}}
|
|
|
- /> : <div/>}
|
|
|
+ /> : <div />}
|
|
|
</div>
|
|
|
)
|
|
|
}
|