From e34fecabbde9ff92747dc78e7da03fa304a91273 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期六, 14 九月 2024 14:58:08 +0800 Subject: [PATCH] # --- zy-acs-flow/src/page/taskSts/index.jsx | 18 zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/TaskTypeController.java | 111 + zy-acs-flow/src/page/actionType/ActionTypeList.jsx | 152 ++ zy-acs-flow/src/page/taskSts/TaskStsEdit.jsx | 97 + zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/BusStsController.java | 111 + zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/TaskStsController.java | 111 + zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/VehFaultRecController.java | 111 + zy-acs-flow/src/page/busSts/BusStsCreate.jsx | 125 + zy-acs-flow/src/page/taskSts/TaskStsCreate.jsx | 125 + zy-acs-flow/src/page/vehFaultRec/VehFaultRecList.jsx | 178 ++ zy-acs-flow/src/themes/rcsTheme.js | 2 zy-acs-flow/src/page/actionSts/ActionStsList.jsx | 152 ++ zy-acs-flow/src/page/busSts/index.jsx | 18 zy-acs-flow/src/page/actionSts/ActionStsPanel.jsx | 63 + zy-acs-flow/src/page/busSts/BusStsList.jsx | 152 ++ zy-acs-flow/src/page/taskType/TaskTypeEdit.jsx | 97 + zy-acs-flow/src/page/vehFaultRec/VehFaultRecCreate.jsx | 204 +++ zy-acs-flow/src/page/busSts/BusStsPanel.jsx | 63 + zy-acs-flow/src/page/actionType/ActionTypeCreate.jsx | 125 + zy-acs-flow/src/page/actionSts/index.jsx | 18 zy-acs-flow/src/page/actionType/ActionTypeEdit.jsx | 97 + zy-acs-flow/src/page/taskType/index.jsx | 18 zy-acs-flow/src/page/vehFaultRec/VehFaultRecPanel.jsx | 129 ++ zy-acs-flow/src/page/vehFaultRec/index.jsx | 18 zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/ActionTypeController.java | 111 + zy-acs-flow/src/i18n/zh.js | 42 zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/ActionStsController.java | 111 + zy-acs-flow/src/i18n/en.js | 42 zy-acs-manager/src/main/java/com/zy/acs/manager/common/CodeBuilder.java | 4 zy-acs-flow/src/page/ResourceContent.js | 18 zy-acs-flow/src/page/taskType/TaskTypeCreate.jsx | 125 + zy-acs-flow/src/page/busSts/BusStsEdit.jsx | 97 + zy-acs-flow/src/page/taskType/TaskTypeList.jsx | 152 ++ zy-acs-flow/src/page/actionType/index.jsx | 18 zy-acs-flow/src/page/taskSts/TaskStsList.jsx | 152 ++ zy-acs-flow/src/page/taskSts/TaskStsPanel.jsx | 63 + zy-acs-flow/src/page/actionSts/ActionStsEdit.jsx | 97 + zy-acs-flow/src/page/actionType/ActionTypePanel.jsx | 63 + zy-acs-flow/src/page/taskType/TaskTypePanel.jsx | 63 + zy-acs-flow/src/page/actionSts/ActionStsCreate.jsx | 125 + zy-acs-flow/src/page/vehFaultRec/VehFaultRecEdit.jsx | 177 ++ 41 files changed, 3,751 insertions(+), 4 deletions(-) diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js index 6561363..fbfa2be 100644 --- a/zy-acs-flow/src/i18n/en.js +++ b/zy-acs-flow/src/i18n/en.js @@ -106,6 +106,13 @@ agvModel: 'Agv Model', agv: 'Agv', agvDetail: 'Agv Detail', + actionSts: 'Action Status', + actionType: 'Action Type', + busSts: 'Bus Status', + taskSts: 'Task Status', + taskType: 'Task Type', + vehFaultRec: 'Agv Fault', + }, table: { field: { @@ -351,6 +358,41 @@ tempQua: "temp", password: "password", }, + actionSts: { + uuid: "uuid", + name: "name", + }, + actionType: { + uuid: "uuid", + name: "name", + }, + busSts: { + uuid: "uuid", + name: "name", + }, + taskSts: { + uuid: "uuid", + name: "name", + }, + taskType: { + uuid: "uuid", + name: "name", + }, + vehFaultRec: { + uuid: "uuid", + agvId: "agv", + faultNo: "fault no", + faultHex: "fault hex", + faultName: "fault name", + faultStatus: "fault status", + faultLev: "fault level", + faultData: "fault data", + type: "type", + protocol: "protocol", + happenTime: "happen time", + resetTime: "reset time", + state: "state", + }, } } }; diff --git a/zy-acs-flow/src/i18n/zh.js b/zy-acs-flow/src/i18n/zh.js index eece5bd..41af553 100644 --- a/zy-acs-flow/src/i18n/zh.js +++ b/zy-acs-flow/src/i18n/zh.js @@ -106,6 +106,12 @@ agvModel: '杞﹀瀷绠$悊', agv: '杞﹁締绠$悊', agvDetail: '杞﹁締璇︽儏', + actionSts: '鍔ㄤ綔鐘舵��', + actionType: '鍔ㄤ綔绫诲瀷', + busSts: '鎬荤嚎鐘舵��', + taskSts: '浠诲姟鐘舵��', + taskType: '浠诲姟绫诲瀷', + vehFaultRec: '杞﹁締鏁呴殰', }, table: { @@ -351,7 +357,41 @@ tempQua: "鏆傚瓨鏁伴噺", password: "瀵嗙爜", }, - + actionSts: { + uuid: "缂栧彿", + name: "鍚嶇О", + }, + actionType: { + uuid: "缂栧彿", + name: "鍚嶇О", + }, + busSts: { + uuid: "缂栧彿", + name: "鍚嶇О", + }, + taskSts: { + uuid: "缂栧彿", + name: "鍚嶇О", + }, + taskType: { + uuid: "缂栧彿", + name: "鍚嶇О", + }, + vehFaultRec: { + uuid: "缂栧彿", + agvId: "杞﹁締", + faultNo: "鏁呴殰鐮�", + faultHex: "鍗佸叚杩涘埗", + faultName: "鏁呴殰鍚�", + faultStatus: "鏁呴殰鐘舵��", + faultLev: "鏁呴殰绛夌骇", + faultData: "鏁呴殰鏁版嵁", + type: "鏁呴殰绫诲瀷", + protocol: "鍘熷鎶ユ枃", + happenTime: "鏁呴殰鏃堕棿", + resetTime: "澶嶄綅鏃堕棿", + state: "杩涘害", + }, } } }; diff --git a/zy-acs-flow/src/page/ResourceContent.js b/zy-acs-flow/src/page/ResourceContent.js index 062ebd6..afcd71b 100644 --- a/zy-acs-flow/src/page/ResourceContent.js +++ b/zy-acs-flow/src/page/ResourceContent.js @@ -28,6 +28,12 @@ import agvModel from './agvModel'; import agv from './agv'; import agvDetail from './agvDetail'; +import actionSts from './actionSts'; +import actionType from './actionType'; +import busSts from './busSts'; +import taskSts from './taskSts'; +import taskType from './taskType'; +import vehFaultRec from './vehFaultRec'; const ResourceContent = (node) => { switch (node.component) { @@ -79,6 +85,18 @@ return agv; case 'agvDetail': return agvDetail; + case 'actionSts': + return actionSts; + case 'actionType': + return actionType; + case 'busSts': + return busSts; + case 'taskSts': + return taskSts; + case 'taskType': + return taskType; + case 'vehFaultRec': + return vehFaultRec; default: return { list: ListGuesser, diff --git a/zy-acs-flow/src/page/actionSts/ActionStsCreate.jsx b/zy-acs-flow/src/page/actionSts/ActionStsCreate.jsx new file mode 100644 index 0000000..de831d4 --- /dev/null +++ b/zy-acs-flow/src/page/actionSts/ActionStsCreate.jsx @@ -0,0 +1,125 @@ +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 ActionStsCreate = (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.actionSts.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.actionSts.name" + source="name" + 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 ActionStsCreate; diff --git a/zy-acs-flow/src/page/actionSts/ActionStsEdit.jsx b/zy-acs-flow/src/page/actionSts/ActionStsEdit.jsx new file mode 100644 index 0000000..e05d39f --- /dev/null +++ b/zy-acs-flow/src/page/actionSts/ActionStsEdit.jsx @@ -0,0 +1,97 @@ +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 ActionStsEdit = () => { + 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.actionSts.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.actionSts.name" + source="name" + 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 ActionStsEdit; diff --git a/zy-acs-flow/src/page/actionSts/ActionStsList.jsx b/zy-acs-flow/src/page/actionSts/ActionStsList.jsx new file mode 100644 index 0000000..ccc325d --- /dev/null +++ b/zy-acs-flow/src/page/actionSts/ActionStsList.jsx @@ -0,0 +1,152 @@ +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 ActionStsCreate from "./ActionStsCreate"; +import ActionStsPanel from "./ActionStsPanel"; +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.actionSts.uuid" />, + <TextInput source="name" label="table.field.actionSts.name" />, + + <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 ActionStsList = () => { + 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.actionSts"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='actionSts' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={25} + > + <StyledDatagrid + preferenceKey='actionSts' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <ActionStsPanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="uuid" label="table.field.actionSts.uuid" /> + <TextField source="name" label="table.field.actionSts.name" /> + + <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> + <ActionStsCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='ActionSts Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default ActionStsList; diff --git a/zy-acs-flow/src/page/actionSts/ActionStsPanel.jsx b/zy-acs-flow/src/page/actionSts/ActionStsPanel.jsx new file mode 100644 index 0000000..05268dd --- /dev/null +++ b/zy-acs-flow/src/page/actionSts/ActionStsPanel.jsx @@ -0,0 +1,63 @@ +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 ActionStsPanel = () => { + 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.actionSts.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.actionSts.uuid" + property={record.uuid} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.actionSts.name" + property={record.name} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default ActionStsPanel; diff --git a/zy-acs-flow/src/page/actionSts/index.jsx b/zy-acs-flow/src/page/actionSts/index.jsx new file mode 100644 index 0000000..fde8026 --- /dev/null +++ b/zy-acs-flow/src/page/actionSts/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import ActionStsList from "./ActionStsList"; +import ActionStsEdit from "./ActionStsEdit"; + +export default { + list: ActionStsList, + edit: ActionStsEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.name}` + } +}; diff --git a/zy-acs-flow/src/page/actionType/ActionTypeCreate.jsx b/zy-acs-flow/src/page/actionType/ActionTypeCreate.jsx new file mode 100644 index 0000000..298e1e5 --- /dev/null +++ b/zy-acs-flow/src/page/actionType/ActionTypeCreate.jsx @@ -0,0 +1,125 @@ +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 ActionTypeCreate = (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.actionType.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.actionType.name" + source="name" + 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 ActionTypeCreate; diff --git a/zy-acs-flow/src/page/actionType/ActionTypeEdit.jsx b/zy-acs-flow/src/page/actionType/ActionTypeEdit.jsx new file mode 100644 index 0000000..4c715d5 --- /dev/null +++ b/zy-acs-flow/src/page/actionType/ActionTypeEdit.jsx @@ -0,0 +1,97 @@ +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 ActionTypeEdit = () => { + 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.actionType.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.actionType.name" + source="name" + 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 ActionTypeEdit; diff --git a/zy-acs-flow/src/page/actionType/ActionTypeList.jsx b/zy-acs-flow/src/page/actionType/ActionTypeList.jsx new file mode 100644 index 0000000..594e106 --- /dev/null +++ b/zy-acs-flow/src/page/actionType/ActionTypeList.jsx @@ -0,0 +1,152 @@ +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 ActionTypeCreate from "./ActionTypeCreate"; +import ActionTypePanel from "./ActionTypePanel"; +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.actionType.uuid" />, + <TextInput source="name" label="table.field.actionType.name" />, + + <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 ActionTypeList = () => { + 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.actionType"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='actionType' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={25} + > + <StyledDatagrid + preferenceKey='actionType' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <ActionTypePanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="uuid" label="table.field.actionType.uuid" /> + <TextField source="name" label="table.field.actionType.name" /> + + <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> + <ActionTypeCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='ActionType Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default ActionTypeList; diff --git a/zy-acs-flow/src/page/actionType/ActionTypePanel.jsx b/zy-acs-flow/src/page/actionType/ActionTypePanel.jsx new file mode 100644 index 0000000..0da94ba --- /dev/null +++ b/zy-acs-flow/src/page/actionType/ActionTypePanel.jsx @@ -0,0 +1,63 @@ +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 ActionTypePanel = () => { + 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.actionType.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.actionType.uuid" + property={record.uuid} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.actionType.name" + property={record.name} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default ActionTypePanel; diff --git a/zy-acs-flow/src/page/actionType/index.jsx b/zy-acs-flow/src/page/actionType/index.jsx new file mode 100644 index 0000000..5fff4e2 --- /dev/null +++ b/zy-acs-flow/src/page/actionType/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import ActionTypeList from "./ActionTypeList"; +import ActionTypeEdit from "./ActionTypeEdit"; + +export default { + list: ActionTypeList, + edit: ActionTypeEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.name}` + } +}; diff --git a/zy-acs-flow/src/page/busSts/BusStsCreate.jsx b/zy-acs-flow/src/page/busSts/BusStsCreate.jsx new file mode 100644 index 0000000..15b110f --- /dev/null +++ b/zy-acs-flow/src/page/busSts/BusStsCreate.jsx @@ -0,0 +1,125 @@ +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 BusStsCreate = (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.busSts.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.busSts.name" + source="name" + 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 BusStsCreate; diff --git a/zy-acs-flow/src/page/busSts/BusStsEdit.jsx b/zy-acs-flow/src/page/busSts/BusStsEdit.jsx new file mode 100644 index 0000000..cf46199 --- /dev/null +++ b/zy-acs-flow/src/page/busSts/BusStsEdit.jsx @@ -0,0 +1,97 @@ +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 BusStsEdit = () => { + 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.busSts.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.busSts.name" + source="name" + 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 BusStsEdit; diff --git a/zy-acs-flow/src/page/busSts/BusStsList.jsx b/zy-acs-flow/src/page/busSts/BusStsList.jsx new file mode 100644 index 0000000..62638ed --- /dev/null +++ b/zy-acs-flow/src/page/busSts/BusStsList.jsx @@ -0,0 +1,152 @@ +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 BusStsCreate from "./BusStsCreate"; +import BusStsPanel from "./BusStsPanel"; +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.busSts.uuid" />, + <TextInput source="name" label="table.field.busSts.name" />, + + <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 BusStsList = () => { + 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.busSts"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='busSts' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={25} + > + <StyledDatagrid + preferenceKey='busSts' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <BusStsPanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="uuid" label="table.field.busSts.uuid" /> + <TextField source="name" label="table.field.busSts.name" /> + + <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> + <BusStsCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='BusSts Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default BusStsList; diff --git a/zy-acs-flow/src/page/busSts/BusStsPanel.jsx b/zy-acs-flow/src/page/busSts/BusStsPanel.jsx new file mode 100644 index 0000000..599e905 --- /dev/null +++ b/zy-acs-flow/src/page/busSts/BusStsPanel.jsx @@ -0,0 +1,63 @@ +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 BusStsPanel = () => { + 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.busSts.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.busSts.uuid" + property={record.uuid} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.busSts.name" + property={record.name} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default BusStsPanel; diff --git a/zy-acs-flow/src/page/busSts/index.jsx b/zy-acs-flow/src/page/busSts/index.jsx new file mode 100644 index 0000000..df6408c --- /dev/null +++ b/zy-acs-flow/src/page/busSts/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import BusStsList from "./BusStsList"; +import BusStsEdit from "./BusStsEdit"; + +export default { + list: BusStsList, + edit: BusStsEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.name}` + } +}; diff --git a/zy-acs-flow/src/page/taskSts/TaskStsCreate.jsx b/zy-acs-flow/src/page/taskSts/TaskStsCreate.jsx new file mode 100644 index 0000000..1fb0a1f --- /dev/null +++ b/zy-acs-flow/src/page/taskSts/TaskStsCreate.jsx @@ -0,0 +1,125 @@ +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 TaskStsCreate = (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.taskSts.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.taskSts.name" + source="name" + 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 TaskStsCreate; diff --git a/zy-acs-flow/src/page/taskSts/TaskStsEdit.jsx b/zy-acs-flow/src/page/taskSts/TaskStsEdit.jsx new file mode 100644 index 0000000..ab81d46 --- /dev/null +++ b/zy-acs-flow/src/page/taskSts/TaskStsEdit.jsx @@ -0,0 +1,97 @@ +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 TaskStsEdit = () => { + 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.taskSts.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.taskSts.name" + source="name" + 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 TaskStsEdit; diff --git a/zy-acs-flow/src/page/taskSts/TaskStsList.jsx b/zy-acs-flow/src/page/taskSts/TaskStsList.jsx new file mode 100644 index 0000000..d0dbd0c --- /dev/null +++ b/zy-acs-flow/src/page/taskSts/TaskStsList.jsx @@ -0,0 +1,152 @@ +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 TaskStsCreate from "./TaskStsCreate"; +import TaskStsPanel from "./TaskStsPanel"; +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.taskSts.uuid" />, + <TextInput source="name" label="table.field.taskSts.name" />, + + <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 TaskStsList = () => { + 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.taskSts"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='taskSts' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={25} + > + <StyledDatagrid + preferenceKey='taskSts' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <TaskStsPanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="uuid" label="table.field.taskSts.uuid" /> + <TextField source="name" label="table.field.taskSts.name" /> + + <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> + <TaskStsCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='TaskSts Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default TaskStsList; diff --git a/zy-acs-flow/src/page/taskSts/TaskStsPanel.jsx b/zy-acs-flow/src/page/taskSts/TaskStsPanel.jsx new file mode 100644 index 0000000..e690401 --- /dev/null +++ b/zy-acs-flow/src/page/taskSts/TaskStsPanel.jsx @@ -0,0 +1,63 @@ +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 TaskStsPanel = () => { + 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.taskSts.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.taskSts.uuid" + property={record.uuid} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.taskSts.name" + property={record.name} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default TaskStsPanel; diff --git a/zy-acs-flow/src/page/taskSts/index.jsx b/zy-acs-flow/src/page/taskSts/index.jsx new file mode 100644 index 0000000..f880d98 --- /dev/null +++ b/zy-acs-flow/src/page/taskSts/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import TaskStsList from "./TaskStsList"; +import TaskStsEdit from "./TaskStsEdit"; + +export default { + list: TaskStsList, + edit: TaskStsEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.name}` + } +}; diff --git a/zy-acs-flow/src/page/taskType/TaskTypeCreate.jsx b/zy-acs-flow/src/page/taskType/TaskTypeCreate.jsx new file mode 100644 index 0000000..ebb5355 --- /dev/null +++ b/zy-acs-flow/src/page/taskType/TaskTypeCreate.jsx @@ -0,0 +1,125 @@ +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 TaskTypeCreate = (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.taskType.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.taskType.name" + source="name" + 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 TaskTypeCreate; diff --git a/zy-acs-flow/src/page/taskType/TaskTypeEdit.jsx b/zy-acs-flow/src/page/taskType/TaskTypeEdit.jsx new file mode 100644 index 0000000..2604c7a --- /dev/null +++ b/zy-acs-flow/src/page/taskType/TaskTypeEdit.jsx @@ -0,0 +1,97 @@ +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 TaskTypeEdit = () => { + 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.taskType.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.taskType.name" + source="name" + 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 TaskTypeEdit; diff --git a/zy-acs-flow/src/page/taskType/TaskTypeList.jsx b/zy-acs-flow/src/page/taskType/TaskTypeList.jsx new file mode 100644 index 0000000..8e2804e --- /dev/null +++ b/zy-acs-flow/src/page/taskType/TaskTypeList.jsx @@ -0,0 +1,152 @@ +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 TaskTypeCreate from "./TaskTypeCreate"; +import TaskTypePanel from "./TaskTypePanel"; +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.taskType.uuid" />, + <TextInput source="name" label="table.field.taskType.name" />, + + <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 TaskTypeList = () => { + 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.taskType"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='taskType' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={25} + > + <StyledDatagrid + preferenceKey='taskType' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <TaskTypePanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="uuid" label="table.field.taskType.uuid" /> + <TextField source="name" label="table.field.taskType.name" /> + + <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> + <TaskTypeCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='TaskType Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default TaskTypeList; diff --git a/zy-acs-flow/src/page/taskType/TaskTypePanel.jsx b/zy-acs-flow/src/page/taskType/TaskTypePanel.jsx new file mode 100644 index 0000000..c046eb8 --- /dev/null +++ b/zy-acs-flow/src/page/taskType/TaskTypePanel.jsx @@ -0,0 +1,63 @@ +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 TaskTypePanel = () => { + 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.taskType.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.taskType.uuid" + property={record.uuid} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.taskType.name" + property={record.name} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default TaskTypePanel; diff --git a/zy-acs-flow/src/page/taskType/index.jsx b/zy-acs-flow/src/page/taskType/index.jsx new file mode 100644 index 0000000..e85f1c7 --- /dev/null +++ b/zy-acs-flow/src/page/taskType/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import TaskTypeList from "./TaskTypeList"; +import TaskTypeEdit from "./TaskTypeEdit"; + +export default { + list: TaskTypeList, + edit: TaskTypeEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.name}` + } +}; diff --git a/zy-acs-flow/src/page/vehFaultRec/VehFaultRecCreate.jsx b/zy-acs-flow/src/page/vehFaultRec/VehFaultRecCreate.jsx new file mode 100644 index 0000000..16e4d90 --- /dev/null +++ b/zy-acs-flow/src/page/vehFaultRec/VehFaultRecCreate.jsx @@ -0,0 +1,204 @@ +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 VehFaultRecCreate = (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.vehFaultRec.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <ReferenceInput + source="agvId" + reference="agv" + > + <AutocompleteInput + label="table.field.vehFaultRec.agvId" + optionText="uuid" + filterToQuery={(val) => ({ uuid: val })} + /> + </ReferenceInput> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.vehFaultRec.faultNo" + source="faultNo" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.vehFaultRec.faultHex" + source="faultHex" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.vehFaultRec.faultName" + source="faultName" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.vehFaultRec.faultStatus" + source="faultStatus" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.vehFaultRec.faultLev" + source="faultLev" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.vehFaultRec.faultData" + source="faultData" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.vehFaultRec.type" + source="type" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.vehFaultRec.protocol" + source="protocol" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <DateInput + label="table.field.vehFaultRec.happenTime" + source="happenTime" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <DateInput + label="table.field.vehFaultRec.resetTime" + source="resetTime" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.vehFaultRec.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 VehFaultRecCreate; diff --git a/zy-acs-flow/src/page/vehFaultRec/VehFaultRecEdit.jsx b/zy-acs-flow/src/page/vehFaultRec/VehFaultRecEdit.jsx new file mode 100644 index 0000000..f6cbc08 --- /dev/null +++ b/zy-acs-flow/src/page/vehFaultRec/VehFaultRecEdit.jsx @@ -0,0 +1,177 @@ +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 VehFaultRecEdit = () => { + 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.vehFaultRec.uuid" + source="uuid" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <ReferenceInput + source="agvId" + reference="agv" + perPage={REFERENCE_INPUT_PAGESIZE} + > + <AutocompleteInput + label="table.field.vehFaultRec.agvId" + optionText="uuid" + filterToQuery={(val) => ({ uuid: val })} + /> + </ReferenceInput> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.vehFaultRec.faultNo" + source="faultNo" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.vehFaultRec.faultHex" + source="faultHex" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.vehFaultRec.faultName" + source="faultName" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.vehFaultRec.faultStatus" + source="faultStatus" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.vehFaultRec.faultLev" + source="faultLev" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.vehFaultRec.faultData" + source="faultData" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.vehFaultRec.type" + source="type" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.vehFaultRec.protocol" + source="protocol" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <DateInput + label="table.field.vehFaultRec.happenTime" + source="happenTime" + /> + </Stack> + <Stack direction='row' gap={2}> + <DateInput + label="table.field.vehFaultRec.resetTime" + source="resetTime" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.vehFaultRec.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 VehFaultRecEdit; diff --git a/zy-acs-flow/src/page/vehFaultRec/VehFaultRecList.jsx b/zy-acs-flow/src/page/vehFaultRec/VehFaultRecList.jsx new file mode 100644 index 0000000..27af4e8 --- /dev/null +++ b/zy-acs-flow/src/page/vehFaultRec/VehFaultRecList.jsx @@ -0,0 +1,178 @@ +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 VehFaultRecCreate from "./VehFaultRecCreate"; +import VehFaultRecPanel from "./VehFaultRecPanel"; +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.vehFaultRec.uuid" />, + <ReferenceInput source="agvId" label="table.field.vehFaultRec.agvId" reference="agv"> + <AutocompleteInput label="table.field.vehFaultRec.agvId" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> + </ReferenceInput>, + <TextInput source="faultNo" label="table.field.vehFaultRec.faultNo" />, + <TextInput source="faultHex" label="table.field.vehFaultRec.faultHex" />, + <TextInput source="faultName" label="table.field.vehFaultRec.faultName" />, + <TextInput source="faultStatus" label="table.field.vehFaultRec.faultStatus" />, + <NumberInput source="faultLev" label="table.field.vehFaultRec.faultLev" />, + <TextInput source="faultData" label="table.field.vehFaultRec.faultData" />, + <TextInput source="type" label="table.field.vehFaultRec.type" />, + <TextInput source="protocol" label="table.field.vehFaultRec.protocol" />, + <DateInput source="happenTime" label="table.field.vehFaultRec.happenTime" />, + <DateInput source="resetTime" label="table.field.vehFaultRec.resetTime" />, + <TextInput source="state" label="table.field.vehFaultRec.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 VehFaultRecList = () => { + 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.vehFaultRec"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='vehFaultRec' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={25} + > + <StyledDatagrid + preferenceKey='vehFaultRec' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <VehFaultRecPanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="uuid" label="table.field.vehFaultRec.uuid" /> + <ReferenceField source="agvId" label="table.field.vehFaultRec.agvId" reference="agv" link={false} sortable={false}> + <TextField source="uuid" /> + </ReferenceField> + <TextField source="faultNo" label="table.field.vehFaultRec.faultNo" /> + <TextField source="faultHex" label="table.field.vehFaultRec.faultHex" /> + <TextField source="faultName" label="table.field.vehFaultRec.faultName" /> + <TextField source="faultStatus" label="table.field.vehFaultRec.faultStatus" /> + <NumberField source="faultLev" label="table.field.vehFaultRec.faultLev" /> + <TextField source="faultData" label="table.field.vehFaultRec.faultData" /> + <TextField source="type" label="table.field.vehFaultRec.type" /> + <TextField source="protocol" label="table.field.vehFaultRec.protocol" /> + <DateField source="happenTime" label="table.field.vehFaultRec.happenTime" showTime /> + <DateField source="resetTime" label="table.field.vehFaultRec.resetTime" showTime /> + <TextField source="state" label="table.field.vehFaultRec.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> + <VehFaultRecCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='VehFaultRec Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default VehFaultRecList; diff --git a/zy-acs-flow/src/page/vehFaultRec/VehFaultRecPanel.jsx b/zy-acs-flow/src/page/vehFaultRec/VehFaultRecPanel.jsx new file mode 100644 index 0000000..2534b70 --- /dev/null +++ b/zy-acs-flow/src/page/vehFaultRec/VehFaultRecPanel.jsx @@ -0,0 +1,129 @@ +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 VehFaultRecPanel = () => { + 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.vehFaultRec.faultName'))}: {record.faultName} + </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.vehFaultRec.uuid" + property={record.uuid} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.agvId" + property={record.agvId$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.faultNo" + property={record.faultNo} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.faultHex" + property={record.faultHex} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.faultName" + property={record.faultName} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.faultStatus" + property={record.faultStatus} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.faultLev" + property={record.faultLev} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.faultData" + property={record.faultData} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.type" + property={record.type} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.protocol" + property={record.protocol} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.happenTime" + property={record.happenTime$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.resetTime" + property={record.resetTime$} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.vehFaultRec.state" + property={record.state} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default VehFaultRecPanel; diff --git a/zy-acs-flow/src/page/vehFaultRec/index.jsx b/zy-acs-flow/src/page/vehFaultRec/index.jsx new file mode 100644 index 0000000..febd791 --- /dev/null +++ b/zy-acs-flow/src/page/vehFaultRec/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import VehFaultRecList from "./VehFaultRecList"; +import VehFaultRecEdit from "./VehFaultRecEdit"; + +export default { + list: VehFaultRecList, + edit: VehFaultRecEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.faultName}` + } +}; diff --git a/zy-acs-flow/src/themes/rcsTheme.js b/zy-acs-flow/src/themes/rcsTheme.js index d3f9837..05b7eb5 100644 --- a/zy-acs-flow/src/themes/rcsTheme.js +++ b/zy-acs-flow/src/themes/rcsTheme.js @@ -71,7 +71,7 @@ // // borderRadius: 10, }, sidebar: { - width: 200, + width: 210, }, components: { ...defaultTheme.components, 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 ad38f1e..1701934 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_agv_detail"; - generator.tableDesc="AgvDetail"; + generator.table="man_veh_fault_rec"; + generator.tableDesc="VehFaultRec"; generator.packagePath="com.zy.acs.manager.manager"; generator.build(); diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/ActionStsController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/ActionStsController.java new file mode 100644 index 0000000..f55f55c --- /dev/null +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/ActionStsController.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.ActionSts; +import com.zy.acs.manager.manager.service.ActionStsService; +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 ActionStsController extends BaseController { + + @Autowired + private ActionStsService actionStsService; + + @PreAuthorize("hasAuthority('manager:actionSts:list')") + @PostMapping("/actionSts/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<ActionSts, BaseParam> pageParam = new PageParam<>(baseParam, ActionSts.class); + return R.ok().add(actionStsService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:actionSts:list')") + @PostMapping("/actionSts/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(actionStsService.list()); + } + + @PreAuthorize("hasAuthority('manager:actionSts:list')") + @PostMapping({"/actionSts/many/{ids}", "/actionStss/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(actionStsService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:actionSts:list')") + @GetMapping("/actionSts/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(actionStsService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:actionSts:save')") + @OperationLog("Create ActionSts") + @PostMapping("/actionSts/save") + public R save(@RequestBody ActionSts actionSts) { + actionSts.setCreateBy(getLoginUserId()); + actionSts.setCreateTime(new Date()); + actionSts.setUpdateBy(getLoginUserId()); + actionSts.setUpdateTime(new Date()); + if (!actionStsService.save(actionSts)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(actionSts); + } + + @PreAuthorize("hasAuthority('manager:actionSts:update')") + @OperationLog("Update ActionSts") + @PostMapping("/actionSts/update") + public R update(@RequestBody ActionSts actionSts) { + actionSts.setUpdateBy(getLoginUserId()); + actionSts.setUpdateTime(new Date()); + if (!actionStsService.updateById(actionSts)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(actionSts); + } + + @PreAuthorize("hasAuthority('manager:actionSts:remove')") + @OperationLog("Delete ActionSts") + @PostMapping("/actionSts/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!actionStsService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:actionSts:list')") + @PostMapping("/actionSts/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<ActionSts> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(ActionSts::getName, condition); + } + actionStsService.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:actionSts:list')") + @PostMapping("/actionSts/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(actionStsService.list(), ActionSts.class), response); + } + +} diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/ActionTypeController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/ActionTypeController.java new file mode 100644 index 0000000..949e6ae --- /dev/null +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/ActionTypeController.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.ActionType; +import com.zy.acs.manager.manager.service.ActionTypeService; +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 ActionTypeController extends BaseController { + + @Autowired + private ActionTypeService actionTypeService; + + @PreAuthorize("hasAuthority('manager:actionType:list')") + @PostMapping("/actionType/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<ActionType, BaseParam> pageParam = new PageParam<>(baseParam, ActionType.class); + return R.ok().add(actionTypeService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:actionType:list')") + @PostMapping("/actionType/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(actionTypeService.list()); + } + + @PreAuthorize("hasAuthority('manager:actionType:list')") + @PostMapping({"/actionType/many/{ids}", "/actionTypes/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(actionTypeService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:actionType:list')") + @GetMapping("/actionType/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(actionTypeService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:actionType:save')") + @OperationLog("Create ActionType") + @PostMapping("/actionType/save") + public R save(@RequestBody ActionType actionType) { + actionType.setCreateBy(getLoginUserId()); + actionType.setCreateTime(new Date()); + actionType.setUpdateBy(getLoginUserId()); + actionType.setUpdateTime(new Date()); + if (!actionTypeService.save(actionType)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(actionType); + } + + @PreAuthorize("hasAuthority('manager:actionType:update')") + @OperationLog("Update ActionType") + @PostMapping("/actionType/update") + public R update(@RequestBody ActionType actionType) { + actionType.setUpdateBy(getLoginUserId()); + actionType.setUpdateTime(new Date()); + if (!actionTypeService.updateById(actionType)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(actionType); + } + + @PreAuthorize("hasAuthority('manager:actionType:remove')") + @OperationLog("Delete ActionType") + @PostMapping("/actionType/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!actionTypeService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:actionType:list')") + @PostMapping("/actionType/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<ActionType> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(ActionType::getName, condition); + } + actionTypeService.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:actionType:list')") + @PostMapping("/actionType/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(actionTypeService.list(), ActionType.class), response); + } + +} diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/BusStsController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/BusStsController.java new file mode 100644 index 0000000..72cdced --- /dev/null +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/BusStsController.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.BusSts; +import com.zy.acs.manager.manager.service.BusStsService; +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 BusStsController extends BaseController { + + @Autowired + private BusStsService busStsService; + + @PreAuthorize("hasAuthority('manager:busSts:list')") + @PostMapping("/busSts/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<BusSts, BaseParam> pageParam = new PageParam<>(baseParam, BusSts.class); + return R.ok().add(busStsService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:busSts:list')") + @PostMapping("/busSts/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(busStsService.list()); + } + + @PreAuthorize("hasAuthority('manager:busSts:list')") + @PostMapping({"/busSts/many/{ids}", "/busStss/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(busStsService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:busSts:list')") + @GetMapping("/busSts/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(busStsService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:busSts:save')") + @OperationLog("Create BusSts") + @PostMapping("/busSts/save") + public R save(@RequestBody BusSts busSts) { + busSts.setCreateBy(getLoginUserId()); + busSts.setCreateTime(new Date()); + busSts.setUpdateBy(getLoginUserId()); + busSts.setUpdateTime(new Date()); + if (!busStsService.save(busSts)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(busSts); + } + + @PreAuthorize("hasAuthority('manager:busSts:update')") + @OperationLog("Update BusSts") + @PostMapping("/busSts/update") + public R update(@RequestBody BusSts busSts) { + busSts.setUpdateBy(getLoginUserId()); + busSts.setUpdateTime(new Date()); + if (!busStsService.updateById(busSts)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(busSts); + } + + @PreAuthorize("hasAuthority('manager:busSts:remove')") + @OperationLog("Delete BusSts") + @PostMapping("/busSts/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!busStsService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:busSts:list')") + @PostMapping("/busSts/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<BusSts> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(BusSts::getName, condition); + } + busStsService.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:busSts:list')") + @PostMapping("/busSts/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(busStsService.list(), BusSts.class), response); + } + +} diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/TaskStsController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/TaskStsController.java new file mode 100644 index 0000000..069bbcb --- /dev/null +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/TaskStsController.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.TaskSts; +import com.zy.acs.manager.manager.service.TaskStsService; +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 TaskStsController extends BaseController { + + @Autowired + private TaskStsService taskStsService; + + @PreAuthorize("hasAuthority('manager:taskSts:list')") + @PostMapping("/taskSts/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<TaskSts, BaseParam> pageParam = new PageParam<>(baseParam, TaskSts.class); + return R.ok().add(taskStsService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:taskSts:list')") + @PostMapping("/taskSts/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(taskStsService.list()); + } + + @PreAuthorize("hasAuthority('manager:taskSts:list')") + @PostMapping({"/taskSts/many/{ids}", "/taskStss/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(taskStsService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:taskSts:list')") + @GetMapping("/taskSts/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(taskStsService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:taskSts:save')") + @OperationLog("Create TaskSts") + @PostMapping("/taskSts/save") + public R save(@RequestBody TaskSts taskSts) { + taskSts.setCreateBy(getLoginUserId()); + taskSts.setCreateTime(new Date()); + taskSts.setUpdateBy(getLoginUserId()); + taskSts.setUpdateTime(new Date()); + if (!taskStsService.save(taskSts)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(taskSts); + } + + @PreAuthorize("hasAuthority('manager:taskSts:update')") + @OperationLog("Update TaskSts") + @PostMapping("/taskSts/update") + public R update(@RequestBody TaskSts taskSts) { + taskSts.setUpdateBy(getLoginUserId()); + taskSts.setUpdateTime(new Date()); + if (!taskStsService.updateById(taskSts)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(taskSts); + } + + @PreAuthorize("hasAuthority('manager:taskSts:remove')") + @OperationLog("Delete TaskSts") + @PostMapping("/taskSts/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!taskStsService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:taskSts:list')") + @PostMapping("/taskSts/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<TaskSts> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(TaskSts::getName, condition); + } + taskStsService.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:taskSts:list')") + @PostMapping("/taskSts/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(taskStsService.list(), TaskSts.class), response); + } + +} diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/TaskTypeController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/TaskTypeController.java new file mode 100644 index 0000000..0e2d9b1 --- /dev/null +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/TaskTypeController.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.TaskType; +import com.zy.acs.manager.manager.service.TaskTypeService; +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 TaskTypeController extends BaseController { + + @Autowired + private TaskTypeService taskTypeService; + + @PreAuthorize("hasAuthority('manager:taskType:list')") + @PostMapping("/taskType/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<TaskType, BaseParam> pageParam = new PageParam<>(baseParam, TaskType.class); + return R.ok().add(taskTypeService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:taskType:list')") + @PostMapping("/taskType/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(taskTypeService.list()); + } + + @PreAuthorize("hasAuthority('manager:taskType:list')") + @PostMapping({"/taskType/many/{ids}", "/taskTypes/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(taskTypeService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:taskType:list')") + @GetMapping("/taskType/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(taskTypeService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:taskType:save')") + @OperationLog("Create TaskType") + @PostMapping("/taskType/save") + public R save(@RequestBody TaskType taskType) { + taskType.setCreateBy(getLoginUserId()); + taskType.setCreateTime(new Date()); + taskType.setUpdateBy(getLoginUserId()); + taskType.setUpdateTime(new Date()); + if (!taskTypeService.save(taskType)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(taskType); + } + + @PreAuthorize("hasAuthority('manager:taskType:update')") + @OperationLog("Update TaskType") + @PostMapping("/taskType/update") + public R update(@RequestBody TaskType taskType) { + taskType.setUpdateBy(getLoginUserId()); + taskType.setUpdateTime(new Date()); + if (!taskTypeService.updateById(taskType)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(taskType); + } + + @PreAuthorize("hasAuthority('manager:taskType:remove')") + @OperationLog("Delete TaskType") + @PostMapping("/taskType/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!taskTypeService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:taskType:list')") + @PostMapping("/taskType/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<TaskType> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(TaskType::getName, condition); + } + taskTypeService.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:taskType:list')") + @PostMapping("/taskType/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(taskTypeService.list(), TaskType.class), response); + } + +} diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/VehFaultRecController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/VehFaultRecController.java new file mode 100644 index 0000000..24df189 --- /dev/null +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/VehFaultRecController.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.VehFaultRec; +import com.zy.acs.manager.manager.service.VehFaultRecService; +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 VehFaultRecController extends BaseController { + + @Autowired + private VehFaultRecService vehFaultRecService; + + @PreAuthorize("hasAuthority('manager:vehFaultRec:list')") + @PostMapping("/vehFaultRec/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<VehFaultRec, BaseParam> pageParam = new PageParam<>(baseParam, VehFaultRec.class); + return R.ok().add(vehFaultRecService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:vehFaultRec:list')") + @PostMapping("/vehFaultRec/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(vehFaultRecService.list()); + } + + @PreAuthorize("hasAuthority('manager:vehFaultRec:list')") + @PostMapping({"/vehFaultRec/many/{ids}", "/vehFaultRecs/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(vehFaultRecService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:vehFaultRec:list')") + @GetMapping("/vehFaultRec/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(vehFaultRecService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:vehFaultRec:save')") + @OperationLog("Create VehFaultRec") + @PostMapping("/vehFaultRec/save") + public R save(@RequestBody VehFaultRec vehFaultRec) { + vehFaultRec.setCreateBy(getLoginUserId()); + vehFaultRec.setCreateTime(new Date()); + vehFaultRec.setUpdateBy(getLoginUserId()); + vehFaultRec.setUpdateTime(new Date()); + if (!vehFaultRecService.save(vehFaultRec)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(vehFaultRec); + } + + @PreAuthorize("hasAuthority('manager:vehFaultRec:update')") + @OperationLog("Update VehFaultRec") + @PostMapping("/vehFaultRec/update") + public R update(@RequestBody VehFaultRec vehFaultRec) { + vehFaultRec.setUpdateBy(getLoginUserId()); + vehFaultRec.setUpdateTime(new Date()); + if (!vehFaultRecService.updateById(vehFaultRec)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(vehFaultRec); + } + + @PreAuthorize("hasAuthority('manager:vehFaultRec:remove')") + @OperationLog("Delete VehFaultRec") + @PostMapping("/vehFaultRec/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!vehFaultRecService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:vehFaultRec:list')") + @PostMapping("/vehFaultRec/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<VehFaultRec> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(VehFaultRec::getFaultName, condition); + } + vehFaultRecService.page(new Page<>(1, 30), wrapper).getRecords().forEach( + item -> vos.add(new KeyValVo(item.getId(), item.getFaultName())) + ); + return R.ok().add(vos); + } + + @PreAuthorize("hasAuthority('manager:vehFaultRec:list')") + @PostMapping("/vehFaultRec/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(vehFaultRecService.list(), VehFaultRec.class), response); + } + +} -- Gitblit v1.9.1