From de2365da21526a6af8e0c1504ed489dcc3617de9 Mon Sep 17 00:00:00 2001 From: DESKTOP-LMJ82IJ\Eno <creaycat@gmail.com> Date: 星期一, 07 四月 2025 20:45:55 +0800 Subject: [PATCH] #修改 任务主单明细显示优化 --- rsf-admin/src/page/task/TaskPanel.jsx | 264 +++++++++++++++++++++++++++------------------------- 1 files changed, 138 insertions(+), 126 deletions(-) diff --git a/rsf-admin/src/page/task/TaskPanel.jsx b/rsf-admin/src/page/task/TaskPanel.jsx index 24270ed..dd7db7f 100644 --- a/rsf-admin/src/page/task/TaskPanel.jsx +++ b/rsf-admin/src/page/task/TaskPanel.jsx @@ -1,139 +1,151 @@ import React, { useState, useRef, useEffect, useMemo } from "react"; import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; import { - useTranslate, + 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 PanelTypography from "../components/PanelTypography"; -import * as Common from '@/utils/common' +import { styled } from '@mui/material/styles'; +import PageDrawer from "../components/PageDrawer"; +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" />, + <DateInput label='common.time.before' source="timeEnd" />, + <NumberInput source="taskId" label="table.field.taskItem.taskId" />, + <NumberInput source="orderId" label="table.field.taskItem.orderId" />, + <NumberInput source="orderType" label="table.field.taskItem.orderType" />, + <NumberInput source="orderItemId" label="table.field.taskItem.orderItemId" />, + <NumberInput source="matnrId" label="table.field.taskItem.matnrId" />, + <TextInput source="maktx" label="table.field.taskItem.maktx" />, + <TextInput source="matnrCode" label="table.field.taskItem.matnrCode" />, + <TextInput source="unit" label="table.field.taskItem.unit" />, + <NumberInput source="anfme" label="table.field.taskItem.anfme" />, + <TextInput source="batch" label="table.field.taskItem.batch" />, + <TextInput source="spec" label="table.field.taskItem.spec" />, + <TextInput source="model" label="table.field.taskItem.model" />, + <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 TaskPanel = () => { - const record = useRecordContext(); - if (!record) return null; const translate = useTranslate(); + const [createDialog, setCreateDialog] = useState(false); + const [drawerVal, setDrawerVal] = useState(false); + 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.task.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.task.taskCode" - property={record.taskCode} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.taskStatus" - property={record.taskStatus} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.taskType" - property={record.taskType} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.orgLoc" - property={record.orgLoc} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.orgSite" - property={record.orgSite} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.targLoc" - property={record.targLoc} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.targSite" - property={record.targSite} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.barcode" - property={record.barcode} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.robotCode" - property={record.robotCode} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.exceStatus" - property={record.exceStatus} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.expDesc" - property={record.expDesc} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.sort" - property={record.sort} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.expCode" - property={record.expCode} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.startTime" - property={record.startTime$} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.task.endTime" - property={record.endTime$} - /> - </Grid> - - </Grid> - </CardContent> - </Card > + <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.taskItem"} + empty={false} + filters={filters} + sort={{ field: "create_time", order: "desc" }} + actions={( + <TopToolbar> + <FilterButton /> + </TopToolbar> + )} + perPage={DEFAULT_PAGE_SIZE} + > + <StyledDatagrid + preferenceKey='taskItem' + bulkActionButtons={false} + rowClick={(id, resource, record) => false} + expandSingle={true} + omit={['id', 'createTime', 'createBy', 'memo', 'taskId', 'orderId', 'orderItemId', 'matnrId']} + > + <NumberField source="id" /> + <NumberField source="taskId" label="table.field.taskItem.taskId" /> + <NumberField source="orderId" label="table.field.taskItem.orderId" /> + <NumberField source="orderType$" label="table.field.taskItem.orderType" /> + <NumberField source="orderItemId" label="table.field.taskItem.orderItemId" /> + <NumberField source="matnrId" label="table.field.taskItem.matnrId" /> + <TextField source="maktx" label="table.field.taskItem.maktx" /> + <TextField source="matnrCode" label="table.field.taskItem.matnrCode" /> + <TextField source="unit" label="table.field.taskItem.unit" /> + <NumberField source="anfme" label="table.field.taskItem.anfme" /> + <TextField source="batch" label="table.field.taskItem.batch" /> + <TextField source="spec" label="table.field.taskItem.spec" /> + <TextField source="model" label="table.field.taskItem.model" /> + <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} /> + </StyledDatagrid> + </List> + <PageDrawer + title='TaskItem Detail' + drawerVal={drawerVal} + setDrawerVal={setDrawerVal} + > + </PageDrawer> + </Box> </> ); }; -- Gitblit v1.9.1