skyouc
2025-03-21 203e553223a51b1e80c3d764363771c4d9453b8d
Merge branch 'front' into devlop
1个文件已添加
2个文件已修改
199 ■■■■■ 已修改文件
rsf-admin/public/img/barcode.jpeg 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx 172 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/public/img/barcode.jpeg
rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx
@@ -4,10 +4,11 @@
    SavedQueriesList,
    FilterLiveSearch,
    useNotify,
    useListContext
    useListContext,
    SearchInput
} from 'react-admin';
import BookmarkIcon from '@mui/icons-material/BookmarkBorder';
import { Box, Typography, Card, CardContent, useTheme, TextField } from '@mui/material';
import { Box, Typography, Card, CardContent, useTheme, Input } from '@mui/material';
import { RichTreeView } from "@mui/x-tree-view/RichTreeView";
import { TreeItem2 } from "@mui/x-tree-view/TreeItem2";
@@ -19,6 +20,7 @@
    const [selectedOption, setSelectedOption] = useState(null);
    const [treeData, setTreeData] = useState([]);
    const [defaultIds, setDefaultIds] = useState(['29']);
    const [condition, setCondition] = useState('');
    const haveChildren = (item) => {
        if (Array.isArray(item)) {
@@ -38,15 +40,17 @@
        return item;
    };
    useEffect(() => {
        request.post('/matnrGroup/tree')
        http()
    }, [condition]);
    const http = () => {
        request.post('/matnrGroup/tree', { condition })
            .then(res => {
                if (res?.data?.code === 200) {
                    let data = res.data.data;
                    let items = haveChildren(data)
                    setTreeData(items)
                    setDefaultIds([items.at(0).id])
                } else {
                    notify(res.data.msg);
@@ -56,12 +60,12 @@
                notify('Error fetching tree data');
            });
    }, []);
    }
    const handleNodeSelect = (event, nodeId) => {
        setFilters({ groupId: nodeId });
    };
    const handleSearch = () => {
        console.log('Search Input:', selectedOption);
    const handleSearch = (e) => {
        setCondition(e.target.value)
    };
@@ -96,8 +100,11 @@
            }}
        >
            <CardContent>
                <SavedQueriesList icon={<BookmarkIcon />} />
                <FilterLiveSearch source="condition" />
                <Input
                    placeholder="搜索物料分区"
                    sx={{ '--Input-focused': 1, marginBottom: '10px' }}
                    onChange={handleSearch}
                />
                <RichTreeView
                    defaultExpandedItems={defaultIds}
                    expansionTrigger="iconContainer"
rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx
@@ -54,7 +54,7 @@
import { useReactToPrint } from "react-to-print";
const InitModal = ({ open, setOpen }) => {
const PrintModal = ({ open, setOpen }) => {
    const refresh = useRefresh();
    const translate = useTranslate();
    const notify = useNotify();
@@ -98,76 +98,17 @@
                </FormControl>
                <Box>
                    <div ref={contentRef} style={{ display: 'flex', justifyContent: 'center' }}>
                        <table
                            className="contain"
                            style={{
                                overflow: 'hidden',
                                fontSize: 'small',
                                tableLayout: 'fixed',
                                width: '280px',
                                borderCollapse: 'collapse', // 合并边框
                                border: '1px solid black' // 设置表格整体边框
                            }}
                        >
                            <tbody>
                                <tr style={{ height: '74px' }}>
                                    <td
                                        align="center"
                                        colSpan={3}
                                        style={{ border: '1px solid black' }} // 设置单元格边框
                                    >
                                        商品编码
                                    </td>
                                    <td
                                        align="center"
                                        className="barcode"
                                        colSpan={9}
                                        style={{ border: '1px solid black' }}
                                    >
                                        {/* <img className="template-code" src={barcodeUrl} style={{ width: '90%' }} alt="Barcode" /> */}
                                        <div style={{ letterSpacing: '2px', marginTop: '1px', textAlign: 'center' }}>
                                            <span>{'matnr'}</span>
                                        </div>
                                    </td>
                                </tr>
                                <tr style={{ height: '74px' }}>
                                    <td
                                        align="center"
                                        colSpan={3}
                                        style={{ border: '1px solid black' }}
                                    >
                                        商品
                                    </td>
                                    <td
                                        align="center"
                                        colSpan={5}
                                        style={{
                                            overflow: 'hidden',
                                            whiteSpace: 'nowrap',
                                            textOverflow: 'ellipsis',
                                            border: '1px solid black'
                                        }}
                                    >
                                        {'maktx'}
                                    </td>
                                    <td
                                        align="center"
                                        colSpan={2}
                                        style={{ border: '1px solid black' }}
                                    >
                                        备注
                                    </td>
                                    <td
                                        align="center"
                                        colSpan={2}
                                        style={{ border: '1px solid black' }}
                                    >
                                        {'memo'}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    <div style={{ textAlign: 'center' }}>
                        <PrintTemp />
                    </div>
                    <style>{`
                    @media print {
                    .print-content {
                            display: block!important;
                        }
                    }`} </style>
                    <div ref={contentRef} className="print-content" style={{ textAlign: 'center', display: 'none' }}>
                        <PrintTemp />
                    </div>
                </Box>
            </DialogContent>
@@ -178,8 +119,93 @@
                    </Button>
                </Box>
            </DialogActions>
        </Dialog>
        </Dialog >
    );
}
export default InitModal;
export default PrintModal;
const PrintTemp = (props) => {
    const [data, setData] = useState([{
        barcode: '/img/barcode.jpeg',
        product: 'xxxxxx-xx/xx',
        remark: 'xx'
    }]);
    return (
        <>
            {data.map((item, index) => (
                <table
                    key={index}
                    className="contain"
                    style={{
                        overflow: 'hidden',
                        fontSize: 'small',
                        tableLayout: 'fixed',
                        width: '280px',
                        borderCollapse: 'collapse',
                        borderSpacing: 0,
                        margin: '0 auto',
                        marginTop: '10px',
                    }}
                >
                    <tbody>
                        <tr style={{ height: '74px' }}>
                            <td align="center" colSpan={3} style={{ border: '1px solid black' }} >
                                商品编码
                            </td>
                            <td
                                align="center"
                                className="barcode"
                                colSpan={9}
                                style={{ border: '1px solid black' }}
                            >
                                <img className="template-code" src={item.barcode} style={{ width: '90%', verticalAlign: 'middle' }} alt="Barcode" />
                                <div style={{ letterSpacing: '2px', marginTop: '1px', textAlign: 'center' }}>
                                    <span>{'xxxxxx'}</span>
                                </div>
                            </td>
                        </tr>
                        <tr style={{ height: '74px' }}>
                            <td
                                align="center"
                                colSpan={3}
                                style={{ border: '1px solid black' }}
                            >
                                商品
                            </td>
                            <td
                                align="center"
                                colSpan={5}
                                style={{
                                    overflow: 'hidden',
                                    whiteSpace: 'nowrap',
                                    textOverflow: 'ellipsis',
                                    border: '1px solid black'
                                }}
                            >
                                {item.product}
                            </td>
                            <td
                                align="center"
                                colSpan={2}
                                style={{ border: '1px solid black' }}
                            >
                                备注
                            </td>
                            <td
                                align="center"
                                colSpan={2}
                                style={{ border: '1px solid black' }}
                            >
                                {item.remark}
                            </td>
                        </tr>
                    </tbody>
                </table>
            ))}
        </>
    )
}