| 
					
				 | 
			
			
				@@ -6,11 +6,9 @@ import { useRequest } from 'umi' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const { TabPane } = Tabs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const SetPermission = ({ ID, activeKey }) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const bottom = 10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const [state, setState] = useState({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    checked: true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    frontPermission: [] // 前台权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const [selectdType, setSelectdType] = useState<any[]>([]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const { run: trySetRolePermission } = useRequest( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     (params: API.SetRolePermissionParams) => setRolePermission(params), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -20,22 +18,15 @@ const SetPermission = ({ ID, activeKey }) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const handleOnchange = (e, type) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    setState({ ...state, checked: e.target.checked }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const types = [...selectdType] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const checked = e.target.checked 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const handleOnchange = (checked: boolean, perm: string) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (checked) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      if (!selectdType.includes(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        types.push(type) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        types = types.filter(item => item !== type) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      setSelectdType(types) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(type) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setState({ ...state, frontPermission: [...state.frontPermission, perm] }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setState({ ...state, frontPermission: state.frontPermission.filter(item => item !== perm) }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const handleSubmit = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // trySetRolePermission({ ID, frontPermission: state.checkValue }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    trySetRolePermission({ ID, frontPermission: state.frontPermission }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   useEffect(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (activeKey === '2') { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -63,7 +54,9 @@ const SetPermission = ({ ID, activeKey }) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               <div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 <h4>我的项目</h4> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 <div className="my-2"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  <Checkbox onChange={e => handleOnchange(e, 'access')} checked={state.checked}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  <Checkbox 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    onChange={e => handleOnchange(e.target.checked, 'access')} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    checked={state.frontPermission.includes('access')}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     查看项目 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   </Checkbox> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   <Checkbox onChange={e => handleOnchange(e, 'add')} checked={state.checked}> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -254,7 +247,7 @@ const SetPermission = ({ ID, activeKey }) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </TabPane> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </Tabs> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <Affix offsetBottom={bottom}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <Affix offsetBottom={10}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <Button type="primary" onClick={handleSubmit}> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           提交 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </Button> 
			 |