Yansen 2 years ago
parent
commit
3855a4348f

+ 4
- 3
src/layouts/AuthLayout/index.jsx View File

16
   const { theme } = useModel('system');
16
   const { theme } = useModel('system');
17
   const { user, menus } = useModel('user');
17
   const { user, menus } = useModel('user');
18
   const location = useLocation();
18
   const location = useLocation();
19
-  const currentRoute = useRoute();
19
+  const { meta } = useRoute() || {};
20
+  const { noLayout = false, noSiderBar = false } = meta || {};
20
 
21
 
21
   const splitMenus = useMemo(() => menus.map(x => ({ ...x, children: undefined })), [menus]);
22
   const splitMenus = useMemo(() => menus.map(x => ({ ...x, children: undefined })), [menus]);
22
   const siderMenus = useMemo(() => {
23
   const siderMenus = useMemo(() => {
29
       <HtmlTitle />
30
       <HtmlTitle />
30
       <RequireLogin>
31
       <RequireLogin>
31
         {
32
         {
32
-          currentRoute && currentRoute.meta && currentRoute.meta.noLayout
33
+          noLayout
33
             ? <Outlet />
34
             ? <Outlet />
34
             : (
35
             : (
35
               <Layout style={{ minHeight: '100vh' }}>
36
               <Layout style={{ minHeight: '100vh' }}>
36
                 <Header theme={theme} menus={splitMenus} location={location} />
37
                 <Header theme={theme} menus={splitMenus} location={location} />
37
                 <Layout>
38
                 <Layout>
38
-                  <SiderBar theme={theme} menus={siderMenus} location={location} />
39
+                  { !noSiderBar && <SiderBar theme={theme} menus={siderMenus} location={location} /> }
39
                   <Container location={location} />
40
                   <Container location={location} />
40
                 </Layout>
41
                 </Layout>
41
               </Layout>
42
               </Layout>

+ 11
- 1
src/pages/message/index.jsx View File

3
 import { queryTable } from '@/utils/request';
3
 import { queryTable } from '@/utils/request';
4
 import { ProTable } from '@ant-design/pro-components';
4
 import { ProTable } from '@ant-design/pro-components';
5
 import { Button, message, Popconfirm } from 'antd';
5
 import { Button, message, Popconfirm } from 'antd';
6
-import { getMessageList } from '@/services/message';
6
+import { getMessageList, setMessageReaded } from '@/services/message';
7
 
7
 
8
 const queryMessage = queryTable(getMessageList);
8
 const queryMessage = queryTable(getMessageList);
9
 
9
 
10
 export default (props) => {
10
 export default (props) => {
11
+  const actionRef = React.useRef();
12
+
13
+  const setReaded = (id) => {
14
+    setMessageReaded(id).then(() => {
15
+      actionRef.current.reset();
16
+    })
17
+  }
18
+
11
   const columns = [
19
   const columns = [
12
     {
20
     {
13
       title: '时间',
21
       title: '时间',
63
             key={1}
71
             key={1}
64
             type="link"
72
             type="link"
65
             disabled={record.isReaded}
73
             disabled={record.isReaded}
74
+            onClick={() => setReaded(record.id)}
66
           >
75
           >
67
             设为已读
76
             设为已读
68
           </Button>,
77
           </Button>,
80
   return (
89
   return (
81
     <ProTable
90
     <ProTable
82
       rowKey="id"
91
       rowKey="id"
92
+      actionRef={actionRef}
83
       request={queryMessage}
93
       request={queryMessage}
84
       columns={columns}
94
       columns={columns}
85
     />
95
     />

+ 5
- 4
src/routes/routes.jsx View File

51
  *    title: 用于页面或者菜单的标题, 没有此字段, 菜单不会显示
51
  *    title: 用于页面或者菜单的标题, 没有此字段, 菜单不会显示
52
  *    hideInMenu: 布尔值, 如果为 false, 菜单不会显示
52
  *    hideInMenu: 布尔值, 如果为 false, 菜单不会显示
53
  *    noLayout: 布尔值, 如果为 true, 将不会使用默认布局
53
  *    noLayout: 布尔值, 如果为 true, 将不会使用默认布局
54
+ *    noSiderBar: 布尔值, 如果为 true, 将没有左侧菜单栏
54
  *    target: 字符串, 如果为 _blank, 将在新窗口打开
55
  *    target: 字符串, 如果为 _blank, 将在新窗口打开
55
  * }
56
  * }
56
  */
57
  */
260
         path: 'stockClassification/list',
261
         path: 'stockClassification/list',
261
         element: <StockClassificationList />,
262
         element: <StockClassificationList />,
262
         meta: {
263
         meta: {
263
-          title: '库存分类管理',
264
+          title: '库存分类',
264
         },
265
         },
265
       },
266
       },
266
       {
267
       {
275
         path: 'log',
276
         path: 'log',
276
         element: <StockLog />,
277
         element: <StockLog />,
277
         meta: {
278
         meta: {
278
-          title: '库存操作日志',
279
+          title: '操作日志',
279
         },
280
         },
280
       },
281
       },
281
       {
282
       {
282
         path: 'roles',
283
         path: 'roles',
283
         element: <Roles />,
284
         element: <Roles />,
284
         meta: {
285
         meta: {
285
-          title: '系统角色管理',
286
+          title: '角色管理',
286
         },
287
         },
287
       },
288
       },
288
       {
289
       {
289
         path: 'user',
290
         path: 'user',
290
         element: <UserList />,
291
         element: <UserList />,
291
         meta: {
292
         meta: {
292
-          title: '系统用户管理',
293
+          title: '用户管理',
293
         },
294
         },
294
       },
295
       },
295
       {
296
       {

+ 3
- 1
src/services/message.js View File

1
-import { restful } from '@/utils/request';
1
+import request, { restful } from '@/utils/request';
2
 
2
 
3
 const [
3
 const [
4
   getMessageList,
4
   getMessageList,
9
   getMessageList,
9
   getMessageList,
10
   getMessage,
10
   getMessage,
11
 }
11
 }
12
+
13
+export const setMessageReaded = id => request.put(`/noticeMessage/${id}/readed`)