| | |
| | | app: null, |
| | | loading: false, |
| | | menulist: [], |
| | | sortType: '', |
| | | columns: [ |
| | | { |
| | | title: '菜单名称', dataIndex: 'MenuName', key: 'MenuName', align: 'center', render: (text, record) => { |
| | |
| | | title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo', align: 'center' |
| | | }, |
| | | { |
| | | title: '修改时间', dataIndex: 'modifydate', key: 'modifydate', align: 'center', sorter: true, render: (text, record) => { |
| | | if (window.GLOB.upStatus && record.up_action === 'Y') { |
| | | return <span style={{color: 'orange'}}>{text}</span> |
| | | } |
| | | return text |
| | | } |
| | | }, |
| | | { |
| | | title: '操作', |
| | | key: 'action', |
| | | align: 'center', |
| | | render: (text, record) => ( |
| | | <div> |
| | | <div style={{minWidth: '125px'}}> |
| | | {record.type !== 'none' ? |
| | | <Button type="link" onClick={() => this.deleteMenu(record)} style={{color: '#ff4d4f'}}>删除</Button> : |
| | | <Button type="link" onClick={() => { |
| | |
| | | window.open(window.location.href.replace(/#.+/ig, `#/${route}/${window.btoa(window.encodeURIComponent(JSON.stringify({...app, MenuID: item.MenuID, type: 'app'})))}`)) |
| | | } |
| | | |
| | | changeTable = (pagination, filters, sorter) => { |
| | | this.setState({sortType: sorter.order || ''}) |
| | | } |
| | | |
| | | render () { |
| | | const { app, loading, columns, menulist, trees, searchkey } = this.state |
| | | let _menulist = menulist |
| | | const { app, loading, columns, menulist, trees, searchkey, sortType } = this.state |
| | | let _menulist = fromJS(menulist).toJS() |
| | | |
| | | if (searchkey) { |
| | | _menulist = _menulist.filter(item => item.MenuName.toLowerCase().indexOf(searchkey.toLowerCase()) > -1) |
| | | } |
| | | |
| | | if (sortType === 'ascend') { |
| | | _menulist.sort((a, b) => { |
| | | if (a.modifydate > b.modifydate) return 1 |
| | | if (a.modifydate < b.modifydate) return -1 |
| | | return 0 |
| | | }) |
| | | } else if (sortType === 'descend') { |
| | | _menulist.sort((a, b) => { |
| | | if (a.modifydate < b.modifydate) return 1 |
| | | if (a.modifydate > b.modifydate) return -1 |
| | | return 0 |
| | | }) |
| | | } |
| | | |
| | | return ( |
| | |
| | | columns={columns} |
| | | dataSource={_menulist} |
| | | pagination={false} |
| | | onChange={this.changeTable} |
| | | /> |
| | | </div> |
| | | </div> |