Commit e332d6f6 authored by Sixiang_Zzb's avatar Sixiang_Zzb

titleSearch 组件变更

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