From c66ba17bb42d7d570e215c2d7214af5945581a1c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 09 九月 2024 10:16:35 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/page/user/UserCreate.jsx | 221 +++++++++++++++
zy-acs-flow/src/i18n/en.js | 18 +
zy-acs-flow/src/page/user/index.jsx | 18 +
zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java | 4
zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/UserController.java | 44 +-
zy-acs-flow/src/page/ResourceContent.js | 3
zy-acs-flow/src/page/user/UserList.jsx | 185 +++++++++++++
zy-acs-flow/src/page/user/UserPanel.jsx | 135 +++++++++
zy-acs-flow/src/i18n/zh.js | 18 +
zy-acs-flow/src/page/user/UserEdit.jsx | 193 +++++++++++++
10 files changed, 813 insertions(+), 26 deletions(-)
diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js
index 7f2173f..4229b1d 100644
--- a/zy-acs-flow/src/i18n/en.js
+++ b/zy-acs-flow/src/i18n/en.js
@@ -67,6 +67,7 @@
tenant: 'Tenant',
role: 'Role',
userLogin: 'Token',
+ user: 'User',
},
table: {
field: {
@@ -124,12 +125,27 @@
icon: "icon",
sort: "sort",
meta: "meta",
-
enums: {
menu: 'Menu',
button: 'Button',
}
},
+ user: {
+ username: "username",
+ password: "password",
+ nickname: "nickname",
+ avatar: "avatar",
+ code: "code",
+ sex: "sex",
+ phone: "phone",
+ email: "email",
+ emailVerified: "email verified",
+ deptId: "deptId",
+ realName: "real name",
+ idCard: "idCard",
+ birthday: "birthday",
+ introduction: "introduction",
+ },
}
}
};
diff --git a/zy-acs-flow/src/i18n/zh.js b/zy-acs-flow/src/i18n/zh.js
index 2d4c194..bfe69ed 100644
--- a/zy-acs-flow/src/i18n/zh.js
+++ b/zy-acs-flow/src/i18n/zh.js
@@ -67,6 +67,7 @@
tenant: '绉熸埛绠$悊',
role: '瑙掕壊绠$悊',
userLogin: '鐧诲綍鏃ュ織',
+ user: '鐢ㄦ埛绠$悊',
},
table: {
field: {
@@ -124,12 +125,27 @@
icon: "鍥炬爣",
sort: "鎺掑簭",
meta: "鍏�",
-
enums: {
menu: '鑿滃崟',
button: '鎸夐挳',
}
},
+ user: {
+ username: "璐﹀彿",
+ password: "瀵嗙爜",
+ nickname: "鏄电О",
+ avatar: "澶村儚",
+ code: "浠e彿",
+ sex: "鎬у埆",
+ phone: "鑱旂郴鏂瑰紡",
+ email: "閭",
+ emailVerified: "閭楠岃瘉",
+ deptId: "閮ㄩ棬",
+ realName: "鐪熷疄濮撳悕",
+ idCard: "韬唤璇�",
+ birthday: "鐢熸棩",
+ introduction: "绠�浠�",
+ },
}
}
};
diff --git a/zy-acs-flow/src/page/ResourceContent.js b/zy-acs-flow/src/page/ResourceContent.js
index 9bd7dd5..b14d8a7 100644
--- a/zy-acs-flow/src/page/ResourceContent.js
+++ b/zy-acs-flow/src/page/ResourceContent.js
@@ -11,6 +11,7 @@
import userLogin from './userLogin';
import dept from "./dept";
import menu from './menu'
+import user from './user';
const ResourceContent = (node) => {
switch (node.component) {
@@ -28,6 +29,8 @@
return dept;
case 'menu':
return menu;
+ case 'user':
+ return user;
default:
return {
list: ListGuesser,
diff --git a/zy-acs-flow/src/page/user/UserCreate.jsx b/zy-acs-flow/src/page/user/UserCreate.jsx
new file mode 100644
index 0000000..b272ab6
--- /dev/null
+++ b/zy-acs-flow/src/page/user/UserCreate.jsx
@@ -0,0 +1,221 @@
+import React, { useState, useRef, useEffect, useMemo } from "react";
+import {
+ CreateBase,
+ useTranslate,
+ TextInput,
+ NumberInput,
+ BooleanInput,
+ DateInput,
+ SaveButton,
+ SelectInput,
+ ReferenceInput,
+ ReferenceArrayInput,
+ AutocompleteInput,
+ Toolbar,
+ required,
+ useDataProvider,
+ useNotify,
+ Form,
+ useCreateController,
+} from 'react-admin';
+import {
+ Dialog,
+ DialogActions,
+ DialogContent,
+ DialogTitle,
+ Stack,
+ Grid,
+ Box,
+} from '@mui/material';
+import DialogCloseButton from "../components/DialogCloseButton";
+import StatusSelectInput from "../components/StatusSelectInput";
+import MemoInput from "../components/MemoInput";
+
+const UserCreate = (props) => {
+ const { open, setOpen } = props;
+
+ const translate = useTranslate();
+ const notify = useNotify();
+
+ const handleClose = (event, reason) => {
+ if (reason !== "backdropClick") {
+ setOpen(false);
+ }
+ };
+
+ const handleSuccess = async (data) => {
+ setOpen(false);
+ notify('common.response.success');
+ };
+
+ const handleError = async (data) => {
+ notify('common.response.fail');
+ };
+
+ return (
+ <>
+ <CreateBase
+ record={{}}
+ transform={(data) => {
+ return data;
+ }}
+ mutationOptions={{ onSuccess: handleSuccess, onError: handleError }}
+ >
+ <Dialog
+ open={open}
+ onClose={handleClose}
+ aria-labelledby="form-dialog-title"
+ fullWidth
+ disableRestoreFocus
+ maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
+ >
+ <Form>
+ <DialogTitle id="form-dialog-title" sx={{
+ position: 'sticky',
+ top: 0,
+ backgroundColor: 'background.paper',
+ zIndex: 1000
+ }}
+ >
+ {translate('create.title')}
+ <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}>
+ <DialogCloseButton onClose={handleClose} />
+ </Box>
+ </DialogTitle>
+ <DialogContent>
+ <Grid container rowSpacing={2} columnSpacing={2}>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.username"
+ source="username"
+ parse={v => v}
+ autoFocus
+ validate={required()}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.password"
+ source="password"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.nickname"
+ source="nickname"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.avatar"
+ source="avatar"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.code"
+ source="code"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <SelectInput
+ label="table.field.user.sex"
+ source="sex"
+ choices={[
+ { id: 0, name: '鏈煡' },
+ { id: 1, name: '鐢�' },
+ { id: 2, name: '濂�' },
+ ]}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.phone"
+ source="phone"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.email"
+ source="email"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <SelectInput
+ label="table.field.user.emailVerified"
+ source="emailVerified"
+ choices={[
+ { id: 0, name: '鍚�' },
+ { id: 1, name: '鏄�' },
+ ]}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <ReferenceInput
+ source="deptId"
+ reference="dept"
+ >
+ <AutocompleteInput
+ label="table.field.user.deptId"
+ optionText="name"
+ />
+ </ReferenceInput>
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.realName"
+ source="realName"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.idCard"
+ source="idCard"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.birthday"
+ source="birthday"
+ parse={v => v}
+ />
+ </Grid>
+ <Grid item xs={6} display="flex" gap={1}>
+ <TextInput
+ label="table.field.user.introduction"
+ source="introduction"
+ parse={v => v}
+ />
+ </Grid>
+
+ <Grid item xs={6} display="flex" gap={1}>
+ <StatusSelectInput />
+ </Grid>
+ <Grid item xs={12} display="flex" gap={1}>
+ <Stack direction="column" spacing={1} width={'100%'}>
+ <MemoInput />
+ </Stack>
+ </Grid>
+ </Grid>
+ </DialogContent>
+ <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}>
+ <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} >
+ <SaveButton />
+ </Toolbar>
+ </DialogActions>
+ </Form>
+ </Dialog>
+ </CreateBase>
+ </>
+ )
+}
+
+export default UserCreate;
diff --git a/zy-acs-flow/src/page/user/UserEdit.jsx b/zy-acs-flow/src/page/user/UserEdit.jsx
new file mode 100644
index 0000000..b236f19
--- /dev/null
+++ b/zy-acs-flow/src/page/user/UserEdit.jsx
@@ -0,0 +1,193 @@
+import React, { useState, useRef, useEffect, useMemo } from "react";
+import {
+ Edit,
+ SimpleForm,
+ FormDataConsumer,
+ useTranslate,
+ TextInput,
+ NumberInput,
+ BooleanInput,
+ DateInput,
+ SelectInput,
+ ReferenceInput,
+ ReferenceArrayInput,
+ AutocompleteInput,
+ SaveButton,
+ Toolbar,
+ Labeled,
+ NumberField,
+ required,
+ useRecordContext,
+ DeleteButton,
+} from 'react-admin';
+import { useWatch, useFormContext } from "react-hook-form";
+import { Stack, Grid, Box, Typography } from '@mui/material';
+import * as Common from '@/utils/common';
+import { EDIT_MODE } from '@/config/setting';
+import EditBaseAside from "../components/EditBaseAside";
+import CustomerTopToolBar from "../components/EditTopToolBar";
+import MemoInput from "../components/MemoInput";
+import StatusSelectInput from "../components/StatusSelectInput";
+
+const FormToolbar = () => {
+ const { getValues } = useFormContext();
+
+ return (
+ <Toolbar sx={{ justifyContent: 'space-between' }}>
+ <SaveButton />
+ <DeleteButton mutationMode="optimistic" />
+ </Toolbar>
+ )
+}
+
+const UserEdit = () => {
+ const translate = useTranslate();
+
+ return (
+ <Edit
+ redirect="list"
+ mutationMode={EDIT_MODE}
+ actions={<CustomerTopToolBar />}
+ aside={<EditBaseAside />}
+ >
+ <SimpleForm
+ shouldUnregister
+ warnWhenUnsavedChanges
+ toolbar={<FormToolbar />}
+ mode="onTouched"
+ defaultValues={{}}
+ // validate={(values) => { }}
+ >
+ <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
+ <Grid item xs={12} md={8}>
+ <Typography variant="h6" gutterBottom>
+ {translate('common.edit.title.main')}
+ </Typography>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.username"
+ source="username"
+ parse={v => v}
+ autoFocus
+ validate={required()}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.password"
+ source="password"
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.nickname"
+ source="nickname"
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.avatar"
+ source="avatar"
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.code"
+ source="code"
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <SelectInput
+ label="table.field.user.sex"
+ source="sex"
+ choices={[
+ { id: 0, name: '鏈煡' },
+ { id: 1, name: '鐢�' },
+ { id: 2, name: '濂�' },
+ ]}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.phone"
+ source="phone"
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.email"
+ source="email"
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <SelectInput
+ label="table.field.user.emailVerified"
+ source="emailVerified"
+ choices={[
+ { id: 0, name: '鍚�' },
+ { id: 1, name: '鏄�' },
+ ]}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <ReferenceInput
+ source="deptId"
+ reference="dept"
+ >
+ <AutocompleteInput
+ label="table.field.user.deptId"
+ optionText="name"
+ />
+ </ReferenceInput>
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.realName"
+ source="realName"
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.idCard"
+ source="idCard"
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.birthday"
+ source="birthday"
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.user.introduction"
+ source="introduction"
+ parse={v => v}
+ />
+ </Stack>
+
+ </Grid>
+ <Grid item xs={12} md={4}>
+ <Typography variant="h6" gutterBottom>
+ {translate('common.edit.title.common')}
+ </Typography>
+ <StatusSelectInput />
+ <Box mt="2em" />
+ <MemoInput />
+ </Grid>
+ </Grid>
+ </SimpleForm>
+ </Edit >
+ )
+}
+
+export default UserEdit;
diff --git a/zy-acs-flow/src/page/user/UserList.jsx b/zy-acs-flow/src/page/user/UserList.jsx
new file mode 100644
index 0000000..c913302
--- /dev/null
+++ b/zy-acs-flow/src/page/user/UserList.jsx
@@ -0,0 +1,185 @@
+import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
+import { useNavigate } from 'react-router-dom';
+import {
+ List,
+ DatagridConfigurable,
+ SearchInput,
+ TopToolbar,
+ SelectColumnsButton,
+ EditButton,
+ FilterButton,
+ CreateButton,
+ ExportButton,
+ BulkDeleteButton,
+ WrapperField,
+ useRecordContext,
+ useTranslate,
+ useListContext,
+ useCreatePath,
+ TextField,
+ NumberField,
+ DateField,
+ BooleanField,
+ ReferenceField,
+ TextInput,
+ DateTimeInput,
+ DateInput,
+ SelectInput,
+ NumberInput,
+ ReferenceInput,
+ ReferenceArrayInput,
+ AutocompleteInput,
+ DeleteButton,
+} from 'react-admin';
+import { Box, Typography, Card, Stack } from '@mui/material';
+import { styled } from '@mui/material/styles';
+import UserCreate from "./UserCreate";
+import UserPanel from "./UserPanel";
+import EmptyData from "../components/EmptyData";
+import MyCreateButton from "../components/MyCreateButton";
+import MyExportButton from '../components/MyExportButton';
+import PageDrawer from "../components/PageDrawer";
+import MyField from "../components/MyField";
+import { PAGE_DRAWER_WIDTH, OPERATE_MODE } from '@/config/setting';
+import * as Common from '@/utils/common';
+
+const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
+ '& .css-1vooibu-MuiSvgIcon-root': {
+ height: '.9em'
+ },
+ '& .RaDatagrid-row': {
+ cursor: 'auto'
+ },
+ '& .column-name': {
+ },
+ '& .opt': {
+ width: 200
+ },
+}));
+
+const filters = [
+ <SearchInput source="condition" alwaysOn />,
+ <DateInput label='common.time.after' source="timeStart" alwaysOn />,
+ <DateInput label='common.time.before' source="timeEnd" alwaysOn />,
+
+ <TextInput source="username" label="table.field.user.username" />,
+ <TextInput source="password" label="table.field.user.password" />,
+ <TextInput source="nickname" label="table.field.user.nickname" />,
+ <TextInput source="avatar" label="table.field.user.avatar" />,
+ <TextInput source="code" label="table.field.user.code" />,
+ <SelectInput source="sex" label="table.field.user.sex"
+ choices={[
+ { id: 0, name: '鏈煡' },
+ { id: 1, name: '鐢�' },
+ { id: 2, name: '濂�' },
+ ]}
+ />,
+ <TextInput source="phone" label="table.field.user.phone" />,
+ <TextInput source="email" label="table.field.user.email" />,
+ <SelectInput source="emailVerified" label="table.field.user.emailVerified"
+ choices={[
+ { id: 0, name: '鍚�' },
+ { id: 1, name: '鏄�' },
+ ]}
+ />,
+ <ReferenceInput source="deptId" reference="dept">
+ <AutocompleteInput label="table.field.user.deptId" optionText="name" />
+ </ReferenceInput>,
+ <TextInput source="realName" label="table.field.user.realName" />,
+ <TextInput source="idCard" label="table.field.user.idCard" />,
+ <TextInput source="birthday" label="table.field.user.birthday" />,
+ <TextInput source="introduction" label="table.field.user.introduction" />,
+
+ <TextInput label="common.field.memo" source="memo" />,
+ <SelectInput
+ label="common.field.status"
+ source="status"
+ choices={[
+ { id: '1', name: 'common.enums.statusTrue' },
+ { id: '0', name: 'common.enums.statusFalse' },
+ ]}
+ />,
+]
+
+const UserList = () => {
+ const translate = useTranslate();
+
+ const [createDialog, setCreateDialog] = useState(false);
+ const [drawerVal, setDrawerVal] = useState(false);
+
+ return (
+ <Box display="flex">
+ <List
+ sx={{
+ flexGrow: 1,
+ transition: (theme) =>
+ theme.transitions.create(['all'], {
+ duration: theme.transitions.duration.enteringScreen,
+ }),
+ marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
+ }}
+ title={"menu.user"}
+ empty={<EmptyData onClick={() => { setCreateDialog(true) }} />}
+ filters={filters}
+ sort={{ field: "create_time", order: "desc" }}
+ actions={(
+ <TopToolbar>
+ <FilterButton />
+ <MyCreateButton onClick={() => { setCreateDialog(true) }} />
+ <SelectColumnsButton preferenceKey='user' />
+ <MyExportButton />
+ </TopToolbar>
+ )}
+ perPage={25}
+ >
+ <StyledDatagrid
+ preferenceKey='user'
+ bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
+ rowClick={(id, resource, record) => false}
+ expand={() => <UserPanel />}
+ expandSingle={true}
+ omit={['id', 'createTime', 'memo']}
+ >
+ <NumberField source="id" />
+ <TextField source="username" label="table.field.user.username" />
+ <TextField source="password" label="table.field.user.password" />
+ <TextField source="nickname" label="table.field.user.nickname" />
+ <TextField source="avatar" label="table.field.user.avatar" />
+ <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="emailVerified$" label="table.field.user.emailVerified" sortable={false} />
+ <ReferenceField source="deptId" label="table.field.user.deptId" reference="dept" link={false}>
+ <TextField source="name" />
+ </ReferenceField>
+ <TextField source="realName" label="table.field.user.realName" />
+ <TextField source="idCard" label="table.field.user.idCard" />
+ <TextField source="birthday" label="table.field.user.birthday" />
+ <TextField source="introduction" label="table.field.user.introduction" />
+
+ <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>
+ </List>
+ <UserCreate
+ open={createDialog}
+ setOpen={setCreateDialog}
+ />
+ <PageDrawer
+ title='User Detail'
+ drawerVal={drawerVal}
+ setDrawerVal={setDrawerVal}
+ >
+ </PageDrawer>
+ </Box>
+ )
+}
+
+export default UserList;
diff --git a/zy-acs-flow/src/page/user/UserPanel.jsx b/zy-acs-flow/src/page/user/UserPanel.jsx
new file mode 100644
index 0000000..d8fef39
--- /dev/null
+++ b/zy-acs-flow/src/page/user/UserPanel.jsx
@@ -0,0 +1,135 @@
+import React, { useState, useRef, useEffect, useMemo } from "react";
+import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material';
+import {
+ useTranslate,
+ useRecordContext,
+} from 'react-admin';
+import PanelTypography from "../components/PanelTypography";
+import * as Common from '@/utils/common'
+
+const UserPanel = () => {
+ const record = useRecordContext();
+ if (!record) return null;
+ const translate = useTranslate();
+ return (
+ <>
+ <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}>
+ <CardContent>
+ <Grid container spacing={2}>
+ <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}>
+ <Typography variant="h6" gutterBottom align="left" sx={{
+ maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' },
+ whiteSpace: 'nowrap',
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ }}>
+ {Common.camelToPascalWithSpaces(translate('table.field.user.nickname'))}: {record.nickname}
+ </Typography>
+ {/* inherit, primary, secondary, textPrimary, textSecondary, error */}
+ <Typography variant="h6" gutterBottom align="right" >
+ ID: {record.id}
+ </Typography>
+ </Grid>
+ </Grid>
+ <Grid container spacing={2}>
+ <Grid item xs={12} container alignContent="flex-end">
+ <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}>
+ {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo}
+ </Typography>
+ </Grid>
+ </Grid>
+ <Box height={20}> </Box>
+ <Grid container spacing={2}>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.username"
+ property={record.username}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.password"
+ property={record.password}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.nickname"
+ property={record.nickname}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.avatar"
+ property={record.avatar}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.code"
+ property={record.code}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.sex"
+ property={record.sex$}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.phone"
+ property={record.phone}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.email"
+ property={record.email}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.emailVerified"
+ property={record.emailVerified$}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.deptId"
+ property={record.deptId$}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.realName"
+ property={record.realName}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.idCard"
+ property={record.idCard}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.birthday"
+ property={record.birthday}
+ />
+ </Grid>
+ <Grid item xs={6}>
+ <PanelTypography
+ title="table.field.user.introduction"
+ property={record.introduction}
+ />
+ </Grid>
+
+ </Grid>
+ </CardContent>
+ </Card >
+ </>
+ );
+};
+
+export default UserPanel;
diff --git a/zy-acs-flow/src/page/user/index.jsx b/zy-acs-flow/src/page/user/index.jsx
new file mode 100644
index 0000000..5fa2867
--- /dev/null
+++ b/zy-acs-flow/src/page/user/index.jsx
@@ -0,0 +1,18 @@
+import React, { useState, useRef, useEffect, useMemo } from "react";
+import {
+ ListGuesser,
+ EditGuesser,
+ ShowGuesser,
+} from "react-admin";
+
+import UserList from "./UserList";
+import UserEdit from "./UserEdit";
+
+export default {
+ list: UserList,
+ edit: UserEdit,
+ show: ShowGuesser,
+ recordRepresentation: (record) => {
+ return `${record.nickname}`
+ }
+};
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java
index 6def127..3ca7c79 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java
@@ -22,8 +22,8 @@
// generator.username="sa";
// generator.password="Zoneyung@zy56$";
- generator.table="sys_menu";
- generator.tableDesc="Menu";
+ generator.table="sys_user";
+ generator.tableDesc="User";
generator.packagePath="com.zy.acs.manager.system";
generator.build();
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/UserController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/UserController.java
index 468002c..8a11520 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/UserController.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/UserController.java
@@ -69,21 +69,21 @@
}
@PreAuthorize("hasAuthority('system:user:save')")
- @OperationLog("娣诲姞鐢ㄦ埛")
+ @OperationLog("Save User")
@PostMapping("/user/save")
@Transactional
public R save(@RequestBody User user) {
if (!Cools.isEmpty(user.getUsername())
&& userService.count(new LambdaQueryWrapper<User>().eq(User::getUsername, user.getUsername())) > 0) {
- return R.error("鐧诲綍璐﹀彿宸插瓨鍦�");
+ return R.error("the username already exist");
}
if (!Cools.isEmpty(user.getNickname())
&& userService.count(new LambdaQueryWrapper<User>().eq(User::getNickname, user.getNickname())) > 0) {
- return R.error("鐢ㄦ埛鍚嶇О宸插瓨鍦�");
+ return R.error("the nickname already exist");
}
if (!Cools.isEmpty(user.getPhone())
&& userService.count(new LambdaQueryWrapper<User>().eq(User::getPhone, user.getPhone())) > 0) {
- return R.error("鎵嬫満鍙峰凡瀛樺湪");
+ return R.error("the phone already exist");
}
user.setPassword(userService.encodePassword(COMMON_PASSWORD));
@@ -94,38 +94,38 @@
user.setUpdateTime(new Date());
if (!userService.save(user)) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
+ throw new CoolException("Internal Server Error");
}
userRoleService.remove(new LambdaQueryWrapper<UserRole>().eq(UserRole::getUserId, user.getId()));
for (Long roleId : user.getRoleIds()) {
if (!userRoleService.save(new UserRole(user.getId(), roleId))) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
+ throw new CoolException("Internal Server Error");
}
}
- return R.ok("娣诲姞鎴愬姛");
+ return R.ok("Save Success");
}
@PreAuthorize("hasAuthority('system:user:update')")
- @OperationLog("淇敼鐢ㄦ埛")
+ @OperationLog("Update User")
@PostMapping("/user/update")
@Transactional
public R update(@RequestBody User user) {
if (!Cools.isEmpty(user.getUsername()) && userService.count(new LambdaQueryWrapper<User>()
.eq(User::getUsername, user.getUsername())
.ne(User::getId, user.getId())) > 0) {
- return R.error("鐧诲綍璐﹀彿宸插瓨鍦�");
+ return R.error("the username already exist");
}
if (!Cools.isEmpty(user.getNickname()) && userService.count(new LambdaQueryWrapper<User>()
.eq(User::getNickname, user.getNickname())
.ne(User::getId, user.getId())) > 0) {
- return R.error("鐢ㄦ埛鍚嶇О宸插瓨鍦�");
+ return R.error("the nickname already exist");
}
if (!Cools.isEmpty(user.getPhone()) && userService.count(new LambdaQueryWrapper<User>()
.eq(User::getPhone, user.getPhone())
.ne(User::getId, user.getId())) > 0) {
- return R.error("鎵嬫満鍙峰凡瀛樺湪");
+ return R.error("the phone already exist");
}
if (!Cools.isEmpty(user.getPassword())) {
@@ -136,35 +136,35 @@
user.setUpdateTime(new Date());
if (!userService.updateById(user)) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
+ throw new CoolException("Internal Server Error");
}
if (user.getRoleIds() != null && user.getRoleIds().length > 0) {
userRoleService.remove(new LambdaQueryWrapper<UserRole>().eq(UserRole::getUserId, user.getId()));
for (Long roleId : user.getRoleIds()) {
if (!userRoleService.save(new UserRole(user.getId(), roleId))) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
+ throw new CoolException("Internal Server Error");
}
}
}
- return R.ok("淇敼鎴愬姛");
+ return R.ok("Update Success");
}
@PreAuthorize("hasAuthority('system:user:remove')")
- @OperationLog("鍒犻櫎鐢ㄦ埛")
+ @OperationLog("Remove User")
@PostMapping("/user/remove/{ids}")
@Transactional
public R remove(@PathVariable Long[] ids) {
for (Long userId : ids) {
if (!userService.removeById(userId)) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
+ throw new CoolException("Internal Server Error");
}
if (!userRoleService.remove(new LambdaQueryWrapper<UserRole>().eq(UserRole::getUserId, userId))) {
- throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
+ throw new CoolException("Internal Server Error");
}
}
- return R.ok("鍒犻櫎鎴愬姛");
+ return R.ok("Delete Success");
}
@PreAuthorize("hasAuthority('system:user:list')")
@@ -188,13 +188,13 @@
}
@PreAuthorize("hasAuthority('system:user:update')")
- @OperationLog("閲嶇疆瀵嗙爜")
+ @OperationLog("Reset Password")
@PostMapping("/user/reset/pwd")
public R resetPwd(@RequestBody ResetPwdParam param) {
User user = userService.getById(param.getId());
if (!Cools.isEmpty(param.getOldPwd())) {
if (!userService.comparePassword(user.getPassword(), param.getOldPwd())) {
- return R.error("褰撳墠瀵嗙爜閿欒");
+ return R.error("The old password is incorrect");
}
}
if (!Cools.isEmpty(param.getPassword())) {
@@ -203,9 +203,9 @@
user.setUpdateBy(getLoginUserId());
user.setUpdateTime(new Date());
if (!userService.updateById(user)) {
- return R.error("閲嶇疆澶辫触");
+ return R.error("Reset Fail");
}
- return R.ok("閲嶇疆鎴愬姛");
+ return R.ok("Reset Success");
}
}
--
Gitblit v1.9.1