From b003a49794f49a329e2702918ecfc8d14b371d0d Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期三, 04 三月 2026 14:51:25 +0800
Subject: [PATCH] 云仓WMS接口流程
---
rsf-admin/src/page/histories/asnOrderLog/AsnOrderLogShow.jsx | 276 ++++++++++++++++++++++++++----------------------------
1 files changed, 134 insertions(+), 142 deletions(-)
diff --git a/rsf-admin/src/page/histories/asnOrderLog/AsnOrderLogShow.jsx b/rsf-admin/src/page/histories/asnOrderLog/AsnOrderLogShow.jsx
index 2acd903..9651db8 100644
--- a/rsf-admin/src/page/histories/asnOrderLog/AsnOrderLogShow.jsx
+++ b/rsf-admin/src/page/histories/asnOrderLog/AsnOrderLogShow.jsx
@@ -1,158 +1,150 @@
-import { BooleanField, DateField, NumberField, ReferenceField, Show, SimpleShowLayout, TextField ,DateInput,
- SelectInput,required,useTranslate,
- useRecordContext,} from 'react-admin';
-import { Stack, Grid, Box, Typography, Card } from '@mui/material';
-import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting';
-import EditBaseAside from "../../components/EditBaseAside";
+import React from "react";
+import { Show, useTranslate, useRecordContext, DateField } from 'react-admin';
+import { Stack, Grid, Box, Typography, TextField as MuiTextField, Card, CardContent } from '@mui/material';
+import AccessTimeIcon from '@mui/icons-material/AccessTime';
import CustomerTopToolBar from "../../components/EditTopToolBar";
import AsnOrderItemLogList from "./AsnOrderItemLogList";
-const AsnOrderLogDetailWithItems = () => {
- const record = useRecordContext();
+/** 鍙杈撳叆妗嗘牱寮忥紝涓� Edit 椤� Filled 鐧藉簳涓�鑷达紝鐢ㄤ簬 Show 澶撮儴 */
+const readOnlyInputSx = {
+ "& .MuiFormLabel-root.MuiInputLabel-root.Mui-disabled": {
+ bgcolor: 'white',
+ WebkitTextFillColor: "rgba(0, 0, 0)"
+ },
+ "& .MuiInputBase-input.MuiFilledInput-input.Mui-disabled": {
+ bgcolor: 'white',
+ WebkitTextFillColor: "rgba(0, 0, 0)"
+ },
+ "& .MuiFilledInput-root.MuiInputBase-sizeSmall": {
+ bgcolor: 'white',
+ }
+};
+
+const ShowField = ({ source, labelKey, value }) => {
const translate = useTranslate();
- if (!record?.id) return null;
return (
- <>
- <Grid item xs={24} md={16} sx={{ marginTop: '1em', width: '100%' }}>
- <Typography variant="h6" gutterBottom>
- {translate('common.edit.title.common')}
- </Typography>
- </Grid>
- <AsnOrderItemLogList logId={record.id} />
- </>
+ <MuiTextField
+ size="small"
+ variant="filled"
+ label={translate(labelKey)}
+ value={value ?? ''}
+ disabled
+ sx={{ width: 130, minWidth: 110, flexShrink: 0, ...readOnlyInputSx }}
+ InputProps={{ readOnly: true }}
+ />
);
};
-const Aa = () =>{
+/**
+ * 鍏ュ簱/鍑哄簱鍘嗗彶鍗曟煡鐪嬭鎯咃細鍗曞垪骞抽摵锛堜富瑕� 鈫� 鏇村 鈫� 鐗╂枡璇︽儏锛夛紝鏃犲彸渚� aside锛屽崰婊℃暣椤靛搴︺��
+ * Show 椤垫棤 Form 涓婁笅鏂囷紝鐢� MUI TextField 鍙鏍峰紡澶嶅埢 Edit 澶撮儴瑙嗚鏁堟灉銆�
+ */
+const AsnOrderLogShow = () => {
const translate = useTranslate();
-
- return(
- <>
+ return (
<Show
- redirect="list"
- mutationMode={EDIT_MODE}
actions={<CustomerTopToolBar />}
- aside={<EditBaseAside />}
- >
- <SimpleShowLayout
- shouldUnregister
- warnWhenUnsavedChanges
- mode="onTouched"
- defaultValues={{}}
- >
-
- <Grid sx={{
- "& .MuiInputBase-input": {
- bgcolor: "white"
- }
- }} container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
-
- <Grid item xs={24} md={12}>
- <Typography variant="h6" gutterBottom>
- {translate('common.edit.title.main')}
- </Typography>
- <Stack display="flax" justifyContent="space-between" flexWrap="wrap" direction='row' gap={2} >
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" >
- {translate('table.field.asnOrderLog.code')}
- </Typography>
- <TextField source="code" label="id"/>
- </Box>
- </Grid>
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" sx={{fontSize: 20}}>
- {translate('table.field.asnOrderLog.poCode')}
- </Typography>
- <TextField source="poCode" label="poCode"/>
- </Box>
- </Grid>
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" sx={{fontSize: 20}}>
- {translate('table.field.asnOrderLog.poId')}
- </Typography>
- <NumberField source="poId" label="poId"/>
- </Box>
- </Grid>
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" sx={{fontSize: 20}}>
- {translate('table.field.asnOrderLog.type')}
- </Typography>
- <TextField source="type$" label="type"/>
- </Box>
- </Grid>
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" sx={{fontSize: 20}}>
- {translate('table.field.asnOrderLog.wkType')}
- </Typography>
- <TextField source="wkType$" label="type"/>
- </Box>
- </Grid>
-
- </Stack>
- <Stack display="flax" justifyContent="space-between" flexWrap="wrap" direction='row' gap={2} sx={{mt:5 }}>
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" sx={{fontSize: 20}}>
- {translate('table.field.asnOrderLog.anfme')}
- </Typography>
- <TextField source="anfme" label="id"/>
- </Box>
- </Grid>
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" sx={{fontSize: 20}}>
- {translate('table.field.asnOrderLog.qty')}
- </Typography>
- <TextField source="qty" label="poCode"/>
- </Box>
- </Grid>
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" sx={{fontSize: 20}}>
- {translate('table.field.asnOrderLog.logisNo')}
- </Typography>
- <NumberField source="logisNo" label="poId"/>
- </Box>
- </Grid>
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" sx={{fontSize: 20}}>
- {translate('table.field.asnOrderLog.arrTime')}
- </Typography>
- <DateField source="arrTime" label="type" showTime/>
- </Box>
- </Grid>
- {/* 璐ㄦ涓婃姤鐘舵��
- <Grid item display="flex" gap={1} minWidth={150}>
- <Box flexGrow={1}>
- <Typography variant="body2" sx={{fontSize: 20}}>
- {translate('table.field.asnOrderLog.ntyStatus')}
- </Typography>
- <TextField source="ntyStatus$" label="type"/>
- </Box>
- </Grid>
- */}
- </Stack>
+ title="鍏ュ簱鍘嗗彶鍗曡鎯�"
+ sx={{
+ width: '100% !important',
+ maxWidth: 'none !important',
+ '& > div': { maxWidth: 'none !important', width: '100% !important' },
+ '& .RaShow-main': { maxWidth: 'none !important', width: '100% !important', minWidth: 0 },
+ '& .RaShow-card': { maxWidth: 'none !important', width: '100% !important' },
+ '& .MuiPaper-root': { maxWidth: 'none !important', width: '100% !important' },
+ '& [class*="RaShow"]': { maxWidth: 'none !important', width: '100% !important' },
+ }}
+ >
+ <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, pt: 1, width: '100%', minWidth: 0 }}>
+ <Grid container spacing={2}>
+ <Grid item xs={12} md>
+ <Card variant="outlined" sx={{ height: '100%' }}>
+ <CardContent sx={{ py: 1, '&:last-child': { pb: 1.5 } }}>
+ <MainSection />
+ </CardContent>
+ </Card>
+ </Grid>
+ <Grid item xs={12} md="auto">
+ <Card variant="outlined" sx={{ height: '100%' }}>
+ <CardContent>
+ <MoreSection />
+ </CardContent>
+ </Card>
</Grid>
</Grid>
- <AsnOrderLogDetailWithItems />
- </SimpleShowLayout>
+ <Card variant="outlined" sx={{ flex: '1 1 auto', minHeight: 0, display: 'flex', flexDirection: 'column' }}>
+ <CardContent sx={{ flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0, '&:last-child': { pb: 2 } }}>
+ <Box sx={{ width: '100%', minWidth: 0, overflowX: 'auto', flex: 1 }}>
+ <AsnOrderItemLogList />
+ </Box>
+ </CardContent>
+ </Card>
+ </Box>
</Show>
- </>
- );
-}
+ );
+};
-const AsnorderlogShow = () => (
-
- <Aa />
-
-
-
-);
+/** 鏇村锛氬垱寤烘椂闂淬�佷慨鏀规椂闂达紝涓� EditBaseAside 鍐呭涓�鑷达紝鏀惧湪涓诲唴瀹瑰尯鍗曞垪灞曠ず */
+const MoreSection = () => {
+ const translate = useTranslate();
+ const record = useRecordContext();
+ if (!record) return null;
+ return (
+ <Box>
+ <Typography variant="h6" gutterBottom>
+ {translate('common.edit.side.title')}
+ </Typography>
+ <Grid container rowSpacing={2} columnSpacing={1}>
+ <Grid item xs={12} display="flex" gap={1}>
+ <AccessTimeIcon fontSize="small" color="disabled" />
+ <Box flexGrow={1}>
+ <Typography variant="body2">{translate('common.field.createTime')}</Typography>
+ <DateField record={record} source="createTime" showTime />
+ </Box>
+ </Grid>
+ <Grid item xs={12} display="flex" gap={1}>
+ <AccessTimeIcon fontSize="small" color="disabled" />
+ <Box flexGrow={1}>
+ <Typography variant="body2">{translate('common.field.updateTime')}</Typography>
+ <DateField record={record} source="updateTime" showTime />
+ </Box>
+ </Grid>
+ </Grid>
+ </Box>
+ );
+};
-export default AsnorderlogShow
\ No newline at end of file
+const MainSection = () => {
+ const translate = useTranslate();
+ const record = useRecordContext();
+ if (!record) return null;
+ const rleStatusText = record.rleStatus === 1 ? '宸查噴鏀�' : (record.rleStatus === 0 ? '姝e父' : (record.rleStatus$ ?? ''));
+ const arrTime = record.arrTime ? (typeof record.arrTime === 'string' ? record.arrTime : new Date(record.arrTime).toLocaleString('zh-CN')) : '';
+ const numOpt = { minimumFractionDigits: 2, maximumFractionDigits: 2 };
+ return (
+ <Box sx={{ pt: 0.3, width: '100%' }}>
+ <Grid container sx={{ width: '100%', maxWidth: '100%' }} rowSpacing={1} columnSpacing={1}>
+ <Grid item xs={12}>
+ <Typography variant="h6" gutterBottom sx={{ mb: 1 }}>
+ {translate('common.edit.title.main')}
+ </Typography>
+ <Stack direction="row" gap={1} flexWrap="wrap" useFlexGap>
+ <ShowField source="code" labelKey="table.field.asnOrder.code" value={record.code} />
+ <ShowField source="poCode" labelKey="table.field.asnOrder.poCode" value={record.poCode} />
+ <ShowField source="type" labelKey="table.field.asnOrder.type" value={record.type$ ?? record.type} />
+ <ShowField source="wkType" labelKey="table.field.asnOrder.wkType" value={record.wkType$ ?? record.wkType} />
+ {/*</Stack>*/}
+ {/*<Stack direction="row" gap={1} flexWrap="wrap" useFlexGap sx={{ mt: 1 }}>*/}
+ <ShowField source="logisNo" labelKey="table.field.asnOrder.logisNo" value={record.logisNo} />
+ <ShowField source="anfme" labelKey="table.field.asnOrder.anfme" value={record.anfme != null ? Number(record.anfme).toLocaleString('zh-CN', numOpt) : ''} />
+ <ShowField source="qty" labelKey="table.field.asnOrder.qty" value={record.qty != null ? Number(record.qty).toLocaleString('zh-CN', numOpt) : ''} />
+ <ShowField source="arrTime" labelKey="table.field.asnOrder.arrTime" value={arrTime} />
+ <ShowField source="rleStatus" labelKey="table.field.asnOrder.rleStatus" value={rleStatusText} />
+ </Stack>
+ </Grid>
+ </Grid>
+ </Box>
+ );
+};
+
+export default AsnOrderLogShow;
--
Gitblit v1.9.1