Explorar el Código

增加&修改 总统计表&终端课程报

sophieChenyx hace 6 años
padre
commit
c09dfc9b09

+ 0 - 4
src/common/router.js

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

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

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

+ 31 - 2
src/models/accounts.js

@@ -3,6 +3,9 @@ import {
   downloadCampusExcel,
   queryTerminalsList,
   downloadTerminalsExcel,
+  queryCampusAmount,
+  queryTotalList,
+
 } from '../services/accounts';
 
 export default {
@@ -13,6 +16,7 @@ export default {
     pageNo: 1,
     pageSize: 15,
     totalSize: 0,
+    campusAmount: 0,
     currentItem: {},
   },
 
@@ -31,9 +35,8 @@ export default {
         });
       }
     },
-    // 下载功能的封装
     *fetchCampusExcel({ payload }, { call }) {
-      window.open('http://47.95.197.36:8500/stmt/campus/export');
+      //window.open('http://47.95.197.36:8500/stmt/campus/export');
       // yield call(downloadCampusExcel, payload);
     },
     *fetchTerminalsList({ payload }, { call, put }) {
@@ -54,6 +57,32 @@ export default {
     *fetchTerminalsExcel({ payload }, { call }) {
       yield call(downloadTerminalsExcel, payload);
     },
+    *fetchCampusAmount({ payload }, { call, put }) {
+      const response = yield call(queryCampusAmount, payload);
+      if (response.success) {
+        console.log('+++++++++++++++response',response)
+        yield put({
+          type: 'querySuccess',
+          payload: {
+            campusAmount: response.data,
+          },
+        });
+      }
+    },
+    *fetchTotalList({ payload }, { call, put }) {
+      const response = yield call(queryTotalList, payload);
+      if (response.success) {
+        yield put({
+          type: 'querySuccess',
+          payload: {
+            list: response.data.list || [],
+            pageSize: response.data.pageSize,
+            totalSize: response.data.totalSize,
+            pageNo: response.data.pageNo,
+          },
+        });
+      }
+    },
   },
 
   reducers: {

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

@@ -8,7 +8,7 @@ const Message = message;
 
 @connect(({ loading, accounts }) => ({
   accounts,
-  loading: loading.models.terminal,
+  loading: loading.models.accounts,
 }))
 
 export default class CampusAccountsPage extends Component {
@@ -45,24 +45,9 @@ export default class CampusAccountsPage extends Component {
       },
     });
   };
-
-  handleBatchOperation = () => {
-    Message.info('暂不支持批量操作!');
-  };
   render() {
     const { loading,accounts } = this.props;
     const { list, totalSize, pageSize, pageNo } = accounts;
-    const batchActions = [{
-      key: 'delete',
-      name: '批量禁用',
-    }, {
-      key: 'recovery',
-      name: '批量解禁',
-    }, {
-      key: 'unbound',
-      name: '批量解绑',
-    }];
-
     const basicSearch = {
       keys: [{
         name: '校区编号',
@@ -136,8 +121,6 @@ export default class CampusAccountsPage extends Component {
           }}
           footer={{
             pagination,
-            batchActions,
-            onBatchClick: this.handleBatchOperation,
           }}
           keepUIState={{ ...this.state.UIParams }}
           showStatusSelect={false}

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

@@ -1,21 +0,0 @@
-import React, { Component } from 'react';
-import moment from 'moment';
-import { Card, Modal, Button, message } from 'antd';
-const Message = message;
-
-export default class OverdueAccountsPage extends Component {
-  constructor(props) {
-    super(props);
-  }
-  componentDidMount() {
-    
-  }
-
-  render() {
-    return (
-      <Card>
-        OverdueAccountsPage
-      </Card>
-    );
-  }
-}

+ 25 - 27
src/routes/Dashboard/Accounts/AccountsTerminals.js

@@ -6,11 +6,10 @@ import { StandardTableList } from '../../../components/AXList';
 import { addRowKey } from '../../../utils/utils';
 import styles from './AccountsTerminals.less';
 const Message = message;
-const timestamp2Str = ts => moment(ts).format('YYYY-MM-DD HH:mm:ss');
 
 @connect(({ loading, accounts }) => ({
   accounts,
-  loading: loading.models.terminal,
+  loading: loading.models.accounts,
 }))
 
 export default class TerminalsAccountsPage extends Component {
@@ -48,23 +47,18 @@ export default class TerminalsAccountsPage extends Component {
       },
     });
   };
-
-  handleBatchOperation = () => {
-    Message.info('暂不支持批量操作!');
+  // 显示最近30天的数据
+  handleOverdueOperation = () => {
+    this.props.dispatch({
+      type: 'accounts/fetchTerminalsList',
+      payload: {
+        fastExpired: 1,
+      }
+    })
   };
   render() {
     const { loading,accounts } = this.props;
     const { list, totalSize, pageSize, pageNo } = accounts;
-    const batchActions = [{
-      key: 'delete',
-      name: '批量禁用',
-    }, {
-      key: 'recovery',
-      name: '批量解禁',
-    }, {
-      key: 'unbound',
-      name: '批量解绑',
-    }];
 
     const basicSearch = {
       keys: [{
@@ -86,12 +80,12 @@ export default class TerminalsAccountsPage extends Component {
       dataIndex: 'ucode',
       width: '15%',
     }, {
-      title: '产品编号',
+      title: '课程包编号',
       key: 2,
       dataIndex: 'pcode',
       width: '10%',
     }, {
-      title: '产品名称',
+      title: '课程包名称',
       key: 3,
       dataIndex: 'pname',
       width: '15%',
@@ -99,16 +93,16 @@ export default class TerminalsAccountsPage extends Component {
       title: '权限有效期',
       key: 4,
       render: (_, record) => {
-        const { startTime, endTime } = record;
+        const { startTimeStr, endTimeStr } = record;
         return (
           <div className={styles.authDesc}>
-            <p><span>起始时间:&nbsp;&nbsp;</span>{`${timestamp2Str(startTime)}`}</p>
-            <p><span>到期时间:&nbsp;&nbsp;</span>{`${timestamp2Str(endTime)}`}</p>
+            <p><span>起始时间:&nbsp;&nbsp;</span>{`${startTimeStr}`}</p>
+            <p><span>到期时间:&nbsp;&nbsp;</span>{`${endTimeStr}`}</p>
           </div>
         );
       },
       dataIndex: 'cityName',
-      width: '30%',
+      width: '15%',
       align: 'center',
     }, {
       title: '权限有效时长',
@@ -123,16 +117,21 @@ export default class TerminalsAccountsPage extends Component {
       },
       width: '10%',
     }, {
-      title: '联系电话',
+      title: '校区名称',
       key: 6,
+      dataIndex: 'campusName',
+      width: '16%',
+    }, {
+      title: '联系电话',
+      key: 7,
       dataIndex: 'campusContactWay',
       width: '12%',
     }, {
       title: '联系人',
-      key: 7,
+      key: 8,
       dataIndex: 'campusContactName',
-      width: '8%',
-    }, ];
+      width: '6%',
+    }];
 
     return (
       <Card>
@@ -143,12 +142,11 @@ export default class TerminalsAccountsPage extends Component {
           header={{
             basicSearch,
             onFilterClick: this.handleFilterOperation,
+            onOverdue: this.handleOverdueOperation,
             onDownload: this.handleDownloadOperation,
           }}
           footer={{
             pagination,
-            batchActions,
-            onBatchClick: this.handleBatchOperation,
           }}
           keepUIState={{ ...this.state.UIParams }}
           showStatusSelect={false}

+ 99 - 166
src/routes/Dashboard/Accounts/AccountsTotalList.js

@@ -1,182 +1,115 @@
+
 import React, { Component } from 'react';
 import moment from 'moment';
-import { Card, Modal, Button, message } from 'antd';
-const Message = message;
+import { connect } from 'dva';
+import { Card, message, Badge } from 'antd';
+import { StandardTableList } from '../../../components/AXList';
+import { addRowKey, renderStatus } from '../../../utils/utils';
+
+@connect(({ loading, accounts }) => ({
+  accounts,
+  loading: loading.models.accounts,
+}))
 
 export default class TotalListAccountsPage extends Component {
   constructor(props) {
     super(props);
+    const { state } = props.location;
+    this.state = {
+      UIParams: (state || {}).UIParams, // 组件的状态参数
+      Queryers: (state || {}).Queryers, // 查询的条件参数
+    };
   }
-  componentDidMount() {
-    
+
+  componentWillMount() {
+    //  获取总的学校得数量
+    this.props.dispatch({
+      type: 'accounts/fetchCampusAmount'
+    })
+    // 获取总表数据
+    this.props.dispatch({
+      type: 'accounts/fetchTotalList',
+      payload: { ...this.state.Queryers }
+    })
   }
+  
+  handleFilterOperation = (params, states) => {
+    this.setState({
+      UIParams: states,
+      Queryers: params,
+    });
+    this.props.dispatch({
+      type: 'accounts/fetchTerminalsList',
+      payload: {
+        ...params,
+      },
+    });
+  };
 
   render() {
+    const { loading,accounts } = this.props;
+    console.log('>>>>>>>>>>>>>this.props',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: 'merchantName',
+      width: '15%',
+    }, {
+      title: '校区名称',
+      key: 2,
+      dataIndex: 'campusName',
+      width: '20%',
+    }, {
+      title: '终端编号',
+      key: 3,
+      dataIndex: 'code',
+      width: '20%',
+    }, {
+      title: '终端名称',
+      key: 4,
+      dataIndex: 'name',
+      width: '30%',
+    }, {
+      title: '课程状态',
+      key: 5,
+      dataIndex: 'status',
+      render: text => renderStatus(text),
+      width: '15%',
+    }];
+
     return (
       <Card>
-        TotalListAccountsPage
+        <StandardTableList
+          columns={columns}
+          loading={loading}
+          dataSource={addRowKey(list)}
+          header={{
+            basicSearch,
+            onFilterClick: this.handleFilterOperation,
+          }}
+          footer={{
+            pagination,
+          }}
+          keepUIState={{ ...this.state.UIParams }}
+          showStatusSelect={false}
+        />
       </Card>
     );
   }
 }
-
-
-// import React, { Component } from 'react';
-// import moment from 'moment';
-// import { connect } from 'dva';
-// import { Card, message, Badge } from 'antd';
-// import { StandardTableList } from '../../../components/AXList';
-// import { addRowKey } from '../../../utils/utils';
-// import styles from './AccountsTerminals.less';
-// const Message = message;
-// const timestamp2Str = ts => moment(ts).format('YYYY-MM-DD HH:mm:ss');
-
-// @connect(({ loading, accounts }) => ({
-//   accounts,
-//   loading: loading.models.terminal,
-// }))
-
-// export default class TerminalsAccountsPage extends Component {
-//   constructor(props) {
-//     super(props);
-//     const { state } = props.location;
-//     this.state = {
-//       UIParams: (state || {}).UIParams, // 组件的状态参数
-//       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,
-//       Queryers: params,
-//     });
-//     this.props.dispatch({
-//       type: 'accounts/fetchTerminalsList',
-//       payload: {
-//         ...params,
-//       },
-//     });
-//   };
-
-//   handleBatchOperation = () => {
-//     Message.info('暂不支持批量操作!');
-//   };
-//   render() {
-//     const { loading,accounts } = this.props;
-//     const { list, totalSize, pageSize, pageNo } = accounts;
-//     const batchActions = [{
-//       key: 'delete',
-//       name: '批量禁用',
-//     }, {
-//       key: 'recovery',
-//       name: '批量解禁',
-//     }, {
-//       key: 'unbound',
-//       name: '批量解绑',
-//     }];
-
-//     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 { startTime, endTime } = record;
-//         return (
-//           <div className={styles.authDesc}>
-//             <p><span>起始时间:&nbsp;&nbsp;</span>{`${timestamp2Str(startTime)}`}</p>
-//             <p><span>到期时间:&nbsp;&nbsp;</span>{`${timestamp2Str(endTime)}`}</p>
-//           </div>
-//         );
-//       },
-//       dataIndex: 'cityName',
-//       width: '30%',
-//       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: 'campusContactWay',
-//       width: '12%',
-//     }, {
-//       title: '联系人',
-//       key: 7,
-//       dataIndex: 'campusContactName',
-//       width: '8%',
-//     }, ];
-
-//     return (
-//       <Card>
-//         <StandardTableList
-//           columns={columns}
-//           loading={loading}
-//           dataSource={addRowKey(list)}
-//           header={{
-//             basicSearch,
-//             onFilterClick: this.handleFilterOperation,
-//             onDownload: this.handleDownloadOperation,
-//           }}
-//           footer={{
-//             pagination,
-//             batchActions,
-//             onBatchClick: this.handleBatchOperation,
-//           }}
-//           keepUIState={{ ...this.state.UIParams }}
-//           showStatusSelect={false}
-//         />
-//       </Card>
-//     );
-//   }
-// }

+ 2 - 10
src/routes/Dashboard/Accounts/index.js

@@ -15,14 +15,10 @@ export default class AccountsPage extends Component {
       case 'campus':
         dispatch(routerRedux.push(`${match.url}/campus`));
         break;
-      // 产品权限
+      // 终端课程包
       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`));
@@ -40,11 +36,7 @@ export default class AccountsPage extends Component {
       },
       {
         key: 'terminals',
-        tab: '产品权限',
-      },
-      {
-        key: 'overdue',
-        tab: '即将逾期',
+        tab: '终端课程包',
       },
       {
         key: 'totalList',

+ 13 - 0
src/services/accounts.js

@@ -13,6 +13,7 @@ export async function queryCampusList(params) {
 export async function downloadCampusExcel() {
   return request(`${api.accountsCampusDownload}`);
 }
+
 export async function queryTerminalsList(params) {
   const newParams = {
     pageSize: Hotax.PAGE_SIZE,
@@ -22,4 +23,16 @@ export async function queryTerminalsList(params) {
 }
 export async function downloadTerminalsExcel() {
   return request(`${api.accountsTerminalsDownload}`);
+}
+
+export async function queryTotalList(params) {
+  const newParams = {
+    pageSize: Hotax.PAGE_SIZE,
+    ...params,
+  };
+  return request(`${api.acconutsTotalList}?${stringify(newParams)}`);
+}
+
+export async function queryCampusAmount() {
+  return request(`${api.acconutsCampusAmount}`);
 }

+ 2 - 0
src/utils/config.js

@@ -148,6 +148,8 @@ const apiObj = {
   accountsCampusDownload: '/stmt/campus/export',
   accountsTerminalsList: '/stmt/terminal/user/page',
   accountsTerminalsDownload: '/stmt/terminal/user/export',
+  acconutsTotalList: '/stmt/stats/page',
+  acconutsCampusAmount: '/stats/campus/totalsize',
 };
 
 /**