|
@@ -5,7 +5,7 @@ import { setRolePermission } from '@/services/permission'
|
|
|
import { useRequest } from 'umi'
|
|
|
const { TabPane } = Tabs
|
|
|
|
|
|
-const SetPermission = ({ ID, activeKey, roleType }) => {
|
|
|
+const SetPermission = ({ ID, activeKey }) => {
|
|
|
const bottom = 10
|
|
|
const [state, setState] = useState({
|
|
|
checkValue: []
|
|
@@ -13,7 +13,7 @@ const SetPermission = ({ ID, activeKey, roleType }) => {
|
|
|
console.log(state.checkValue)
|
|
|
|
|
|
const { run: trySetRolePermission } = useRequest(
|
|
|
- (frontPermission: string) => setRolePermission({ ID, frontPermission }),
|
|
|
+ (params: API.SetRolePermissionParams) => setRolePermission(params),
|
|
|
{
|
|
|
manual: true,
|
|
|
onSuccess: () => {
|
|
@@ -22,8 +22,10 @@ const SetPermission = ({ ID, activeKey, roleType }) => {
|
|
|
}
|
|
|
)
|
|
|
const handleOnchange = e => {
|
|
|
- setState({ ...state, checkValue: e })
|
|
|
- // trySetRolePermission(ID, e)
|
|
|
+ setState({ ...state, checkValue: e[0] })
|
|
|
+ }
|
|
|
+ const handleSubmit = () => {
|
|
|
+ trySetRolePermission({ ID, frontPermission: state.checkValue })
|
|
|
}
|
|
|
useEffect(() => {
|
|
|
if (activeKey === '2') {
|
|
@@ -248,7 +250,7 @@ const SetPermission = ({ ID, activeKey, roleType }) => {
|
|
|
</TabPane>
|
|
|
</Tabs>
|
|
|
<Affix offsetBottom={bottom}>
|
|
|
- <Button type="primary" onClick={handleOnchange}>
|
|
|
+ <Button type="primary" onClick={handleSubmit}>
|
|
|
提交
|
|
|
</Button>
|
|
|
</Affix>
|