Browse Source

运营管理判断

dev01 2 years ago
parent
commit
76d05406e0

+ 10 - 3
js/component/manageCenter/customer/publicSummary/index.jsx

@@ -221,7 +221,9 @@ class PublicSummary extends Component {
           key: "auditInfo",
           width: 200,
           render: (text) => {
-            return <div style={{ wordBreak: "break-all" }}>{text}</div>;
+            return <div style={{ wordBreak: "break-all" }}>
+              {text}
+            </div>;
           },
         },
         {
@@ -320,7 +322,7 @@ class PublicSummary extends Component {
       },
       dataSource: [],
       logData: [],
-      releaseDate: [],
+      releaseDate: [moment(Date.now() - 777600000).format('YYYY-MM-DD'), moment(Date.now()).format('YYYY-MM-DD')],
       status: undefined,
       clockIn: undefined,
       deps: undefined,
@@ -464,7 +466,7 @@ class PublicSummary extends Component {
   resetAll() {
     this.setState(
       {
-        releaseDate: [],
+        releaseDate: [moment(Date.now() - 777600000).format('YYYY-MM-DD'), moment(Date.now()).format('YYYY-MM-DD')],
         theCustomerTypes: undefined,
         status: undefined,
         clockIn: undefined,
@@ -896,6 +898,11 @@ class PublicSummary extends Component {
                     公出时间 :
                   </span>
                   <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;
+                    }}
                     style={{ marginRight: "10px", marginBottom: "10px" }}
                     value={[
                       this.state.releaseDate[0]

+ 91 - 68
js/component/manageCenter/customer/statistics/departmentStatistics/customerDetails.jsx

@@ -1,13 +1,13 @@
-import React,{Component} from 'react';
-import {message, Modal, Spin, Table, Tooltip,Tag} from "antd";
+import React, { Component } from 'react';
+import { message, Modal, Spin, Table, Tooltip, Tag } from "antd";
 import PropTypes from 'prop-types';
 import $ from "jquery/src/ajax";
 
-class CustomerDetails extends Component{
+class CustomerDetails extends Component {
     constructor(props) {
         super(props);
-        this.state={
-            loading:false,
+        this.state = {
+            loading: false,
             columns: [{
                 title: '客户名称',
                 dataIndex: 'name',
@@ -16,22 +16,22 @@ class CustomerDetails extends Component{
                 title: '来源',
                 dataIndex: 'sourceName',
                 key: 'sourceName',
-                width:75,
+                width: 75,
             }, {
                 title: '联系人(部门/职务)',
                 dataIndex: 'contacts',
                 key: 'contacts',
-                width:155,
-                render:(text,record)=>{
-                    if(!text){return ''}
-                    let str = text+'('+(record.contactsDep ? record.contactsDep : ' ')+'/'+ (record.contactsPosition ? record.contactsPosition : ' ')+')';
+                width: 155,
+                render: (text, record) => {
+                    if (!text) { return '' }
+                    let str = text + '(' + (record.contactsDep ? record.contactsDep : ' ') + '/' + (record.contactsPosition ? record.contactsPosition : ' ') + ')';
                     return (
                         <Tooltip title={str}>
                             <div style={{
-                                maxWidth:'155px',
-                                overflow:'hidden',
+                                maxWidth: '155px',
+                                overflow: 'hidden',
                                 textOverflow: "ellipsis",
-                                whiteSpace:'nowrap',
+                                whiteSpace: 'nowrap',
                             }}>{str}</div>
                         </Tooltip>
                     )
@@ -44,25 +44,25 @@ class CustomerDetails extends Component{
                 title: '创建时间',
                 dataIndex: 'createTime',
                 key: 'createTime',
-                width:145,
+                width: 145,
             }, {
                 title: '跟进时间',
                 dataIndex: 'followTime',
                 key: 'followTime',
-                width:145,
-            },{
+                width: 145,
+            }, {
                 title: '企业主营',
                 dataIndex: 'businessScope',
                 key: 'businessScope',
-                width:200,
-                render:(text)=>{
+                width: 200,
+                render: (text) => {
                     return (
                         <Tooltip title={text}>
                             <div style={{
-                                maxWidth:'200px',
-                                overflow:'hidden',
+                                maxWidth: '200px',
+                                overflow: 'hidden',
                                 textOverflow: "ellipsis",
-                                whiteSpace:'nowrap',
+                                whiteSpace: 'nowrap',
                             }}>{text}</div>
                         </Tooltip>
                     )
@@ -71,15 +71,15 @@ class CustomerDetails extends Component{
                 title: '意向合作',
                 dataIndex: 'intendedProject',
                 key: 'intendedProject',
-                width:200,
-                render:(text)=>{
+                width: 200,
+                render: (text) => {
                     return (
                         <Tooltip title={text}>
                             <div style={{
-                                maxWidth:'200px',
-                                overflow:'hidden',
+                                maxWidth: '200px',
+                                overflow: 'hidden',
                                 textOverflow: "ellipsis",
-                                whiteSpace:'nowrap',
+                                whiteSpace: 'nowrap',
                             }}>{text}</div>
                         </Tooltip>
                     )
@@ -90,15 +90,16 @@ class CustomerDetails extends Component{
                 defaultPageSize: 10,
                 showQuickJumper: true,
                 pageSize: 10,
-                onChange: function(page) {
+                onChange: function (page) {
                     this.loadData(page);
                 }.bind(this),
-                showTotal: function(total) {
+                showTotal: function (total) {
                     return '共' + total + '条数据';
                 }
             }
         }
         this.loadData = this.loadData.bind(this);
+        this.isView = this.isView.bind(this);
     }
 
     componentDidMount() {
@@ -107,25 +108,25 @@ class CustomerDetails extends Component{
 
     loadData(pageNo) {
         this.setState({
-            loading:true
+            loading: true
         })
         $.ajax({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context +"/api/admin/customer/selectAdminCustomerList",
+            url: globalConfig.context + "/api/admin/customer/selectAdminCustomerList",
             data: {
-                pageNo:pageNo || 1,
-                pageSize:this.state.pagination.pageSize,
-                aid:this.props.aid,
-                type:this.props.type,                       //0 所有 1新增 2领取 3已签 4面谈
-                startTime:this.props.startTime,
-                endTime:this.props.endTime,
+                pageNo: pageNo || 1,
+                pageSize: this.state.pagination.pageSize,
+                aid: this.props.aid,
+                type: this.props.type,                       //0 所有 1新增 2领取 3已签 4面谈
+                startTime: this.props.startTime,
+                endTime: this.props.endTime,
             },
-            success: function(data) {
+            success: function (data) {
                 let theArr = [];
-                if(data.error.length || data.data.list == "") {
-                    if(data.error && data.error.length) {
+                if (data.error.length || data.data.list == "") {
+                    if (data.error && data.error.length) {
                         message.warning(data.error[0].message);
                     };
                 } else {
@@ -137,7 +138,7 @@ class CustomerDetails extends Component{
                     this.state.pagination.current = pageNo;
                     this.state.pagination.total = data.data.totalCount;
                 };
-                if(!data.data.list.length) {
+                if (!data.data.list.length) {
                     this.state.pagination.current = 0
                     this.state.pagination.total = 0
                 }
@@ -146,12 +147,27 @@ class CustomerDetails extends Component{
                     pagination: this.state.pagination,
                 });
             }.bind(this),
-        }).always(function() {
+        }).always(function () {
             this.setState({
                 loading: false
             });
         }.bind(this));
     }
+    // 判断是否有权限查看详情
+    isView() {
+        // 11=运营管理,12=总裁助理,13=总裁
+        let iskeep =
+            window.adminData.shiroList.indexOf("11") != -1 ||
+            window.adminData.shiroList.indexOf("12") != -1 ||
+            window.adminData.shiroList.indexOf("13") != -1
+        // 
+        let isName = this.props.aName.indexOf("曹津") != -1
+        if (iskeep && isName) {
+            return false
+        } else {
+            return true
+        }
+    }
 
     render() {
         return (
@@ -164,26 +180,26 @@ class CustomerDetails extends Component{
                     width='1300px'
                     title={
                         <span>
-                            <span style={{marginRight:'15px'}}>客户详情</span>
+                            <span style={{ marginRight: '15px' }}>客户详情</span>
                             <Tag color="#f50">{this.props.aName}</Tag>
                             <Tag color="#108ee9">
                                 {
-                                    this.props.type === 0?
-                                        '私有客户':
-                                        this.props.type === 1?
-                                            '外联客户':
-                                            this.props.type === 2?
-                                                '签单客户':
-                                                this.props.type === 3?
-                                                    '私有新增客户':
-                                                    this.props.type === 4?
-                                                        '外联新增客户':
-                                                        this.props.type === 5?
-                                                            '私有面谈客户':
-                                                            this.props.type === 6?
-                                                                '外联面谈客户':
-                                                                this.props.type === 7?
-                                                                    '私有领取客户': ''
+                                    this.props.type === 0 ?
+                                        '私有客户' :
+                                        this.props.type === 1 ?
+                                            '外联客户' :
+                                            this.props.type === 2 ?
+                                                '签单客户' :
+                                                this.props.type === 3 ?
+                                                    '私有新增客户' :
+                                                    this.props.type === 4 ?
+                                                        '外联新增客户' :
+                                                        this.props.type === 5 ?
+                                                            '私有面谈客户' :
+                                                            this.props.type === 6 ?
+                                                                '外联面谈客户' :
+                                                                this.props.type === 7 ?
+                                                                    '私有领取客户' : ''
                                 }
                             </Tag>
                         </span>
@@ -192,11 +208,18 @@ class CustomerDetails extends Component{
                     className="admin-desc-content">
                     <div className="patent-table">
                         <Spin spinning={this.state.loading}>
-                            <Table
-                                columns={this.state.columns}
-                                dataSource={this.state.dataSource}
-                                pagination={this.state.pagination}
-                            />
+                            {
+                                this.isView()
+                                    ? <Table
+                                        columns={this.state.columns}
+                                        dataSource={this.state.dataSource}
+                                        pagination={this.state.pagination}
+                                    />
+                                    : <div style={{ padding: "40px 0", textAlign: "center", color: "red", fontSize: "20px" }}>
+                                        暂无权限查看
+                                    </div>
+
+                            }
                         </Spin>
                     </div>
                 </Modal>
@@ -205,18 +228,18 @@ class CustomerDetails extends Component{
     }
 }
 
-CustomerDetails.propTypes={
+CustomerDetails.propTypes = {
     visible: PropTypes.bool,
     onCancel: PropTypes.func,
     aid: PropTypes.number,      //员工ID
     type: PropTypes.number,     //列表类型 客户总数 成交客户总数 新增客户数等等
-    startTime:PropTypes.string, //开始时间
-    endTime:PropTypes.string,   //结束时间
+    startTime: PropTypes.string, //开始时间
+    endTime: PropTypes.string,   //结束时间
 }
 
-CustomerDetails.defaultProps={
+CustomerDetails.defaultProps = {
     visible: false,
-    onCancel: ()=>{}
+    onCancel: () => { }
 }
 
 export default CustomerDetails;

+ 64 - 61
js/component/manageCenter/customer/statistics/departmentStatistics/index.jsx

@@ -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>
         )
     }

+ 1 - 1
webpack-dll.config.js

@@ -10,7 +10,7 @@ let theme = {
   '@link-color': '#58a3ff'
 };
 module.exports = (function () {
-  let staticHost = 'http://172.16.1.187';
+  let staticHost = 'http://172.16.1.214';
   switch (argv.env.deploy) {
     case 'test':
       staticHost = '//static.jishutao.com';

+ 2 - 2
webpack.config.js

@@ -345,7 +345,7 @@ module.exports = (function () {
     }
 
     //let staticHost = 'http://afts.hnzhiming.com';
-    let staticHost = 'http://172.16.1.187:80'
+    let staticHost = 'http://172.16.1.214:80'
     // let staticHost = "http://192.168.0.106";
     // let staticHost = "http://192.168.0.103";
     switch (argv.env.deploy) {
@@ -389,7 +389,7 @@ module.exports = (function () {
         // }
         devServer: {
             disableHostCheck: true,
-            host: '172.16.1.187',
+            host: '172.16.1.214',
             port: 80,
             allowedHosts: ['127.0.0.1', '192.168.0.20', '192.168.0.99'],
             headers: {