From 8e6ecd57bad3d66a0c9407f41fd04b3ff7747553 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期四, 17 十月 2024 15:43:37 +0800 Subject: [PATCH] # --- zy-acs-flow/src/map/insight/agv/AgvControl.jsx | 236 ++++++++++++++++++++++++++++++---------------------------- 1 files changed, 121 insertions(+), 115 deletions(-) diff --git a/zy-acs-flow/src/map/insight/agv/AgvControl.jsx b/zy-acs-flow/src/map/insight/agv/AgvControl.jsx index 5f0d918..70a274c 100644 --- a/zy-acs-flow/src/map/insight/agv/AgvControl.jsx +++ b/zy-acs-flow/src/map/insight/agv/AgvControl.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { useForm, Controller, useWatch } from 'react-hook-form'; +import { useForm, Controller } from 'react-hook-form'; import { Drawer, Button, @@ -63,14 +63,15 @@ </Typography> <form onSubmit={handleSubmit(onSubmit)}> <Grid container spacing={2}> - {/* 浠诲姟鏂瑰紡閫夋嫨 */} - <Grid item xs={12}> + {/* 宸︿晶锛氫换鍔℃柟寮忛�夋嫨 */} + <Grid item xs={4}> <Controller name="taskMode" control={control} render={({ field }) => ( <ToggleButtonGroup {...field} + orientation="vertical" exclusive fullWidth color="primary" @@ -81,7 +82,7 @@ }} > {taskModes.map((mode) => ( - <ToggleButton key={mode.value} value={mode.value}> + <ToggleButton key={mode.value} value={mode.value} sx={{ textAlign: 'left' }}> {mode.label} </ToggleButton> ))} @@ -90,129 +91,134 @@ /> </Grid> - {/* 鍔ㄦ�佹覆鏌撹〃鍗曞瓧娈� */} - {showField('startCode') && ( - <Grid item xs={12}> - <Controller - name="startCode" - control={control} - rules={{ required: '璧峰鍦伴潰鐮佷笉鑳戒负绌�' }} - render={({ field, fieldState }) => ( - <TextField - {...field} - fullWidth - label="璧峰鍦伴潰鐮�" - error={!!fieldState.error} - helperText={fieldState.error?.message} + {/* 鍙充晶锛氳緭鍏ュ瓧娈靛拰鎸夐挳 */} + <Grid item xs={8}> + <Grid container spacing={2}> + {/* 鍔ㄦ�佹覆鏌撹〃鍗曞瓧娈� */} + {showField('startCode') && ( + <Grid item xs={12}> + <Controller + name="startCode" + control={control} + rules={{ required: '璧峰鍦伴潰鐮佷笉鑳戒负绌�' }} + render={({ field, fieldState }) => ( + <TextField + {...field} + fullWidth + label="璧峰鍦伴潰鐮�" + error={!!fieldState.error} + helperText={fieldState.error?.message} + /> + )} /> - )} - /> - </Grid> - )} + </Grid> + )} - {showField('endCode') && ( - <Grid item xs={12}> - <Controller - name="endCode" - control={control} - rules={{ required: '鐩爣鍦伴潰鐮佷笉鑳戒负绌�' }} - render={({ field, fieldState }) => ( - <TextField - {...field} - fullWidth - label="鐩爣鍦伴潰鐮�" - error={!!fieldState.error} - helperText={fieldState.error?.message} + {showField('endCode') && ( + <Grid item xs={12}> + <Controller + name="endCode" + control={control} + rules={{ required: '鐩爣鍦伴潰鐮佷笉鑳戒负绌�' }} + render={({ field, fieldState }) => ( + <TextField + {...field} + fullWidth + label="鐩爣鍦伴潰鐮�" + error={!!fieldState.error} + helperText={fieldState.error?.message} + /> + )} /> - )} - /> - </Grid> - )} + </Grid> + )} - {showField('startLocNo') && ( - <Grid item xs={12}> - <Controller - name="startLocNo" - control={control} - rules={{ required: '璧峰搴撲綅涓嶈兘涓虹┖' }} - render={({ field, fieldState }) => ( - <TextField - {...field} - fullWidth - label="璧峰搴撲綅" - error={!!fieldState.error} - helperText={fieldState.error?.message} + {showField('startLocNo') && ( + <Grid item xs={12}> + <Controller + name="startLocNo" + control={control} + rules={{ required: '璧峰搴撲綅涓嶈兘涓虹┖' }} + render={({ field, fieldState }) => ( + <TextField + {...field} + fullWidth + label="璧峰搴撲綅" + error={!!fieldState.error} + helperText={fieldState.error?.message} + /> + )} /> - )} - /> - </Grid> - )} + </Grid> + )} - {showField('endLocNo') && ( - <Grid item xs={12}> - <Controller - name="endLocNo" - control={control} - rules={{ required: '鐩爣搴撲綅涓嶈兘涓虹┖' }} - render={({ field, fieldState }) => ( - <TextField - {...field} - fullWidth - label="鐩爣搴撲綅" - error={!!fieldState.error} - helperText={fieldState.error?.message} + {showField('endLocNo') && ( + <Grid item xs={12}> + <Controller + name="endLocNo" + control={control} + rules={{ required: '鐩爣搴撲綅涓嶈兘涓虹┖' }} + render={({ field, fieldState }) => ( + <TextField + {...field} + fullWidth + label="鐩爣搴撲綅" + error={!!fieldState.error} + helperText={fieldState.error?.message} + /> + )} /> - )} - /> - </Grid> - )} + </Grid> + )} - {showField('startStaNo') && ( - <Grid item xs={12}> - <Controller - name="startStaNo" - control={control} - rules={{ required: '璧峰绔欑偣涓嶈兘涓虹┖' }} - render={({ field, fieldState }) => ( - <TextField - {...field} - fullWidth - label="璧峰绔欑偣" - error={!!fieldState.error} - helperText={fieldState.error?.message} + {showField('startStaNo') && ( + <Grid item xs={12}> + <Controller + name="startStaNo" + control={control} + rules={{ required: '璧峰绔欑偣涓嶈兘涓虹┖' }} + render={({ field, fieldState }) => ( + <TextField + {...field} + fullWidth + label="璧峰绔欑偣" + error={!!fieldState.error} + helperText={fieldState.error?.message} + /> + )} /> - )} - /> - </Grid> - )} + </Grid> + )} - {showField('endStaNo') && ( - <Grid item xs={12}> - <Controller - name="endStaNo" - control={control} - rules={{ required: '鐩爣绔欑偣涓嶈兘涓虹┖' }} - render={({ field, fieldState }) => ( - <TextField - {...field} - fullWidth - label="鐩爣绔欑偣" - error={!!fieldState.error} - helperText={fieldState.error?.message} + {showField('endStaNo') && ( + <Grid item xs={12}> + <Controller + name="endStaNo" + control={control} + rules={{ required: '鐩爣绔欑偣涓嶈兘涓虹┖' }} + render={({ field, fieldState }) => ( + <TextField + {...field} + fullWidth + label="鐩爣绔欑偣" + error={!!fieldState.error} + helperText={fieldState.error?.message} + /> + )} /> - )} - /> - </Grid> - )} + </Grid> + )} - {/* 鎸夐挳 */} - <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between', mt: 2 }}> - <Button variant="contained" color="primary" type="submit"> - 纭 - </Button> - <Button variant="outlined" color="secondary" onClick={() => reset()}> - 閲嶇疆 - </Button> + {/* 鎸夐挳鍖哄煙 */} + <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'flex-end', mt: 2 }}> + <Button variant="contained" color="primary" type="submit" sx={{ mr: 2 }}> + 纭 + </Button> + <Button variant="outlined" color="secondary" onClick={() => reset()}> + 閲嶇疆 + </Button> + </Grid> + </Grid> </Grid> </Grid> </form> -- Gitblit v1.9.1