新增用户备注,管理员可查看和编辑

This commit is contained in:
lq1405 2024-10-30 15:36:49 +08:00
parent 11a23c92df
commit e4801202f7
3 changed files with 46 additions and 13 deletions

View File

@ -113,7 +113,7 @@ const ModifyUser: React.FC<ModifyUserProps> = ({ userId, setFormRef, open }) =>
<Form.Item <Form.Item
label="用户名称" label="用户名称"
name="userName" name="userName"
rules={[{ required: true, message: 'Please input your username!' }]} rules={[{ required: true, message: '请填写用户名称!' }]}
> >
<Input /> <Input />
</Form.Item> </Form.Item>
@ -123,7 +123,7 @@ const ModifyUser: React.FC<ModifyUserProps> = ({ userId, setFormRef, open }) =>
<Form.Item <Form.Item
label="用户昵称" label="用户昵称"
name="nickName" name="nickName"
rules={[{ required: true, message: 'Please input your username!' }]} rules={[{ required: true, message: '请填写用户昵称!' }]}
> >
<Input /> <Input />
</Form.Item> </Form.Item>
@ -132,7 +132,7 @@ const ModifyUser: React.FC<ModifyUserProps> = ({ userId, setFormRef, open }) =>
<Form.Item <Form.Item
label="邮箱" label="邮箱"
name="email" name="email"
rules={[{ required: true, message: 'Please input your username!' }]} rules={[{ required: true, message: '请填写邮箱!' }]}
> >
<Input /> <Input />
</Form.Item> </Form.Item>
@ -149,7 +149,7 @@ const ModifyUser: React.FC<ModifyUserProps> = ({ userId, setFormRef, open }) =>
<Form.Item <Form.Item
label="角色名称" label="角色名称"
name="roleNames" name="roleNames"
rules={[{ required: true, message: 'Please input your username!' }]} rules={[{ required: true, message: '请选择角色名称!' }]}
> >
<Select <Select
mode="multiple" mode="multiple"
@ -165,7 +165,7 @@ const ModifyUser: React.FC<ModifyUserProps> = ({ userId, setFormRef, open }) =>
<Form.Item <Form.Item
label="可激活设备" label="可激活设备"
name="allDeviceCount" name="allDeviceCount"
rules={[{ required: true, message: 'Please input your username!' }]} rules={[{ required: true, message: '请设置可激活设置!' }]}
> >
<InputNumber min={0} step="1" /> <InputNumber min={0} step="1" />
</Form.Item> </Form.Item>
@ -174,7 +174,7 @@ const ModifyUser: React.FC<ModifyUserProps> = ({ userId, setFormRef, open }) =>
<Form.Item <Form.Item
label="代理分成" label="代理分成"
name="agentPercent" name="agentPercent"
rules={[{ required: true, message: 'Please input your username!' }]} rules={[{ required: true, message: '请设置代理分成!' }]}
> >
<InputNumber min={0.1} max={0.7} step="0.01" /> <InputNumber min={0.1} max={0.7} step="0.01" />
</Form.Item> </Form.Item>
@ -183,7 +183,7 @@ const ModifyUser: React.FC<ModifyUserProps> = ({ userId, setFormRef, open }) =>
<Form.Item <Form.Item
label="免费换绑次数" label="免费换绑次数"
name="freeCount" name="freeCount"
rules={[{ required: true, message: 'Please input your username!' }]} rules={[{ required: true, message: '请设置免费换绑次数!' }]}
> >
<InputNumber min={1} max={10} step="1" /> <InputNumber min={1} max={10} step="1" />
</Form.Item> </Form.Item>
@ -192,11 +192,20 @@ const ModifyUser: React.FC<ModifyUserProps> = ({ userId, setFormRef, open }) =>
<Form.Item <Form.Item
label="注册时间" label="注册时间"
name="createdDate" name="createdDate"
rules={[{ required: true, message: 'Please input your username!' }]} rules={[{ required: true, message: '请选择注册时间!' }]}
> >
<Input disabled={true} /> <Input disabled={true} />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}>
<Form.Item
label="备注"
name="remark"
rules={[{ required: true, message: '请输入备注!' }]}
>
<Input />
</Form.Item>
</Col>
</Row> </Row>
<Form.Item wrapperCol={{ offset: 4, span: 3 }}> <Form.Item wrapperCol={{ offset: 4, span: 3 }}>

View File

@ -4,7 +4,7 @@ import { QueryRoleOption } from "@/services/services/role";
import { QueryUserList } from "@/services/services/user"; import { QueryUserList } from "@/services/services/user";
import { FormatDate } from "@/util/time"; import { FormatDate } from "@/util/time";
import { useAccess, useModel } from "@umijs/max"; import { useAccess, useModel } from "@umijs/max";
import { Button, Form, Input, InputNumber, message, Modal, Select, SelectProps, Table, Tag } from "antd"; import { Button, Form, Input, InputNumber, message, Modal, Select, SelectProps, Table, Tag, Tooltip } from "antd";
import { ColumnsType, TablePaginationConfig } from "antd/es/table"; import { ColumnsType, TablePaginationConfig } from "antd/es/table";
import { FilterValue, SorterResult, TableCurrentDataSource } from "antd/es/table/interface"; import { FilterValue, SorterResult, TableCurrentDataSource } from "antd/es/table/interface";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
@ -172,18 +172,31 @@ const UserManagement: React.FC = () => {
title: '创建时间', title: '创建时间',
dataIndex: 'createdDate', dataIndex: 'createdDate',
render: (text, record) => FormatDate(record.createdDate), render: (text, record) => FormatDate(record.createdDate),
width: '200px', width: '160px',
}, },
{ {
title: '上次登录时间', title: '上次登录时间',
dataIndex: 'lastLoginDate', dataIndex: 'lastLoginDate',
render: (text, record) => FormatDate(record.lastLoginDate), render: (text, record) => FormatDate(record.lastLoginDate),
width: '200px', width: '160px',
}, },
{ {
title: '上次登录IP', title: '上次登录IP',
dataIndex: 'lastLoginIp', dataIndex: 'lastLoginIp',
width: '200px', width: '120px',
},
{
title: '备注',
dataIndex: 'remark',
hidden: !access.isAdminOrSuperAdmin,
ellipsis: {
showTitle: false,
},
render: (remark) => (
<Tooltip placement="topLeft" title={remark}>
{remark}
</Tooltip>
),
}, },
{ {
title: '操作', title: '操作',
@ -243,6 +256,16 @@ const UserManagement: React.FC = () => {
</Form.Item> : </Form.Item> :
null null
}
<Form.Item>
</Form.Item>
{
access.isAdminOrSuperAdmin ?
<Form.Item label="备注" name='remark' style={{ marginBottom: 5 }}>
<Input placeholder="请输入备注" />
</Form.Item> :
null
} }
<Form.Item> <Form.Item>
<Button type="primary" htmlType='submit'></Button> <Button type="primary" htmlType='submit'></Button>

View File

@ -43,7 +43,8 @@ declare namespace UserModel {
freeCount: number; freeCount: number;
affiliateCode: string; affiliateCode: string;
createdDate: Date; createdDate: Date;
options: userOptions options: userOptions;
remark?: string;
} }
type userOptions = { type userOptions = {