Commit c386d214 authored by 皮倩雯's avatar 皮倩雯

fix: '角色管理限制内置角色权限'

parent 87b9cd2f
Pipeline #78042 passed with stages
...@@ -31,6 +31,7 @@ import { ...@@ -31,6 +31,7 @@ import {
UserAddOutlined, UserAddOutlined,
WindowsOutlined, WindowsOutlined,
IeOutlined, IeOutlined,
InfoCircleOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { import {
setMenuToRole, setMenuToRole,
...@@ -101,19 +102,18 @@ const SiteManage = () => { ...@@ -101,19 +102,18 @@ const SiteManage = () => {
const { node } = treenode; const { node } = treenode;
const { roleID: id } = node; const { roleID: id } = node;
console.log(node); console.log(node);
debugger;
setItemObj(node); setItemObj(node);
if (node.BuiltInRole) {
setKeyValue('0');
}
setUserNewVisible(true); setUserNewVisible(true);
console.log(id); console.log(id);
if (id) { if (id) {
setSaveTreeId(id); setSaveTreeId(id);
if (node.BuiltInRole === true && keyValue == 1) { setRoleID(id);
setRoleID(''); setFlagSearch(1);
setDescrip('内置角色不可配置菜单权限');
setFlagSearch(0);
} else {
setRoleID(id);
setFlagSearch(1);
}
setValueList([...valueList]); setValueList([...valueList]);
console.log([...valueList]); console.log([...valueList]);
} else { } else {
...@@ -284,7 +284,7 @@ const SiteManage = () => { ...@@ -284,7 +284,7 @@ const SiteManage = () => {
{afterStr} {afterStr}
</div> </div>
) : ( ) : (
<div className={styles.titleTop}>{i.title}</div> <div className={styles.titleTop}>{i.title}12</div>
)} )}
<div className={styles.tip}> <div className={styles.tip}>
{i.roleID && ( {i.roleID && (
...@@ -295,12 +295,15 @@ const SiteManage = () => { ...@@ -295,12 +295,15 @@ const SiteManage = () => {
onClick={e => editorUser(e, i)} onClick={e => editorUser(e, i)}
/> />
</Tooltip> </Tooltip>
<Tooltip title="删除角色" className={styles.fs}> {!i.BuiltInRole && (
<DeleteOutlined <Tooltip title="删除角色" className={styles.fs}>
style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }} <DeleteOutlined
onClick={e => deletesUser(e, i)} style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }}
/> onClick={e => deletesUser(e, i)}
</Tooltip> />
</Tooltip>
)}
{/* <Tooltip title="关联用户" className={styles.fs}> {/* <Tooltip title="关联用户" className={styles.fs}>
<UserAddOutlined <UserAddOutlined
style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }} style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }}
...@@ -369,7 +372,16 @@ const SiteManage = () => { ...@@ -369,7 +372,16 @@ const SiteManage = () => {
{afterStr} {afterStr}
</div> </div>
) : ( ) : (
<div className={styles.titleTop}>{itemRole.title}</div> <div className={styles.titleTop}>
{itemRole.title}
{itemRole.description && (
<Tooltip title={itemRole.description}>
<InfoCircleOutlined
style={{ color: 'rgb(24, 144, 255)', marginLeft: '5px', marginTop: '3px' }}
/>
</Tooltip>
)}
</div>
)} )}
<div className={styles.tip}> <div className={styles.tip}>
{itemRole.roleID && ( {itemRole.roleID && (
...@@ -380,12 +392,15 @@ const SiteManage = () => { ...@@ -380,12 +392,15 @@ const SiteManage = () => {
onClick={e => editorUser(e, itemRole)} onClick={e => editorUser(e, itemRole)}
/> />
</Tooltip> </Tooltip>
<Tooltip title="删除角色" className={styles.fs}> {!itemRole.BuiltInRole && (
<DeleteOutlined <Tooltip title="删除角色" className={styles.fs}>
style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }} <DeleteOutlined
onClick={e => deletesUser(e, itemRole)} style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }}
/> onClick={e => deletesUser(e, itemRole)}
</Tooltip> />
</Tooltip>
)}
{/* <Tooltip title="关联用户" className={styles.fs}> {/* <Tooltip title="关联用户" className={styles.fs}>
<UserAddOutlined <UserAddOutlined
style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }} style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }}
...@@ -429,12 +444,15 @@ const SiteManage = () => { ...@@ -429,12 +444,15 @@ const SiteManage = () => {
onClick={e => editorUser(e, item)} onClick={e => editorUser(e, item)}
/> />
</Tooltip> </Tooltip>
<Tooltip title="删除角色" className={styles.fs}> {!item.BuiltInRole && (
<DeleteOutlined <Tooltip title="删除角色" className={styles.fs}>
style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }} <DeleteOutlined
onClick={e => deletesUser(e, item)} style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }}
/> onClick={e => deletesUser(e, item)}
</Tooltip> />
</Tooltip>
)}
{/* <Tooltip title="关联用户" className={styles.fs}> {/* <Tooltip title="关联用户" className={styles.fs}>
<UserAddOutlined <UserAddOutlined
style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }} style={{ fontSize: '16px', color: '#1890FF', marginTop: '5px' }}
...@@ -528,14 +546,8 @@ const SiteManage = () => { ...@@ -528,14 +546,8 @@ const SiteManage = () => {
setItemObj(aa); setItemObj(aa);
if (itemObj.roleID === currentSelectId[0]) { if (itemObj.roleID === currentSelectId[0]) {
if (prop == true) { if (prop == true) {
if (keyValue == 0) { setRoleID(currentSelectId);
setRoleID(currentSelectId); setFlagSearch(1);
setFlagSearch(1);
} else {
setRoleID('');
setDescrip('内置角色不可配置菜单权限');
setFlagSearch(0);
}
} else { } else {
setRoleID(currentSelectId); setRoleID(currentSelectId);
setFlagSearch(1); setFlagSearch(1);
...@@ -752,14 +764,8 @@ const SiteManage = () => { ...@@ -752,14 +764,8 @@ const SiteManage = () => {
setKeyValue(key); setKeyValue(key);
const { roleID: id } = itemObj; const { roleID: id } = itemObj;
if (id) { if (id) {
if (itemObj.BuiltInRole === true && key == 1) { setRoleID(id);
setRoleID(''); setFlagSearch(1);
setDescrip('内置角色不可配置菜单权限');
setFlagSearch(0);
} else {
setRoleID(id);
setFlagSearch(1);
}
} else { } else {
setRoleID(''); setRoleID('');
setDescrip('当前未选中角色'); setDescrip('当前未选中角色');
...@@ -954,39 +960,51 @@ const SiteManage = () => { ...@@ -954,39 +960,51 @@ const SiteManage = () => {
</div> </div>
)} )}
</TabPane> </TabPane>
<TabPane tab="菜单权限" key="1"> {!itemObj.BuiltInRole && (
{flagSearch == 1 ? ( <TabPane tab="菜单权限" key="1">
<Search {flagSearch == 1 ? (
style={{ width: 260 }} <Search
allowClear style={{ width: 260 }}
value={searchWord} allowClear
placeholder={placeholder} value={searchWord}
// onSearch={handleSearch} placeholder={placeholder}
onChange={handleChange} // onSearch={handleSearch}
enterButton onChange={handleChange}
/> enterButton
) : (
<span />
)}
{roleID ? (
<div className={styles.cardBoxR}>
<ListCard
roleID={roleID}
loading={loading}
checkList={valueList}
dataList={dataList}
searchWord={searchWord}
onCommit={handleCommit}
btnLoading={btnLoading}
hasData={hasData}
/> />
</div> ) : (
<span />
)}
{roleID ? (
<div className={styles.cardBoxR}>
<ListCard
roleID={roleID}
loading={loading}
checkList={valueList}
dataList={dataList}
searchWord={searchWord}
onCommit={handleCommit}
btnLoading={btnLoading}
hasData={hasData}
/>
</div>
) : (
<div className={styles.cardBoxH}>
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={descrip} />
</div>
)}
</TabPane>
)}
{/* <TabPane tab="菜单权限优化" key="2">
{roleID ? (
<div className={styles.cardBoxR} />
) : ( ) : (
<div className={styles.cardBoxH}> <div className={styles.cardBoxH}>
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={descrip} /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={descrip} />
</div> </div>
)} )}
</TabPane> </TabPane> */}
</Tabs> </Tabs>
</Card> </Card>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment