From b93e65afde0702f0ec93be4352528add6176ace7 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期三, 30 四月 2025 10:58:08 +0800 Subject: [PATCH] 新增库位明细 --- rsf-admin/src/page/orders/asnOrder/AsnOrderModal.jsx | 77 ++++++++++++++++++++++++++------------ 1 files changed, 52 insertions(+), 25 deletions(-) diff --git a/rsf-admin/src/page/orders/asnOrder/AsnOrderModal.jsx b/rsf-admin/src/page/orders/asnOrder/AsnOrderModal.jsx index 97f66bd..95c39cc 100644 --- a/rsf-admin/src/page/orders/asnOrder/AsnOrderModal.jsx +++ b/rsf-admin/src/page/orders/asnOrder/AsnOrderModal.jsx @@ -66,9 +66,7 @@ const notify = useNotify(); const refresh = useRefresh(); const [disabled, setDisabled] = useState(false) - const [createDialog, setCreateDialog] = useState(false); - const tableRef = useRef(); useEffect(() => { @@ -104,6 +102,7 @@ ...prevData, [name]: value })); + console.log(formData); }; const resetData = () => { @@ -181,7 +180,7 @@ setFormData(res.data.data) } else { notify(res.data.msg); - } + } } const requestGetBody = async () => { @@ -203,7 +202,7 @@ } return ( - <> + <> <Dialog open={open} onClose={handleClose} @@ -212,7 +211,7 @@ fullWidth disableRestoreFocus maxWidth="lg" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' - > + > <DialogTitle id="form-dialog-title" sx={{ position: 'sticky', top: 0, @@ -226,7 +225,7 @@ </DialogTitle> <DialogContent sx={{ mt: 2 }}> <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> - <Form> + <Form defaultValues={formData}> <Grid container spacing={2}> <Grid item md={3}> <DictSelect @@ -283,7 +282,7 @@ <Stack direction="row" spacing={2}> <Button variant="contained" onClick={() => setCreateDialog(true)}>鏂板鐗╂枡</Button> {/* {asnId !== '' && <ConfirmButton label={'鍒犻櫎'} variant="outlined" color="error" onConfirm={handleDelete} />} */} - <ConfirmButton label={'鍒犻櫎'} variant="outlined" color="error" onConfirm={handleDeleteItem} /> + <ConfirmButton label={'ra.action.delete'} variant="outlined" color="error" onConfirm={handleDeleteItem} /> </Stack> </Box> <Box sx={{ mt: 2 }}> @@ -318,7 +317,8 @@ getOptions(); }, []); const getOptions = async () => { - const parmas = { + const parmas = { + "type": "supplier" } const { data: { code, data, msg }, @@ -334,19 +334,33 @@ return ( <Select value={params.value} - onChange={(e) => - params.api.setEditCellValue({ - id: params.id, - field: params.field, - value: e.target.value, - }) + onChange={(e) =>{ + params.api.setEditCellValue({ + id: params.id, + field: params.field, + value: e.target.value, + }) + // 鎵惧埌閫変腑鐨勪緵搴斿晢璁板綍 + const selectedSupplier = formData.find(supplier => supplier.name === e.target.value); + + // 濡傛灉鎵惧埌瀵瑰簲鐨勪緵搴斿晢璁板綍锛屽悓鏃舵洿鏂皊plrCode瀛楁 + if (selectedSupplier) { + params.api.setEditCellValue({ + id: params.id, + field: 'splrCode', + value: selectedSupplier.id, + }); + } + + } + } fullWidth - autoFocus + > {formData.map(e => { return( - <MenuItem value={e.name} children={e.name} /> + <MenuItem value={e.name} children={e.name} key={e.id} /> ); })} @@ -361,7 +375,8 @@ getOptions(); }, []); const getOptions = async () => { - const parmas = { + const parmas = { + "type": "supplier" } const { data: { code, data, msg }, @@ -377,19 +392,31 @@ return ( <Select value={params.value} - onChange={(e) => - params.api.setEditCellValue({ - id: params.id, - field: params.field, - value: e.target.value, - }) + onChange={(e) =>{ + params.api.setEditCellValue({ + id: params.id, + field: params.field, + value: e.target.value, + }) + const selectedSupplier = formData.find(supplier => supplier.id === e.target.value); + + // 濡傛灉鎵惧埌瀵瑰簲鐨勪緵搴斿晢璁板綍锛屽悓鏃舵洿鏂皊plrCode瀛楁 + if (selectedSupplier) { + params.api.setEditCellValue({ + id: params.id, + field: 'splrName', + value: selectedSupplier.name, + }); + } + } + } fullWidth - autoFocus + > {formData.map(e => { return( - <MenuItem value={e.id} children={e.name} /> + <MenuItem value={e.id} children={e.name} key={e.id} /> ); })} -- Gitblit v1.9.1