From 014270352f8e19b51bbb4367ae2ff256050a30a2 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期二, 22 四月 2025 14:03:42 +0800 Subject: [PATCH] #修改优化 1. 字典优化修改 2. 编码规则优化 3. 出库单编码生成为空问题修复 --- rsf-admin/src/page/task/TaskPanel.jsx | 199 ++++++++++++++++++------------------------------- 1 files changed, 73 insertions(+), 126 deletions(-) diff --git a/rsf-admin/src/page/task/TaskPanel.jsx b/rsf-admin/src/page/task/TaskPanel.jsx index 24270ed..6207229 100644 --- a/rsf-admin/src/page/task/TaskPanel.jsx +++ b/rsf-admin/src/page/task/TaskPanel.jsx @@ -1,139 +1,86 @@ import React, { useState, useRef, useEffect, useMemo } from "react"; -import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; +import { Box } from '@mui/material'; import { - useTranslate, + List, + DatagridConfigurable, useRecordContext, + useTranslate, + TextField, + NumberField, + DateField, + BooleanField, + ReferenceField, } 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 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 resource="taskItem" + sx={{ + flexGrow: 1, + transition: (theme) => + theme.transitions.create(['all'], { + duration: theme.transitions.duration.enteringScreen, + }), + marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, + }} + filter={{ taskId: record.id }} + // title={"menu.taskItem"} + pagination={false} + empty={false} + actions={false} + > + <StyledDatagrid + preferenceKey='taskItem' + bulkActionButtons={false} + rowClick={false} + expandSingle + 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" /> + <TextField source="updateBy$" label="common.field.updateBy"/> + <TextField source="createBy$" label="common.field.createBy"/> + <DateField source="updateTime" label="common.field.updateTime" showTime /> + <DateField source="createTime" label="common.field.createTime" showTime /> + <TextField source="memo" label="common.field.memo" sortable={false} /> + </StyledDatagrid> + </List> + </Box> </> ); }; -- Gitblit v1.9.1