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

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

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