From 75d3e411d1a6ac9c83b4f595db581c8c337e50a9 Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期六, 15 三月 2025 16:55:51 +0800 Subject: [PATCH] feat:asn单据修改 --- rsf-admin/src/page/asnOrderItem/AsnOrderItemEdit.jsx | 4 rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx | 4 rsf-admin/src/page/asnOrderItem/AsnOrderItemCreate.jsx | 4 rsf-admin/src/page/asnOrderItem/AsnOrderItemList.jsx | 4 rsf-admin/src/page/asnOrder/AsnWareModal.jsx | 2 rsf-admin/src/i18n/zh.js | 2 rsf-admin/src/i18n/en.js | 2 rsf-admin/src/page/asnOrderItem/AsnOrderItemPanel.jsx | 34 +++++----- rsf-admin/src/page/asnOrder/AsnOrderModal.jsx | 68 +++++++++++++--------- 9 files changed, 69 insertions(+), 55 deletions(-) diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js index 4739948..4596053 100644 --- a/rsf-admin/src/i18n/en.js +++ b/rsf-admin/src/i18n/en.js @@ -460,7 +460,7 @@ poDetlId: "poDetlId", poDetlCode: "poDetlCode", matnrId: "matnrId", - matnk: "matnk", + maktx: "maktx", anfme: "anfme", stockUnit: "stockUnit", purQty: "purQty", diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js index ab555e4..8c533da 100644 --- a/rsf-admin/src/i18n/zh.js +++ b/rsf-admin/src/i18n/zh.js @@ -460,7 +460,7 @@ poDetlId: "PO鍗曟爣璇�", poDetlCode: "PO鍗曠紪鐮�", matnrId: "鐗╂枡鏍囪瘑", - matnk: "鐗╂枡鍚嶇О", + maktx: "鐗╂枡鍚嶇О", anfme: "鏁伴噺", stockUnit: "搴撳瓨鍗曚綅", purQty: "閲囪喘鏁伴噺", diff --git a/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx b/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx index 66af5ed..2942d22 100644 --- a/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx +++ b/rsf-admin/src/page/asnOrder/AsnOrderModal.jsx @@ -57,8 +57,6 @@ const AsnOrderModal = (props) => { const { open, setOpen, asnId } = props; - - const translate = useTranslate(); const notify = useNotify(); const refresh = useRefresh(); @@ -95,16 +93,22 @@ }; const handleSubmit = async () => { - const parmas = { - "orders": formData, - "items": tabelData, - } - const res = await request.post(`/asnOrder/items/save`, parmas); - if (res?.data?.code === 200) { - setOpen(false); + if (asnId === 0) { + const parmas = { + "orders": formData, + "items": tabelData, + } + const res = await request.post(`/asnOrder/items/save`, parmas); + if (res?.data?.code === 200) { + setOpen(false); + refresh(); + } else { + notify(res.data.msg); + } } else { - notify(res.data.msg); + setOpen(false); } + }; @@ -125,7 +129,6 @@ } else { notify(res.data.msg); } - } const requestGetBody = async () => { @@ -134,6 +137,13 @@ setTableData(res.data.data.records) } else { notify(res.data.msg); + } + } + + const requestSetHead = async () => { + if (asnId !== 0) { + const res = await request.post(`/asnOrder/update`, { ...formData }); + refresh() } } @@ -170,6 +180,7 @@ name="type" value={formData.type} onChange={handleChange} + onBlur={requestSetHead} variant="outlined" size="small" validate={required()} @@ -199,7 +210,7 @@ </Box> <Box sx={{ mt: 2 }}> - <AsnOrderModalTable tabelData={tabelData} setTableData={setTableData} ></AsnOrderModalTable> + <AsnOrderModalTable tabelData={tabelData} setTableData={setTableData} asnId={asnId} ></AsnOrderModalTable> </Box> </DialogContent> <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> @@ -224,7 +235,7 @@ export default AsnOrderModal; -const AsnOrderModalTable = ({ tabelData, setTableData }) => { +const AsnOrderModalTable = ({ tabelData, setTableData, asnId }) => { const translate = useTranslate(); const columns = [ @@ -247,11 +258,11 @@ headerName: translate('table.field.asnOrderItem.matnrId'), minWidth: 100, flex: 1, - editable: false, // 鍋囪 matnrId 涓嶅彲缂栬緫 + editable: false, }, { - field: 'matnk', - headerName: translate('table.field.asnOrderItem.matnk'), + field: 'maktx', + headerName: translate('table.field.asnOrderItem.maktx'), minWidth: 100, flex: 1, editable: true, @@ -261,14 +272,12 @@ headerName: translate('table.field.asnOrderItem.poDetlId'), minWidth: 100, flex: 1, - editable: true, }, { field: 'poDetlCode', headerName: translate('table.field.asnOrderItem.poDetlCode'), minWidth: 100, flex: 1, - editable: true, }, { field: 'anfme', @@ -336,22 +345,27 @@ ]; + const requestSetBody = async (row) => { + if (asnId !== 0) { + const res = await request.post(`/asnOrderItem/update`, row); + } + + } + const handleDelete = (row) => { const newData = _.filter(tabelData, (item) => item.matnrId !== row.matnrId); setTableData(newData); }; - const handleEdit = (field, row, value) => { - setTableData((prevData) => - prevData.map((r) => - r.matnrId === row.matnrId ? { ...r, [field]: value } : r - ) - ); - }; const processRowUpdate = (newRow, oldRow) => { - const field = Object.keys(newRow).find((key) => newRow[key] !== oldRow[key]); - handleEdit(field, oldRow, newRow[field]); + setTableData((prevData) => + prevData.map((r) => + r.matnrId === newRow.matnrId ? { ...newRow } : r + ) + ); + + requestSetBody(newRow) return newRow; }; diff --git a/rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx b/rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx index 43aec14..36e5df2 100644 --- a/rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx +++ b/rsf-admin/src/page/asnOrder/AsnOrderPanel.jsx @@ -74,8 +74,8 @@ minWidth: 100, }, { - id: 'matnk', - label: 'table.field.asnOrderItem.matnk', + id: 'maktx', + label: 'table.field.asnOrderItem.maktx', minWidth: 100, }, { diff --git a/rsf-admin/src/page/asnOrder/AsnWareModal.jsx b/rsf-admin/src/page/asnOrder/AsnWareModal.jsx index 1b1200d..a3d58ce 100644 --- a/rsf-admin/src/page/asnOrder/AsnWareModal.jsx +++ b/rsf-admin/src/page/asnOrder/AsnWareModal.jsx @@ -55,7 +55,7 @@ const value = selectedData.map((el => { return { matnrId: el.id, - matnk: el.name, + maktx: el.name, stockUnit: el.stockUnit || '', purUnit: el.purchaseUnit || '', } diff --git a/rsf-admin/src/page/asnOrderItem/AsnOrderItemCreate.jsx b/rsf-admin/src/page/asnOrderItem/AsnOrderItemCreate.jsx index dc78822..c811495 100644 --- a/rsf-admin/src/page/asnOrderItem/AsnOrderItemCreate.jsx +++ b/rsf-admin/src/page/asnOrderItem/AsnOrderItemCreate.jsx @@ -121,8 +121,8 @@ </Grid> <Grid item xs={6} display="flex" gap={1}> <TextInput - label="table.field.asnOrderItem.matnk" - source="matnk" + label="table.field.asnOrderItem.maktx" + source="maktx" parse={v => v} /> </Grid> diff --git a/rsf-admin/src/page/asnOrderItem/AsnOrderItemEdit.jsx b/rsf-admin/src/page/asnOrderItem/AsnOrderItemEdit.jsx index 2d2d159..e6c3f8b 100644 --- a/rsf-admin/src/page/asnOrderItem/AsnOrderItemEdit.jsx +++ b/rsf-admin/src/page/asnOrderItem/AsnOrderItemEdit.jsx @@ -100,8 +100,8 @@ </Stack> <Stack direction='row' gap={2}> <TextInput - label="table.field.asnOrderItem.matnk" - source="matnk" + label="table.field.asnOrderItem.maktx" + source="maktx" parse={v => v} /> </Stack> diff --git a/rsf-admin/src/page/asnOrderItem/AsnOrderItemList.jsx b/rsf-admin/src/page/asnOrderItem/AsnOrderItemList.jsx index 688e1c1..c9a8366 100644 --- a/rsf-admin/src/page/asnOrderItem/AsnOrderItemList.jsx +++ b/rsf-admin/src/page/asnOrderItem/AsnOrderItemList.jsx @@ -71,7 +71,7 @@ <TextInput source="poDetlId" label="table.field.asnOrderItem.poDetlId" />, <TextInput source="poDetlCode" label="table.field.asnOrderItem.poDetlCode" />, <TextInput source="matnrId" label="table.field.asnOrderItem.matnrId" />, - <TextInput source="matnk" label="table.field.asnOrderItem.matnk" />, + <TextInput source="maktx" label="table.field.asnOrderItem.maktx" />, <NumberInput source="anfme" label="table.field.asnOrderItem.anfme" />, <TextInput source="stockUnit" label="table.field.asnOrderItem.stockUnit" />, <NumberInput source="purQty" label="table.field.asnOrderItem.purQty" />, @@ -152,7 +152,7 @@ <TextField source="poDetlId" label="table.field.asnOrderItem.poDetlId" /> <TextField source="poDetlCode" label="table.field.asnOrderItem.poDetlCode" /> <TextField source="matnrId" label="table.field.asnOrderItem.matnrId" /> - <TextField source="matnk" label="table.field.asnOrderItem.matnk" /> + <TextField source="maktx" label="table.field.asnOrderItem.maktx" /> <NumberField source="anfme" label="table.field.asnOrderItem.anfme" /> <TextField source="stockUnit" label="table.field.asnOrderItem.stockUnit" /> <NumberField source="purQty" label="table.field.asnOrderItem.purQty" /> diff --git a/rsf-admin/src/page/asnOrderItem/AsnOrderItemPanel.jsx b/rsf-admin/src/page/asnOrderItem/AsnOrderItemPanel.jsx index d9336fb..8cfe2e6 100644 --- a/rsf-admin/src/page/asnOrderItem/AsnOrderItemPanel.jsx +++ b/rsf-admin/src/page/asnOrderItem/AsnOrderItemPanel.jsx @@ -42,97 +42,97 @@ <Grid container spacing={2}> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.asnId" + title="table.field.asnOrderItem.asnId" property={record.asnId} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.asnCode" + title="table.field.asnOrderItem.asnCode" property={record.asnCode} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.poDetlId" + title="table.field.asnOrderItem.poDetlId" property={record.poDetlId} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.poDetlCode" + title="table.field.asnOrderItem.poDetlCode" property={record.poDetlCode} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.matnrId" + title="table.field.asnOrderItem.matnrId" property={record.matnrId} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.matnk" - property={record.matnk} + title="table.field.asnOrderItem.maktx" + property={record.maktx} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.anfme" + title="table.field.asnOrderItem.anfme" property={record.anfme} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.stockUnit" + title="table.field.asnOrderItem.stockUnit" property={record.stockUnit} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.purQty" + title="table.field.asnOrderItem.purQty" property={record.purQty} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.purUnit" + title="table.field.asnOrderItem.purUnit" property={record.purUnit} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.qty" + title="table.field.asnOrderItem.qty" property={record.qty} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.splrCode" + title="table.field.asnOrderItem.splrCode" property={record.splrCode} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.splrName" + title="table.field.asnOrderItem.splrName" property={record.splrName} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.qrcode" + title="table.field.asnOrderItem.qrcode" property={record.qrcode} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.barcode" + title="table.field.asnOrderItem.barcode" property={record.barcode} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.asnOrderItem.packName" + title="table.field.asnOrderItem.packName" property={record.packName} /> </Grid> -- Gitblit v1.9.1