skyouc
4 天以前 5c372e346df385e4ca4600e0bd3c3f2e143ead7e
rsf-admin/src/page/orders/transfer/TransferPanel.jsx
@@ -1,11 +1,43 @@
import React, { useState, useRef, useEffect, useMemo } from "react";
import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material';
import {
    List,
    DateField,
    TextField,
    TopToolbar,
    FilterButton,
    NumberField,
    useTranslate,
    WrapperField,
    useRecordContext,
    DatagridConfigurable,
} from 'react-admin';
import PanelTypography from "../../components/PanelTypography.jsx";
import * as Common from '@/utils/common.js'
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting.js';
import BillStatusField from '../../components/BillStatusField';
import { styled } from '@mui/material/styles';
import * as Common from '@/utils/common.js';
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
    '& .css-1vooibu-MuiSvgIcon-root': {
        height: '.9em'
    },
    '& .RaDatagrid-row': {
        cursor: 'auto'
    },
    '& .column-name': {
    },
    '& .opt': {
        width: 220
    },
    '& .wkType': {
        width: 110
    },
    '& .status': {
        width: 90
    },
}));
const TransferPanel = () => {
    const record = useRecordContext();
@@ -13,108 +45,51 @@
    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.transfer.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}>&nbsp;</Box>
                    <Grid container spacing={2}>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.code"
                                property={record.code}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.type"
                                property={record.type}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.source"
                                property={record.source$}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.exceStatus"
                                property={record.exceStatus$}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.orgWareId"
                                property={record.orgWareId}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.orgWareName"
                                property={record.orgWareName}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.tarWareId"
                                property={record.tarWareId}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.tarWareName"
                                property={record.tarWareName}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.orgAreaId"
                                property={record.orgAreaId}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.orgAreaName"
                                property={record.orgAreaName}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.tarAreaId"
                                property={record.tarAreaId}
                            />
                        </Grid>
                        <Grid item xs={6}>
                            <PanelTypography
                                title="table.field.transfer.tarAreaName"
                                property={record.tarAreaName}
                            />
                        </Grid>
                    </Grid>
                </CardContent>
            <Card sx={{ margin: 'auto' }}>
                <List
                    resource="transfer/orders"
                    sx={{
                        flexGrow: 1,
                        transition: (theme) =>
                            theme.transitions.create(['all'], {
                                duration: theme.transitions.duration.enteringScreen,
                            }),
                    }}
                    title={false}
                    empty={false}
                    pagination={false}
                    filters={false}
                    filter={{ id: record?.id }}
                    sort={{ field: "create_time", order: "desc" }}
                    actions={false}
                    perPage={DEFAULT_PAGE_SIZE}
                >
                    <StyledDatagrid
                        sx={{ width: '100%' }}
                        preferenceKey='outStock'
                        bulkActionButtons={false}
                        rowClick={false}
                        expandSingle={true}
                        omit={['id', 'createTime', 'createBy$', 'memo', 'rleStatus$']}
                    >
                        <NumberField source="id" />
                        <TextField source="code" label="table.field.outStock.code" />
                        <TextField source="poCode" label="table.field.outStock.poCode" />
                        <TextField source="type$" label="table.field.outStock.type" />
                        <TextField cellClassName="wkType" source="wkType$" label="table.field.outStock.wkType" />
                        <NumberField source="anfme" label="table.field.outStock.anfme" />
                        <NumberField source="workQty" label="table.field.outStock.workQty" />
                        <NumberField source="qty" label="table.field.outStock.qty" />
                        <TextField source="logisNo" label="table.field.outStock.logisNo" />
                        <TextField source="rleStatus$" label="table.field.outStock.rleStatus" sortable={false} />
                        <TextField source="updateBy$" label="common.field.updateBy" />
                        <DateField source="updateTime" label="common.field.updateTime" showTime />
                        <TextField source="createBy$" label="common.field.createBy" />
                        <DateField source="createTime" label="common.field.createTime" showTime />
                        <BillStatusField cellClassName="status" source="exceStatus" label="table.field.outStock.exceStatus" />
                        <TextField source="memo" label="common.field.memo" sortable={false} />
                    </StyledDatagrid>
                </List>
            </Card >
        </>
    );