From 0eb129a9beddbb86ae74d7106a8e60823206b8d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 14 十二月 2023 11:29:15 +0800
Subject: [PATCH] 2023-12-14

---
 src/views/rolemanage/index.jsx |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/src/views/rolemanage/index.jsx b/src/views/rolemanage/index.jsx
index e246e2b..8f03846 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) => {
@@ -38,11 +39,19 @@
         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={() => {
@@ -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