From 5381a47293605d8f77de09334c1a6cdac84fb995 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Fri, 11 Oct 2024 11:22:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Home/User/index.ts | 7 ++ src/page/Home/User/index.tsx | 145 +++++++++++++++++++++++++++++------ 2 files changed, 129 insertions(+), 23 deletions(-) diff --git a/src/api/Home/User/index.ts b/src/api/Home/User/index.ts index 2664037..0a3b33c 100644 --- a/src/api/Home/User/index.ts +++ b/src/api/Home/User/index.ts @@ -19,6 +19,13 @@ export const PutUser = (data: any) => method: 'put', data }) + +export const PutUserBth = (data: any) => + request({ + url: `/user/bth`, + method: 'put', + data + }) export const DeleteUser = (data: any) => request({ url: `/user`, diff --git a/src/page/Home/User/index.tsx b/src/page/Home/User/index.tsx index 5219e01..0ace807 100644 --- a/src/page/Home/User/index.tsx +++ b/src/page/Home/User/index.tsx @@ -3,7 +3,7 @@ import { useEffect, useState, useRef } from "react"; import Operation from '@/components/Operation'; import { Button, Input, Table, Pagination, Modal, message, Select } from "antd"; import { ExclamationCircleFilled, SearchOutlined } from '@ant-design/icons'; -import { GetUserList, PostUser, PutUser, DeleteUser, PutUserPwd, GetRoleDpList, PostUserImport } from '@/api/Home/User'; +import { GetUserList, PostUser, PutUser, DeleteUser, PutUserPwd, GetRoleDpList, PostUserImport, GetSubDpList, PutUserBth } from '@/api/Home/User'; import * as CryptoJS from 'crypto-js'; import ImageUrl from '@/utils/package/imageUrl'; import { storage } from '@/utils'; @@ -15,7 +15,7 @@ const fs = require('fs').promises; const User: React.FC = () => { const stupWizardRef = useRef(); const [selectedRowKeys, setSelectedRowKeys] = useState([]); - const [isCreateUser, setIsCreateUser] = useState(false); + const [isCreateUser, setIsCreateUser] = useState<'add' | 'batch' | 'edit'>(); const [list, setList] = useState({ data: [], searchKeywod: '', @@ -30,7 +30,9 @@ const User: React.FC = () => { Account: "", RoleId: null, Pwd: "", - UserName: "" + UserName: "", + subject: null, + year: "", }) const [changeUserPawModal, setChangeUserPawModal] = useState(false) const [changeImportModal, setChangeImportModal] = useState(false) @@ -39,6 +41,10 @@ const User: React.FC = () => { newPwd: '', }) const [deleteUserPawModal, setDeleteUserPawModal] = useState(false) + const [subjectList, setSubjectList] = useState([]); + useEffect(() => { + getSubDpList() + }, []); useEffect(() => { getUserList() @@ -61,6 +67,7 @@ const User: React.FC = () => { } }), }) + setSelectedRowKeys([]) } }) } @@ -118,7 +125,13 @@ const User: React.FC = () => { } } } - + const getSubDpList = async (): Promise => { + await GetSubDpList().then(res => { + if (res.code === 200) { + setSubjectList(res.data.map((item: any) => { return { value: item.value, label: item.name } })) + } + }) + } return ( <>
@@ -131,13 +144,15 @@ const User: React.FC = () => { onClick={() => { getRoleDpList((bool: boolean) => { if (bool) { - setIsCreateUser(true) + setIsCreateUser('add') setAddUserFrom({ Id: "", Account: "", RoleId: null, Pwd: "", UserName: "", + subject: null, + year: "", }) setAddUserModal(true) } @@ -154,6 +169,31 @@ const User: React.FC = () => { className='m-ant-btn'> 批量导入用户 +
- +
-
+ {isCreateUser !== 'batch' ?
账号: { }); }} /> -
+
: null}
角色: { }); }} /> +
: null} +
+ 届: + { + const regex = /^[0-9]*$/; + if (regex.test(e.target.value)) { + setAddUserFrom({ + ...addUserFrom, + year: e.target.value + }); + } + }} + /> +
+
+ 学科: +