| | |
| | | const handleChange = (value, name) => { |
| | | setFormData((prevData) => ({ |
| | | ...prevData, |
| | | [name]: ['locType', 'type'].includes(name) ? value : +value |
| | | [name]: value |
| | | })); |
| | | }; |
| | | |
| | |
| | | |
| | | return ( |
| | | <Dialog open={open} maxWidth="md" fullWidth> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>{translate('toolbar.locInit')}</DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> |
| | | <Form> |
| | | |
| | | <Form onSubmit={handleSubmit}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>{translate('toolbar.locInit')}</DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={4}> |
| | | <ReferenceInput |
| | |
| | | value={formData.locType} |
| | | onChange={(e) => handleChange(e.target.value, 'locType')} |
| | | size="small" |
| | | validate={[required()]} |
| | | dictTypeCode="sys_width_type" |
| | | /> |
| | | </Grid> |
| | |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | <TextField |
| | | <TextInput |
| | | label={translate("table.field.loc.startBay")} |
| | | name="startBay" |
| | | value={formData.startBay} |
| | | onChange={(e) => handleChange(e.target.value, 'startBay')} |
| | | onChange={(e) => handleChange(+e.target.value, 'startBay')} |
| | | size="small" |
| | | type="number" |
| | | required |
| | | validate={[required()]} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | <TextField |
| | | <TextInput |
| | | label={translate("table.field.loc.startLev")} |
| | | name="startLev" |
| | | value={formData.startLev} |
| | | onChange={(e) => handleChange(e.target.value, 'startLev')} |
| | | onChange={(e) => handleChange(+e.target.value, 'startLev')} |
| | | size="small" |
| | | type="number" |
| | | required |
| | | validate={[required()]} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | <TextField |
| | | <TextInput |
| | | label={translate("table.field.loc.startRow")} |
| | | name="startRow" |
| | | value={formData.startRow} |
| | | onChange={(e) => handleChange(e.target.value, 'startRow')} |
| | | onChange={(e) => handleChange(+e.target.value, 'startRow')} |
| | | size="small" |
| | | type="number" |
| | | required |
| | | validate={[required()]} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | <TextField |
| | | <TextInput |
| | | label={translate("table.field.loc.endBay")} |
| | | name="endBay" |
| | | value={formData.endBay} |
| | | onChange={(e) => handleChange(e.target.value, 'endBay')} |
| | | onChange={(e) => handleChange(+e.target.value, 'endBay')} |
| | | size="small" |
| | | type="number" |
| | | required |
| | | validate={[required()]} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | <TextField |
| | | <TextInput |
| | | label={translate("table.field.loc.endLev")} |
| | | name="endLev" |
| | | value={formData.endLev} |
| | | onChange={(e) => handleChange(e.target.value, 'endLev')} |
| | | onChange={(e) => handleChange(+e.target.value, 'endLev')} |
| | | size="small" |
| | | type="number" |
| | | required |
| | | validate={[required()]} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | <TextField |
| | | <TextInput |
| | | label={translate("table.field.loc.endRow")} |
| | | name="endRow" |
| | | value={formData.endRow} |
| | | onChange={(e) => handleChange(e.target.value, 'endRow')} |
| | | onChange={(e) => handleChange(+e.target.value, 'endRow')} |
| | | size="small" |
| | | type="number" |
| | | required |
| | | validate={[required()]} |
| | | /> |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | </Form> |
| | | </Box> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> |
| | | <Button onClick={handleSubmit} variant="contained" startIcon={<SaveIcon />}> |
| | | 确认 |
| | | </Button> |
| | | </Box> |
| | | </DialogActions> |
| | | |
| | | </Box> |
| | | </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> |
| | | </Box> |
| | | </DialogActions> |
| | | </Form> |
| | | </Dialog> |
| | | ); |
| | | } |