upgrade permissions

pull/330/head
vapao 2021-06-03 15:10:13 +08:00
parent 5953e8e61f
commit 1d1db13488
5 changed files with 13 additions and 14 deletions

View File

@ -7,7 +7,7 @@ import React, { useState, useEffect } from 'react';
import { Avatar, Button, Card, Col, Row } from 'antd'; import { Avatar, Button, Card, Col, Row } from 'antd';
import { LeftSquareOutlined, RightSquareOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons'; import { LeftSquareOutlined, RightSquareOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
import NavForm from './NavForm'; import NavForm from './NavForm';
import { http } from 'libs'; import { http, hasPermission } from 'libs';
import styles from './index.module.less'; import styles from './index.module.less';
function NavIndex(props) { function NavIndex(props) {
@ -40,7 +40,8 @@ function NavIndex(props) {
title="便捷导航" title="便捷导航"
className={styles.nav} className={styles.nav}
bodyStyle={{paddingBottom: 0, minHeight: 166}} bodyStyle={{paddingBottom: 0, minHeight: 166}}
extra={<Button type="link" onClick={() => setIsEdit(!isEdit)}>{isEdit ? '完成' : '编辑'}</Button>}> extra={<Button hidden={!hasPermission('admin')} type="link"
onClick={() => setIsEdit(!isEdit)}>{isEdit ? '完成' : '编辑'}</Button>}>
{isEdit ? ( {isEdit ? (
<Row gutter={24}> <Row gutter={24}>
<Col span={6} style={{marginBottom: 24}}> <Col span={6} style={{marginBottom: 24}}>

View File

@ -6,7 +6,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, Card, List, Modal, Form, Input, Switch, Divider, Typography } from 'antd'; import { Button, Card, List, Modal, Form, Input, Switch, Divider, Typography } from 'antd';
import { DownSquareOutlined, PlusOutlined, UpSquareOutlined, SoundOutlined } from '@ant-design/icons'; import { DownSquareOutlined, PlusOutlined, UpSquareOutlined, SoundOutlined } from '@ant-design/icons';
import { http } from 'libs'; import { http, hasPermission } from 'libs';
import styles from './index.module.less'; import styles from './index.module.less';
function NoticeIndex(props) { function NoticeIndex(props) {
@ -75,7 +75,7 @@ function NoticeIndex(props) {
title="系统公告" title="系统公告"
loading={fetching} loading={fetching}
className={styles.notice} className={styles.notice}
extra={<Button type="link" onClick={() => setIsEdit(!isEdit)}>{isEdit ? '完成' : '编辑'}</Button>}> extra={<Button hidden={!hasPermission('admin')} type="link" onClick={() => setIsEdit(!isEdit)}>{isEdit ? '完成' : '编辑'}</Button>}>
{isEdit ? ( {isEdit ? (
<List> <List>
<div className={styles.add} onClick={() => showForm({})}><PlusOutlined/>新建公告</div> <div className={styles.add} onClick={() => showForm({})}><PlusOutlined/>新建公告</div>

View File

@ -9,9 +9,7 @@ import { Card, List } from 'antd';
function TodoIndex(props) { function TodoIndex(props) {
return ( return (
<Card title="待办事项" bodyStyle={{height: 234, padding: '0 24px'}}> <Card title="待办事项" bodyStyle={{height: 234, padding: '0 24px'}}>
<List> <List/>
<List.Item>工单 ECS购买 需要你审核</List.Item>
</List>
</Card> </Card>
) )
} }

View File

@ -4,13 +4,13 @@
* Released under the AGPL-3.0 License. * Released under the AGPL-3.0 License.
*/ */
export default [{ export default [{
key: 'home', key: 'dashboard',
label: '工作台', label: 'Dashboard',
pages: [{ pages: [{
key: 'home', key: 'dashboard',
label: '工作台', label: 'Dashboard',
perms: [ perms: [
{key: 'view', label: '查看工作台'} {key: 'view', label: '查看Dashboard'}
] ]
}] }]
}, { }, {

View File

@ -43,11 +43,11 @@ import WelcomeIndex from './pages/welcome/index';
import WelcomeInfo from './pages/welcome/info'; import WelcomeInfo from './pages/welcome/info';
export default [ export default [
{icon: <DesktopOutlined/>, title: '工作台', auth: 'home.home.view', path: '/home', component: HomeIndex}, {icon: <DesktopOutlined/>, title: '工作台', path: '/home', component: HomeIndex},
{ {
icon: <DashboardOutlined/>, icon: <DashboardOutlined/>,
title: 'Dashboard', title: 'Dashboard',
auth: 'home.home.view', auth: 'dashboard.dashboard.view',
path: '/dashboard', path: '/dashboard',
component: DashboardIndex component: DashboardIndex
}, },