Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
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
Dida Adams Arizona
Tia-dev
Commits
619fd806
Commit
619fd806
authored
Sep 07, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update again
parent
6030f5e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
23 deletions
+75
-23
UserRole.js
src/container/Otorisasi/UserRole.js
+1
-1
AddRole.js
src/container/Otorisasi/UserRole/AddRole.js
+1
-20
EditRole.js
src/container/Otorisasi/UserRole/EditRole.js
+73
-2
No files found.
src/container/Otorisasi/UserRole.js
View file @
619fd806
...
...
@@ -152,7 +152,7 @@ class UserRole extends Component {
handleChange
(
e
)
{
let
data
=
this
.
state
window
.
requestIdleCallback
((
e
)
=>
this
.
setState
({
...
data
,
[
e
.
target
.
name
]:
e
.
target
.
value
},
()
=>
{
alert
(
'asdk'
)
//
alert('asdk')
}))
}
...
...
src/container/Otorisasi/UserRole/AddRole.js
View file @
619fd806
...
...
@@ -324,23 +324,9 @@ export default class AddRole extends Component {
let
indexButtonID
=
this
.
state
.
privileges
[
indexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
privileges
=
this
.
state
.
privileges
let
button_id
=
privileges
[
indexID
].
button_id
// const handlePushChild = (item) => {
// let indexIDzz = company.findIndex((val) => val === item.id)
// if (indexIDzz === -1) {
// company.push(item.id)
// }
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items,indexs) => {
// handlePushChild(items)
// })
// }
// }
// }
if
(
indexButtonID
===
-
1
)
{
button_id
.
push
(
index
)
// console.log(item)
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
items
.
menu_id
)
...
...
@@ -356,8 +342,6 @@ export default class AddRole extends Component {
if
(
subIndexButtonID
===
-
1
)
{
subButton_id
.
push
(
index
)
}
// privileges[subIndexID].button_id = subButton_id
// console.log(subButton_id)
}
})
}
...
...
@@ -381,7 +365,6 @@ export default class AddRole extends Component {
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
subButton_id
=
privileges
[
subIndexID
].
button_id
if
(
subIndexButtonID
!==
-
1
)
{
// console.log('masuk pa eko', subIndexID)
subButton_id
.
splice
(
subIndexButtonID
,
1
)
privileges
[
subIndexID
].
button_id
=
subButton_id
if
(
privileges
[
subIndexID
].
button_id
.
length
<
1
)
{
...
...
@@ -421,9 +404,7 @@ export default class AddRole extends Component {
if
(
button_id
.
length
===
0
)
{
privileges
.
splice
(
indexID
,
1
)
}
this
.
setState
({
privileges
:
privileges
.
sort
((
a
,
b
)
=>
a
.
menu_id
-
b
.
menu_id
)
},
()
=>
{
console
.
log
(
this
.
state
.
privileges
)
})
this
.
setState
({
privileges
:
privileges
.
sort
((
a
,
b
)
=>
a
.
menu_id
-
b
.
menu_id
)
})
}
handleDate
(
item
)
{
...
...
src/container/Otorisasi/UserRole/EditRole.js
View file @
619fd806
...
...
@@ -299,16 +299,87 @@ export default class EditRole extends Component {
let
indexButtonID
=
this
.
state
.
privileges
[
indexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
privileges
=
this
.
state
.
privileges
let
button_id
=
privileges
[
indexID
].
button_id
if
(
indexButtonID
===
-
1
)
{
button_id
.
push
(
index
)
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
items
.
menu_id
)
if
(
subIndexID
===
-
1
)
{
console
.
log
(
'masuk pa eko'
,
subIndexID
)
privileges
.
push
({
menu_id
:
items
.
menu_id
,
button_id
:
[
index
]
})
}
else
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
subButton_id
=
privileges
[
subIndexID
].
button_id
if
(
subIndexButtonID
===
-
1
)
{
subButton_id
.
push
(
index
)
}
}
})
}
if
(
item
.
reference
!==
null
&&
item
.
reference
!==
13
&&
item
.
reference
!==
1
)
{
let
refIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
if
(
refIndexID
!==
-
1
)
{
let
refIndexButtonID
=
privileges
[
refIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
refButton_id
=
privileges
[
refIndexID
].
button_id
if
(
refIndexButtonID
===
-
1
)
{
refButton_id
.
push
(
index
)
}
privileges
[
refIndexID
].
button_id
=
refButton_id
}
}
}
else
{
button_id
.
splice
(
indexButtonID
,
1
)
if
(
item
.
sub_menu
.
length
>
0
)
{
item
.
sub_menu
.
map
((
items
,
indexs
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
items
.
menu_id
)
if
(
subIndexID
!==
-
1
)
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
subButton_id
=
privileges
[
subIndexID
].
button_id
if
(
subIndexButtonID
!==
-
1
)
{
subButton_id
.
splice
(
subIndexButtonID
,
1
)
privileges
[
subIndexID
].
button_id
=
subButton_id
if
(
privileges
[
subIndexID
].
button_id
.
length
<
1
)
{
privileges
.
splice
(
subIndexID
,
1
)
}
}
}
})
}
if
(
item
.
reference
!==
null
&&
item
.
reference
!==
13
&&
item
.
reference
!==
1
)
{
let
refIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
if
(
refIndexID
!==
-
1
)
{
let
refIndexButtonID
=
privileges
[
refIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
let
refButton_id
=
privileges
[
refIndexID
].
button_id
let
indexIDapp
=
this
.
state
.
application
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
let
indexIDset
=
this
.
state
.
setting
.
findIndex
((
val
)
=>
val
.
menu_id
===
item
.
reference
)
let
indexIDs
=
indexIDapp
==
-
1
?
indexIDset
:
indexIDapp
let
array
=
indexIDapp
==
-
1
?
this
.
state
.
setting
:
this
.
state
.
application
let
splicer
=
0
array
[
indexIDs
].
sub_menu
.
map
((
refItem
,
refIndex
)
=>
{
let
subIndexID
=
privileges
.
findIndex
((
val
)
=>
val
.
menu_id
===
refItem
.
menu_id
)
if
(
subIndexID
!==
-
1
)
{
let
subIndexButtonID
=
privileges
[
subIndexID
].
button_id
.
findIndex
((
val
)
=>
val
===
index
)
if
(
subIndexButtonID
!==
-
1
)
{
splicer
+=
1
}
}
})
if
(
refIndexButtonID
!==
-
1
&&
splicer
<
1
)
{
refButton_id
.
splice
(
refIndexButtonID
,
1
)
}
privileges
[
refIndexID
].
button_id
=
refButton_id
}
}
}
privileges
[
indexID
].
button_id
=
button_id
privileges
[
indexID
].
button_id
=
button_id
.
sort
((
a
,
b
)
=>
a
-
b
)
if
(
button_id
.
length
===
0
)
{
privileges
.
splice
(
indexID
,
1
)
}
this
.
setState
({
privileges
})
this
.
setState
({
privileges
:
privileges
.
sort
((
a
,
b
)
=>
a
.
menu_id
-
b
.
menu_id
)
})
}
handleCollapse
(
item
)
{
...
...
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