Commit b86ffb0b authored by TZW's avatar TZW

1215

parent ed5c95b7
......@@ -5,9 +5,9 @@ import { doFetch } from '@/utils/doFetch';
import { useRequest } from 'ahooks';
const TreeNode = Tree.TreeNode;
const initState = {
pcTree: [],
pcCheckedKeys: [],
pcHalfCheckedKeys: [],
pcList: [],
havepremIdList: [],
haveParentIdList: [],
appTree: [],
appCheckedKeys: [],
appHalfCheckedKeys: [],
......@@ -22,8 +22,8 @@ function reducer(state, action) {
case 'changePc':
newState = {
...state,
pcCheckedKeys: [...action.checkedKeys],
pcHalfCheckedKeys: [...action.halfCheckedKeys],
havepremIdList: [...action.checkedKeys],
haveParentIdList: [...action.halfCheckedKeys],
};
break;
case 'changeApp':
......@@ -43,9 +43,9 @@ function reducer(state, action) {
case 'reset':
newState = {
...state,
pcTree: [...action.pcTree],
pcCheckedKeys: [...action.pcCheckedKeys],
pcHalfCheckedKeys: [...action.pcHalfCheckedKeys],
pcList: [...action.pcList],
havepremIdList: [...action.havepremIdList],
haveParentIdList: [...action.haveParentIdList],
// appTree: [...action.appTree],
// appCheckedKeys: [...action.appCheckedKeys],
// appHalfCheckedKeys: [...action.appHalfCheckedKeys]
......@@ -68,9 +68,9 @@ const Permissiontree = (props) => {
const { id, close, treeType } = props,
[state, dispatch] = useReducer(reducer, initState),
{
pcTree,
pcCheckedKeys,
pcHalfCheckedKeys,
pcList,
havepremIdList,
haveParentIdList,
appTree,
appCheckedKeys,
appHalfCheckedKeys,
......@@ -104,7 +104,7 @@ const Permissiontree = (props) => {
manual: true,
onSuccess: (result, params) => {
if (result.code == '0000') {
message.success('权限配置成功!')
message.success('权限配置成功!');
close();
}
},
......@@ -122,8 +122,8 @@ const Permissiontree = (props) => {
roleTree({ roleId: id }).then((res) => {
if (res.code == '0000') {
let data = res?.data || {};
const { pcTree, pcCheckedKeys, pcHalfCheckedKeys } = data;
dispatch({ type: 'reset', pcTree, pcCheckedKeys, pcHalfCheckedKeys });
const { pcList, havepremIdList, haveParentIdList } = data;
dispatch({ type: 'reset', pcList, havepremIdList, haveParentIdList });
}
});
} else {
......@@ -138,10 +138,10 @@ const Permissiontree = (props) => {
}
const saveData = () => {
run({
url: '/sysRolePermission/save',
url: '/auth/sysRolePermission/save',
params: {
roleId: id,
permissionIds: [...pcCheckedKeys, ...pcHalfCheckedKeys],
permissionIds: [...havepremIdList, ...haveParentIdList],
},
});
};
......@@ -156,10 +156,10 @@ const Permissiontree = (props) => {
<Tree
checkable
defaultExpandAll={false}
checkedKeys={pcCheckedKeys}
checkedKeys={havepremIdList}
onCheck={pcCheck}
>
{loop(pcTree || [])}
{loop(pcList || [])}
</Tree>
</div>
{/* <div style={{ flex: 1, minHeight: 100 }}>
......
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-15 09:46:05
* @Last Modified time: 2022-12-15 13:52:19
*/
import * as React from 'react';
......@@ -144,7 +144,7 @@ function Role(props) {
onFinish: async (vals) => {
//console.log(vals);
let res = await doFetch({
url: '/auth/sysPermission/queryAll',
url: '/auth/sysRolePermission/queryAll',
params: { ...vals },
});
//console.log(res);
......@@ -311,7 +311,7 @@ function Role(props) {
<Drawer
title="角色权限"
onClose={() => {
setdrawer((s) => ({
setDrawer((s) => ({
...s,
authorityOpen: false,
}));
......@@ -321,7 +321,7 @@ function Role(props) {
<PermissionTree
id={drawer?.item?.id}
close={() => {
setdrawer((s) => ({
setDrawer((s) => ({
...s,
authorityOpen: false,
item: null,
......
......@@ -84,6 +84,7 @@ function getcolumns(setdrawer) {
{
title: '排序号',
dataIndex: 'sort',
valueType: 'digit',
formItemProps: {
rules: [
{
......
......@@ -88,7 +88,7 @@ export async function sectionSelectByShops(params) {
}
//授权前查询权限树
export async function roleTree(params) {
return request(`/ngic-auth/sysRolePermission/queryAll`, {
return request(`/emspro/auth/sysRolePermission/queryAll`, {
method: 'POST',
data: 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