import { iUserInfo } from '@/types/setting' import consts from '@/utils/consts' import { EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons' import { Button, Form, Input, Modal, Select } from 'antd' import React, { useEffect, useState } from 'react' import { apiAccountDelete } from '../api' import styles from '../index.module.scss' import PswModal from './PswModal' const { Option } = Select export interface iUserModal { visible: boolean loading: boolean userInfo: iUserInfo onCreate: (values: any) => void onCancel: () => void initData: () => void } const userModal:React.FC = ({ visible, loading, onCreate, onCancel, userInfo, initData }) => { const [ form ] = Form.useForm() const [ delLoading, setDelLoading ] = useState(false) const [ showPswModal, setShowPswModal ] = useState(false) useEffect(() => { form.setFieldsValue(userInfo) }, [ visible ]) const delBtnHandler = async () => { setDelLoading(true) const { code = -1 } = await apiAccountDelete(userInfo.id) if (code === consts.RET_CODE.SUCCESS) { onCancel() initData() } setDelLoading(false) } return ( <> { userInfo.id ? <> : '' } } >
{ userInfo.id ? : '' } { !userInfo.id ? 随机密码} iconRender={visible => (visible ? : )} /> : '' }
setShowPswModal(false)} userInfo={userInfo}> ) } export default userModal