From 8843117cb805ed5d4d5476c041e7e373bbc6232f Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期四, 27 三月 2025 16:14:38 +0800 Subject: [PATCH] feat:站点管理 --- rsf-admin/src/page/waitPakinItem/WaitPakinItemList.jsx | 170 ++++ rsf-admin/src/page/waitPakinItem/WaitPakinItemPanel.jsx | 111 +++ rsf-admin/src/page/waitPakinItem/WaitPakinItemCreate.jsx | 176 +++++ rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteList.jsx | 198 +++++ rsf-admin/src/page/waitPakinItem/index.jsx | 18 rsf-admin/src/page/basicInfo/deviceSite/InitModal.jsx | 181 +++++ rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteEdit.jsx | 141 ++++ rsf-admin/src/page/waitPakin/WaitPakinEdit.jsx | 126 +++ rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteCreate.jsx | 169 ++++ rsf-admin/src/page/basicInfo/deviceSite/index.jsx | 18 rsf-admin/src/page/waitPakin/WaitPakinCreate.jsx | 154 ++++ rsf-admin/src/page/waitPakinItem/WaitPakinItemEdit.jsx | 148 ++++ rsf-admin/src/page/basicInfo/deviceSite/DeviceSitePanel.jsx | 99 ++ rsf-admin/src/page/basicInfo/loc/InitModal.jsx | 2 rsf-admin/src/page/waitPakin/index.jsx | 18 rsf-admin/src/page/waitPakin/WaitPakinList.jsx | 167 ++++ rsf-admin/src/page/components/DictionarySelect.jsx | 9 rsf-admin/src/i18n/zh.js | 38 + rsf-admin/src/i18n/en.js | 42 + rsf-admin/src/page/ResourceContent.js | 10 rsf-admin/src/page/waitPakin/WaitPakinPanel.jsx | 87 ++ rsf-admin/src/page/asnOrder/AsnOrderModal.jsx | 16 22 files changed, 2,077 insertions(+), 21 deletions(-) diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js index 6876c34..3615e90 100644 --- a/rsf-admin/src/i18n/en.js +++ b/rsf-admin/src/i18n/en.js @@ -147,12 +147,9 @@ fields: 'Extend Fields', fieldsItem: 'Extend Fields Items', warehouseAreasItem: 'WarehouseAreasItem', - endBay: "endBay", - endLev: "endLev", - endRow: "endRow", - startBay: "startBay", - startLev: "startLev", - startRow: "startRow", + deviceSite: 'deviceSite', + waitPakin: 'WaitPakin', + waitPakinItem: 'WaitPakinItem', }, table: { field: { @@ -561,6 +558,38 @@ matnrId: "MatnrId", shiperId: "Shipper", }, + deviceSite: { + type: "type", + site: "site", + name: "name", + wcsCode: "wcsCode", + label: "label", + device: "device", + deviceCode: "deviceCode", + deviceSite: "deviceSite", + flagInitu: "flagInitu", + sites: "sites", + }, + waitPakin: { + code: "code", + ansId: "ansId", + asnCode: "asnCode", + barcode: "barcode", + anfme: "anfme", + ioStatus: "ioStatus", + }, + waitPakinItem: { + pakinId: "pakinId", + maktx: "maktx", + matnrId: "matnrId", + matnrCode: "matnrCode", + anfme: "anfme", + workQty: "workQty", + unit: "unit", + fieldsIndex: "fieldsIndex", + qty: "qty", + batch: "batch", + }, } }, page: { @@ -643,6 +672,7 @@ enable: 'enable', unenable: 'unenable', locInit: 'loc init', + siteInit: 'site init', batch: 'batch', confirm: 'confirm', subzone: 'subzone', diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js index 4684a76..0f284aa 100644 --- a/rsf-admin/src/i18n/zh.js +++ b/rsf-admin/src/i18n/zh.js @@ -147,6 +147,9 @@ fields: '鎵╁睍瀛楁', fieldsItem: '鎵╁睍瀛楁鏄庣粏', warehouseAreasItem: '搴撳尯搴撳瓨淇℃伅', + deviceSite: '绔欑偣绠$悊', + waitPakin: 'WaitPakin', + waitPakinItem: 'WaitPakinItem', }, table: { field: { @@ -561,6 +564,38 @@ matnrId: "matnrId", shiperId: "shiperId", }, + deviceSite: { + type: "鍏ュ嚭搴撶被鍨�", + site: "绔欑偣缂栧彿", + name: "鍚嶇О", + wcsCode: "wcs绔欑偣缂栧彿", + label: "绔欑偣鏍囩", + device: "璁惧绫诲瀷", + deviceCode: "璁惧缂栧彿", + deviceSite: "璁惧绔欑偣", + flagInitu: "鏄惁鍒濆鍖�", + sites: "浣滀笟绔欑偣", + }, + waitPakin: { + code: "code", + ansId: "ansId", + asnCode: "asnCode", + barcode: "barcode", + anfme: "anfme", + ioStatus: "ioStatus", + }, + waitPakinItem: { + pakinId: "pakinId", + maktx: "maktx", + matnrId: "matnrId", + matnrCode: "matnrCode", + anfme: "anfme", + workQty: "workQty", + unit: "unit", + fieldsIndex: "fieldsIndex", + qty: "qty", + batch: "batch", + }, } }, page: { @@ -644,7 +679,8 @@ print: "鎵撳嵃", enable: '鍚敤', unenable: '绂佺敤', - locInit: '聽搴撲綅鍒濆鍖�', + locInit: '搴撲綅鍒濆鍖�', + siteInit: '绔欑偣鍒濆鍖�', batch: '鎵归噺鎿嶄綔', confirm: '纭', subzone: '缁戝畾鍒嗗尯', diff --git a/rsf-admin/src/page/ResourceContent.js b/rsf-admin/src/page/ResourceContent.js index fb93236..8214420 100644 --- a/rsf-admin/src/page/ResourceContent.js +++ b/rsf-admin/src/page/ResourceContent.js @@ -39,6 +39,9 @@ import fields from './fields'; import fieldsItem from './fieldsItem'; import warehouseAreasItem from './warehouseAreasItem'; +import deviceSite from './basicInfo//deviceSite'; +import waitPakin from './waitPakin'; +import waitPakinItem from './waitPakinItem'; const ResourceContent = (node) => { switch (node.component) { @@ -112,6 +115,13 @@ return locAreaMatRela; case 'locAreaMat': return locAreaMat; + case 'deviceSite': + return deviceSite; + case 'waitPakin': + return waitPakin; + case 'waitPakinItem': + return waitPakinItem; + default: diff --git a/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx b/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx index ce14597..8846b3d 100644 --- a/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx +++ b/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx @@ -115,15 +115,13 @@ "orders": formData, "items": tabelData, } - console.log(parmas); - // const res = await request.post(`/asnOrder/items/save`, parmas); - // if (res?.data?.code === 200) { - // setOpen(false); - // refresh(); - // } else { - // notify(res.data.msg); - // } - // setOpen(false); + const res = await request.post(`/asnOrder/items/update`, parmas); + if (res?.data?.code === 200) { + setOpen(false); + refresh(); + } else { + notify(res.data.msg); + } } diff --git a/rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteCreate.jsx b/rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteCreate.jsx new file mode 100644 index 0000000..f391ae9 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteCreate.jsx @@ -0,0 +1,169 @@ +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"; +import DictionarySelect from "../../components/DictionarySelect"; + +const DeviceSiteCreate = (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 (error) => { + notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); + }; + + 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 sx={{ mt: 2 }}> + <Grid container rowSpacing={2} columnSpacing={2}> + <Grid item xs={6} display="flex" gap={1}> + <DictionarySelect + label={translate("table.field.deviceSite.type")} + name="type" + validate={[required()]} + dictTypeCode="sys_task_type" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.deviceSite.site" + source="site" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.deviceSite.name" + source="name" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.deviceSite.wcsCode" + source="wcsCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.deviceSite.label" + source="label" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <DictionarySelect + label={translate("table.field.deviceSite.device")} + name="device" + validate={[required()]} + dictTypeCode="sys_device_type" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.deviceSite.deviceCode" + source="deviceCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.deviceSite.deviceSite" + source="deviceSite" + 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 DeviceSiteCreate; diff --git a/rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteEdit.jsx b/rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteEdit.jsx new file mode 100644 index 0000000..fb9f923 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteEdit.jsx @@ -0,0 +1,141 @@ +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"; +import DictionarySelect from "../../components/DictionarySelect"; + +const FormToolbar = () => { + const { getValues } = useFormContext(); + + return ( + <Toolbar sx={{ justifyContent: 'space-between' }}> + <SaveButton /> + <DeleteButton mutationMode="optimistic" /> + </Toolbar> + ) +} + +const DeviceSiteEdit = () => { + 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}> + <DictionarySelect + label={translate("table.field.deviceSite.type")} + name="type" + validate={[required()]} + dictTypeCode="sys_task_type" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.deviceSite.site" + source="site" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.deviceSite.name" + source="name" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.deviceSite.wcsCode" + source="wcsCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.deviceSite.label" + source="label" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <DictionarySelect + label={translate("table.field.deviceSite.device")} + name="device" + validate={[required()]} + dictTypeCode="sys_device_type" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.deviceSite.deviceCode" + source="deviceCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.deviceSite.deviceSite" + source="deviceSite" + 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 DeviceSiteEdit; diff --git a/rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteList.jsx b/rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteList.jsx new file mode 100644 index 0000000..6658540 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/deviceSite/DeviceSiteList.jsx @@ -0,0 +1,198 @@ +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, + useNotify, + useListContext, + FunctionField, + TextField, + NumberField, + DateField, + BooleanField, + ReferenceField, + TextInput, + DateTimeInput, + DateInput, + SelectInput, + NumberInput, + ReferenceInput, + ReferenceArrayInput, + AutocompleteInput, + DeleteButton, + Button +} from 'react-admin'; +import { Box, Typography, Card, Stack } from '@mui/material'; +import { styled } from '@mui/material/styles'; +import DeviceSiteCreate from "./DeviceSiteCreate"; +import DeviceSitePanel from "./DeviceSitePanel"; +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, DEFAULT_PAGE_SIZE } from '@/config/setting'; +import * as Common from '@/utils/common'; +import InitModal from "./InitModal"; + +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 />, + + <NumberInput source="type" label="table.field.deviceSite.type" />, + <TextInput source="site" label="table.field.deviceSite.site" />, + <TextInput source="name" label="table.field.deviceSite.name" />, + <TextInput source="wcsCode" label="table.field.deviceSite.wcsCode" />, + <TextInput source="label" label="table.field.deviceSite.label" />, + <TextInput source="device" label="table.field.deviceSite.device" />, + <TextInput source="deviceCode" label="table.field.deviceSite.deviceCode" />, + <TextInput source="deviceSite" label="table.field.deviceSite.deviceSite" />, + + <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' }, + ]} + resettable + />, +] + +const DeviceSiteList = () => { + const translate = useTranslate(); + + const [createDialog, setCreateDialog] = useState(false); + const [drawerVal, setDrawerVal] = useState(false); + const [initDialog, setInitDialog] = 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.deviceSite"} + empty={<EmptyData + children={ + <Box sx={{ gap: 2, display: 'flex' }}> + <Button + variant="contained" + color="primary" + sx={{ + fontSize: '1em', + mt: 2 + }} + onClick={() => { setCreateDialog(true) }}> + {translate('create.empty.button')} + </Button> + + <Button + variant="contained" + color="primary" + sx={{ + fontSize: '1em', + mt: 2 + }} + onClick={() => { setInitDialog(true) }}> + {translate('toolbar.siteInit')} + </Button> + </Box> + } + onClick={() => { }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='deviceSite' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={DEFAULT_PAGE_SIZE} + > + <StyledDatagrid + preferenceKey='deviceSite' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <DeviceSitePanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="name" label="table.field.deviceSite.name" /> + <NumberField source="type" label="table.field.deviceSite.type" /> + <TextField source="site" label="table.field.deviceSite.site" /> + <TextField source="wcsCode" label="table.field.deviceSite.wcsCode" /> + <TextField source="label" label="table.field.deviceSite.label" /> + <TextField source="device" label="table.field.deviceSite.device" /> + <TextField source="deviceCode" label="table.field.deviceSite.deviceCode" /> + <TextField source="deviceSite" label="table.field.deviceSite.deviceSite" /> + + <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> + <DeviceSiteCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='DeviceSite Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + + <InitModal + open={initDialog} + setOpen={setInitDialog} + /> + </Box> + ) +} + +export default DeviceSiteList; diff --git a/rsf-admin/src/page/basicInfo/deviceSite/DeviceSitePanel.jsx b/rsf-admin/src/page/basicInfo/deviceSite/DeviceSitePanel.jsx new file mode 100644 index 0000000..5f1e5a9 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/deviceSite/DeviceSitePanel.jsx @@ -0,0 +1,99 @@ +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 DeviceSitePanel = () => { + 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.deviceSite.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.deviceSite.type" + property={record.type} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceSite.site" + property={record.site} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceSite.name" + property={record.name} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceSite.wcsCode" + property={record.wcsCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceSite.label" + property={record.label} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceSite.device" + property={record.device} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceSite.deviceCode" + property={record.deviceCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.deviceSite.deviceSite" + property={record.deviceSite} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default DeviceSitePanel; diff --git a/rsf-admin/src/page/basicInfo/deviceSite/InitModal.jsx b/rsf-admin/src/page/basicInfo/deviceSite/InitModal.jsx new file mode 100644 index 0000000..1cc4b81 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/deviceSite/InitModal.jsx @@ -0,0 +1,181 @@ +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, + useListContext, + useRefresh, + SelectArrayInput +} from 'react-admin'; +import { + Dialog, + DialogActions, + DialogContent, + DialogTitle, + Grid, + TextField, + Box, + Button, + Paper, + TableContainer, + Table, + TableHead, + TableBody, + TableRow, + TableCell, + Tooltip, + IconButton, + styled + + +} from '@mui/material'; +import DialogCloseButton from "../../components/DialogCloseButton"; +import DictionarySelect from "../../components/DictionarySelect"; +import { useForm, Controller, useWatch, FormProvider, useFormContext } from "react-hook-form"; +import SaveIcon from '@mui/icons-material/Save'; +import request from '@/utils/request'; +import { Add, Edit, Delete } from '@mui/icons-material'; +import _ from 'lodash'; +import { DataGrid } from '@mui/x-data-grid'; + + + + +const InitModal = ({ open, setOpen }) => { + const refresh = useRefresh(); + const translate = useTranslate(); + + + const notify = useNotify(); + const [disabled, setDisabled] = useState(false) + + + const handleClose = (event, reason) => { + if (reason !== "backdropClick") { + setOpen(false); + } + }; + + const handleReset = (e) => { + e.preventDefault(); + }; + + const handleChange = (value, name) => { + setFormData((prevData) => ({ + ...prevData, + [name]: value + })); + }; + + const handleSubmit = async (value) => { + setDisabled(true) + const res = await request.post(`/deviceSite/init`, value); + if (res?.data?.code === 200) { + setOpen(false); + refresh(); + } else { + notify(res.data.msg); + } + setDisabled(false) + } + + + return ( + <Dialog open={open} maxWidth="md" fullWidth> + <Form onSubmit={handleSubmit}> + <DialogCloseButton onClose={handleClose} /> + <DialogTitle>{translate('toolbar.siteInit')}</DialogTitle> + <DialogContent sx={{ mt: 2 }}> + <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> + <Grid container spacing={2}> + <Grid item xs={4}> + <DictionarySelect + label={translate("table.field.deviceSite.type")} + name="typeIds" + dictTypeCode="sys_task_type" + multiple + /> + + </Grid> + + <Grid item xs={4}> + <DictionarySelect + label={translate("table.field.deviceSite.device")} + name="deviceType" + dictTypeCode="sys_device_type" + multiple + /> + </Grid> + + + <Grid item xs={4}> + <TextInput + label={translate("table.field.deviceSite.deviceCode")} + name="deviceCode" + size="small" + type="number" + /> + </Grid> + + <Grid item xs={4}> + <TextInput + label={translate("table.field.deviceSite.deviceSite")} + name="deviceSites" + size="small" + type="number" + /> + </Grid> + + <Grid item xs={4}> + <TextInput + label={translate("table.field.deviceSite.sites")} + name="sites" + size="small" + type="number" + /> + </Grid> + + <Grid item xs={4}> + <SelectInput + label="table.field.deviceSite.flagInitu" + source="flagInitu" + choices={[ + { id: 0, name: '鍚�' }, + { id: 1, name: '鏄�' }, + ]} + /> + </Grid> + + + </Grid> + + </Box> + </DialogContent> + <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> + <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> + <Button disabled={disabled} type="submit" variant="contained" startIcon={<SaveIcon />} > + {translate('toolbar.confirm')} + </Button> + </Box> + + </DialogActions> + </Form> + </Dialog> + ); +} + +export default InitModal; \ No newline at end of file diff --git a/rsf-admin/src/page/basicInfo/deviceSite/index.jsx b/rsf-admin/src/page/basicInfo/deviceSite/index.jsx new file mode 100644 index 0000000..36cf141 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/deviceSite/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import DeviceSiteList from "./DeviceSiteList"; +import DeviceSiteEdit from "./DeviceSiteEdit"; + +export default { + list: DeviceSiteList, + edit: DeviceSiteEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.name}` + } +}; diff --git a/rsf-admin/src/page/basicInfo/loc/InitModal.jsx b/rsf-admin/src/page/basicInfo/loc/InitModal.jsx index 931b943..c3c685a 100644 --- a/rsf-admin/src/page/basicInfo/loc/InitModal.jsx +++ b/rsf-admin/src/page/basicInfo/loc/InitModal.jsx @@ -152,7 +152,7 @@ <Grid item xs={4}> - <ReferenceArrayInput source="typeIds" reference="locType" > + <ReferenceArrayInput source="typeIds" reference="dictData" filter={{}}> <SelectArrayInput label="table.field.loc.type" onChange={(e) => handleChange(e.target.value, 'typeIds')} validate={[required()]} /> </ReferenceArrayInput> </Grid> diff --git a/rsf-admin/src/page/components/DictionarySelect.jsx b/rsf-admin/src/page/components/DictionarySelect.jsx index 2a0a428..0eb2fab 100644 --- a/rsf-admin/src/page/components/DictionarySelect.jsx +++ b/rsf-admin/src/page/components/DictionarySelect.jsx @@ -2,13 +2,13 @@ import { useState, useEffect } from 'react'; import { Button, useListContext, SelectInput, - required, + required, SelectArrayInput, useTranslate, useNotify } from 'react-admin'; import request from '@/utils/request'; const DictionarySelect = (props) => { - const { dictTypeCode, name, ...parmas } = props; + const { dictTypeCode, name, multiple = false, ...parmas } = props; const translate = useTranslate(); const notify = useNotify(); const [list, setList] = useState([]) @@ -31,14 +31,15 @@ notify(res.data.msg); } } + const InputComponent = multiple ? SelectArrayInput : SelectInput; return ( - <SelectInput + <InputComponent source={name} choices={list} - {...parmas} /> + ); }; diff --git a/rsf-admin/src/page/waitPakin/WaitPakinCreate.jsx b/rsf-admin/src/page/waitPakin/WaitPakinCreate.jsx new file mode 100644 index 0000000..e5250df --- /dev/null +++ b/rsf-admin/src/page/waitPakin/WaitPakinCreate.jsx @@ -0,0 +1,154 @@ +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 WaitPakinCreate = (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 (error) => { + notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); + }; + + 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 sx={{ mt: 2 }}> + <Grid container rowSpacing={2} columnSpacing={2}> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.waitPakin.code" + source="code" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.waitPakin.ansId" + source="ansId" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.waitPakin.asnCode" + source="asnCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.waitPakin.barcode" + source="barcode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.waitPakin.anfme" + source="anfme" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <SelectInput + label="table.field.waitPakin.ioStatus" + source="ioStatus" + choices={[ + { id: 0, name: '寰呭叆搴�' }, + { id: 1, name: ' 鍏ュ簱涓�' }, + ]} + /> + </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 WaitPakinCreate; diff --git a/rsf-admin/src/page/waitPakin/WaitPakinEdit.jsx b/rsf-admin/src/page/waitPakin/WaitPakinEdit.jsx new file mode 100644 index 0000000..93a66e4 --- /dev/null +++ b/rsf-admin/src/page/waitPakin/WaitPakinEdit.jsx @@ -0,0 +1,126 @@ +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 WaitPakinEdit = () => { + 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.waitPakin.code" + source="code" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.waitPakin.ansId" + source="ansId" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.waitPakin.asnCode" + source="asnCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.waitPakin.barcode" + source="barcode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.waitPakin.anfme" + source="anfme" + /> + </Stack> + <Stack direction='row' gap={2}> + <SelectInput + label="table.field.waitPakin.ioStatus" + source="ioStatus" + choices={[ + { id: 0, name: '寰呭叆搴�' }, + { id: 1, name: ' 鍏ュ簱涓�' }, + ]} + /> + </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 WaitPakinEdit; diff --git a/rsf-admin/src/page/waitPakin/WaitPakinList.jsx b/rsf-admin/src/page/waitPakin/WaitPakinList.jsx new file mode 100644 index 0000000..d25f626 --- /dev/null +++ b/rsf-admin/src/page/waitPakin/WaitPakinList.jsx @@ -0,0 +1,167 @@ +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, + useNotify, + useListContext, + FunctionField, + 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 WaitPakinCreate from "./WaitPakinCreate"; +import WaitPakinPanel from "./WaitPakinPanel"; +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, DEFAULT_PAGE_SIZE } 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="code" label="table.field.waitPakin.code" />, + <NumberInput source="ansId" label="table.field.waitPakin.ansId" />, + <TextInput source="asnCode" label="table.field.waitPakin.asnCode" />, + <TextInput source="barcode" label="table.field.waitPakin.barcode" />, + <NumberInput source="anfme" label="table.field.waitPakin.anfme" />, + <SelectInput source="ioStatus" label="table.field.waitPakin.ioStatus" + choices={[ + { id: 0, name: '寰呭叆搴�' }, + { id: 1, 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' }, + ]} + resettable + />, +] + +const WaitPakinList = () => { + 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.waitPakin"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='waitPakin' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={DEFAULT_PAGE_SIZE} + > + <StyledDatagrid + preferenceKey='waitPakin' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <WaitPakinPanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <TextField source="code" label="table.field.waitPakin.code" /> + <NumberField source="ansId" label="table.field.waitPakin.ansId" /> + <TextField source="asnCode" label="table.field.waitPakin.asnCode" /> + <TextField source="barcode" label="table.field.waitPakin.barcode" /> + <NumberField source="anfme" label="table.field.waitPakin.anfme" /> + <TextField source="ioStatus$" label="table.field.waitPakin.ioStatus" sortable={false} /> + + <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> + <WaitPakinCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='WaitPakin Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default WaitPakinList; diff --git a/rsf-admin/src/page/waitPakin/WaitPakinPanel.jsx b/rsf-admin/src/page/waitPakin/WaitPakinPanel.jsx new file mode 100644 index 0000000..e8d6108 --- /dev/null +++ b/rsf-admin/src/page/waitPakin/WaitPakinPanel.jsx @@ -0,0 +1,87 @@ +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 WaitPakinPanel = () => { + 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.waitPakin.id'))}: {record.id} + </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.waitPakin.code" + property={record.code} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakin.ansId" + property={record.ansId} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakin.asnCode" + property={record.asnCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakin.barcode" + property={record.barcode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakin.anfme" + property={record.anfme} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakin.ioStatus" + property={record.ioStatus$} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default WaitPakinPanel; diff --git a/rsf-admin/src/page/waitPakin/index.jsx b/rsf-admin/src/page/waitPakin/index.jsx new file mode 100644 index 0000000..999e0a8 --- /dev/null +++ b/rsf-admin/src/page/waitPakin/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import WaitPakinList from "./WaitPakinList"; +import WaitPakinEdit from "./WaitPakinEdit"; + +export default { + list: WaitPakinList, + edit: WaitPakinEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.id}` + } +}; diff --git a/rsf-admin/src/page/waitPakinItem/WaitPakinItemCreate.jsx b/rsf-admin/src/page/waitPakinItem/WaitPakinItemCreate.jsx new file mode 100644 index 0000000..208cedd --- /dev/null +++ b/rsf-admin/src/page/waitPakinItem/WaitPakinItemCreate.jsx @@ -0,0 +1,176 @@ +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 WaitPakinItemCreate = (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 (error) => { + notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); + }; + + 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 sx={{ mt: 2 }}> + <Grid container rowSpacing={2} columnSpacing={2}> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.waitPakinItem.pakinId" + source="pakinId" + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.waitPakinItem.maktx" + source="maktx" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.waitPakinItem.matnrId" + source="matnrId" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.waitPakinItem.matnrCode" + source="matnrCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.waitPakinItem.anfme" + source="anfme" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.waitPakinItem.workQty" + source="workQty" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.waitPakinItem.unit" + source="unit" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.waitPakinItem.fieldsIndex" + source="fieldsIndex" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.waitPakinItem.qty" + source="qty" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.waitPakinItem.batch" + source="batch" + 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 WaitPakinItemCreate; diff --git a/rsf-admin/src/page/waitPakinItem/WaitPakinItemEdit.jsx b/rsf-admin/src/page/waitPakinItem/WaitPakinItemEdit.jsx new file mode 100644 index 0000000..7e1238a --- /dev/null +++ b/rsf-admin/src/page/waitPakinItem/WaitPakinItemEdit.jsx @@ -0,0 +1,148 @@ +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 WaitPakinItemEdit = () => { + 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}> + <NumberInput + label="table.field.waitPakinItem.pakinId" + source="pakinId" + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.waitPakinItem.maktx" + source="maktx" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.waitPakinItem.matnrId" + source="matnrId" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.waitPakinItem.matnrCode" + source="matnrCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.waitPakinItem.anfme" + source="anfme" + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.waitPakinItem.workQty" + source="workQty" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.waitPakinItem.unit" + source="unit" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.waitPakinItem.fieldsIndex" + source="fieldsIndex" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.waitPakinItem.qty" + source="qty" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.waitPakinItem.batch" + source="batch" + 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 WaitPakinItemEdit; diff --git a/rsf-admin/src/page/waitPakinItem/WaitPakinItemList.jsx b/rsf-admin/src/page/waitPakinItem/WaitPakinItemList.jsx new file mode 100644 index 0000000..7d051ac --- /dev/null +++ b/rsf-admin/src/page/waitPakinItem/WaitPakinItemList.jsx @@ -0,0 +1,170 @@ +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, + useNotify, + useListContext, + FunctionField, + 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 WaitPakinItemCreate from "./WaitPakinItemCreate"; +import WaitPakinItemPanel from "./WaitPakinItemPanel"; +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, DEFAULT_PAGE_SIZE } 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 />, + + <NumberInput source="pakinId" label="table.field.waitPakinItem.pakinId" />, + <TextInput source="maktx" label="table.field.waitPakinItem.maktx" />, + <NumberInput source="matnrId" label="table.field.waitPakinItem.matnrId" />, + <TextInput source="matnrCode" label="table.field.waitPakinItem.matnrCode" />, + <NumberInput source="anfme" label="table.field.waitPakinItem.anfme" />, + <NumberInput source="workQty" label="table.field.waitPakinItem.workQty" />, + <TextInput source="unit" label="table.field.waitPakinItem.unit" />, + <TextInput source="fieldsIndex" label="table.field.waitPakinItem.fieldsIndex" />, + <NumberInput source="qty" label="table.field.waitPakinItem.qty" />, + <TextInput source="batch" label="table.field.waitPakinItem.batch" />, + + <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' }, + ]} + resettable + />, +] + +const WaitPakinItemList = () => { + 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.waitPakinItem"} + empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + <MyCreateButton onClick={() => { setCreateDialog(true) }} /> + <SelectColumnsButton preferenceKey='waitPakinItem' /> + <MyExportButton /> + </TopToolbar> + )} + perPage={DEFAULT_PAGE_SIZE} + > + <StyledDatagrid + preferenceKey='waitPakinItem' + bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} + rowClick={(id, resource, record) => false} + expand={() => <WaitPakinItemPanel />} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo']} + > + <NumberField source="id" /> + <NumberField source="pakinId" label="table.field.waitPakinItem.pakinId" /> + <TextField source="maktx" label="table.field.waitPakinItem.maktx" /> + <NumberField source="matnrId" label="table.field.waitPakinItem.matnrId" /> + <TextField source="matnrCode" label="table.field.waitPakinItem.matnrCode" /> + <NumberField source="anfme" label="table.field.waitPakinItem.anfme" /> + <NumberField source="workQty" label="table.field.waitPakinItem.workQty" /> + <TextField source="unit" label="table.field.waitPakinItem.unit" /> + <TextField source="fieldsIndex" label="table.field.waitPakinItem.fieldsIndex" /> + <NumberField source="qty" label="table.field.waitPakinItem.qty" /> + <TextField source="batch" label="table.field.waitPakinItem.batch" /> + + <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> + <WaitPakinItemCreate + open={createDialog} + setOpen={setCreateDialog} + /> + <PageDrawer + title='WaitPakinItem Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> + ) +} + +export default WaitPakinItemList; diff --git a/rsf-admin/src/page/waitPakinItem/WaitPakinItemPanel.jsx b/rsf-admin/src/page/waitPakinItem/WaitPakinItemPanel.jsx new file mode 100644 index 0000000..80d742e --- /dev/null +++ b/rsf-admin/src/page/waitPakinItem/WaitPakinItemPanel.jsx @@ -0,0 +1,111 @@ +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 WaitPakinItemPanel = () => { + 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.waitPakinItem.id'))}: {record.id} + </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.waitPakinItem.pakinId" + property={record.pakinId} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakinItem.maktx" + property={record.maktx} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakinItem.matnrId" + property={record.matnrId} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakinItem.matnrCode" + property={record.matnrCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakinItem.anfme" + property={record.anfme} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakinItem.workQty" + property={record.workQty} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakinItem.unit" + property={record.unit} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakinItem.fieldsIndex" + property={record.fieldsIndex} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakinItem.qty" + property={record.qty} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.waitPakinItem.batch" + property={record.batch} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default WaitPakinItemPanel; diff --git a/rsf-admin/src/page/waitPakinItem/index.jsx b/rsf-admin/src/page/waitPakinItem/index.jsx new file mode 100644 index 0000000..656424d --- /dev/null +++ b/rsf-admin/src/page/waitPakinItem/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import WaitPakinItemList from "./WaitPakinItemList"; +import WaitPakinItemEdit from "./WaitPakinItemEdit"; + +export default { + list: WaitPakinItemList, + edit: WaitPakinItemEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.id}` + } +}; -- Gitblit v1.9.1