Commit fb513653 authored by 涂伟's avatar 涂伟

fix: 'tableRender条件筛选组件优化'

parent 6b1e72aa
...@@ -49,6 +49,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -49,6 +49,7 @@ const SearchGroup = forwardRef((props, ref) => {
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
getQueryInfo getQueryInfo
})); }));
const [form] = Form.useForm();
// const { // const {
// fieldSearch // fieldSearch
...@@ -180,19 +181,32 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -180,19 +181,32 @@ const SearchGroup = forwardRef((props, ref) => {
// getAccountData(); // getAccountData();
// } // }
setQueryInfo({...queryInfo,info: e}) setQueryInfo({...queryInfo,info: e})
getQueryInfo(form.getFieldsValue())
}; };
const getQueryInfo = () => { const onValuesChange = (values) => {
return queryInfo let keys = Object.keys(values)
if (keys.includes('info')) return
getQueryInfo(form.getFieldsValue())
}
const getQueryInfo = (data) => {
let params = {}
params.timeFrom = data.time&&data.time[0].format('YYYY-MM-DD HH:mm:ss') || ''
params.timeTo = data.time&&data.time[1].format('YYYY-MM-DD HH:mm:ss') || ''
params.info = data.info
console.log(params,'666666666666666');
props&&props.onChange(params)
return params
} }
return ( return (
<div className={styles.accountFlexWrapper}> <div className={styles.accountFlexWrapper}>
<Row className={styles.controlRow}> <Row className={styles.controlRow}>
<Form layout={'horizontal'}> <Form layout={'horizontal'} form={form} onValuesChange={onValuesChange}>
<Space className={styles.controlRowLeft} wrap> <Space className={styles.controlRowLeft} wrap>
{showPicker ? ( {showPicker ? (
<Form.Item label={`录入时间`} className={styles.noMarginBottom}> <Form.Item label={`录入时间`} name='time' className={styles.noMarginBottom}>
<RangePicker <RangePicker
size='middle' size='middle'
value={[...dateArray]} value={[...dateArray]}
...@@ -202,7 +216,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -202,7 +216,7 @@ const SearchGroup = forwardRef((props, ref) => {
ranges={{ ...rangerOptions }} ranges={{ ...rangerOptions }}
format={formatterStr} format={formatterStr}
style={{ width: 300 }} style={{ width: 300 }}
onChange={dateChange} // onChange={dateChange}
/> />
</Form.Item> </Form.Item>
) : ( ) : (
...@@ -224,7 +238,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -224,7 +238,7 @@ const SearchGroup = forwardRef((props, ref) => {
</Select> </Select>
</Form.Item> </Form.Item>
))} */} ))} */}
<Form.Item label={'快捷搜索'} className={styles.noMarginBottom}> <Form.Item label={'快捷搜索'} name='info' className={styles.noMarginBottom}>
{/* {searchKey && fieldSearch ? <Select {/* {searchKey && fieldSearch ? <Select
style={{ maxWidth: '112px' }} style={{ maxWidth: '112px' }}
placeholder='请选择字段' placeholder='请选择字段'
...@@ -255,8 +269,8 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -255,8 +269,8 @@ const SearchGroup = forwardRef((props, ref) => {
marginLeft: '10px' marginLeft: '10px'
}} }}
placeholder='请输入值' placeholder='请输入值'
value={searchValues} // value={searchValues}
onChange={e => setSearchValues(e.target.value)} // onChange={e => setSearchValues(e.target.value)}
onSearch={onSearch} onSearch={onSearch}
/> />
</Form.Item> </Form.Item>
......
...@@ -96,7 +96,7 @@ const TableRender = (props) => { ...@@ -96,7 +96,7 @@ const TableRender = (props) => {
return ( return (
<div className={styles.tableRender}> <div className={styles.tableRender}>
<div className={styles.top}> <div className={styles.top}>
{/* <SearchGroup /> */} <SearchGroup />
</div> </div>
<div className={styles.bottom}> <div className={styles.bottom}>
<Table <Table
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment