Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
19dd0baf
Commit
19dd0baf
authored
Nov 26, 2020
by
Maofei94
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 角色选择
parent
1acd91b5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
6 deletions
+110
-6
AddForm.jsx
src/pages/mobileConfig/menuconfig/AddForm.jsx
+0
-1
checkBox.jsx
src/pages/mobileConfig/menuconfig/checkBox.jsx
+71
-0
checkBox.less
src/pages/mobileConfig/menuconfig/checkBox.less
+13
-0
miniMenu.jsx
src/pages/mobileConfig/menuconfig/miniMenu.jsx
+25
-4
miniMenu.less
src/pages/mobileConfig/menuconfig/miniMenu.less
+1
-1
No files found.
src/pages/mobileConfig/menuconfig/AddForm.jsx
View file @
19dd0baf
...
...
@@ -6,7 +6,6 @@ import PicturesWall from '@/components/Upload/index';
const
{
Item
}
=
Form
;
const
AddForm
=
props
=>
{
const
{
submitCallback
,
nodeType
,
nodeObj
,
addType
}
=
props
;
// const [type, setType] = useState(2);
const
[
form
]
=
Form
.
useForm
();
const
[
otherForm
]
=
Form
.
useForm
();
console
.
log
(
nodeObj
,
'nodeObj'
);
...
...
src/pages/mobileConfig/menuconfig/checkBox.jsx
0 → 100644
View file @
19dd0baf
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Checkbox
,
Empty
}
from
'antd'
;
import
styles
from
'./checkBox.less'
;
const
CheckList
=
props
=>
{
const
{
info
,
valueCallback
,
nodeType
}
=
props
;
console
.
log
(
info
,
'info'
);
const
[
list
,
setList
]
=
useState
([]);
const
[
checkList
,
setCheckList
]
=
useState
([]);
const
[
flag
,
setFlag
]
=
useState
(
false
);
const
a
=
'a'
;
useEffect
(()
=>
{
if
(
info
.
pageUrl
)
{
let
arr
=
[...
info
.
relatedRoleList
];
let
arr2
=
[];
arr
.
map
(
item
=>
{
if
(
item
.
related
)
{
arr2
.
push
(
item
.
relatedRoleCode
);
}
});
console
.
log
(
arr2
,
'arr2'
);
setCheckList
(
arr2
);
setList
(
arr
);
setFlag
(
true
);
}
return
()
=>
{
setFlag
(
false
);
setCheckList
([]);
};
},
[
info
]);
const
handleSelect
=
(
e
,
val
)
=>
{
console
.
log
(
e
.
target
,
'e'
,
val
);
let
arr
=
[];
list
.
forEach
(
item
=>
{
if
(
item
.
relatedRoleCode
===
val
)
{
item
.
related
=
e
.
target
.
checked
;
}
});
setList
([...
list
]);
valueCallback
(
list
);
};
return
(
<
div
>
{
nodeType
===
3
||
nodeType
===
4
?
(
<
div
className=
{
styles
.
box
}
>
{
/* <Checkbox>全选/反选</Checkbox> */
}
{
list
&&
list
.
length
>
0
&&
list
.
map
(
item
=>
(
<
div
key=
{
item
.
relatedRoleCode
}
className=
{
styles
.
check
}
>
<
Checkbox
checked=
{
item
.
related
}
onChange=
{
e
=>
{
handleSelect
(
e
,
item
.
relatedRoleCode
);
}
}
>
{
item
.
relatedRoleName
}
</
Checkbox
>
</
div
>
))
}
</
div
>
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
)
}
</
div
>
);
};
export
default
CheckList
;
src/pages/mobileConfig/menuconfig/checkBox.less
0 → 100644
View file @
19dd0baf
.box{
display: flex;
padding: 10px;
margin-top: 10px;
flex-wrap: wrap;
}
.check{
flex-shrink: 0;
flex-grow: 0;
min-width: 150px;
padding-bottom: 10px;
}
\ No newline at end of file
src/pages/mobileConfig/menuconfig/miniMenu.jsx
View file @
19dd0baf
...
...
@@ -31,6 +31,7 @@ import {
import
styles
from
'./miniMenu.less'
;
import
AddForm
from
'./AddForm'
;
import
EditForm
from
'./editForm'
;
import
CheckList
from
'./checkBox'
;
const
MiniMenu
=
props
=>
{
const
[
flag
,
setFlag
]
=
useState
(
1
);
// 刷新标志
...
...
@@ -47,6 +48,7 @@ const MiniMenu = props => {
const
[
nodeObj
,
setNodeObj
]
=
useState
({});
const
[
addType
,
setAddType
]
=
useState
(
''
);
// 添加下级类型
const
[
modalTitle
,
setModalTitle
]
=
useState
(
''
);
const
[
roleList
,
setRoleList
]
=
useState
([]);
// 复选框选中的值
// 获取菜单树
useEffect
(()
=>
{
updateTrees
();
...
...
@@ -74,10 +76,10 @@ const MiniMenu = props => {
setTreeData
(
result
);
console
.
log
(
result
);
// 第一次加载,默认选择第一个组织
if
(
treeFlage
)
{
handleSelect
([
result
[
0
].
menuID
],
false
);
setTreeFlag
(
false
);
}
//
if (treeFlage) {
//
handleSelect([result[0].menuID], false);
//
setTreeFlag(false);
//
}
}
})
.
catch
(
err
=>
{
...
...
@@ -288,6 +290,9 @@ const MiniMenu = props => {
setLoading
(
true
);
console
.
log
(
prop
);
let
obj
=
{
...
prop
};
if
(
nodeType
===
3
||
nodeType
===
4
)
{
obj
.
relatedRoleList
=
String
(
roleList
)
||
''
;
}
editMenu
({
_dc
:
Date
.
now
(),
menuID
,
...
...
@@ -319,6 +324,17 @@ const MiniMenu = props => {
setLoading
(
false
);
});
};
const
valueCallback
=
val
=>
{
console
.
log
(
val
);
let
arr
=
[...
val
];
let
arr2
=
[];
arr
.
map
(
item
=>
{
if
(
item
.
related
)
{
arr2
.
push
(
item
.
relatedRoleCode
);
}
});
setRoleList
(
arr2
);
};
return
(
<
Spin
spinning=
{
loading
}
tip=
"loading..."
>
<
div
...
...
@@ -428,6 +444,11 @@ const MiniMenu = props => {
})
}
>
关联角色
<
CheckList
info=
{
info
}
nodeType=
{
nodeType
}
valueCallback=
{
valueCallback
}
/>
</
div
>
</
div
>
</
Spin
>
...
...
src/pages/mobileConfig/menuconfig/miniMenu.less
View file @
19dd0baf
...
...
@@ -4,7 +4,7 @@
}
.left{
min-width: 300px;
width: 3
0
0px;
width: 3
5
0px;
min-height: 100%;
border: 1px solid #eee;
padding: 10px;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment