Commit e332d6f6 authored by Sixiang_Zzb's avatar Sixiang_Zzb

titleSearch 组件变更

parent f0c57fc4
...@@ -26,7 +26,7 @@ const TitleSearch = (props: any) => { ...@@ -26,7 +26,7 @@ const TitleSearch = (props: any) => {
// const communitySelect = props.communitySelect // const communitySelect = props.communitySelect
// const defaultValue = props.defaultValue; // const defaultValue = props.defaultValue;
const {single,checklist,status,communitySelect,defaultValue} = props; const { single, checklist, status, communitySelect, defaultValue } = props;
const time = props.time; const time = props.time;
...@@ -36,7 +36,7 @@ const TitleSearch = (props: any) => { ...@@ -36,7 +36,7 @@ const TitleSearch = (props: any) => {
const [communitySingle, setCommunitySingle] = useState(null) const [communitySingle, setCommunitySingle] = useState(null)
const [datePicker, setDate] = useState(null) const [datePicker, setDate] = useState(null)
const formRef = useRef(null) const [form] = Form.useForm()
const tosCommunityget = (values: any) => { dispatch({ type: 'Init/tosCommunityget', playload: values }) }; const tosCommunityget = (values: any) => { dispatch({ type: 'Init/tosCommunityget', playload: values }) };
useEffect(() => { useEffect(() => {
...@@ -46,14 +46,14 @@ const TitleSearch = (props: any) => { ...@@ -46,14 +46,14 @@ const TitleSearch = (props: any) => {
tosCommunityget(null) tosCommunityget(null)
} }
if (defaultValue != null) { if (defaultValue != null) {
formRef.current.setFieldsValue(defaultValue) form.setFieldsValue(defaultValue)
} }
}, []); }, []);
useEffect(() => { useEffect(() => {
if (defaultValue != null) { if (defaultValue != null) {
formRef.current.setFieldsValue(defaultValue) form.setFieldsValue(defaultValue)
} }
}, [defaultValue]) }, [defaultValue])
useEffect(() => { useEffect(() => {
...@@ -94,14 +94,21 @@ const TitleSearch = (props: any) => { ...@@ -94,14 +94,21 @@ const TitleSearch = (props: any) => {
setCommunitys(comment) setCommunitys(comment)
} }
// 选择小区名字并赋值
const opname = (value: any) => {
form.setFieldsValue({
'communityName': value
})
}
return ( return (
<> <>
<Form ref={formRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}> <Form form={form} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Row gutter={32}> <Row gutter={32}>
{ {
communitySelect != null ? communitySelect != null ?
<Col key={"communitySelect_"} ><Form.Item name={"communityName"}><SearchOptionsCommnity titleSearch={true} /></Form.Item></Col> <Col key={"communitySelect_"} ><Form.Item name={"communityName"}><SearchOptionsCommnity titleSearch={true} opname={opname} /></Form.Item></Col>
: null : null
} }
{ {
......
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