Browse Source

分类搜索代码提交

hy 7 years ago
parent
commit
b6a1e427e5

+ 67 - 4
src/components/chart/list.jsx

@@ -2,11 +2,11 @@
  * 图表列表
  */
 import React from 'react'
-import { Layout, Button, Icon, Input, Menu, Dropdown, Card, Col, Row, Popover, Breadcrumb, Tree, Tag } from 'antd'
+import { Layout, Button, Icon, Input, Menu, Dropdown, Card, Col, Row, Popover, Breadcrumb, Tree, Tag, Select, DatePicker } from 'antd'
 import { connect } from 'dva'
+import moment from 'moment'
 import './list.less'
 import ChooseDataSourceBox from './chooseDataSourceBox'
-import moment from 'moment'
 import Ellipsis from 'ant-design-pro/lib/Ellipsis'
 import 'ant-design-pro/dist/ant-design-pro.css'
 import GroupSelector from '../dataSource/groupSelector'
@@ -18,6 +18,8 @@ const { Content } = Layout
 const { Search } = Input
 const CardGrid = Card.Grid
 const { TreeNode } = Tree
+const { Option } = Select
+const { RangePicker } = DatePicker
 
 
 class ChartList extends React.Component {
@@ -74,6 +76,8 @@ class ChartList extends React.Component {
 
         const reg = new RegExp('([+ \\- & | ! ( ) { } \\[ \\] ^ \" ~ * ? : ( ) \/])', 'g'); // 需要转义的字符
         let filterLabel = chart.filterLabel.replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1'); // 添加转义符号
+        let typeLabel = chart.typeLabel
+
         const operationMenu = (
             <Menu className='menu-operation'>
                 <Menu.Item disabled>
@@ -128,9 +132,24 @@ class ChartList extends React.Component {
 
         let cards = list.filter(l => groupFilter.indexOf(l.groupCode+'') !== -1).map(l => {
             let reg = new RegExp('(' + filterLabel + '){1}', 'ig');
-            if((l.name || '').search(reg) !== -1 || (l.description || '').search(reg) !== -1) {
+
+            if(l[typeLabel] && typeLabel!=='createTime' && l[typeLabel].search(reg) !== -1){
                 return { ...l, bf: false };
-            }else {
+            }else if(l[typeLabel] && typeLabel==='createTime'){
+                if(filterLabel===""){
+                    return { ...l, bf: false };
+                }else if(filterLabel.indexOf('#')>-1){
+                    let start = filterLabel.split('#')[0]
+                    let end = filterLabel.split('#')[1]
+                    let nowTime = new Date(l[typeLabel]).getTime();
+                    if(nowTime>=start && nowTime<=end){
+                        return { ...l, bf: false };
+                    }
+                    return { ...l, bf: true };
+                }else{
+                    return { ...l, bf: true };
+                }
+            }else{
                 return { ...l, bf: true };
             }
         }).sort((a, b) => {
@@ -367,6 +386,9 @@ class ChartList extends React.Component {
         const { visibleChooseDataSourceBox, visibleDistributeBox, visibleTransferBox, visibleDeleteBox, selectedRecord } = this.state;
         const { dispatch, chart } = this.props;
         const TAG_COLOR = ['blue'];
+        const { changeSearchType } = chart;
+        
+
         return (
             <Layout className='chart-list'>
                 <Content>
@@ -418,7 +440,47 @@ class ChartList extends React.Component {
                                 </Breadcrumb>
                             </Col>
                             <Col className='search'>
+                                <Col style={{ padding: '0 1px', margin: '0 -5px' }}>
+                                    <Select 
+                                        value={chart.typeLabel}
+                                        style={{ width: 120 }}
+                                        onChange={e => {
+                                            dispatch({ type: 'chart/setTypeLabel', selected: e });
+                                        }}
+                                    >
+                                        <Option value="name">图表名称</Option>
+                                        <Option value="creatorName">创建人</Option>
+                                        <Option value="createTime">创建时间</Option>
+                                    </Select>
+                                </Col>
                                 <Col style={{ padding: '0 5px' }}>
+                                {changeSearchType ? 
+                                    <RangePicker  
+                                        ranges={{
+                                            '今天': [moment().startOf('day'), moment().endOf('day')], 
+                                            '昨天': [moment().startOf('day').add(-1,'days'), moment().endOf('day')],
+                                            '近七天': [moment().startOf('day'),moment().endOf('day').add(6,'days')],
+                                            '本月': [moment().startOf('month'), moment().endOf('month')],
+                                            '本年': [moment().startOf('year'), moment().endOf('year')] 
+                                        }}
+                                        showTime={{ format: 'HH:mm' }}
+                                        format="YYYY-MM-DD HH:mm:ss"
+                                        onChange={e => {
+                                            //清空时间时
+                                            if(e.length === 0){
+                                                dispatch({ type: 'chart/setFilterLabel', label: '' });
+                                            }
+                                        }}
+                                        onOk={e => {
+                                            //解析时间格式
+                                            let start = e[0]
+                                            let end = e[1]
+                                            let time = start._d.getTime() + "#" + end._d.getTime()
+                                            dispatch({ type: 'chart/setFilterLabel', label: time });
+                                        }}
+                                    >
+                                    </RangePicker> 
+                                    : 
                                     <Search
                                         placeholder="请输入关键字"
                                         value={chart.filterLabel}
@@ -426,6 +488,7 @@ class ChartList extends React.Component {
                                             dispatch({ type: 'chart/setFilterLabel', label: e.target.value });
                                         }}
                                     />
+                                }
                                 </Col>
                                 <Col >
                                     <Button onClick={() => {

+ 76 - 15
src/components/dashboard/list.jsx

@@ -1,6 +1,7 @@
 import React from 'react'
-import { Layout, Button, Icon, Input, Table, Menu, Dropdown, Card, Col, Row } from 'antd'
+import { Layout, Button, Icon, Input, Table, Menu, Dropdown, Card, Col, Row, Select, DatePicker } from 'antd'
 import { connect } from 'dva'
+import moment from 'moment'
 import TransferBox from '../common/selectUserBox/selectUserBox';
 import AccessObjectBox from '../common/accessObjectBox/accessObjectBox'
 import { dateFormat } from '../../utils/baseUtils'
@@ -10,6 +11,8 @@ import CopyBox from './copyBox'
 import './list.less'
 const { Content } = Layout
 const { Search } = Input
+const { Option } = Select
+const { RangePicker } = DatePicker
 
 
 class DashboardList extends React.Component {
@@ -87,18 +90,33 @@ class DashboardList extends React.Component {
         dispatch({ type: 'dashboard/share', code: selectedRecord.code, targets });
     }
 
-    onSearch(list, text) {
+    onSearch(list, dashboard) {
         const reg = new RegExp('([+ \\- & | ! ( ) { } \\[ \\] ^ \" ~ * ? : ( ) \/])', 'g'); // 需要转义的字符
-        let filterLabel = (text || '').replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1'); // 添加转义符号
+        let filterLabel = (dashboard.filterLabel || '').replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1'); // 添加转义符号
+        let typeLabel = dashboard.typeLabel
+        
         return list.map(l => {
             let o = Object.assign({}, l);
             let reg = new RegExp('('+ filterLabel +'){1}', 'ig');
-            if(o.name && o.name.search(reg) !== -1) {
-                return o;
-            }else if(o.description && o.description.search(reg) !== -1) {
+
+            if(o[typeLabel] && typeLabel!=='createTime' && o[typeLabel].search(reg) !== -1){
                 return o;
-            }else {
-                return null
+            }else if(o[typeLabel] && typeLabel==='createTime'){
+                if(filterLabel===""){
+                    return o;
+                }else if(filterLabel.indexOf('#')>-1){
+                    let start = filterLabel.split('#')[0]
+                    let end = filterLabel.split('#')[1]
+                    let nowTime = new Date(o[typeLabel]).getTime();
+                    if(nowTime>=start && nowTime<=end){
+                        return o;
+                    }
+                    return null 
+                }else{
+                    return null 
+                }
+            }else{
+                return null 
             }
         }).filter(a => a!==null);
     }
@@ -113,6 +131,7 @@ class DashboardList extends React.Component {
         const { dispatch, dashboard, main } = this.props;
         const { visibleShareBox, shareUrl, visibleDistributeBox, visibleTransferBox, visibleDeleteBox, visibleCopyBox, selectedRecord, defaultSelectedGroups, defaultSelectedUsers } = this.state
         const { currentUser } = main;
+        const { changeSearchType } = dashboard;
 
         const reg = new RegExp('([+ \\- & | ! ( ) { } \\[ \\] ^ \" ~ * ? : ( ) \/])', 'g'); // 需要转义的字符
         let filterLabel = dashboard.filterLabel.replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1'); // 添加转义符号
@@ -231,14 +250,56 @@ class DashboardList extends React.Component {
                             <Col style={{ display: 'flex' }}>
                             </Col>
                             <Col className='search'>
-                                <Col style={{ padding: '0 5px' }}>
-                                    <Search
-                                        placeholder="请输入关键字"
-                                        value={dashboard.filterLabel}
+                                <Col style={{ padding: '0 1px', margin: '0 -5px' }}>
+                                    <Select 
+                                        value={dashboard.typeLabel}
+                                        style={{ width: 120 }}
                                         onChange={e => {
-                                            dispatch({ type: 'dashboard/setFilterLabel', label: e.target.value });
+                                            dispatch({ type: 'dashboard/setTypeLabel', selected: e });
                                         }}
-                                    />
+                                    >
+                                        <Option value="name">名称</Option>
+                                        <Option hidden value="description">说明</Option>
+                                        <Option value="creatorName">创建人</Option>
+                                        <Option value="createTime">创建时间</Option>
+                                    </Select>
+                                </Col>
+                                <Col style={{ padding: '0 5px' }}>
+                                   {changeSearchType ? 
+                                        <RangePicker  
+                                            ranges={{
+                                                 '今天': [moment().startOf('day'), moment().endOf('day')], 
+                                                 '昨天': [moment().startOf('day').add(-1,'days'), moment().endOf('day')],
+                                                 '近七天': [moment().startOf('day'),moment().endOf('day').add(6,'days')],
+                                                 '本月': [moment().startOf('month'), moment().endOf('month')],
+                                                 '本年': [moment().startOf('year'), moment().endOf('year')]  
+                                            }}
+                                            showTime={{ format: 'HH:mm' }}
+                                            format="YYYY-MM-DD HH:mm:ss"
+                                            onChange={e => {
+                                                //清空时间时
+                                                if(e.length === 0){
+                                                    dispatch({ type: 'dashboard/setFilterLabel', label: '' });
+                                                }
+                                            }}
+                                            onOk={e => {
+                                                //解析时间格式
+                                                let start = e[0]
+                                                let end = e[1]
+                                                let time = start._d.getTime() + "#" + end._d.getTime()
+                                                dispatch({ type: 'dashboard/setFilterLabel', label: time });
+                                            }}
+                                        >
+                                        </RangePicker> 
+                                        : 
+                                        <Search
+                                            placeholder="请输入关键字"
+                                            value={dashboard.filterLabel}
+                                            onChange={e => {
+                                                dispatch({ type: 'dashboard/setFilterLabel', label: e.target.value });
+                                            }}
+                                        />
+                                   }
                                 </Col>
                                 <Col >
                                     <Button onClick={() => {
@@ -258,7 +319,7 @@ class DashboardList extends React.Component {
                             columns={dashboardColumns}
                             dataSource={
                                 this.onSort(
-                                    this.onSearch(dashboard.list, dashboard.filterLabel)
+                                    this.onSearch(dashboard.list, dashboard)
                                 )
                             }
                             size='small'

+ 62 - 12
src/components/dataConnect/list.jsx

@@ -1,5 +1,5 @@
 import React from 'react'
-import { Layout, Row, Col, Input, Button, Icon, Card, Tooltip } from 'antd'
+import { Layout, Row, Col, Input, Button, Icon, Card, Tooltip, Select } from 'antd'
 import { connect } from 'dva'
 import DeleteBox from '../common/deleteBox/deleteBox'
 import DataConnectBox from '../dataSourceDetail/dataConnectBox'
@@ -7,6 +7,7 @@ import './list.less'
 const CardGrid = Card.Grid
 const { Content } = Layout
 const { Search } = Input
+const { Option } = Select
 
 class DataConnect extends React.Component {
     constructor(props) {
@@ -62,9 +63,10 @@ class DataConnect extends React.Component {
         const { dataConnect, dispatch } = this.props;
         const reg = new RegExp('([+ \\- & | ! ( ) { } \\[ \\] ^ \" ~ * ? : ( ) \/])', 'g'); // 需要转义的字符
         let filterLabel = dataConnect.filterLabel.replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1'); // 添加转义符号
+        let typeLabel = dataConnect.typeLabel
 
         let cards = dataConnect.list.filter(l => {
-            return ((l.name || '').search(new RegExp('(' + filterLabel + '){1}', 'ig')) !== -1);
+            return ((l[dataConnect.typeLabel] || '').search(new RegExp('(' + filterLabel + '){1}', 'ig')) !== -1);
         }).map( (l, i) => (
             <CardGrid className='dataconnect-card' key={i}>
                 <Card
@@ -82,7 +84,7 @@ class DataConnect extends React.Component {
                             }}
                         >
                             <Col className='label'>
-                                { filterLabel ?
+                                { filterLabel && typeLabel==='name' ?
                                     ((l.name || '').split(new RegExp(`(${filterLabel})`, 'i')).map((fragment, i) => {
                                         return (
                                             fragment.toLowerCase().replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1') === filterLabel.toLowerCase() ?
@@ -139,10 +141,28 @@ class DataConnect extends React.Component {
                         }}
                     >
                         <Row className='address'>
-                            {l.address}
+                            { filterLabel && typeLabel==='address' ?
+                                ((l.address || '').split(new RegExp(`(${filterLabel})`, 'i')).map((fragment, i) => {
+                                    return (
+                                        fragment.toLowerCase().replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1') === filterLabel.toLowerCase() ?
+                                        <span key={i} style={{fontWeight: 'bold', color: 'red'}} className="highlight">{fragment}</span> :
+                                        fragment
+                                    )
+                                }
+                                )) : l.address
+                            }
                         </Row>
                         <Row className='username'>
-                            {l.userName}
+                            { filterLabel && typeLabel==='userName' ?
+                                ((l.userName || '').split(new RegExp(`(${filterLabel})`, 'i')).map((fragment, i) => {
+                                    return (
+                                        fragment.toLowerCase().replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1') === filterLabel.toLowerCase() ?
+                                        <span key={i} style={{fontWeight: 'bold', color: 'red'}} className="highlight">{fragment}</span> :
+                                        fragment
+                                    )
+                                }
+                                )) : l.userName
+                            }
                         </Row>
                     </div>
                 </Card>
@@ -158,7 +178,7 @@ class DataConnect extends React.Component {
 
     render() {
         const { dataConnect, dispatch } = this.props;
-        const { selected } = dataConnect;
+        const { selected, changeSearchType } = dataConnect;
         const { visibleDeleteBox } = this.state;
 
         return (
@@ -169,14 +189,44 @@ class DataConnect extends React.Component {
                             <Col style={{ display: 'flex' }}>
                             </Col>
                             <Col className='search'>
-                                <Col style={{ padding: '0 5px' }}>
-                                    <Search
-                                        placeholder="请输入关键字"
-                                        value={dataConnect.filterLabel}
+                                <Col style={{ padding: '0 1px', margin: '0 -5px' }}>
+                                    <Select 
+                                        value={dataConnect.typeLabel}
+                                        style={{ width: 90 }}
                                         onChange={e => {
-                                            dispatch({ type: 'dataConnect/setFilterLabel', label: e.target.value });
+                                            dispatch({ type: 'dataConnect/setTypeLabel', selected: e });
                                         }}
-                                    />
+                                    >
+                                        <Option value="name">连接名</Option>
+                                        <Option hidden value="userName">用户名</Option>
+                                        <Option hidden value="dbType">数据库类型</Option>
+                                        <Option hidden value="address">数据库地址</Option>
+                                    </Select>
+                                </Col>
+                                <Col style={{ padding: '0 5px' }}>
+                                    {changeSearchType ? 
+                                        <Select 
+                                            value={dataConnect.filterLabel}
+                                            style={{ width: 120 }}
+                                            onChange={e => {
+                                                dispatch({ type: 'dataConnect/setFilterLabel', label: e });
+                                            }}
+                                        >
+                                            <Option value="oracle">ORACLE</Option>
+                                            <Option value="mysql">MYSQL</Option>
+                                            <Option value="sqlserver">SQLSERVER</Option>
+                                            <Option value="sqlite">SQLITE</Option>
+                                        </Select> 
+                                        : 
+                                        <Search
+                                            placeholder="请输入关键字"
+                                            value={dataConnect.filterLabel}
+                                            onChange={e => {
+                                                dispatch({ type: 'dataConnect/setFilterLabel', label: e.target.value });
+                                            }}
+                                        />
+                                    }
+                                    
                                 </Col>
                                 <Col >
                                     <Button onClick={() => {

+ 77 - 19
src/components/dataSource/list.jsx

@@ -1,6 +1,7 @@
 import React from 'react'
-import { Layout, Row, Col, Input, Button, Table, Icon, Menu, Dropdown, Card, Breadcrumb, Popover, Tree, Tag } from 'antd'
+import { Layout, Row, Col, Input, Button, Table, Icon, Menu, Dropdown, Card, Breadcrumb, Popover, Tree, Tag, Select, DatePicker  } from 'antd'
 import { connect } from 'dva'
+import moment from 'moment'
 import { dateFormat } from '../../utils/baseUtils'
 import GroupSelector from './groupSelector'
 import TransferBox from '../common/selectUserBox/selectUserBox'
@@ -11,6 +12,8 @@ import './list.less'
 const { Content } = Layout
 const { Search } = Input
 const { TreeNode } = Tree
+const { Option } = Select
+const { RangePicker } = DatePicker
 
 class DataSource extends React.Component {
     constructor(props) {
@@ -49,9 +52,7 @@ class DataSource extends React.Component {
 
     onGroup() {
         const { dataSource } = this.props;
-        const groupList = dataSource.groupList;
-        const list = dataSource.list;
-        const currentGroup = dataSource.currentGroup;
+        const { groupList, currentGroup, list } = dataSource;
         
         let groupFilter = groupList.concat({ code: '-1', label: '未分组' }).filter(g => (
             currentGroup[0].code === 'all' || 
@@ -69,18 +70,33 @@ class DataSource extends React.Component {
         return list.filter(l => groupFilter.indexOf(l.groupCode+'') !== -1);
     }
 
-    onSearch(list, text) {
+    onSearch(list, dataSource) {
         const reg = new RegExp('([+ \\- & | ! ( ) { } \\[ \\] ^ \" ~ * ? : ( ) \/])', 'g'); // 需要转义的字符
-        let filterLabel = (text || '').replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1'); // 添加转义符号
+        let filterLabel = (dataSource.filterLabel || '').replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1'); // 添加转义符号
+        let typeLabel = dataSource.typeLabel
+        
         return list.map(l => {
             let o = Object.assign({}, l);
             let reg = new RegExp('('+ filterLabel +'){1}', 'ig');
-            if(o.name && o.name.search(reg) !== -1) {
-                return o;
-            }else if(o.description && o.description.search(reg) !== -1) {
+
+            if(o[typeLabel] && typeLabel!=='createTime' && o[typeLabel].search(reg) !== -1){
                 return o;
-            }else {
-                return null
+            }else if(o[typeLabel] && typeLabel==='createTime'){
+                if(filterLabel===""){
+                    return o;
+                }else if(filterLabel.indexOf('#')>-1){
+                    let start = filterLabel.split('#')[0]
+                    let end = filterLabel.split('#')[1]
+                    let nowTime = o[typeLabel].getTime();
+                    if(nowTime>=start && nowTime<=end){
+                        return o;
+                    }
+                    return null 
+                }else{
+                    return null 
+                }
+            }else{
+                return null 
             }
         }).filter(a => a!==null);
     }
@@ -247,10 +263,10 @@ class DataSource extends React.Component {
     }
 
     render() {
-        
         const { main, dataSource, dispatch } = this.props;
         const { selectedRecord, visibleTransferBox, visibleCopyBox, visibleDeleteBox, visibleDataPreviewBox } = this.state;
         const { currentUser } = main;
+        const { changeSearchType } = dataSource;
 
         const reg = new RegExp('([+ \\- & | ! ( ) { } \\[ \\] ^ \" ~ * ? : ( ) \/])', 'g'); // 需要转义的字符
         let filterLabel = dataSource.filterLabel.replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1'); // 添加转义符号
@@ -432,14 +448,56 @@ class DataSource extends React.Component {
                                 </Breadcrumb>
                             </Col>
                             <Col className='search'>
-                                <Col>
-                                    <Search
-                                        value={dataSource.filterLabel}
-                                        placeholder="请输入关键字"
+                                <Col style={{ padding: '0 1px', margin: '0 -5px' }}>
+                                    <Select 
+                                        value={dataSource.typeLabel}
+                                        style={{ width: 120 }}
                                         onChange={e => {
-                                            dispatch({ type: 'dataSource/setFilterLabel', label: e.target.value });
+                                            dispatch({ type: 'dataSource/setTypeLabel', selected: e });
                                         }}
-                                    />
+                                    >
+                                        <Option value="name">名称</Option>
+                                        <Option hidden value="description">说明</Option>
+                                        <Option value="creatorName">创建人</Option>
+                                        <Option value="createTime">创建时间</Option>
+                                    </Select>
+                                </Col>
+                                <Col style={{ padding: '0 5px' }}>
+                                    {changeSearchType ? 
+                                        <RangePicker  
+                                            ranges={{
+                                                '今天': [moment().startOf('day'), moment().endOf('day')], 
+                                                '昨天': [moment().startOf('day').add(-1,'days'), moment().endOf('day')],
+                                                '近七天': [moment().startOf('day'),moment().endOf('day').add(6,'days')],
+                                                '本月': [moment().startOf('month'), moment().endOf('month')],
+                                                '本年': [moment().startOf('year'), moment().endOf('year')] 
+                                            }}
+                                            showTime={{ format: 'HH:mm' }}
+                                            format="YYYY-MM-DD HH:mm:ss"
+                                            onChange={e => {
+                                                //清空时间时
+                                                if(e.length === 0){
+                                                    dispatch({ type: 'dataSource/setFilterLabel', label: '' });
+                                                }
+                                            }}
+                                            onOk={e => {
+                                                //解析时间格式
+                                                let start = e[0]
+                                                let end = e[1]
+                                                let time = start._d.getTime() + "#" + end._d.getTime()
+                                                dispatch({ type: 'dataSource/setFilterLabel', label: time });
+                                            }}
+                                        >
+                                        </RangePicker> 
+                                        : 
+                                        <Search
+                                            value={dataSource.filterLabel}
+                                            placeholder="请输入关键字"
+                                            onChange={e => {
+                                                dispatch({ type: 'dataSource/setFilterLabel', label: e.target.value });
+                                            }}
+                                        />
+                                    }
                                 </Col>
                                 <Col>
                                     <Dropdown overlay={(
@@ -467,7 +525,7 @@ class DataSource extends React.Component {
                             columns={dataSourceColumns}
                             dataSource={
                                 this.onSort(
-                                    this.onSearch(this.onGroup(), dataSource.filterLabel)
+                                    this.onSearch(this.onGroup(), dataSource)
                                 )
                             }
                             size='small'

+ 114 - 0
src/components/logs/logs.jsx

@@ -0,0 +1,114 @@
+import React from 'react'
+import { Layout, Row, Col, Input, Button, Table, Icon, Card } from 'antd'
+import { connect } from 'dva'
+import { dateFormat } from '../../utils/baseUtils'
+import './logs.less'
+const { Content } = Layout
+const { Search } = Input
+
+class Logs extends React.Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            pageSize: 10,
+            tableBodyHeight: 0,
+            //visibleAddMemberBox: false
+        }
+    };
+
+    componentDidMount() {
+        const { dispatch } = this.props;
+        //dispatch({ type: 'userGroup/fetchList', autoSelect: true });
+        this.tableSize();
+        window.addEventListener('resize', this.tableSize);
+    }
+
+    componentWillUnmount() {
+        window.removeEventListener('resize', this.tableSize);
+    }
+
+    tableSize = () => {
+        const tableEl = document.getElementsByClassName('logs-table')[0];
+        const tableScrollEl = tableEl.getElementsByClassName('ant-table-scroll')[0];
+        this.setState({
+            tableBodyHeight: tableScrollEl.offsetHeight - 38,
+            pageSize: Math.ceil((tableScrollEl.offsetHeight - 38) / 38)
+        });
+    }
+
+    render() {
+        const { logs } = this.props 
+        const { tableBodyHeight, pageSize, visibleDeleteBox } = this.state;
+        const logsColumns = [{
+            title: '界面名称',
+            dataIndex: 'name',
+            key: 'name',
+            width: 200
+        }, {
+            title: '界面模块',
+            dataIndex: 'module',
+            key: 'module',
+            width: 100,
+        }, {
+            title: '操作人',
+            dataIndex: 'operator',
+            key: 'operator',
+            width: 100
+        }, {
+            title: '操作时间',
+            dataIndex: 'createTime',
+            key: 'createTime',
+            render: (text, record) => dateFormat(text, 'yyyy-MM-dd hh:mm:ss'),
+            width: 100
+        }, {
+            title: '操作',
+            dataIndex: 'action',
+            key: 'action',
+            width: 150
+        }];
+
+        return (      
+            <Layout className='logs-view'>
+                <Content>
+                    <Card className='logs-body' title={
+                            <Row className='logs-tools' type='flex' justify='space-between'>
+                                <Col className='search'>
+                                    <Col>
+                                        <Search
+                                            //value={dataSource.filterLabel}
+                                            placeholder="请输入关键字"
+                                            // onChange={e => {
+                                            //     //dispatch({ type: 'dataSource/setFilterLabel', label: e.target.value });
+                                            // }}
+                                        />
+                                    </Col>
+                                </Col>
+                            </Row>
+                        }>
+                        <Table
+                            className='logs-table'
+                            columns={logsColumns}
+                            dataSource={
+                                logs.dataList
+                                // this.onSort(
+                                //     this.onSearch(this.onGroup(), dataSource.filterLabel)
+                                // )
+                            }
+                            size='small'
+                            scroll={{
+                                x: false, 
+                                y: 440,
+                            }}
+                            pagination={{
+                                total: 20
+                            }}
+                        />,
+                        mountNode
+                    </Card>
+                </Content>
+            </Layout>
+        )
+    }
+}
+
+export default connect(({ present: { logs } }) => ({ logs }))(Logs)

+ 13 - 0
src/components/logs/logs.less

@@ -0,0 +1,13 @@
+.logs-tabs {
+    height: 100%;
+    .ant-tabs-bar {
+        margin: 0;
+    }
+    .ant-tabs-content {
+        height: 100%;
+        border: none !important;
+        .ant-tabs-tabpane {
+            height: 100%;
+        }
+    }
+}

+ 3 - 1
src/components/setting/index.jsx

@@ -5,6 +5,7 @@ import { Layout, Button } from 'antd'
 import { connect } from 'dva'
 import Loading from '../../components/common/loading/loading'
 import Admin from '../../components/admin/admin'
+import Logs from '../../components/logs/logs'
 import './index.less'
 const { Sider, Content } = Layout
 
@@ -34,11 +35,12 @@ class Setting extends React.Component {
             >
                 <Link to='/setting/admin'><Button className='ant-btn-block' type={(paths[1] === 'admin' || !paths[1]) ? 'primary' : 'default'} >用户管理</Button></Link>
                 <Link to=''><Button disabled className='ant-btn-block' type={paths[1] === 'datasource' ? 'primary' : 'default'} >权限管理</Button></Link>
-                <Link to=''><Button disabled className='ant-btn-block' type={paths[1] === 'chart' ? 'primary' : 'default'} >操作日志</Button></Link>
+                <Link to='/setting/logs'><Button className='ant-btn-block' type={paths[1] === 'logs' ? 'primary' : 'default'} >操作日志</Button></Link>
             </Sider>
             <Content className='main-content'>
                 <Switch>
                     <Route sensitive path='/setting/admin' component={Admin}/>
+                    <Route sensitive path='/setting/logs' component={Logs}/>
                     <Route path='/' component={() => (<Redirect to={{ pathname: '/setting/admin' }} ></Redirect>)}/>
                 </Switch>
             </Content>

+ 2 - 0
src/index.js

@@ -14,6 +14,7 @@ import user from './models/user'
 import chartPolicy from './models/chartPolicy'
 import dataSourcePolicy from './models/dataSourcePolicy'
 import dataList from './models/dataList'
+import logs from './models/logs'
 import recent from './models/recent'
 import './utils/baseUtils'
 import './index.less'
@@ -48,6 +49,7 @@ app.model(chartPolicy); // 图表策略
 app.model(dataSourcePolicy); // 数据源策略
 app.model(dataList); // 数据列表
 app.model(recent); // 最近访问记录
+app.model(logs); // 操作日志
 
 // 4. Router
 app.router(indexRouter);

+ 6 - 0
src/models/chart.js

@@ -9,6 +9,8 @@ export default {
         originData: {
             list: [],
             filterLabel: '',
+            typeLabel: 'name',
+            changeSearchType:false,
             groupList: [],
             currentGroup: [{
                 code: 'all',
@@ -32,6 +34,10 @@ export default {
             const { label } = action;
             return Object.assign({}, state, {filterLabel: label});
         },
+        setTypeLabel(state, action) {
+            const { selected } = action;
+            return Object.assign({}, state, {typeLabel: selected , filterLabel:'', changeSearchType:selected==='createTime'?true:false});
+        },
         groupList(state, action) {
             let data = action.data;
             return Object.assign({}, state, {groupList: data});

+ 6 - 0
src/models/dashboard.js

@@ -16,6 +16,8 @@ export default {
                 defaultSelectedUsers: []
             },
             filterLabel: '',
+            typeLabel: 'name',
+            changeSearchType:false,
             groupList: [],
             currentGroup: [{
                 code: 'all',
@@ -33,6 +35,10 @@ export default {
             let { label } = action;
             return Object.assign({}, state, {filterLabel: label});
         },
+        setTypeLabel(state, action) {
+            const { selected } = action;
+            return Object.assign({}, state, {typeLabel: selected , filterLabel:'', changeSearchType:selected==='createTime'?true:false});
+        },
         reset(state, action) {
             let newState = Object.assign({}, state, state.originData);
             return Object.assign({}, newState);

+ 6 - 0
src/models/dataConnect.js

@@ -9,6 +9,8 @@ export default {
             list: [],
             newOne: {},
             filterLabel: '',
+            typeLabel: 'name',
+            changeSearchType:false,
             validInfo: {}
         },
     },
@@ -58,6 +60,10 @@ export default {
             const { label } = action;
             return Object.assign({}, state, { filterLabel: label });
         },
+        setTypeLabel(state, action) {
+            const { selected } = action;
+            return Object.assign({}, state, { typeLabel: selected , filterLabel:'',changeSearchType:selected==='dbType'?true:false });
+        },
         setNewModelField(state, action) {
             const { name, value } = action;
             let newOne = state.newOne;

+ 6 - 0
src/models/dataSource.js

@@ -9,7 +9,9 @@ export default {
         originData: {
             list: [],
             filterLabel: '',
+            typeLabel: 'name',
             invalidSQL: false,
+            changeSearchType:false,
             groupList: [],
             currentGroup: [{
                 code: 'all',
@@ -38,6 +40,10 @@ export default {
             const { label } = action;
             return Object.assign({}, state, {filterLabel: label});
         },
+        setTypeLabel(state, action) {
+            const { selected } = action;
+            return Object.assign({}, state, {typeLabel: selected , filterLabel:'', changeSearchType:selected==='createTime'?true:false});
+        },
         groupList(state, action) {
             let data = action.data;
             return Object.assign({}, state, {groupList: data});

+ 145 - 0
src/models/logs.js

@@ -0,0 +1,145 @@
+import { message } from 'antd'
+import * as service from '../services/index'
+import URLS from '../constants/url'
+
+export default {
+    namespace: 'logs',
+    state: {
+        dataList:[{
+            name:'报表',
+            module:'筛选模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'修改操作'
+        },{
+            name:'报表',
+            module:'全部模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'新增'
+        },{
+            name:'报表',
+            module:'报表设计模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'删除'
+        },{
+            name:'报表',
+            module:'筛选模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'修改操作'
+        },{
+            name:'报表',
+            module:'全部模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'新增'
+        },{
+            name:'报表',
+            module:'报表设计模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'删除'
+        },{
+            name:'报表',
+            module:'筛选模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'修改操作'
+        },{
+            name:'报表',
+            module:'全部模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'新增'
+        },{
+            name:'报表',
+            module:'报表设计模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'删除'
+        },{
+            name:'报表',
+            module:'筛选模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'修改操作'
+        },{
+            name:'报表',
+            module:'全部模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'新增'
+        },{
+            name:'报表',
+            module:'报表设计模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'删除'
+        },{
+            name:'报表',
+            module:'筛选模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'修改操作'
+        },{
+            name:'报表',
+            module:'全部模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'新增'
+        },{
+            name:'报表',
+            module:'报表设计模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'删除'
+        },{
+            name:'报表',
+            module:'筛选模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'修改操作'
+        },{
+            name:'报表',
+            module:'全部模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'新增'
+        },{
+            name:'报表',
+            module:'报表设计模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'删除'
+        },{
+            name:'报表',
+            module:'筛选模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'修改操作'
+        },{
+            name:'报表',
+            module:'全部模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'新增'
+        },{
+            name:'报表',
+            module:'报表设计模块',
+            operator:'张三',
+            createTime:1555316130068,
+            action:'删除'
+        }]
+    },
+    reducers: {
+        
+    },
+    effects: {
+        
+    },
+    subscriptions: {
+
+    }
+};