import React, { useEffect, useState, useRef } from 'react'; import { connect } from 'react-redux'; import { Col, Row, Modal, Form } from '@douyinfe/semi-ui'; import '../style.less' const employeeAuthUserModal = (props) => { const form = useRef(); const { dispatch, actions, handleCancelUser, visibleUser, getRoleList, roleList,userRoleList } = props const [userValue, setUserValue] = useState([]); const handleOk = () => { form.current.validate() .then((values) => { dispatch(actions.humanAffairs.addUserRole(values)).then(e => { if (e.success) { getRoleList() handleCancelUser() } }) }) .catch((errors) => { console.log(errors); }); }; let message = '该项为必填项'; let hrUser = JSON.parse(sessionStorage.getItem('hrUser')) const seleRole = (value)=>{ let userValue = [] userRoleList&&userRoleList.rows&&userRoleList.rows.forEach(e=> { if(e.roleId == value){ userValue.push(e.userId) } }) form.current.setValue('userId',userValue) } return ( <>
(form.current = formApi)} labelPosition={'left'} labelAlign={'right'} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} > {/* */} { roleList && roleList.rows.map(e => { return ( {e.name} ) }) } { hrUser.userListArr.map(e => { return ( {e.name} ) }) }
) } function mapStateToProps(state) { const { auth, global, roleList } = state; return { user: auth.user, actions: global.actions, roleList: roleList.data, }; } export default connect(mapStateToProps)(employeeAuthUserModal);