From d65fbaaedd80bec4fd6d90a23d437d344689435f Mon Sep 17 00:00:00 2001 From: vincentlu <t1341870251@gmail.com> Date: 星期一, 10 二月 2025 08:58:53 +0800 Subject: [PATCH] # --- rsf-admin/src/page/dept/DeptList.jsx | 20 +++++- rsf-admin/src/page/menu/MenuList.jsx | 19 +++++- rsf-admin/src/page/user/UserList.jsx | 84 +++++++++++++++++---------- 3 files changed, 85 insertions(+), 38 deletions(-) diff --git a/rsf-admin/src/page/dept/DeptList.jsx b/rsf-admin/src/page/dept/DeptList.jsx index 9ed9626..253d92f 100644 --- a/rsf-admin/src/page/dept/DeptList.jsx +++ b/rsf-admin/src/page/dept/DeptList.jsx @@ -24,6 +24,7 @@ TextField, Tooltip, Button, + LinearProgress, } from '@mui/material'; import { Add, Edit, Delete, Padding } from '@mui/icons-material'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; @@ -92,7 +93,7 @@ const TreeTableRow = (props) => { const { row, depth = 0, openNodes, setOpenNodes, onEdit, onDelete } = props; const translate = useTranslate(); - + const toggleNode = (id) => { setOpenNodes(prevState => ({ ...prevState, [id]: !prevState[id] })); }; @@ -165,7 +166,7 @@ const refresh = useRefresh(); const [deleteOne] = useDelete(); - const [treeData, setTreeData] = React.useState([]); + const [treeData, setTreeData] = React.useState(null); const [filter, setFilter] = React.useState(""); const [createDialog, setCreateDialog] = React.useState(false); const [editRecord, setEditRecord] = React.useState(null); @@ -293,7 +294,20 @@ </Button> </Box> </Box> - <Card> + <Card sx={{ + position: 'relative', + }}> + {!treeData && ( + <LinearProgress + sx={{ + height: "3px", + position: 'absolute', + top: 0, + left: 0, + right: 0, + }} + /> + )} <TableContainer component={Paper}> <Table size="small"> <TableHead> diff --git a/rsf-admin/src/page/menu/MenuList.jsx b/rsf-admin/src/page/menu/MenuList.jsx index 8b1ed6b..ab0e3c7 100644 --- a/rsf-admin/src/page/menu/MenuList.jsx +++ b/rsf-admin/src/page/menu/MenuList.jsx @@ -25,6 +25,7 @@ Tooltip, Button, Chip, + LinearProgress, } from '@mui/material'; import { Add, Edit, Delete } from '@mui/icons-material'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; @@ -33,7 +34,6 @@ import request from '@/utils/request'; import DeptEdit from './MenuEdit'; import * as Icons from '@mui/icons-material'; - const RESOURCE = 'menu'; const TITLE = 'menu.menu'; @@ -211,7 +211,7 @@ const refresh = useRefresh(); const [deleteOne] = useDelete(); - const [treeData, setTreeData] = React.useState([]); + const [treeData, setTreeData] = React.useState(null); const [filter, setFilter] = React.useState(""); const [createDialog, setCreateDialog] = React.useState(false); const [editRecord, setEditRecord] = React.useState(null); @@ -339,7 +339,20 @@ </Button> </Box> </Box> - <Card> + <Card sx={{ + position: 'relative', + }}> + {!treeData && ( + <LinearProgress + sx={{ + height: "3px", + position: 'absolute', + top: 0, + left: 0, + right: 0, + }} + /> + )} <TableContainer component={Paper}> <Table size="small"> <TableHead> diff --git a/rsf-admin/src/page/user/UserList.jsx b/rsf-admin/src/page/user/UserList.jsx index 25fd5bd..c53310a 100644 --- a/rsf-admin/src/page/user/UserList.jsx +++ b/rsf-admin/src/page/user/UserList.jsx @@ -31,7 +31,7 @@ AutocompleteInput, DeleteButton, } from 'react-admin'; -import { Box, Typography, Card, Stack } from '@mui/material'; +import { Box, Typography, Card, Stack, LinearProgress } from '@mui/material'; import { styled } from '@mui/material/styles'; import UserCreate from "./UserCreate"; import UserPanel from "./UserPanel"; @@ -112,6 +112,56 @@ />, ] +const UserListContent = (props) => { + const { isLoading } = useListContext(); + return ( + <Box sx={{ position: 'relative' }}> + {isLoading && ( + <LinearProgress + sx={{ + height: "2px", + position: 'absolute', + top: 0, + left: 0, + right: 0, + }} + /> + )} + <StyledDatagrid + preferenceKey='user' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <UserPanel />} + expandSingle={true} + omit={['id', 'email', 'idCard', 'birthday', 'realName', 'updateTime', 'createTime', 'memo']} + > + <NumberField source="id" /> + <TextField source="username" label="table.field.user.username" /> + <ReferenceField source="deptId" label="table.field.user.deptId" reference="dept" link={false} sortable={false}> + <TextField source="name" /> + </ReferenceField> + <TextField source="nickname" label="table.field.user.nickname" /> + <TextField source="code" label="table.field.user.code" /> + <TextField source="sex$" label="table.field.user.sex" sortable={false} /> + <TextField source="phone" label="table.field.user.phone" /> + <TextField source="email" label="table.field.user.email" /> + <TextField source="realName" label="table.field.user.realName" /> + <TextField source="idCard" label="table.field.user.idCard" /> + <TextField source="birthday" label="table.field.user.birthday" /> + <RolesField source="roles" label="table.field.user.role" sortable={false} /> + <DateField source="updateTime" label="common.field.updateTime" showTime /> + <DateField source="createTime" label="common.field.createTime" showTime /> + <BooleanField source="statusBool" label="common.field.status" sortable={false} /> + <TextField source="memo" label="common.field.memo" sortable={false} /> + <WrapperField cellClassName="opt" label="common.field.opt"> + <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> + <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> + </WrapperField> + </StyledDatagrid> + </Box> + ) +} + const UserList = () => { const translate = useTranslate(); @@ -144,37 +194,7 @@ perPage={DEFAULT_PAGE_SIZE} aside={<UserListAside />} > - <StyledDatagrid - preferenceKey='user' - bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} - rowClick={(id, resource, record) => false} - expand={() => <UserPanel />} - expandSingle={true} - omit={['id', 'email', 'idCard', 'birthday', 'realName', 'updateTime', 'createTime', 'memo']} - > - <NumberField source="id" /> - <TextField source="username" label="table.field.user.username" /> - <ReferenceField source="deptId" label="table.field.user.deptId" reference="dept" link={false} sortable={false}> - <TextField source="name" /> - </ReferenceField> - <TextField source="nickname" label="table.field.user.nickname" /> - <TextField source="code" label="table.field.user.code" /> - <TextField source="sex$" label="table.field.user.sex" sortable={false} /> - <TextField source="phone" label="table.field.user.phone" /> - <TextField source="email" label="table.field.user.email" /> - <TextField source="realName" label="table.field.user.realName" /> - <TextField source="idCard" label="table.field.user.idCard" /> - <TextField source="birthday" label="table.field.user.birthday" /> - <RolesField source="roles" label="table.field.user.role" sortable={false} /> - <DateField source="updateTime" label="common.field.updateTime" showTime /> - <DateField source="createTime" label="common.field.createTime" showTime /> - <BooleanField source="statusBool" label="common.field.status" sortable={false} /> - <TextField source="memo" label="common.field.memo" sortable={false} /> - <WrapperField cellClassName="opt" label="common.field.opt"> - <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> - <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> - </WrapperField> - </StyledDatagrid> + <UserListContent /> </List> <UserCreate open={createDialog} -- Gitblit v1.9.1