Browse Source

添加 统计概览> 即将逾期

sophieChenyx 6 years ago
parent
commit
971e3882e2

+ 4 - 0
src/common/router.js

@@ -404,6 +404,10 @@ export const getRouterData = (app) => {
     '/dashboard/accounts/terminals': {
       component: dynamicWrapper(app, ['accounts'], () => import('../routes/Dashboard/Accounts/AccountsTerminals')),
     },
+    // 即将逾期
+    '/dashboard/accounts/overdue': {
+      component: dynamicWrapper(app, ['accounts'], () => import('../routes/Dashboard/Accounts/AccountsOverdue')),
+    },
     // 异常相关路由注册
     '/exception/403': {
       component: dynamicWrapper(app, [], () => import('../routes/Exception/403')),

+ 1 - 9
src/components/AXList/StandardTableList.js

@@ -68,7 +68,7 @@ export default class StandardTableList extends PureComponent {
   getListHeader = () => {
     const {
       showStatusSelect,
-      header: { basicSearch, onAdvanceFilterClick, onCreateClick, onDownload, onOverdue, campusAmount },
+      header: { basicSearch, onAdvanceFilterClick, onCreateClick, onDownload, campusAmount },
       footer: { pagination },
     } = this.props;
     const { keys } = basicSearch;
@@ -137,14 +137,6 @@ export default class StandardTableList extends PureComponent {
                 >新建
                 </Button>
               )}
-              {onOverdue !== undefined && (
-                <Button
-                  type="primary"
-                  style={{ marginLeft: 5 }}
-                  onClick={onOverdue}
-                >近30天逾期
-                </Button>
-              )}
               {onDownload !== undefined && (
                 <Button
                   icon="download"

+ 1 - 7
src/routes/Dashboard/Accounts/AccountsCampus.js

@@ -1,10 +1,9 @@
 import React, { Component } from 'react';
 import moment from 'moment';
 import { connect } from 'dva';
-import { Card,message } from 'antd';
+import { Card } from 'antd';
 import { StandardTableList } from '../../../components/AXList';
 import { addRowKey } from '../../../utils/utils';
-const Message = message;
 
 @connect(({ loading, accounts }) => ({
   accounts,
@@ -20,7 +19,6 @@ export default class CampusAccountsPage extends Component {
       Queryers: (state || {}).Queryers, // 查询的条件参数
     };
   }
-
   componentWillMount() {
     this.props.dispatch({
       type: 'accounts/fetchCampusList',
@@ -28,7 +26,6 @@ export default class CampusAccountsPage extends Component {
     })
   }
   handleDownloadOperation = () => {
-    console.log('>>>>>press AccountsCampus download')
     this.props.dispatch({
       type: 'accounts/fetchCampusExcel'
     })
@@ -57,14 +54,11 @@ export default class CampusAccountsPage extends Component {
         field: 'name',
       }],
     };
-
-
     const pagination = {
       pageNo,
       pageSize,
       totalSize,
     };
-
     const columns = [{
       title: '校区编号',
       key: 1,

+ 148 - 0
src/routes/Dashboard/Accounts/AccountsOverdue.js

@@ -0,0 +1,148 @@
+import React, { Component } from 'react';
+import moment from 'moment';
+import { connect } from 'dva';
+import { Card, Badge } from 'antd';
+import { StandardTableList } from '../../../components/AXList';
+import { addRowKey } from '../../../utils/utils';
+import styles from './AccountsTerminals.less';
+
+@connect(({ loading, accounts }) => ({
+  accounts,
+  loading: loading.models.accounts,
+}))
+
+export default class OverdueAccountsPage extends Component {
+  constructor(props) {
+    super(props);
+    const { state } = props.location;
+    this.state = {
+      UIParams: (state || {}).UIParams, // 组件的状态参数
+      Queryers: (state || {}).Queryers, // 查询的条件参数
+    };
+  }
+  componentWillMount() {
+    this.props.dispatch({
+        type: 'accounts/fetchTerminalsList',
+        payload: {
+          fastExpired: 1,
+          ...this.state.Queryers,
+        }
+    })
+  }
+  // 下载
+  handleDownloadOperation = () => {
+    this.props.dispatch({
+      type: 'accounts/fetchTerminalsExcel',
+      payload: {
+        fastExpired: 1
+      }
+    })
+  };
+
+  handleFilterOperation = (params, states) => {
+    this.setState({
+      UIParams: states,
+      Queryers: params,
+    });
+    this.props.dispatch({
+        type: 'accounts/fetchTerminalsList',
+        payload: {
+          fastExpired: 1,
+          ...params,
+        },
+    });
+  };
+  render() {
+    const { loading,accounts } = this.props;
+    const { list, totalSize, pageSize, pageNo } = accounts;
+    const basicSearch = {
+      keys: [{
+        name: '终端编号',
+        field: 'code',
+      }],
+    };
+    const pagination = {
+      pageNo,
+      pageSize,
+      totalSize,
+    };
+    const columns = [{
+      title: '终端编号',
+      key: 1,
+      dataIndex: 'ucode',
+      width: '15%',
+    }, {
+      title: '课程包编号',
+      key: 2,
+      dataIndex: 'pcode',
+      width: '10%',
+    }, {
+      title: '课程包名称',
+      key: 3,
+      dataIndex: 'pname',
+      width: '15%',
+    }, {
+      title: '权限有效期',
+      key: 4,
+      render: (_, record) => {
+        const { startTimeStr, endTimeStr } = record;
+        return (
+          <div className={styles.authDesc}>
+            <p><span>起始时间:&nbsp;&nbsp;</span>{`${startTimeStr}`}</p>
+            <p><span>到期时间:&nbsp;&nbsp;</span>{`${endTimeStr}`}</p>
+          </div>
+        );
+      },
+      dataIndex: 'cityName',
+      width: '15%',
+      align: 'center',
+    }, {
+      title: '权限有效时长',
+      key: 5,
+      dataIndex: 'endTime',
+      render: (text) => {
+        const day = moment(text).diff(moment(), 'days');
+        if (day < 0) {
+          return <Badge status="error" text="已到期" />;
+        }
+        return <span><span style={{ color: '#52c41a', fontWeight: 'bold' }}>{day}</span>天到期</span>;
+      },
+      width: '10%',
+    }, {
+      title: '校区名称',
+      key: 6,
+      dataIndex: 'campusName',
+      width: '16%',
+    }, {
+      title: '联系电话',
+      key: 7,
+      dataIndex: 'campusContactWay',
+      width: '12%',
+    }, {
+      title: '联系人',
+      key: 8,
+      dataIndex: 'campusContactName',
+      width: '6%',
+    }];
+    
+    return (
+      <Card>
+        <StandardTableList
+          columns={columns}
+          loading={loading}
+          dataSource={addRowKey(list)}
+          header={{
+            basicSearch,
+            onFilterClick: this.handleFilterOperation,
+            onDownload: this.handleDownloadOperation,
+          }}
+          footer={{
+            pagination,
+          }}
+          keepUIState={{ ...this.state.UIParams }}
+          showStatusSelect={false}
+        />
+      </Card>
+    );
+  }
+}

+ 4 - 17
src/routes/Dashboard/Accounts/AccountsTerminals.js

@@ -1,11 +1,11 @@
 import React, { Component } from 'react';
 import moment from 'moment';
 import { connect } from 'dva';
-import { Card, message, Badge } from 'antd';
+import { Card, Badge } from 'antd';
 import { StandardTableList } from '../../../components/AXList';
 import { addRowKey } from '../../../utils/utils';
 import styles from './AccountsTerminals.less';
-const Message = message;
+
 
 @connect(({ loading, accounts }) => ({
   accounts,
@@ -21,20 +21,19 @@ export default class TerminalsAccountsPage extends Component {
       Queryers: (state || {}).Queryers, // 查询的条件参数
     };
   }
-
   componentWillMount() {
-    console.log('TerminalsAccountsPage');
-
     this.props.dispatch({
       type: 'accounts/fetchTerminalsList',
       payload: { ...this.state.Queryers }
     })
   }
+  // 下载
   handleDownloadOperation = () => {
     this.props.dispatch({
       type: 'accounts/fetchTerminalsExcel'
     })
   };
+
   handleFilterOperation = (params, states) => {
     this.setState({
       UIParams: states,
@@ -47,15 +46,6 @@ export default class TerminalsAccountsPage extends Component {
       },
     });
   };
-  // 显示最近30天的数据
-  handleOverdueOperation = () => {
-    this.props.dispatch({
-      type: 'accounts/fetchTerminalsList',
-      payload: {
-        fastExpired: 1,
-      }
-    })
-  };
   render() {
     const { loading,accounts } = this.props;
     const { list, totalSize, pageSize, pageNo } = accounts;
@@ -66,8 +56,6 @@ export default class TerminalsAccountsPage extends Component {
         field: 'code',
       }],
     };
-
-
     const pagination = {
       pageNo,
       pageSize,
@@ -142,7 +130,6 @@ export default class TerminalsAccountsPage extends Component {
           header={{
             basicSearch,
             onFilterClick: this.handleFilterOperation,
-            onOverdue: this.handleOverdueOperation,
             onDownload: this.handleDownloadOperation,
           }}
           footer={{

+ 4 - 10
src/routes/Dashboard/Accounts/AccountsTotalList.js

@@ -1,8 +1,7 @@
 
 import React, { Component } from 'react';
-import moment from 'moment';
 import { connect } from 'dva';
-import { Card, message, Badge } from 'antd';
+import { Card } from 'antd';
 import { StandardTableList } from '../../../components/AXList';
 import { addRowKey, renderStatus } from '../../../utils/utils';
 
@@ -22,18 +21,15 @@ export default class TotalListAccountsPage extends Component {
   }
 
   componentWillMount() {
-    //  获取总的学校得数量
     this.props.dispatch({
       type: 'accounts/fetchCampusAmount',
       payload: {}
     })
-    // 获取总表数据
     this.props.dispatch({
       type: 'accounts/fetchTotalList',
       payload: { ...this.state.Queryers }
     })
   }
-  
   handleFilterOperation = (params, states) => {
     this.setState({
       UIParams: states,
@@ -50,21 +46,20 @@ export default class TotalListAccountsPage extends Component {
   render() {
     const { loading,accounts } = this.props;
     const { list, totalSize, pageSize, pageNo,  campusAmount} = accounts;
-
     const basicSearch = {
       keys: [{
+        name: '校区名称',
+        field: 'campusName',
+      }, {
         name: '终端编号',
         field: 'code',
       }],
     };
-
-
     const pagination = {
       pageNo,
       pageSize,
       totalSize,
     };
-
     const columns = [{
       title: '校区类型',
       key: 1,
@@ -92,7 +87,6 @@ export default class TotalListAccountsPage extends Component {
       render: text => renderStatus(text),
       width: '15%',
     }];
-
     return (
       <Card>
         <StandardTableList

+ 8 - 4
src/routes/Dashboard/Accounts/index.js

@@ -3,10 +3,7 @@ import { Redirect, Route, Switch, routerRedux } from 'dva/router';
 import { connect } from 'dva';
 import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
 import { getRoutes } from '../../../utils/utils';
-
-// tab首页
 @connect()
-
 export default class AccountsPage extends Component {
   handleTabChange = (key) => {
     const { dispatch, match } = this.props;
@@ -19,6 +16,10 @@ export default class AccountsPage extends Component {
       case 'terminals':
         dispatch(routerRedux.push(`${match.url}/terminals`));
         break;
+      // 即将逾期
+      case 'overdue':
+        dispatch(routerRedux.push(`${match.url}/overdue`));
+        break;
       // 总统计表
       case 'totalList':
         dispatch(routerRedux.push(`${match.url}/totalList`));
@@ -27,7 +28,6 @@ export default class AccountsPage extends Component {
         break;
     }
   };
-
   render() {
     const tabList = [
       {
@@ -39,6 +39,10 @@ export default class AccountsPage extends Component {
         tab: '终端课程包',
       },
       {
+        key: 'overdue',
+        tab: '即将逾期',
+      },
+      {
         key: 'totalList',
         tab: '总统计表',
       },