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