From 463375d2729eeebf657b1688acf0e85ef75816b7 Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期五, 28 三月 2025 15:05:31 +0800 Subject: [PATCH] feat:收货打印 --- rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx | 84 ++++++++++++++++++++++++++++++++++++------ 1 files changed, 72 insertions(+), 12 deletions(-) diff --git a/rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx b/rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx index 5d1eeb6..a4e6655 100644 --- a/rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx +++ b/rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx @@ -3,7 +3,9 @@ import { useTranslate, useRecordContext, - useNotify + useNotify, + useRefresh, + useListContext, } from 'react-admin'; import PanelTypography from "../components/PanelTypography"; import * as Common from '@/utils/common' @@ -11,6 +13,7 @@ import request from '@/utils/request'; import debounce from 'lodash/debounce'; import { DataGrid } from '@mui/x-data-grid'; +import PrintModal from './PrintModal'; const AsnOrderPanel = () => { const record = useRecordContext(); if (!record) return null; @@ -106,13 +109,23 @@ headerName: translate('table.field.asnOrderItem.splrName') }, { - field: 'barcode', + field: 'trackCode', headerName: translate('table.field.asnOrderItem.barcode') }, { field: 'packName', headerName: translate('table.field.asnOrderItem.packName') - }] + }, + { + field: 'action', + headerName: '鎿嶄綔', + width: 70, + lockPosition: 'left', + renderCell: (params) => ( + <PrintButton rows={[params.row.id]} /> + ), + + },] const [selectedRows, setSelectedRows] = useState([]); @@ -124,13 +137,6 @@ setMaktx(value) } - const wakbarcode = () => { - - } - - const wakprint = () => { - - } return ( @@ -143,8 +149,7 @@ <TextField value={maktx} onChange={(e) => maktxChange(e.target.value)} label="鎼滅储鐗╂枡" variant="outlined" sx={{ width: '300px' }} /> <div style={{ display: 'flex', gap: '10px' }}> - <Button variant="contained" onClick={wakbarcode}>鐢熸垚鏉$爜</Button> - <Button variant="contained" onClick={wakprint}>鎵撳嵃</Button> + <PrintsButton rows={selectedRows} /> </div> </div> @@ -153,6 +158,7 @@ size="small" rows={rows} columns={columns} + disableRowSelectionOnClick checkboxSelection onRowSelectionModelChange={handleSelectionChange} selectionModel={selectedRows} @@ -166,3 +172,57 @@ }; export default AsnOrderPanel; + +const PrintsButton = ({ rows }) => { + const record = useRecordContext(); + const { resource, selectedIds } = useListContext(); + const notify = useNotify(); + const refresh = useRefresh(); + const translate = useTranslate(); + + const [createDialog, setCreateDialog] = useState(false); + + const modalChange = () => { + if (rows?.length === 0) { + notify('璇烽�夋嫨鐗╂枡'); + return; + } else { + setCreateDialog(true) + } + + } + + return ( + <> + <Button size="small" variant="contained" color="secondary" onClick={modalChange}>{translate("toolbar.batchPrint")}</Button> + + <PrintModal + open={createDialog} + setOpen={setCreateDialog} + rows={rows} + /> + </> + ) +} + +const PrintButton = ({ rows }) => { + const record = useRecordContext(); + + const notify = useNotify(); + const refresh = useRefresh(); + + const [createDialog, setCreateDialog] = useState(false); + const translate = useTranslate(); + + return ( + <> + <Button size="small" variant="contained" color="secondary" onClick={() => setCreateDialog(true)}>{translate("toolbar.print")}</Button> + + <PrintModal + open={createDialog} + setOpen={setCreateDialog} + rows={rows} + /> + </> + ) +} -- Gitblit v1.9.1