Commit 4d71e5cc authored by littleforest's avatar littleforest

feat: changed init state issues

parent 232e6205
...@@ -10,19 +10,7 @@ import { PlusOutlined } from '@ant-design/icons'; ...@@ -10,19 +10,7 @@ import { PlusOutlined } from '@ant-design/icons';
import type { ActionType } from '@ant-design/pro-components'; import type { ActionType } from '@ant-design/pro-components';
import { PageContainer } from '@ant-design/pro-components'; import { PageContainer } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components'; import { ProTable } from '@ant-design/pro-components';
import { import { Button, Col, Divider, Form, Input, Modal, Radio, Row, Switch, message } from 'antd';
Button,
Col,
Divider,
Form,
Input,
Modal,
Radio,
Row,
Select,
Switch,
message,
} from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { useRef, useState } from 'react'; import { useRef, useState } from 'react';
...@@ -30,6 +18,8 @@ import styles from './index.less'; ...@@ -30,6 +18,8 @@ import styles from './index.less';
import { Exclamtion } from '@/components/Icons/Icons'; import { Exclamtion } from '@/components/Icons/Icons';
const { Item } = Form; const { Item } = Form;
const { Password } = Input;
const layout = { const layout = {
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 18 }, wrapperCol: { span: 18 },
...@@ -59,11 +49,7 @@ const UserManage = () => { ...@@ -59,11 +49,7 @@ const UserManage = () => {
const [ressetLoading, setResetLoading] = useState(false); const [ressetLoading, setResetLoading] = useState(false);
const [accountModalName, setAccountModalName] = useState('新建账号'); const [accountModalName, setAccountModalName] = useState('新建账号');
const [accountForm] = Form.useForm(); const [accountForm] = Form.useForm();
const [resetPasswordForm] = Form.useForm();
const isActiveSelectOption = [
{ label: '启用', value: true },
{ label: '禁用', value: false },
];
const showModal = () => { const showModal = () => {
getRole().then((res) => { getRole().then((res) => {
...@@ -131,7 +117,7 @@ const UserManage = () => { ...@@ -131,7 +117,7 @@ const UserManage = () => {
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
key: 'option', key: 'option',
render: (text, record, _, action) => [ render: (_text, record, _, _action) => [
<a <a
key="editable" key="editable"
onClick={() => { onClick={() => {
...@@ -194,6 +180,7 @@ const UserManage = () => { ...@@ -194,6 +180,7 @@ const UserManage = () => {
.then((res) => { .then((res) => {
setLoading(false); setLoading(false);
setIsModalAccountOpen(false); setIsModalAccountOpen(false);
accountForm.resetFields();
actionRef.current?.reload(); actionRef.current?.reload();
}) })
.catch((error) => { .catch((error) => {
...@@ -212,6 +199,7 @@ const UserManage = () => { ...@@ -212,6 +199,7 @@ const UserManage = () => {
setLoading(false); setLoading(false);
setIsModalAccountOpen(false); setIsModalAccountOpen(false);
message.success('编辑成功'); message.success('编辑成功');
accountForm.resetFields();
actionRef.current?.reload(); actionRef.current?.reload();
}) })
.catch((error) => { .catch((error) => {
...@@ -277,6 +265,7 @@ const UserManage = () => { ...@@ -277,6 +265,7 @@ const UserManage = () => {
setResetLoading(false); setResetLoading(false);
setIsModalResetPassword(false); setIsModalResetPassword(false);
actionRef.current?.reload(); actionRef.current?.reload();
resetPasswordForm.resetFields();
message.success('重置成功'); message.success('重置成功');
}) })
.catch((err) => { .catch((err) => {
...@@ -312,7 +301,12 @@ const UserManage = () => { ...@@ -312,7 +301,12 @@ const UserManage = () => {
}} }}
footer={null} footer={null}
> >
<Form {...resetLayout} onFinish={handleClickOpenModalReset} name="resetPassword"> <Form
form={resetPasswordForm}
{...resetLayout}
onFinish={handleClickOpenModalReset}
name="resetPassword"
>
<Item <Item
name={'newPassword'} name={'newPassword'}
label={'新密码'} label={'新密码'}
...@@ -387,7 +381,7 @@ const UserManage = () => { ...@@ -387,7 +381,7 @@ const UserManage = () => {
{ validator: validatePassword }, { validator: validatePassword },
]} ]}
> >
<Input /> <Password />
</Item> </Item>
</> </>
)} )}
...@@ -448,7 +442,7 @@ const UserManage = () => { ...@@ -448,7 +442,7 @@ const UserManage = () => {
}} }}
rowKey="id" rowKey="id"
pagination={{ pagination={{
pageSize: 5, pageSize: 9,
onChange: (page) => {}, onChange: (page) => {},
}} }}
options={false} options={false}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment