Commit b86ffb0b authored by TZW's avatar TZW

1215

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