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

fix: '搭建平台操作权限接口修改'

parent 0f9e7ea2
Pipeline #88446 passed with stages
...@@ -11,8 +11,15 @@ import { ...@@ -11,8 +11,15 @@ import {
Space, Space,
Checkbox, Checkbox,
notification, notification,
Radio,
Popconfirm,
} from 'antd'; } from 'antd';
import { getRolePermission, updateRolePermission } from '@/services/RoleManage/api'; import {
getRolePermission,
updateRolePermission,
getRolePermissionTable,
updateRolePermissionTable,
} from '@/services/RoleManage/api';
import styles from './SelectUser.less'; import styles from './SelectUser.less';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
...@@ -24,6 +31,7 @@ const OpePermissions = props => { ...@@ -24,6 +31,7 @@ const OpePermissions = props => {
const [option, setOption] = useState([]); const [option, setOption] = useState([]);
const [groupList, setGroupList] = useState([]); const [groupList, setGroupList] = useState([]);
const [keepGroupList, setKeepGroupList] = useState([]); const [keepGroupList, setKeepGroupList] = useState([]);
const [value4, setValue4] = useState('BI');
useEffect(() => { useEffect(() => {
getInitialData(); getInitialData();
...@@ -51,9 +59,30 @@ const OpePermissions = props => { ...@@ -51,9 +59,30 @@ const OpePermissions = props => {
}); });
}; };
const getTableData = () => {
setLoading(true);
getRolePermissionTable({ roleId: roleID })
.then(res => {
if (res.code === 0) {
setLoading(false);
setOption(res.data.dicPermissions);
setGroupList(res.data.projectPermission);
setKeepGroupList(res.data.projectPermission);
getAllData(res.data.projectPermission);
} else {
setOption([]);
setGroupList([]);
getAllData({});
}
})
.catch(err => {
setLoading(false);
});
};
const getAllData = val => { const getAllData = val => {
let obj = { 预览: [], 编辑: [], 发布: [], 删除: [], 导出: [] }; let obj = { 预览: [], 编辑: [], 发布: [], 删除: [], 导出: [] };
val.map(i => { val?.map(i => {
if (i.permission.indexOf('预览') !== -1) { if (i.permission.indexOf('预览') !== -1) {
obj.预览 = [...obj.预览, i.projectName]; obj.预览 = [...obj.预览, i.projectName];
} }
...@@ -172,32 +201,82 @@ const OpePermissions = props => { ...@@ -172,32 +201,82 @@ const OpePermissions = props => {
permission: item.permission.toString(), permission: item.permission.toString(),
}); });
}); });
updateRolePermission({ roleId: roleID, permissons: arr }).then(res => { if (value4 === 'BI') {
if (res.code === 0) { updateRolePermission({ roleId: roleID, permissons: arr }).then(res => {
notification.success({ if (res.code === 0) {
message: '提示', notification.success({
duration: 3, message: '提示',
description: '设置成功', duration: 3,
}); description: '设置成功',
getInitialData(); });
} else { getInitialData();
notification.error({ } else {
message: '提示', notification.error({
duration: 3, message: '提示',
description: res.msg, duration: 3,
}); description: res.msg,
} });
}); }
});
} else {
updateRolePermissionTable({ roleId: roleID, permissons: arr }).then(res => {
if (res.code === 0) {
notification.success({
message: '提示',
duration: 3,
description: '设置成功',
});
getTableData();
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
}
} else { } else {
message.warning('请更改后再保存!'); message.warning('请更改后再保存!');
} }
}; };
const optionsWithDisabled = [
{
label: 'BI操作权限',
value: 'BI',
},
{
label: '报表操作权限',
value: 'Table',
},
];
const onChange4 = ({ target: { value } }) => {
setGroupList([]);
setKeepGroupList([]);
setCheckAll({});
if (value === 'BI') {
getInitialData();
} else {
getTableData();
}
setValue4(value);
};
return ( return (
<> <>
{/* 头部搜索框 */} {/* 头部搜索框 */}
<div className={styles.header}> <div className={styles.header}>
<div> <div>
<Radio.Group
options={optionsWithDisabled}
onChange={onChange4}
value={value4}
optionType="button"
buttonStyle="solid"
style={{ marginRight: '20px' }}
/>
<Checkbox <Checkbox
style={{ marginRight: '20px' }} style={{ marginRight: '20px' }}
checked={checkAll?.全选} checked={checkAll?.全选}
...@@ -236,9 +315,25 @@ const OpePermissions = props => { ...@@ -236,9 +315,25 @@ const OpePermissions = props => {
导出全选 导出全选
</Checkbox> </Checkbox>
</div> </div>
<Button onClick={onFinish} type="primary" htmlType="submit"> <Popconfirm
提交 placement="bottomRight"
</Button> title={
<p>
确定修改
<span style={{ color: '#1685FF' }}>{value4 === 'BI' ? 'BI' : '报表'}</span>
操作权限吗?
</p>
}
okText="确认"
cancelText="取消"
onConfirm={() => {
onFinish();
}}
>
<Button type="primary" htmlType="submit">
提交
</Button>
</Popconfirm>
</div> </div>
<div className={styles.pushTestContent}> <div className={styles.pushTestContent}>
<div className={styles.leftContent}> <div className={styles.leftContent}>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 0 20px; padding: 0;
} }
.pushTestContent { .pushTestContent {
.ant-table-body { .ant-table-body {
......
...@@ -58,10 +58,18 @@ export const getWebConfigTypes = params => ...@@ -58,10 +58,18 @@ export const getWebConfigTypes = params =>
// 菜单拖拽 // 菜单拖拽
export const DragGroup = params => post(`${PUBLISH_SERVICE}/UserCenter/DragGroup`, params); export const DragGroup = params => post(`${PUBLISH_SERVICE}/UserCenter/DragGroup`, params);
// 获取角色拥有的工程权限 // 获取BI角色拥有的工程权限
export const getRolePermission = params => export const getRolePermission = params =>
get(`/PandaView/publish/RolePermission/GetRolePermission`, params); get(`/PandaView/publish/RolePermission/GetRolePermission`, params);
// 更新角色工程权限 // 更新BI角色工程权限
export const updateRolePermission = params => export const updateRolePermission = params =>
post(`/PandaView/publish/RolePermission/UpdateRolePermission`, params); post(`/PandaView/publish/RolePermission/UpdateRolePermission`, params);
// 获取报表角色拥有的工程权限
export const getRolePermissionTable = params =>
get(`/PandaView/publish/ReportRolePermission/GetRolePermission`, params);
// 更新报表角色工程权限
export const updateRolePermissionTable = params =>
post(`/PandaView/publish/ReportRolePermission/UpdateRolePermission`, params);
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