| | |
| | | ascend: 'Ascend', |
| | | descend: 'Descend', |
| | | }, |
| | | valid: { |
| | | common: 'Please set the config parameters first', |
| | | shelf: 'Please set the row and bay in the config parameters first', |
| | | }, |
| | | }, |
| | | more: { |
| | | title: 'More', |
| | |
| | | ascend: '升序', |
| | | descend: '降序', |
| | | }, |
| | | valid: { |
| | | common: '请先设置系统参数', |
| | | shelf: '请先在系统参数中设置排和列', |
| | | }, |
| | | }, |
| | | more: { |
| | | title: '更多', |
| | |
| | | ], |
| | | }; |
| | | |
| | | |
| | | const validateIncrement = (value, deviceType, sprite, translate) => { |
| | | if (!value) { |
| | | return true; |
| | | } |
| | | switch (deviceType) { |
| | | case DEVICE_TYPE.SHELF: |
| | | if (!sprite?.data?.row || !sprite?.data?.bay) { |
| | | return translate('page.map.settings.map.copy.valid.shelf'); |
| | | } |
| | | break; |
| | | default: |
| | | if (!sprite?.data?.no) { |
| | | return translate('page.map.settings.map.copy.valid.common'); |
| | | } |
| | | break; |
| | | } |
| | | return true; |
| | | }; |
| | | |
| | | const getDefaultFormValues = (value = {}) => ({ |
| | | copyDirect: value.copyDirect || '', |
| | | copyCount: value.copyCount || '', |
| | |
| | | const handleClose = () => { |
| | | onCancel(); |
| | | } |
| | | |
| | | const validateIncrement = (value) => { |
| | | if (!value) { |
| | | return true; |
| | | } |
| | | if (deviceType === DEVICE_TYPE.SHELF) { |
| | | if (!sprite?.data?.row || !sprite?.data?.bay) { |
| | | return 'Row or Bay value is required for SHELF device type.'; |
| | | } |
| | | } |
| | | return true; |
| | | }; |
| | | |
| | | const onFormSubmit = (data) => { |
| | | console.log(data); |
| | |
| | | <Controller |
| | | name="autoIncrement" |
| | | control={control} |
| | | rules={{ validate: validateIncrement }} |
| | | rules={{ validate: (value) => validateIncrement(value, deviceType, sprite, translate) }} |
| | | render={({ field }) => ( |
| | | <FormControlLabel |
| | | control={ |
| | |
| | | value={field.value} |
| | | exclusive |
| | | onChange={(event, value) => { |
| | | field.onChange(value); |
| | | if (value !== null) { |
| | | field.onChange(value); |
| | | } |
| | | }} |
| | | fullWidth |
| | | > |
| | |
| | | value={field.value} |
| | | exclusive |
| | | onChange={(event, value) => { |
| | | field.onChange(value); |
| | | if (value !== null) { |
| | | field.onChange(value); |
| | | } |
| | | }} |
| | | fullWidth |
| | | > |