diff --git a/packages/app/src/components/form.fields/filter/index.tsx b/packages/app/src/components/form.fields/filter/index.tsx index adf2575af8..e5ef09753b 100644 --- a/packages/app/src/components/form.fields/filter/index.tsx +++ b/packages/app/src/components/form.fields/filter/index.tsx @@ -142,7 +142,7 @@ const OP_MAP = { {label: '大于等于', value: 'gte'}, {label: '小于', value: 'lt'}, {label: '小于等于', value: 'lte'}, - {label: '介于', value: 'between'}, + // {label: '介于', value: 'between'}, {label: '非空', value: '$notNull'}, {label: '为空', value: '$null'}, ], @@ -177,7 +177,7 @@ const OP_MAP = { {label: '大于等于', value: 'gte'}, {label: '小于', value: 'lt'}, {label: '小于等于', value: 'lte'}, - {label: '介于', value: 'between'}, + // {label: '介于', value: 'between'}, {label: '非空', value: '$notNull'}, {label: '为空', value: '$null'}, // {label: '是今天', value: 'now'}, @@ -191,7 +191,7 @@ const OP_MAP = { {label: '大于等于', value: 'gte'}, {label: '小于', value: 'lt'}, {label: '小于等于', value: 'lte'}, - {label: '介于', value: 'between'}, + // {label: '介于', value: 'between'}, {label: '非空', value: '$notNull'}, {label: '为空', value: '$null'}, // {label: '是今天', value: 'now'}, @@ -250,23 +250,35 @@ const controls = { radio: OptionControl, checkboxes: OptionControl, multipleSelect: OptionControl, - time: TimePicker, + time: TimeControl, date: DateControl, }; function DateControl(props: any) { - const { value, onChange, ...restProps } = props; - const m = moment(value, 'YYYY-MM-DD HH:mm:ss'); + const { field, value, onChange, ...restProps } = props; + let format = field.dateFormat; + if (field.showTime) { + format += ` ${field.timeFormat}`; + } + const m = moment(value, format); return ( - { - onChange(value ? value.format('YYYY-MM-DD HH:mm:ss') : null) - console.log(value.format('YYYY-MM-DD HH:mm:ss')); + { + onChange(value ? value.format(field.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD') : null) }}/> ); } function TimeControl(props: any) { - return + const { field, value, onChange, ...restProps } = props; + let format = field.timeFormat; + const m = moment(value, format); + return { + onChange(value ? value.format('HH:mm:ss') : null) + }} + /> } function OptionControl(props) { @@ -347,7 +359,7 @@ export function FilterItem(props: FilterItemProps) { {field.title} ))} - - { + { onChange({...dataSource, value: value}); }} style={{ width: 180 }}