From ef487d5d81e2e3725caf907f009ce729831b451f Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 18 九月 2024 10:31:00 +0800 Subject: [PATCH] # --- zy-acs-flow/src/page/jam/JamPanel.jsx | 141 +++++++ zy-acs-flow/src/page/jam/JamCreate.jsx | 250 +++++++++++++ zy-acs-flow/src/i18n/en.js | 19 + zy-acs-flow/src/page/jam/JamEdit.jsx | 229 ++++++++++++ zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java | 4 zy-acs-flow/src/page/ResourceContent.js | 4 zy-acs-flow/src/page/jam/JamList.jsx | 211 +++++++++++ zy-acs-flow/src/page/jam/index.jsx | 18 + zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/JamController.java | 111 ++++++ zy-acs-flow/src/i18n/zh.js | 19 + zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Jam.java | 24 - 11 files changed, 1,007 insertions(+), 23 deletions(-) diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js index 58afabf..e67fc31 100644 --- a/zy-acs-flow/src/i18n/en.js +++ b/zy-acs-flow/src/i18n/en.js @@ -121,6 +121,7 @@ task: 'Task', travel: 'Travel', segment: 'Segment', + jam: 'Jam', }, table: { @@ -456,6 +457,24 @@ backpack: "backpack", state: "state", }, + jam: { + uuid: "uuid", + name: "name", + jamAgv: "jam agv", + jamCode: "jam code", + jamSeg: "jam seg", + avoAgv: "avoid agv", + avoCode: "avoid code", + avoSeg: "avoid seg", + cycleAvo: "cycle avoid", + cycleCode: "cycle code", + startTime: "start time", + notifyTime: "notify time", + endTime: "end time", + duration: "duration", + state: "state", + }, + } } }; diff --git a/zy-acs-flow/src/i18n/zh.js b/zy-acs-flow/src/i18n/zh.js index afd0f30..d987777 100644 --- a/zy-acs-flow/src/i18n/zh.js +++ b/zy-acs-flow/src/i18n/zh.js @@ -121,6 +121,7 @@ task: '浠诲姟绠$悊', travel: '琛岀▼绠$悊', segment: '鍗曟浣滀笟', + jam: '浜ら�氶伩璁�', }, table: { @@ -455,6 +456,24 @@ backpack: "鑳岀瘬", state: "鐘舵��", }, + jam: { + uuid: "缂栧彿", + name: "鍒悕", + jamAgv: "闃诲杞﹁締", + jamCode: "闃诲鍦版爣", + jamSeg: "闃诲浣滀笟", + avoAgv: "閬胯杞﹁締", + avoCode: "閬胯鍦版爣", + avoSeg: "閬胯浣滀笟", + cycleAvo: "宓屽閬胯", + cycleCode: "宓屽鍦版爣", + startTime: "寮�濮嬫椂闂�", + notifyTime: "閫氱煡鏃堕棿", + endTime: "缁撴潫鏃堕棿", + duration: "鎸佺画鏃堕暱", + state: "鐘舵��", + }, + } } }; diff --git a/zy-acs-flow/src/page/ResourceContent.js b/zy-acs-flow/src/page/ResourceContent.js index 1432d2c..27c6e01 100644 --- a/zy-acs-flow/src/page/ResourceContent.js +++ b/zy-acs-flow/src/page/ResourceContent.js @@ -38,7 +38,7 @@ import task from './task'; import travel from './travel'; import segment from './segment'; - +import jam from './jam'; const ResourceContent = (node) => { switch (node.component) { @@ -110,6 +110,8 @@ return travel; case 'segment': return segment; + case 'jam': + return jam; default: return { list: ListGuesser, diff --git a/zy-acs-flow/src/page/jam/JamCreate.jsx b/zy-acs-flow/src/page/jam/JamCreate.jsx new file mode 100644 index 0000000..4032715 --- /dev/null +++ b/zy-acs-flow/src/page/jam/JamCreate.jsx @@ -0,0 +1,250 @@ +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 JamCreate = (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.jam.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.jam.name" + source="name" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="jamAgv" + reference="agv" + > + <AutocompleteInput + label="table.field.jam.jamAgv" + optionText="uuid" + filterToQuery={(val) => ({ uuid: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="jamCode" + reference="code" + > + <AutocompleteInput + label="table.field.jam.jamCode" + optionText="data" + filterToQuery={(val) => ({ data: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="jamSeg" + reference="segment" + > + <AutocompleteInput + label="table.field.jam.jamSeg" + optionText="id" + filterToQuery={(val) => ({ id: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="avoAgv" + reference="agv" + > + <AutocompleteInput + label="table.field.jam.avoAgv" + optionText="uuid" + filterToQuery={(val) => ({ uuid: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="avoCode" + reference="code" + > + <AutocompleteInput + label="table.field.jam.avoCode" + optionText="data" + filterToQuery={(val) => ({ data: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="avoSeg" + reference="segment" + > + <AutocompleteInput + label="table.field.jam.avoSeg" + optionText="id" + filterToQuery={(val) => ({ id: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <SelectInput + label="table.field.jam.cycleAvo" + source="cycleAvo" + choices={[ + { id: 1, name: '鏄�' }, + { id: 0, name: '鍚�' }, + ]} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="cycleCode" + reference="code" + > + <AutocompleteInput + label="table.field.jam.cycleCode" + optionText="data" + filterToQuery={(val) => ({ data: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <DateInput + label="table.field.jam.startTime" + source="startTime" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <DateInput + label="table.field.jam.notifyTime" + source="notifyTime" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <DateInput + label="table.field.jam.endTime" + source="endTime" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.jam.duration" + source="duration" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.jam.state" + source="state" + 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 JamCreate; diff --git a/zy-acs-flow/src/page/jam/JamEdit.jsx b/zy-acs-flow/src/page/jam/JamEdit.jsx new file mode 100644 index 0000000..66de7c5 --- /dev/null +++ b/zy-acs-flow/src/page/jam/JamEdit.jsx @@ -0,0 +1,229 @@ +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, REFERENCE_INPUT_PAGESIZE } 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 JamEdit = () => { + 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.jam.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.jam.name" + source="name" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="jamAgv" + reference="agv" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.jam.jamAgv" + optionText="uuid" + filterToQuery={(val) => ({ uuid: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="jamCode" + reference="code" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.jam.jamCode" + optionText="data" + filterToQuery={(val) => ({ data: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="jamSeg" + reference="segment" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.jam.jamSeg" + optionText="id" + filterToQuery={(val) => ({ id: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="avoAgv" + reference="agv" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.jam.avoAgv" + optionText="uuid" + filterToQuery={(val) => ({ uuid: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="avoCode" + reference="code" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.jam.avoCode" + optionText="data" + filterToQuery={(val) => ({ data: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="avoSeg" + reference="segment" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.jam.avoSeg" + optionText="id" + filterToQuery={(val) => ({ id: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <SelectInput + label="table.field.jam.cycleAvo" + source="cycleAvo" + choices={[ + { id: 1, name: '鏄�' }, + { id: 0, name: '鍚�' }, + ]} + /> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="cycleCode" + reference="code" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.jam.cycleCode" + optionText="data" + filterToQuery={(val) => ({ data: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <DateInput + label="table.field.jam.startTime" + source="startTime" + /> + </Stack> + <Stack direction='row' gap={2}> + <DateInput + label="table.field.jam.notifyTime" + source="notifyTime" + /> + </Stack> + <Stack direction='row' gap={2}> + <DateInput + label="table.field.jam.endTime" + source="endTime" + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.jam.duration" + source="duration" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.jam.state" + source="state" + 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 JamEdit; diff --git a/zy-acs-flow/src/page/jam/JamList.jsx b/zy-acs-flow/src/page/jam/JamList.jsx new file mode 100644 index 0000000..2889a73 --- /dev/null +++ b/zy-acs-flow/src/page/jam/JamList.jsx @@ -0,0 +1,211 @@ +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 JamCreate from "./JamCreate"; +import JamPanel from "./JamPanel"; +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="uuid" label="table.field.jam.uuid" />, + <TextInput source="name" label="table.field.jam.name" />, + <ReferenceInput source="jamAgv" label="table.field.jam.jamAgv" reference="agv"> + <AutocompleteInput label="table.field.jam.jamAgv" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> + </ReferenceInput>, + <ReferenceInput source="jamCode" label="table.field.jam.jamCode" reference="code"> + <AutocompleteInput label="table.field.jam.jamCode" optionText="data" filterToQuery={(val) => ({ data: val })} /> + </ReferenceInput>, + <ReferenceInput source="jamSeg" label="table.field.jam.jamSeg" reference="segment"> + <AutocompleteInput label="table.field.jam.jamSeg" optionText="id" filterToQuery={(val) => ({ id: val })} /> + </ReferenceInput>, + <ReferenceInput source="avoAgv" label="table.field.jam.avoAgv" reference="agv"> + <AutocompleteInput label="table.field.jam.avoAgv" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> + </ReferenceInput>, + <ReferenceInput source="avoCode" label="table.field.jam.avoCode" reference="code"> + <AutocompleteInput label="table.field.jam.avoCode" optionText="data" filterToQuery={(val) => ({ data: val })} /> + </ReferenceInput>, + <ReferenceInput source="avoSeg" label="table.field.jam.avoSeg" reference="segment"> + <AutocompleteInput label="table.field.jam.avoSeg" optionText="id" filterToQuery={(val) => ({ id: val })} /> + </ReferenceInput>, + <SelectInput source="cycleAvo" label="table.field.jam.cycleAvo" + choices={[ + { id: 1, name: 'common.enums.true' }, + { id: 0, name: 'common.enums.false' }, + ]} + />, + <ReferenceInput source="cycleCode" label="table.field.jam.cycleCode" reference="code"> + <AutocompleteInput label="table.field.jam.cycleCode" optionText="data" filterToQuery={(val) => ({ data: val })} /> + </ReferenceInput>, + <DateInput source="startTime" label="table.field.jam.startTime" />, + <DateInput source="notifyTime" label="table.field.jam.notifyTime" />, + <DateInput source="endTime" label="table.field.jam.endTime" />, + <NumberInput source="duration" label="table.field.jam.duration" />, + <TextInput source="state" label="table.field.jam.state" />, + + <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 JamList = () => { + 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.jam"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='jam' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={25} + > + <StyledDatagrid + preferenceKey='jam' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <JamPanel />} + expandSingle={true} + omit={['id', 'uuid', 'cycleCode', 'updateBy', 'updateTime', 'createTime', 'createBy', 'statusBool', 'memo']} + > + <NumberField source="id" /> + <TextField source="uuid" label="table.field.jam.uuid" /> + {/* <TextField source="name" label="table.field.jam.name" /> */} + <ReferenceField source="jamAgv" label="table.field.jam.jamAgv" reference="agv" link={false} sortable={false}> + <TextField source="uuid" /> + </ReferenceField> + <ReferenceField source="jamCode" label="table.field.jam.jamCode" reference="code" link={false} sortable={false}> + <TextField source="data" /> + </ReferenceField> + <ReferenceField source="jamSeg" label="table.field.jam.jamSeg" reference="segment" link={false} sortable={false}> + <TextField source="id" /> + </ReferenceField> + <ReferenceField source="avoAgv" label="table.field.jam.avoAgv" reference="agv" link={false} sortable={false}> + <TextField source="uuid" /> + </ReferenceField> + <ReferenceField source="avoCode" label="table.field.jam.avoCode" reference="code" link={false} sortable={false}> + <TextField source="data" /> + </ReferenceField> + <ReferenceField source="avoSeg" label="table.field.jam.avoSeg" reference="segment" link={false} sortable={false}> + <TextField source="id" /> + </ReferenceField> + <BooleanField source="cycleAvoBool" label="table.field.jam.cycleAvo" /> + <ReferenceField source="cycleCode" label="table.field.jam.cycleCode" reference="code" link={false} sortable={false}> + <TextField source="data" /> + </ReferenceField> + <DateField source="startTime" label="table.field.jam.startTime" showTime /> + <DateField source="notifyTime" label="table.field.jam.notifyTime" showTime /> + <DateField source="endTime" label="table.field.jam.endTime" showTime /> + <NumberField source="duration" label="table.field.jam.duration" /> + <TextField source="state" label="table.field.jam.state" /> + + <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> + <TextField source="nickname" /> + </ReferenceField> + <DateField source="updateTime" label="common.field.updateTime" showTime /> + <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> + <TextField source="nickname" /> + </ReferenceField> + <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> + <JamCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='Jam Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default JamList; diff --git a/zy-acs-flow/src/page/jam/JamPanel.jsx b/zy-acs-flow/src/page/jam/JamPanel.jsx new file mode 100644 index 0000000..78d84d7 --- /dev/null +++ b/zy-acs-flow/src/page/jam/JamPanel.jsx @@ -0,0 +1,141 @@ +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 JamPanel = () => { + 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.jam.name'))}: {record.name} + </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.jam.uuid" + property={record.uuid} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.name" + property={record.name} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.jamAgv" + property={record.jamAgv$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.jamCode" + property={record.jamCode$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.jamSeg" + property={record.jamSeg$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.avoAgv" + property={record.avoAgv$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.avoCode" + property={record.avoCode$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.avoSeg" + property={record.avoSeg$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.cycleAvo" + property={record.cycleAvo$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.cycleCode" + property={record.cycleCode$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.startTime" + property={record.startTime$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.notifyTime" + property={record.notifyTime$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.endTime" + property={record.endTime$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.duration" + property={record.duration} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.jam.state" + property={record.state} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default JamPanel; diff --git a/zy-acs-flow/src/page/jam/index.jsx b/zy-acs-flow/src/page/jam/index.jsx new file mode 100644 index 0000000..9ede50b --- /dev/null +++ b/zy-acs-flow/src/page/jam/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import JamList from "./JamList"; +import JamEdit from "./JamEdit"; + +export default { + list: JamList, + edit: JamEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.name}` + } +}; 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 2496807..c3a75f5 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="man_segment"; - generator.tableDesc="Segment"; + generator.table="man_jam"; + generator.tableDesc="Jam"; generator.packagePath="com.zy.acs.manager.manager"; generator.build(); diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/JamController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/JamController.java new file mode 100644 index 0000000..e882071 --- /dev/null +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/JamController.java @@ -0,0 +1,111 @@ +package com.zy.acs.manager.manager.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zy.acs.framework.common.Cools; +import com.zy.acs.framework.common.R; +import com.zy.acs.manager.common.utils.ExcelUtil; +import com.zy.acs.manager.common.annotation.OperationLog; +import com.zy.acs.manager.common.domain.BaseParam; +import com.zy.acs.manager.common.domain.KeyValVo; +import com.zy.acs.manager.common.domain.PageParam; +import com.zy.acs.manager.manager.entity.Jam; +import com.zy.acs.manager.manager.service.JamService; +import com.zy.acs.manager.system.controller.BaseController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +@RestController +@RequestMapping("/api") +public class JamController extends BaseController { + + @Autowired + private JamService jamService; + + @PreAuthorize("hasAuthority('manager:jam:list')") + @PostMapping("/jam/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<Jam, BaseParam> pageParam = new PageParam<>(baseParam, Jam.class); + return R.ok().add(jamService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:jam:list')") + @PostMapping("/jam/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(jamService.list()); + } + + @PreAuthorize("hasAuthority('manager:jam:list')") + @PostMapping({"/jam/many/{ids}", "/jams/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(jamService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:jam:list')") + @GetMapping("/jam/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(jamService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:jam:save')") + @OperationLog("Create Jam") + @PostMapping("/jam/save") + public R save(@RequestBody Jam jam) { + jam.setCreateBy(getLoginUserId()); + jam.setCreateTime(new Date()); + jam.setUpdateBy(getLoginUserId()); + jam.setUpdateTime(new Date()); + if (!jamService.save(jam)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(jam); + } + + @PreAuthorize("hasAuthority('manager:jam:update')") + @OperationLog("Update Jam") + @PostMapping("/jam/update") + public R update(@RequestBody Jam jam) { + jam.setUpdateBy(getLoginUserId()); + jam.setUpdateTime(new Date()); + if (!jamService.updateById(jam)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(jam); + } + + @PreAuthorize("hasAuthority('manager:jam:remove')") + @OperationLog("Delete Jam") + @PostMapping("/jam/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!jamService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:jam:list')") + @PostMapping("/jam/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<Jam> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(Jam::getName, condition); + } + jamService.page(new Page<>(1, 30), wrapper).getRecords().forEach( + item -> vos.add(new KeyValVo(item.getId(), item.getName())) + ); + return R.ok().add(vos); + } + + @PreAuthorize("hasAuthority('manager:jam:list')") + @PostMapping("/jam/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(jamService.list(), Jam.class), response); + } + +} diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Jam.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Jam.java index f916219..722578e 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Jam.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Jam.java @@ -210,31 +210,17 @@ return null; } - public String getCycleAvo$(){ + public Boolean getCycleAvoBool(){ if (null == this.cycleAvo){ return null; } switch (this.cycleAvo){ case 1: - return "鏄�"; + return true; case 0: - return "鍚�"; + return false; default: - return String.valueOf(this.cycleAvo); + return null; } } - - public String getStatus$(){ - if (null == this.status){ return null; } - switch (this.status){ - case 1: - return "姝e父"; - case 0: - return "鍐荤粨"; - default: - return String.valueOf(this.status); - } - } - - public Boolean getStatusBool(){ if (null == this.status){ return null; } @@ -247,7 +233,5 @@ return null; } } - - } -- Gitblit v1.9.1