From 3e3e7327d92e11beb0aa46a4915733be37e0d198 Mon Sep 17 00:00:00 2001
From: verou <857149855@qq.com>
Date: 星期二, 25 三月 2025 15:08:15 +0800
Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
---
rsf-admin/src/page/purchase/PurchasePanel.jsx | 273 +++++++++++++++++++++++++++++++++---------------------
1 files changed, 166 insertions(+), 107 deletions(-)
diff --git a/rsf-admin/src/page/purchase/PurchasePanel.jsx b/rsf-admin/src/page/purchase/PurchasePanel.jsx
index 0712c0d..39b1d20 100644
--- a/rsf-admin/src/page/purchase/PurchasePanel.jsx
+++ b/rsf-admin/src/page/purchase/PurchasePanel.jsx
@@ -1,122 +1,181 @@
import React, { useState, useRef, useEffect, useMemo } from "react";
-import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material';
+import { Box, Card, CardContent, Grid, Typography, Tooltip, Paper, TableContainer, Table, TableBody, TableCell, TableHead, TableRow } from '@mui/material';
import {
useTranslate,
useRecordContext,
+ useNotify
} from 'react-admin';
import PanelTypography from "../components/PanelTypography";
import * as Common from '@/utils/common'
-
+import { styled } from "@mui/material/styles";
+import request from '@/utils/request';
const PurchasePanel = () => {
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.purchase.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.purchase.code"
- property={record.code}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.type"
- property={record.type}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.from"
- property={record.from}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.preArr"
- property={record.preArr$}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.anfme"
- property={record.anfme}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.qty"
- property={record.qty}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.workQty"
- property={record.workQty}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.channel"
- property={record.channel}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.erpCode"
- property={record.erpCode}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.startTime"
- property={record.startTime$}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.endTime"
- property={record.endTime$}
- />
- </Grid>
- <Grid item xs={6}>
- <PanelTypography
- title="table.field.purchase.project"
- property={record.project}
- />
- </Grid>
+ const notify = useNotify();
+ const [rows, setRows] = useState([]);
+ const poId = record.id;
- </Grid>
- </CardContent>
- </Card >
- </>
+ useEffect(() => {
+ http();
+ }, [poId]);
+
+ const http = async () => {
+ const res = await request.post('/purchaseItem/page', { purchaseId: poId });
+ if (res?.data?.code === 200) {
+ setRows(res.data.data.records)
+ } else {
+ notify(res.data.msg);
+ }
+ }
+
+ const StyledTable = styled(TableRow)(({ theme }) => ({
+ "& .MuiButtonBase-root.": {
+ padding: "0px 0px",
+ },
+ }));
+
+ const StyledTableRow = styled(TableRow)(({ theme }) => ({
+ "& .MuiButtonBase-root.": {
+ padding: "0px 0px",
+ },
+ }));
+
+ const StyledTableCell = styled(TableCell)(({ theme }) => ({
+ "& .MuiButtonBase-root": {
+ padding: "0px 0px",
+ },
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ whiteSpace: "nowrap",
+ maxWidth: 600,
+ }));
+
+ const columns = [
+ {
+ id: 'purchaseId',
+ label: 'table.field.purchaseItem.purchaseId',
+ minWidth: 100
+ },
+ {
+ id: 'platItemId',
+ label: 'table.field.purchaseItem.platItemId',
+ minWidth: 100
+ },
+ {
+ id: 'matnrCode',
+ label: 'table.field.purchaseItem.matnrCode',
+ minWidth: 100
+ },
+ {
+ id: 'matnrName',
+ label: 'table.field.purchaseItem.matnrName',
+ minWidth: 100
+ },
+ {
+ id: 'unit',
+ label: 'table.field.purchaseItem.unit',
+ minWidth: 100
+ },
+ {
+ id: 'anfme',
+ label: 'table.field.purchaseItem.anfme',
+ minWidth: 100
+ },
+ {
+ id: 'qty',
+ label: 'table.field.purchaseItem.qty',
+ minWidth: 100
+ },
+ {
+ id: 'nromQty',
+ label: 'table.field.purchaseItem.nromQty',
+ minWidth: 100
+ },
+ {
+ id: 'asnQty',
+ label: 'table.field.purchaseItem.asnQty',
+ minWidth: 100
+ },
+ {
+ id: 'printQty',
+ label: 'table.field.purchaseItem.printQty',
+ minWidth: 100
+ },
+ {
+ id: 'splrName',
+ label: 'table.field.purchaseItem.splrName',
+ minWidth: 100
+ },
+ {
+ id: 'splrCode',
+ label: 'table.field.purchaseItem.splrCode',
+ minWidth: 100
+ },
+ {
+ id: 'splrBatch',
+ label: 'table.field.purchaseItem.splrBatch',
+ minWidth: 100
+ },
+ {
+ id: 'statusBool',
+ label: 'common.field.status',
+ minWidth: 100,
+ formatter: (value) => value ? 'Yes' : 'No'
+ },
+ {
+ id: 'memo',
+ label: 'common.field.memo',
+ minWidth: 100
+ }
+ ];
+
+
+ return (
+
+ <Box sx={{
+ position: 'relative',
+ padding: '5px 10px'
+ }}>
+ <TableContainer component={Paper} >
+ <Table size="small" >
+ <TableHead>
+ <StyledTableRow key={'head'}>
+ {columns.map((column, idx) => {
+ const value = column.label;
+ return (
+ <>
+ <StyledTableCell
+ key={column.id}
+ align={column.align || "left"}
+ // style={{ paddingLeft: idx === 0 && (depth * 16 + 16) }}
+ >
+ {column.format ? column.format(value) : translate(value)}
+ </StyledTableCell>
+ </>
+ );
+
+ })}
+ </StyledTableRow>
+ </TableHead>
+
+ <TableBody>
+ {rows.map((row) => (
+ <StyledTableRow key={row.id || Math.random()}>
+ {columns.map((column) => (
+ <StyledTableCell key={column.id} >
+ {row[column.id]}
+ </StyledTableCell>
+ ))}
+ </StyledTableRow>
+ ))}
+
+ </TableBody>
+ </Table>
+ </TableContainer>
+ </Box>
+
);
};
--
Gitblit v1.9.1