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
27ece2de
Commit
27ece2de
authored
Oct 19, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '修改流程中心接口'
parent
7425e91b
Pipeline
#80330
canceled with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
204 additions
and
7 deletions
+204
-7
index.jsx
src/components/RuleConfig/index.jsx
+0
-7
RecursiveCheckbox.jsx
src/pages/userCenter/roleManage/RecursiveCheckbox.jsx
+41
-0
OpePermissions.jsx
...pages/userCenter/roleManage/SelectUser/OpePermissions.jsx
+163
-0
No files found.
src/components/RuleConfig/index.jsx
View file @
27ece2de
...
...
@@ -52,13 +52,6 @@ const RuleConfig = props => {
message
.
error
(
'请检查规则是否正确'
);
}
});
// RuleValidation({ ruleContent: rule, flowId: flowID }).then(res => {
// if (res.data) {
// onSubumit(rule);
// } else {
// message.error('请检查规则是否正确');
// }
// });
}
else
{
onSubumit
(
''
);
handleCancel
();
...
...
src/pages/userCenter/roleManage/RecursiveCheckbox.jsx
0 → 100644
View file @
27ece2de
import
React
,
{
useState
}
from
'react'
;
import
{
Checkbox
}
from
'antd'
;
const
RecursiveCheckbox
=
({
data
,
parentChecked
,
onCheckChange
})
=>
{
const
[
checked
,
setChecked
]
=
useState
(
parentChecked
);
const
[
indeterminate
,
setIndeterminate
]
=
useState
(
false
);
const
handleCheckChange
=
e
=>
{
setChecked
(
e
.
target
.
checked
);
onCheckChange
(
e
.
target
.
checked
);
};
const
handleChildCheckChange
=
childChecked
=>
{
if
(
!
childChecked
&&
checked
)
{
setChecked
(
false
);
setIndeterminate
(
true
);
}
else
if
(
childChecked
&&
!
checked
)
{
setChecked
(
true
);
setIndeterminate
(
false
);
}
};
return
(
<
div
>
<
Checkbox
checked=
{
checked
}
indeterminate=
{
indeterminate
}
onChange=
{
handleCheckChange
}
>
{
data
.
name
}
</
Checkbox
>
{
data
.
children
&&
data
.
children
.
map
(
child
=>
(
<
RecursiveCheckbox
key=
{
child
.
id
}
data=
{
child
}
parentChecked=
{
checked
}
onCheckChange=
{
handleChildCheckChange
}
/>
))
}
</
div
>
);
};
export
default
RecursiveCheckbox
;
src/pages/userCenter/roleManage/SelectUser/OpePermissions.jsx
0 → 100644
View file @
27ece2de
import
React
,
{
useState
,
useEffect
,
useCallback
,
useRef
,
useMemo
}
from
'react'
;
import
{
Modal
,
Input
,
Button
,
message
,
Spin
,
Pagination
,
Table
,
Tooltip
,
Space
,
Checkbox
,
notification
,
}
from
'antd'
;
import
{
getRolePermission
,
updateRolePermission
}
from
'@/services/RoleManage/api'
;
import
styles
from
'./SelectUser.less'
;
const
CheckboxGroup
=
Checkbox
.
Group
;
const
OpePermissions
=
props
=>
{
const
{
confirmModal
,
onCancel
,
visible
,
itemObj
,
roleID
}
=
props
;
const
[
checkedList
,
setCheckedList
]
=
useState
();
const
[
indeterminate
,
setIndeterminate
]
=
useState
(
true
);
const
[
checkAll
,
setCheckAll
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
option
,
setOption
]
=
useState
([]);
const
[
groupList
,
setGroupList
]
=
useState
([]);
const
[
keepGroupList
,
setKeepGroupList
]
=
useState
([]);
useEffect
(()
=>
{
getInitialData
();
},
[
itemObj
]);
// 获取初始数据
const
getInitialData
=
()
=>
{
setLoading
(
true
);
getRolePermission
({
roleId
:
roleID
})
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
code
===
0
)
{
setOption
(
res
.
data
.
dicPermissions
);
setGroupList
(
res
.
data
.
projectPermission
);
setKeepGroupList
(
res
.
data
.
projectPermission
);
}
else
{
setOption
([]);
setGroupList
([]);
}
})
.
catch
(
err
=>
{
setLoading
(
false
);
});
};
const
onChange
=
(
list
,
id
)
=>
{
let
newData
=
JSON
.
parse
(
JSON
.
stringify
(
groupList
));
let
item
=
newData
.
find
(
i
=>
i
.
projeectId
===
id
);
let
index
=
newData
.
findIndex
(
i
=>
i
.
projeectId
===
id
);
item
.
permission
=
list
;
newData
[
index
]
=
item
;
setGroupList
(
newData
);
};
const
onCheckAllChange
=
(
e
,
id
)
=>
{
let
newData
=
JSON
.
parse
(
JSON
.
stringify
(
groupList
));
let
item
=
newData
.
find
(
i
=>
i
.
projeectId
===
id
);
let
index
=
newData
.
findIndex
(
i
=>
i
.
projeectId
===
id
);
item
.
permission
=
e
.
target
.
checked
?
option
:
[];
newData
[
index
]
=
item
;
setGroupList
(
newData
);
};
// 提交勾选人员
const
onFinish
=
()
=>
{
let
arrList
=
[];
groupList
.
forEach
(
item
=>
{
let
data
=
keepGroupList
.
find
(
i
=>
i
.
projeectId
===
item
.
projeectId
);
if
(
item
.
permission
.
length
!==
data
.
permission
.
length
)
{
arrList
.
push
(
item
);
}
});
console
.
log
(
arrList
);
debugger
;
let
arr
=
[];
if
(
arrList
.
length
>
0
)
{
arrList
.
forEach
(
item
=>
{
arr
.
push
({
projectId
:
item
.
projeectId
,
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
,
});
}
});
}
else
{
message
.
warning
(
'请更改后再保存!'
);
}
};
return
(
<>
{
/* 头部搜索框 */
}
<
div
className=
{
styles
.
headerLeft
}
>
<
Button
onClick=
{
onFinish
}
type=
"primary"
htmlType=
"submit"
>
提交
</
Button
>
</
div
>
<
div
className=
{
styles
.
pushTestContent
}
>
<
div
className=
{
styles
.
leftContent
}
>
{
/* 复选框模块 */
}
<
div
className=
{
styles
.
checkScrollBox
}
>
<
Spin
spinning=
{
loading
}
>
<
div
className=
{
styles
.
checkContainer
}
>
{
groupList
?.
map
((
item
,
index
)
=>
(
<
div
className=
{
styles
.
checkBoxContent
}
key=
{
item
.
projeectId
}
>
<
div
className=
{
styles
.
checkContent
}
>
<
div
className=
{
styles
.
topCheckbox
}
>
<
Checkbox
indeterminate=
{
item
.
permission
.
length
>
0
&&
item
.
permission
.
length
<
option
?.
length
}
onChange=
{
e
=>
onCheckAllChange
(
e
,
item
.
projeectId
)
}
checked=
{
item
.
permission
.
length
===
option
?.
length
}
>
{
`${item.projeectId}-${item.projectName}`
}
</
Checkbox
>
</
div
>
<
div
className=
{
styles
.
bottomCheckbox
}
>
<
CheckboxGroup
value=
{
item
.
permission
}
onChange=
{
list
=>
onChange
(
list
,
item
.
projeectId
)
}
style=
{
{
display
:
'flex'
,
flexWrap
:
'wrap'
}
}
>
{
option
.
map
(
i
=>
(
<
Checkbox
key=
{
i
}
value=
{
i
}
>
<
span
className=
{
styles
.
fontlabel
}
>
{
i
}
</
span
>
</
Checkbox
>
))
}
</
CheckboxGroup
>
</
div
>
</
div
>
</
div
>
))
}
</
div
>
</
Spin
>
</
div
>
</
div
>
</
div
>
</>
);
};
export
default
OpePermissions
;
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