From 6830aad220f6b8f263b2e64eaaae56a6ad785afd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 06 十二月 2023 10:18:06 +0800 Subject: [PATCH] 2023-12-06 --- src/views/rolemanage/index.jsx | 32 ++++++++++++++++++++++++++++++-- 1 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/views/rolemanage/index.jsx b/src/views/rolemanage/index.jsx index e246e2b..3a273df 100644 --- a/src/views/rolemanage/index.jsx +++ b/src/views/rolemanage/index.jsx @@ -23,6 +23,7 @@ app: null, loading: false, menulist: [], + sortType: '', columns: [ { title: '鑿滃崟鍚嶇О', dataIndex: 'MenuName', key: 'MenuName', align: 'center', render: (text, record) => { @@ -36,6 +37,14 @@ }, { 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: '鎿嶄綔', @@ -878,12 +887,30 @@ 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 ( @@ -907,6 +934,7 @@ columns={columns} dataSource={_menulist} pagination={false} + onChange={this.changeTable} /> </div> </div> -- Gitblit v1.8.0