|
@@ -1,5 +1,6 @@
|
|
|
import { iUserInfo } from '@/types/setting'
|
|
|
import consts from '@/utils/consts'
|
|
|
+import { generatePsw } from '@/utils/util'
|
|
|
import { EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons'
|
|
|
import { Form, Input, message, Modal } from 'antd'
|
|
|
import React, { useEffect, useState } from 'react'
|
|
@@ -30,6 +31,11 @@ const PswModal:React.FC<iPswModalProps> = ({ visible, onCancel, userInfo: { id,
|
|
|
useEffect(() => {
|
|
|
form.setFieldsValue({ id, ps_account: account })
|
|
|
}, [ visible ])
|
|
|
+
|
|
|
+ const pswHandler = () => {
|
|
|
+ const ps_password = generatePsw(12)
|
|
|
+ form.setFieldsValue({ ps_password })
|
|
|
+ }
|
|
|
return (
|
|
|
<div>
|
|
|
<Modal
|
|
@@ -61,7 +67,7 @@ const PswModal:React.FC<iPswModalProps> = ({ visible, onCancel, userInfo: { id,
|
|
|
<Form.Item name="ps_password" label="登录密码" rules={[ { required: true, message: '请输入登录密码' } ]}>
|
|
|
<Input.Password
|
|
|
placeholder="密码支持英文数字及符号"
|
|
|
- addonAfter={<span>随机密码</span>}
|
|
|
+ addonAfter={<span className="pi-pd-lr-11" onClick={() => pswHandler()}>随机密码</span>}
|
|
|
iconRender={visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />)}
|
|
|
/>
|
|
|
</Form.Item>
|