forked from Gitlink/forgeplus-react
权限管理模块
This commit is contained in:
parent
094e7d1d5a
commit
041fe24b03
|
@ -44,7 +44,7 @@ export default [
|
|||
title: "延期任务处理",
|
||||
location: "/managements/task/delayManage",
|
||||
menustatus: "Y",
|
||||
parentKey: "task",
|
||||
parentKey: "commission",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
|
@ -55,7 +55,7 @@ export default [
|
|||
title: "支付报酬凭证上传",
|
||||
location: "/managements/task/payProof",
|
||||
menustatus: "Y",
|
||||
parentKey: "task",
|
||||
parentKey: "commission",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
|
@ -78,7 +78,7 @@ export default [
|
|||
title: "统筹任务发布审批",
|
||||
location: "/managements/task/taskManage/1",
|
||||
menustatus: "Y",
|
||||
parentKey: "task",
|
||||
parentKey: "publish",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
|
@ -89,7 +89,7 @@ export default [
|
|||
title: "自主任务发布审批",
|
||||
location: "/managements/task/taskManage/0",
|
||||
menustatus: "Y",
|
||||
parentKey: "task",
|
||||
parentKey: "publish",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
|
@ -246,7 +246,7 @@ export default [
|
|||
title: "竞赛评审列表",
|
||||
location: "/managements/expert/competition",
|
||||
menustatus: "Y",
|
||||
parentKey: "task",
|
||||
parentKey: "competition",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
|
@ -267,7 +267,7 @@ export default [
|
|||
title: "专家注册列表",
|
||||
location: "/managements/expert/register",
|
||||
menustatus: "Y",
|
||||
parentKey: "task",
|
||||
parentKey: "userManagement",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
|
@ -278,7 +278,50 @@ export default [
|
|||
title: "专家库列表",
|
||||
location: "/managements/expert/list",
|
||||
menustatus: "Y",
|
||||
parentKey: "task",
|
||||
parentKey: "userManagement",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "jurisdiction",
|
||||
title: "权限管理",
|
||||
location: "",
|
||||
icon: "icon-yonghuguanli",
|
||||
target: "_self",
|
||||
urltype: "self",
|
||||
children: [
|
||||
{
|
||||
key: "adminUserList",
|
||||
title: "管理员列表",
|
||||
location: "/managements/jurisdiction/users",
|
||||
menustatus: "Y",
|
||||
parentKey: "jurisdiction",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
key: "roleList",
|
||||
title: "角色列表",
|
||||
location: "/managements/jurisdiction/roles",
|
||||
menustatus: "Y",
|
||||
parentKey: "jurisdiction",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
key: "menuList",
|
||||
title: "菜单列表",
|
||||
location: "/managements/jurisdiction/menu",
|
||||
menustatus: "Y",
|
||||
parentKey: "jurisdiction",
|
||||
icon: "",
|
||||
target: "",
|
||||
urltype: "self",
|
||||
|
|
|
@ -7,12 +7,14 @@ const { SubMenu } = Menu;
|
|||
|
||||
const titleObj = {};
|
||||
const locationObj = {};
|
||||
const parentKeyObj = {};
|
||||
function titleFun(menus) {
|
||||
menus.forEach(i => {
|
||||
titleObj[i.key] = i.title;
|
||||
locationObj[i.location] = i;
|
||||
if (Array.isArray(i.children) && i.children.length > 0) {
|
||||
titleFun(i.children);
|
||||
i.parentKey && (parentKeyObj[i.key] = i.parentKey);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -39,8 +41,6 @@ export default (props) => {
|
|||
setActive(item)
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getMenuList(menus) {
|
||||
return menus.map(function (item) {
|
||||
if (Array.isArray(item.children) && item.children.length > 0) {
|
||||
|
@ -77,13 +77,17 @@ export default (props) => {
|
|||
}catch(err){}
|
||||
}
|
||||
|
||||
const defaultOpenKeys = [];
|
||||
const myKey = locationObj && pathname && locationObj[pathname].parentKey;
|
||||
defaultOpenKeys.push(myKey ? myKey: "task") ;
|
||||
defaultOpenKeys.push(parentKeyObj[myKey]);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="layouts">
|
||||
<Menu
|
||||
mode="inline"
|
||||
mode="inline"
|
||||
defaultOpenKeys={["task"]}
|
||||
defaultOpenKeys={defaultOpenKeys}
|
||||
selectedKeys={current}
|
||||
onClick={handleClick}
|
||||
>
|
||||
|
|
|
@ -92,6 +92,23 @@ const CompetitionList = Loadable({
|
|||
loading: Loading,
|
||||
})
|
||||
|
||||
// 权限管理
|
||||
// 非普通用户(管理员)列表
|
||||
const AdminUserList = Loadable({
|
||||
loader: () => import("./jurisdiction/userList"),
|
||||
loading: Loading,
|
||||
})
|
||||
// 系统角色列表
|
||||
const RoleList = Loadable({
|
||||
loader: () => import("./jurisdiction/roles"),
|
||||
loading: Loading,
|
||||
})
|
||||
// 菜单列表
|
||||
const MenuList = Loadable({
|
||||
loader: () => import("./jurisdiction/menuList"),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
const Managements = (propsF) => {
|
||||
|
||||
return (
|
||||
|
@ -214,6 +231,27 @@ const Managements = (propsF) => {
|
|||
<CompetitionList {...propsF} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
{/* 非普通用户(管理员)列表 */}
|
||||
<Route
|
||||
path="/managements/jurisdiction/users"
|
||||
render={(props) => (
|
||||
<AdminUserList {...propsF} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
{/* 系统角色列表 */}
|
||||
<Route
|
||||
path="/managements/jurisdiction/roles"
|
||||
render={(props) => (
|
||||
<RoleList {...propsF} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
{/* 菜单列表 */}
|
||||
<Route
|
||||
path="/managements/jurisdiction/menu"
|
||||
render={(props) => (
|
||||
<MenuList {...propsF} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
</Switch>
|
||||
</Layouts>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
||||
import { Input, Select, Button, Form, DatePicker, Modal, message, Popover, Switch } from 'antd';
|
||||
import PaginationTable from '../../../components/pagination-table';
|
||||
|
||||
export default Form.create()(({ form, showNotification, match, history, state }) => {
|
||||
|
||||
const [reload, setReload] = useState();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [curPage, setCurPage] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [dataList, setDataList] = useState([]);
|
||||
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
title: '编号',
|
||||
dataIndex: 'number',
|
||||
},
|
||||
{
|
||||
title: '菜单名称',
|
||||
dataIndex: 'name',
|
||||
render: (text, record) => (
|
||||
text
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '菜单级数',
|
||||
dataIndex: 'enterpriseName',
|
||||
},
|
||||
{
|
||||
title: '前端名称',
|
||||
dataIndex: 'publishedAt',
|
||||
},
|
||||
{
|
||||
title: '前端图标',
|
||||
dataIndex: 'publishMode',
|
||||
render: (text, record) => {
|
||||
text = text && text.replaceAll('-','/').substring(0,16);
|
||||
return text || '--'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '是否显示',
|
||||
dataIndex: 'showUserMode',
|
||||
render: (text, record) => {
|
||||
return <Switch defaultChecked={text || false}/>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'status',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
dataIndex: 'expertReview',
|
||||
align: 'center',
|
||||
render: (text, record) => {
|
||||
return(
|
||||
<React.Fragment>
|
||||
<Button className="mr5 f20">查看下级</Button>
|
||||
<Button className="mr5 f89">编辑</Button>
|
||||
<Button className={`mr5 c2a3 ${text ? 'bor':'full'}`}>删除</Button>
|
||||
|
||||
</React.Fragment>
|
||||
)},
|
||||
},
|
||||
]
|
||||
}, [curPage]);
|
||||
|
||||
return (
|
||||
<div className="centerbox task-manage-all ">
|
||||
<div className='management-content-head'>
|
||||
<p className='font-18'>菜单列表</p>
|
||||
<div className="search-screen" ></div>
|
||||
</div>
|
||||
<div className="center-content">
|
||||
<PaginationTable
|
||||
loading={loading}
|
||||
rowKey={(row) => row.id}
|
||||
dataSource={dataList}
|
||||
columns={columns}
|
||||
total={total}
|
||||
current={curPage}
|
||||
setCurPage={(page)=>{setCurPage(page)}}
|
||||
className="expertReviewTable"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
|
@ -0,0 +1,87 @@
|
|||
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
||||
import { Input, Select, Button, Form, DatePicker, Modal, message, Popover } from 'antd';
|
||||
import PaginationTable from '../../../components/pagination-table';
|
||||
|
||||
export default Form.create()(({ form, showNotification, match, history, state }) => {
|
||||
|
||||
const [reload, setReload] = useState();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [curPage, setCurPage] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [dataList, setDataList] = useState([]);
|
||||
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
title: '编号',
|
||||
dataIndex: 'number',
|
||||
},
|
||||
{
|
||||
title: '角色名称',
|
||||
dataIndex: 'name',
|
||||
render: (text, record) => (
|
||||
text
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '描述',
|
||||
dataIndex: 'enterpriseName',
|
||||
},
|
||||
{
|
||||
title: '用户数',
|
||||
dataIndex: 'publishedAt',
|
||||
},
|
||||
{
|
||||
title: '添加时间',
|
||||
dataIndex: 'publishMode',
|
||||
render: (text, record) => {
|
||||
text = text && text.replaceAll('-','/').substring(0,16);
|
||||
return text || '--'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '是否启用',
|
||||
dataIndex: 'showUserMode',
|
||||
render: (text, record) => {
|
||||
return <Switch defaultChecked={text || false}/>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
dataIndex: 'expertReview',
|
||||
align: 'center',
|
||||
render: (text, record) => {
|
||||
return(
|
||||
<React.Fragment>
|
||||
<Button className="mr5 f20">分配菜单</Button>
|
||||
<Button className="mr5 f20">分配资源</Button>
|
||||
<Button className="mr5 f89">编辑</Button>
|
||||
<Button className={`mr5 c2a3 ${text ? 'bor':'full'}`}>删除</Button>
|
||||
</React.Fragment>
|
||||
)},
|
||||
},
|
||||
]
|
||||
}, [curPage]);
|
||||
|
||||
return (
|
||||
<div className="centerbox task-manage-all ">
|
||||
<div className='management-content-head'>
|
||||
<p className='font-18'>角色列表</p>
|
||||
<div className="search-screen" ></div>
|
||||
</div>
|
||||
<div className="center-content">
|
||||
<PaginationTable
|
||||
loading={loading}
|
||||
rowKey={(row) => row.id}
|
||||
dataSource={dataList}
|
||||
columns={columns}
|
||||
total={total}
|
||||
current={curPage}
|
||||
setCurPage={(page)=>{setCurPage(page)}}
|
||||
className="expertReviewTable"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
|
@ -0,0 +1,95 @@
|
|||
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
||||
import { Input, Select, Button, Form, DatePicker, Modal, message, Popover, Switch } from 'antd';
|
||||
import PaginationTable from '../../../components/pagination-table';
|
||||
|
||||
export default Form.create()(({ form, showNotification, match, history, state }) => {
|
||||
|
||||
const [reload, setReload] = useState();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [curPage, setCurPage] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [dataList, setDataList] = useState([]);
|
||||
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
title: '编号',
|
||||
dataIndex: 'number',
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
dataIndex: 'name',
|
||||
render: (text, record) => (
|
||||
text
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'enterpriseName',
|
||||
},
|
||||
{
|
||||
title: '邮箱',
|
||||
dataIndex: 'publishedAt',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'publishMode',
|
||||
render: (text, record) => {
|
||||
text = text && text.replaceAll('-','/').substring(0,16);
|
||||
return text || '--'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '最后登录时间',
|
||||
dataIndex: 'status',
|
||||
render: (text, record) => {
|
||||
text = text && text.replaceAll('-','/').substring(0,16);
|
||||
return text || '--'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '是否禁用',
|
||||
dataIndex: 'showUserMode',
|
||||
render: (text, record) => {
|
||||
return <Switch defaultChecked={text || false}/>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
dataIndex: 'expertReview',
|
||||
align: 'center',
|
||||
render: (text, record) => {
|
||||
return(
|
||||
<React.Fragment>
|
||||
<Button className="mr5 f20">分配角色</Button>
|
||||
<Button className="mr5 f89">编辑</Button>
|
||||
<Button className={`mr5 c2a3 ${text ? 'bor':'full'}`}>删除</Button>
|
||||
|
||||
</React.Fragment>
|
||||
)},
|
||||
},
|
||||
]
|
||||
}, [curPage]);
|
||||
|
||||
return (
|
||||
<div className="centerbox task-manage-all ">
|
||||
<div className='management-content-head'>
|
||||
<p className='font-18'>管理员列表</p>
|
||||
<div className="search-screen" ></div>
|
||||
</div>
|
||||
<div className="center-content">
|
||||
<PaginationTable
|
||||
loading={loading}
|
||||
rowKey={(row) => row.id}
|
||||
dataSource={dataList}
|
||||
columns={columns}
|
||||
total={total}
|
||||
current={curPage}
|
||||
setCurPage={(page)=>{setCurPage(page)}}
|
||||
className="expertReviewTable"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
Loading…
Reference in New Issue