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 { LeftSquareOutlined, RightSquareOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
import NavForm from './NavForm';
import { http } from 'libs';
import { http, hasPermission } from 'libs';
import styles from './index.module.less';
function NavIndex(props) {
@ -40,7 +40,8 @@ function NavIndex(props) {
title="便捷导航"
className={styles.nav}
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 ? (
<Row gutter={24}>
<Col span={6} style={{marginBottom: 24}}>

View File

@ -6,7 +6,7 @@
import React, { useEffect, useState } from 'react';
import { Button, Card, List, Modal, Form, Input, Switch, Divider, Typography } from 'antd';
import { DownSquareOutlined, PlusOutlined, UpSquareOutlined, SoundOutlined } from '@ant-design/icons';
import { http } from 'libs';
import { http, hasPermission } from 'libs';
import styles from './index.module.less';
function NoticeIndex(props) {
@ -75,7 +75,7 @@ function NoticeIndex(props) {
title="系统公告"
loading={fetching}
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 ? (
<List>
<div className={styles.add} onClick={() => showForm({})}><PlusOutlined/>新建公告</div>

View File

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

View File

@ -4,13 +4,13 @@
* Released under the AGPL-3.0 License.
*/
export default [{
key: 'home',
label: '工作台',
key: 'dashboard',
label: 'Dashboard',
pages: [{
key: 'home',
label: '工作台',
key: 'dashboard',
label: 'Dashboard',
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';
export default [
{icon: <DesktopOutlined/>, title: '工作台', auth: 'home.home.view', path: '/home', component: HomeIndex},
{icon: <DesktopOutlined/>, title: '工作台', path: '/home', component: HomeIndex},
{
icon: <DashboardOutlined/>,
title: 'Dashboard',
auth: 'home.home.view',
auth: 'dashboard.dashboard.view',
path: '/dashboard',
component: DashboardIndex
},