From 01d2f0e5612891c59976404331ac9c7cfbbd5d1a Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期六, 22 三月 2025 09:15:33 +0800 Subject: [PATCH] Merge branch 'front' into devlop --- rsf-admin/src/page/basicInfo/loc/InitModal.jsx | 6 + rsf-admin/src/page/basicInfo/loc/LocCreate.jsx | 2 rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx | 6 rsf-admin/package.json | 1 rsf-admin/src/i18n/zh.js | 12 +- rsf-admin/src/page/basicInfo/loc/LocEdit.jsx | 2 rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx | 3 rsf-admin/pnpm-lock.yaml | 3 rsf-admin/src/page/basicInfo/loc/LocList.jsx | 19 +++- rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx | 130 ++++++++++++++++++++++++++++---- 10 files changed, 148 insertions(+), 36 deletions(-) diff --git a/rsf-admin/package.json b/rsf-admin/package.json index 3bf09ac..fb022cd 100644 --- a/rsf-admin/package.json +++ b/rsf-admin/package.json @@ -21,6 +21,7 @@ "axios": "^1.7.4", "date-fns": "^3.6.0", "framer-motion": "^12.4.10", + "jsbarcode": "^3.11.6", "lodash": "^4.17.21", "motion": "^12.4.1", "papaparse": "^5.4.1", diff --git a/rsf-admin/pnpm-lock.yaml b/rsf-admin/pnpm-lock.yaml index f66ce5c..1e1c44c 100644 --- a/rsf-admin/pnpm-lock.yaml +++ b/rsf-admin/pnpm-lock.yaml @@ -41,6 +41,9 @@ framer-motion: specifier: ^12.4.10 version: 12.4.10(@emotion/is-prop-valid@1.3.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + jsbarcode: + specifier: ^3.11.6 + version: 3.11.6 lodash: specifier: ^4.17.21 version: 4.17.21 diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js index f94b280..2f2f96b 100644 --- a/rsf-admin/src/i18n/zh.js +++ b/rsf-admin/src/i18n/zh.js @@ -13,8 +13,8 @@ id: 'ID', uuid: '缂栧彿', name: '鍚嶇О', - createTime: '娣诲姞鏃堕棿', - createBy: '娣诲姞浜哄憳', + createTime: '鍒涘缓鏃堕棿', + createBy: '鍒涘缓浜哄憳', updateTime: '淇敼鏃堕棿', updateBy: '淇敼浜哄憳', status: '鐘舵��', @@ -122,11 +122,11 @@ userLogin: '鐧诲綍鏃ュ織', customer: '瀹㈡埛琛�', shipper: '璐т富淇℃伅', - matnr: '鐗╂枡鏁版嵁', + matnr: '鐗╂枡', matnrGroup: '鐗╂枡鍒嗙粍', - warehouse: '浠撳簱淇℃伅', - warehouseAreas: '浠撳簱搴撳尯', - loc: '鍩虹搴撲綅', + warehouse: '浠撳簱', + warehouseAreas: '搴撳尯', + loc: '搴撲綅', locType: '搴撲綅绫诲瀷', locArea: '閫昏緫鍒嗗尯', container: '瀹瑰櫒绠$悊', diff --git a/rsf-admin/src/page/basicInfo/loc/InitModal.jsx b/rsf-admin/src/page/basicInfo/loc/InitModal.jsx index a02d8b9..16a287a 100644 --- a/rsf-admin/src/page/basicInfo/loc/InitModal.jsx +++ b/rsf-admin/src/page/basicInfo/loc/InitModal.jsx @@ -61,6 +61,7 @@ const notify = useNotify(); + const [disabled, setDisabled] = useState(false) const [formData, setFormData] = useState({ "warehouseId": null, @@ -94,6 +95,7 @@ }; const handleSubmit = async () => { + setDisabled(true) const res = await request.post(`/loc/init`, formData); if (res?.data?.code === 200) { setOpen(false); @@ -101,6 +103,7 @@ } else { notify(res.data.msg); } + setDisabled(false) } @@ -232,10 +235,11 @@ </DialogContent> <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> - <Button type="submit" variant="contained" startIcon={<SaveIcon />}> + <Button disabled={disabled} type="submit" variant="contained" startIcon={<SaveIcon />} > {translate('toolbar.confirm')} </Button> </Box> + </DialogActions> </Form> </Dialog> diff --git a/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx b/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx index 3f63d03..e5eb67a 100644 --- a/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx +++ b/rsf-admin/src/page/basicInfo/loc/LocCreate.jsx @@ -154,7 +154,7 @@ validate={[required()]} /> */} <ReferenceArrayInput source="typeIds" reference="locType" > - <SelectArrayInput label="table.field.loc.type" /> + <SelectArrayInput label="table.field.loc.type" validate={[required()]} /> </ReferenceArrayInput> </Grid> {/* <Grid item xs={6} display="flex" gap={1}> diff --git a/rsf-admin/src/page/basicInfo/loc/LocEdit.jsx b/rsf-admin/src/page/basicInfo/loc/LocEdit.jsx index b1b1ed5..5c640c5 100644 --- a/rsf-admin/src/page/basicInfo/loc/LocEdit.jsx +++ b/rsf-admin/src/page/basicInfo/loc/LocEdit.jsx @@ -121,7 +121,7 @@ validate={[required()]} /> */} <ReferenceArrayInput source="typeIds" reference="locType" > - <SelectArrayInput label="table.field.loc.type" /> + <SelectArrayInput label="table.field.loc.type" validate={[required()]} /> </ReferenceArrayInput> </Grid> <Grid item xs={6} display="flex" gap={1}> diff --git a/rsf-admin/src/page/basicInfo/loc/LocList.jsx b/rsf-admin/src/page/basicInfo/loc/LocList.jsx index dda2264..d07243d 100644 --- a/rsf-admin/src/page/basicInfo/loc/LocList.jsx +++ b/rsf-admin/src/page/basicInfo/loc/LocList.jsx @@ -54,6 +54,7 @@ import EditIcon from '@mui/icons-material/Edit'; import request from '@/utils/request'; import DiscountIcon from '@mui/icons-material/Discount'; +import { textAlign } from "@mui/system"; const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ '& .css-1vooibu-MuiSvgIcon-root': { @@ -67,6 +68,9 @@ '& .opt': { width: 200 }, + '& .RaDatagrid-headerCell': { + textAlign: 'left' + } })); const filters = [ @@ -140,6 +144,7 @@ > <StyledDatagrid preferenceKey='loc' + align="left" bulkActionButtons={ <> <BatchButton /> @@ -152,9 +157,9 @@ > <NumberField source="id" /> <NumberField source="warehouseId$" label="table.field.loc.warehouseId" /> - <NumberField source="areaId$" label="table.field.loc.areaId" /> - <TextField source="code" label="table.field.loc.code" /> - <TextField source="typeIds$" label="table.field.loc.type" /> + <NumberField source="areaId$" label="table.field.loc.areaId" align="left" /> + <TextField source="code" label="table.field.loc.code" align="left" /> + <TextField source="typeIds$" label="table.field.loc.type" align="left" /> {/* <TextField source="name" label="table.field.loc.name" /> */} {/* <NumberField source="flagLogic" label="table.field.loc.flagLogic" /> <TextField source="fucAtrrs" label="table.field.loc.fucAtrrs" /> @@ -175,12 +180,12 @@ <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> <TextField source="nickname" /> </ReferenceField> - <DateField source="updateTime" label="common.field.updateTime" showTime /> - <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> + <DateField source="updateTime" label="common.field.updateTime" showTime align="left" /> + <ReferenceField source="createBy" label="common.field.createBy" align="left" reference="user" link={false} sortable={false}> <TextField source="nickname" /> </ReferenceField> - <DateField source="createTime" label="common.field.createTime" showTime /> - <BooleanField source="statusBool" label="common.field.status" sortable={false} /> + <DateField source="createTime" label="common.field.createTime" showTime align="left" /> + <BooleanField source="statusBool" label="common.field.status" sortable={false} align="left" /> <TextField source="memo" label="common.field.memo" sortable={false} /> <WrapperField cellClassName="opt" label="common.field.opt"> diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx index 3140810..e27b5e6 100644 --- a/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx +++ b/rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx @@ -156,7 +156,6 @@ const [columns, setColumns] = useState([]); const refresh = useRefresh(); - const { refetch } = useListContext(); useEffect(() => { getDynamicFields(); @@ -360,6 +359,7 @@ const PrintButton = () => { const record = useRecordContext(); + const { resource, selectedIds } = useListContext(); const notify = useNotify(); const refresh = useRefresh(); @@ -374,6 +374,7 @@ <PrintModal open={createDialog} setOpen={setCreateDialog} + rows={selectedIds} /> </> diff --git a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx index 9f4d75c..dd93b57 100644 --- a/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx +++ b/rsf-admin/src/page/basicInfo/matnr/MatnrListAside.jsx @@ -19,7 +19,7 @@ const { setFilters } = useListContext(); // 鑾峰彇鍒楄〃涓婁笅鏂� const [selectedOption, setSelectedOption] = useState(null); const [treeData, setTreeData] = useState([]); - const [defaultIds, setDefaultIds] = useState(['29']); + const [defaultIds, setDefaultIds] = useState(['65']); const [condition, setCondition] = useState(''); const haveChildren = (item) => { @@ -96,12 +96,12 @@ border: theme.palette.mode === 'light' && '1px solid #e0e0e3', width: 250, minWidth: 150, - height: `calc(100% - 120px)`, + height: `100%`, }} > <CardContent> <Input - placeholder="鎼滅储鐗╂枡鍒嗗尯" + placeholder="鎼滅储鐗╂枡鍒嗙粍" sx={{ '--Input-focused': 1, marginBottom: '10px' }} onChange={handleSearch} /> diff --git a/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx b/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx index 83df0e0..7513fbe 100644 --- a/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx +++ b/rsf-admin/src/page/basicInfo/matnr/PrintModal.jsx @@ -53,8 +53,10 @@ import StatusSelectInput from "../../components/StatusSelectInput"; import { useReactToPrint } from "react-to-print"; +import jsbarcode from 'jsbarcode' +import { el } from "date-fns/locale"; -const PrintModal = ({ open, setOpen }) => { +const PrintModal = ({ open, setOpen, rows }) => { const refresh = useRefresh(); const translate = useTranslate(); const notify = useNotify(); @@ -98,8 +100,76 @@ </FormControl> <Box> - <div style={{ textAlign: 'center' }}> - <PrintTemp /> + <div style={{ textAlign: 'center', 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={'/img/barcode.jpeg'} style={{ width: '90%' }} 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' + }} + > + {'xxxxxxxx'} + </td> + <td + align="center" + colSpan={2} + style={{ border: '1px solid black' }} + > + 澶囨敞 + </td> + <td + align="center" + colSpan={2} + style={{ border: '1px solid black' }} + > + {'xx'} + </td> + </tr> + </tbody> + </table> </div> <style>{` @media print { @@ -108,7 +178,7 @@ } }`} </style> <div ref={contentRef} className="print-content" style={{ textAlign: 'center', display: 'none' }}> - <PrintTemp /> + <PrintTemp key={'bb'} rows={rows} /> </div> </Box> </DialogContent> @@ -125,12 +195,39 @@ export default PrintModal; -const PrintTemp = (props) => { - const [data, setData] = useState([{ - barcode: '/img/barcode.jpeg', - product: 'xxxxxx-xx/xx', - remark: 'xx' - }]); +const PrintTemp = ({ rows }) => { + const notify = useNotify(); + const [data, setData] = useState([]); + const http = async () => { + const res = await request.post(`/matnrs/many/${rows?.join()}`); + if (res?.data?.code === 200) { + let val = res.data.data.map((el => { + return { + barcode: '/img/barcode.jpeg', + code: el.code, + name: el.name, + memo: el.memo + } + })) + setData(val) + val.forEach((el) => { + jsbarcode(`#barcode${el.code}`, el.code, { height: 30 }); + }); + + + } else { + notify(res.data.msg); + } + } + + useEffect(() => { + if (rows?.length > 0) { + http(); + } + + }, [rows]); + + return ( <> {data.map((item, index) => ( @@ -159,10 +256,11 @@ 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> + <img id={"barcode" + item.code} style={{ width: '70%', verticalAlign: 'middle' }} /> + {/* <img className="template-code" src={item.barcode} style={{ width: '90%', verticalAlign: 'middle' }} alt="Barcode" /> */} + {/* <div style={{ letterSpacing: '2px', marginTop: '1px', textAlign: 'center' }}> + <span>{item.code}</span> + </div> */} </td> </tr> <tr style={{ height: '74px' }}> @@ -183,7 +281,7 @@ border: '1px solid black' }} > - {item.product} + {item.name} </td> <td align="center" @@ -197,7 +295,7 @@ colSpan={2} style={{ border: '1px solid black' }} > - {item.remark} + {item.memo} </td> </tr> </tbody> -- Gitblit v1.9.1