fix(plugin-workflow): fix endsOn field (#1144)
This commit is contained in:
		
							parent
							
								
									945c64304a
								
							
						
					
					
						commit
						2c6b9babff
					
				| @ -32,6 +32,7 @@ export default { | ||||
|   'Based on date field of collection': '根据数据表时间字段', | ||||
|   'Starts on': '开始于', | ||||
|   'Ends on': '结束于', | ||||
|   'No end': '不结束', | ||||
|   'Exactly at': '当时', | ||||
|   'Repeat mode': '重复模式', | ||||
|   'Repeat limit': '重复次数', | ||||
|  | ||||
| @ -10,23 +10,28 @@ import { OnField } from "./OnField"; | ||||
| 
 | ||||
| export function EndsByField({ value, onChange }) { | ||||
|   const { t } = useWorkflowTranslation(); | ||||
|   const [type, setType] = useState(typeof value === 'object' && !(value instanceof Date) ? 'field' : 'date'); | ||||
| 
 | ||||
|   const type = value != null ? typeof value === 'object' && !(value instanceof Date) ? 'field' : 'date' : null; | ||||
|   return ( | ||||
|     <fieldset className={css` | ||||
|       display: flex; | ||||
|       gap: .5em; | ||||
|     `}>
 | ||||
|       <Select value={type} onChange={t => { | ||||
|         onChange(t === 'field' ? {} : null); | ||||
|         setType(t); | ||||
|         onChange(t ? t === 'field' ? {} : new Date() : null); | ||||
|       }}> | ||||
|         <Select.Option value={null}>{t('No end')}</Select.Option> | ||||
|         <Select.Option value={'field'}>{t('By field')}</Select.Option> | ||||
|         <Select.Option value={'date'}>{t('By custom date')}</Select.Option> | ||||
|       </Select> | ||||
|       {type === 'field' | ||||
|         ? <OnField value={value} onChange={onChange} /> | ||||
|         : <DatePicker showTime value={moment(value)} onChange={onChange} /> | ||||
|         : null | ||||
|       } | ||||
|       {type === 'date' | ||||
|         ? <DatePicker showTime value={moment(value)} onChange={(v) => { | ||||
|           onChange(v ? v.toDate() : null); | ||||
|         }} /> | ||||
|         : null | ||||
|       } | ||||
|     </fieldset> | ||||
|   ); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user