|
@@ -1,14 +1,29 @@
|
1
|
1
|
import React from 'react'
|
2
|
|
-import { Form, Input, notification, Select } from 'antd'
|
|
2
|
+import { Row, Col, Form, Input, InputNumber, Radio, notification, Select } from 'antd'
|
3
|
3
|
import FileUpload from '@/components/XForm/FileUpload';
|
|
4
|
+import ImageUpload from '@/components/XForm/ImageUpload';
|
|
5
|
+import ImageListUpload from '@/components/XForm/ImageListUpload';
|
|
6
|
+import SelectCity from '@/components/SelectButton/CitySelect'
|
|
7
|
+import AreaSelect from '@/components/SelectButton/AreaSelect'
|
4
|
8
|
import BuildingType from './components/BuildingTypeSelect'
|
5
|
|
-import { formItemLayout } from './utils'
|
|
9
|
+import OpenTimePicker from './components/OpenTimePicker'
|
|
10
|
+import Amap from './components/Amap'
|
|
11
|
+import { formItemLayout, groupItemLayout } from './utils'
|
|
12
|
+
|
|
13
|
+const fullWidth= { width: '100%' }
|
6
|
14
|
|
7
|
15
|
const Item = Form.Item
|
8
|
16
|
|
|
17
|
+const GroupItem = ({children}) => (
|
|
18
|
+ <Row gutter={24}>
|
|
19
|
+ <Col span={12}>{children[0]}</Col>
|
|
20
|
+ <Col span={11}>{children[1]}</Col>
|
|
21
|
+ </Row>
|
|
22
|
+)
|
|
23
|
+
|
9
|
24
|
const BuildingBasic = (props) => {
|
10
|
25
|
const { form } = props;
|
11
|
|
- const { getFieldDecorator } = form;
|
|
26
|
+ const { getFieldDecorator, getFieldValue, setFieldsValue } = form;
|
12
|
27
|
|
13
|
28
|
|
14
|
29
|
// 视频文件上传前 回调
|
|
@@ -24,16 +39,37 @@ const BuildingBasic = (props) => {
|
24
|
39
|
})
|
25
|
40
|
}
|
26
|
41
|
|
|
42
|
+ // 周边设施 回调
|
|
43
|
+ function handleMapScope(e) {
|
|
44
|
+ const coordinateValue = getFieldValue('coordinate')
|
|
45
|
+ if (!coordinateValue) {
|
|
46
|
+ notification.error({ message: '请先选择项目坐标位置' })
|
|
47
|
+ return
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+ const lngLat = getFieldValue('coordinate').split(',')
|
|
51
|
+ const poiData = [].concat(POI_TYPES)
|
|
52
|
+ poiData.map(item => {
|
|
53
|
+ getAroundData({ types: item.key, location: lngLat, radius: e }).then(res => {
|
|
54
|
+ const { pois } = res
|
|
55
|
+ setFormMapScopeValue(item.key, pois)
|
|
56
|
+ }).catch(err => {
|
|
57
|
+ console.error(err)
|
|
58
|
+ notification.error({ message: '周边数据获取失败' })
|
|
59
|
+ })
|
|
60
|
+ })
|
|
61
|
+ }
|
|
62
|
+
|
27
|
63
|
return (
|
28
|
64
|
<Form {...formItemLayout}>
|
29
|
65
|
<Item label="项目Id" style={{ display: 'none' }}>
|
30
|
66
|
{getFieldDecorator('buildingId')(<Input disabled />)}
|
31
|
67
|
</Item>
|
32
|
|
- <Item label="楼盘编号" >
|
|
68
|
+ {/* <Item label="楼盘编号" >
|
33
|
69
|
{getFieldDecorator('code', {
|
34
|
70
|
rules: [{ required: true, message: '请输入楼盘编号' }],
|
35
|
71
|
})(<Input />)}
|
36
|
|
- </Item>
|
|
72
|
+ </Item> */}
|
37
|
73
|
<Item label="楼盘名称" >
|
38
|
74
|
{getFieldDecorator('buildingName', {
|
39
|
75
|
rules: [{ required: true, message: '请输入楼盘名' }],
|
|
@@ -47,30 +83,34 @@ const BuildingBasic = (props) => {
|
47
|
83
|
<Form.Item label="列表均价" help="项目列表展示价格,示例:约10000元/㎡、约1000万元/套起">
|
48
|
84
|
{getFieldDecorator('price')(<Input />)}
|
49
|
85
|
</Form.Item>
|
50
|
|
- <Form.Item label="开盘时间" >
|
51
|
|
- {getFieldDecorator('openingDate')(<Input placeholder="预计xxxx年xx月开盘" />)}
|
52
|
|
- </Form.Item>
|
53
|
|
- <Form.Item label="电话" >
|
54
|
|
- {getFieldDecorator('tel', {
|
55
|
|
- rules: [
|
56
|
|
- {
|
57
|
|
- pattern: new RegExp('^[0-9]*$'),
|
58
|
|
- message: '请输入正确的电话号码',
|
59
|
|
- },
|
60
|
|
- ],
|
61
|
|
- })(<Input placeholder="手机或者座机号码" />)}
|
62
|
|
- </Form.Item>
|
|
86
|
+ <GroupItem>
|
|
87
|
+ <Form.Item label="开盘时间" {...groupItemLayout.a} >
|
|
88
|
+ {getFieldDecorator('openingDate')(
|
|
89
|
+ <OpenTimePicker placeholder="请选择开盘时间" style={fullWidth} />
|
|
90
|
+ )}
|
|
91
|
+ </Form.Item>
|
|
92
|
+ <Form.Item label="电话" {...groupItemLayout.b } >
|
|
93
|
+ {getFieldDecorator('tel', {
|
|
94
|
+ rules: [
|
|
95
|
+ {
|
|
96
|
+ pattern: new RegExp('^[0-9]*$'),
|
|
97
|
+ message: '请输入正确的电话号码',
|
|
98
|
+ },
|
|
99
|
+ ],
|
|
100
|
+ })(<Input placeholder="手机或者座机号码" />)}
|
|
101
|
+ </Form.Item>
|
|
102
|
+ </GroupItem>
|
63
|
103
|
<Form.Item label="项目说明" >
|
64
|
104
|
{getFieldDecorator('dynamic')(<Input placeholder="项目动态等,不超过30个字" maxLength={30}/>)}
|
65
|
105
|
</Form.Item>
|
66
|
|
- <Form.Item label="物业类型" >
|
|
106
|
+ {/* <Form.Item label="物业类型" >
|
67
|
107
|
{getFieldDecorator('propertyType')(<Input />)}
|
68
|
|
- </Form.Item>
|
|
108
|
+ </Form.Item> */}
|
69
|
109
|
<Form.Item label="销售状态" >
|
70
|
110
|
{getFieldDecorator('marketStatus', {
|
71
|
111
|
rules: [{ required: true, message: '请选择销售状态' }],
|
72
|
112
|
})(
|
73
|
|
- <Select placeholder="销售状态" style={{ width: '100%' }}>
|
|
113
|
+ <Select placeholder="销售状态" style={fullWidth}>
|
74
|
114
|
<Select.Option value="待售">待售</Select.Option>
|
75
|
115
|
<Select.Option value="在售">在售</Select.Option>
|
76
|
116
|
<Select.Option value="售罄">售罄</Select.Option>
|
|
@@ -80,14 +120,92 @@ const BuildingBasic = (props) => {
|
80
|
120
|
</Form.Item>
|
81
|
121
|
<Form.Item label="项目标签" >
|
82
|
122
|
{getFieldDecorator('tag')(
|
83
|
|
- <Select mode="tags" placeholder="输入后选中" style={{ width: '100%' }} />
|
|
123
|
+ <Select mode="tags" placeholder="输入后选中" style={fullWidth} />
|
84
|
124
|
)}
|
85
|
125
|
</Form.Item>
|
86
|
|
- <Form.Item label="项目视频" help="视频仅支持mp4格式,建议尺寸:750*600,比例5:4,用于楼盘详情">
|
87
|
|
- {getFieldDecorator('videoUrl')(
|
88
|
|
- <FileUpload accept=".mp4" beforeUpload={fileUploadBeforeUpload} label="上传视频" size={1} />,
|
|
126
|
+
|
|
127
|
+ <GroupItem>
|
|
128
|
+ <Form.Item label="项目视频" help="视频仅支持mp4格式,建议尺寸:750*600,比例5:4,用于楼盘详情" {...groupItemLayout.a} >
|
|
129
|
+ {getFieldDecorator('videoUrl')(
|
|
130
|
+ <FileUpload accept=".mp4" beforeUpload={fileUploadBeforeUpload} label="上传视频" size={1} />,
|
|
131
|
+ )}
|
|
132
|
+ </Form.Item>
|
|
133
|
+ <Form.Item label="视频封面图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于视频封面" labelCol={{span: 8}} wrapperCol={{span:16}}>
|
|
134
|
+ {getFieldDecorator('videoImage', {
|
|
135
|
+ rules: [{ required: true, message: '请选择视频封面图' }],
|
|
136
|
+ })(
|
|
137
|
+ <ImageUpload />,
|
|
138
|
+ )}
|
|
139
|
+ </Form.Item>
|
|
140
|
+ </GroupItem>
|
|
141
|
+ <Form.Item label="楼盘主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于楼盘详情">
|
|
142
|
+ {getFieldDecorator('avatarImage', {
|
|
143
|
+ rules: [{ required: true, message: '请选择项目主图' }],
|
|
144
|
+ })(
|
|
145
|
+ <ImageListUpload unlimited />,
|
89
|
146
|
)}
|
90
|
147
|
</Form.Item>
|
|
148
|
+ <Form.Item label="楼盘封面图" help="建议图片尺寸:750*420px,比例16:9,格式:jpg,用于楼盘列表">
|
|
149
|
+ {getFieldDecorator('listImage', {
|
|
150
|
+ rules: [{ required: true, message: '请选择列表图' }],
|
|
151
|
+ })(
|
|
152
|
+ <ImageUpload />,
|
|
153
|
+ )}
|
|
154
|
+ </Form.Item>
|
|
155
|
+ <GroupItem>
|
|
156
|
+ <Form.Item label="首页推荐" {...groupItemLayout.a} >
|
|
157
|
+ {getFieldDecorator('isMain', { initialValue: 1 })(
|
|
158
|
+ <Radio.Group>
|
|
159
|
+ <Radio value={1}>是</Radio>
|
|
160
|
+ <Radio value={2}>否</Radio>
|
|
161
|
+ </Radio.Group>,
|
|
162
|
+ )}
|
|
163
|
+ </Form.Item>
|
|
164
|
+ <Form.Item label="排序" help="数值越大,楼盘在小程序列表页中展示越靠前" {...groupItemLayout.b}>
|
|
165
|
+ {getFieldDecorator('orderNo')(<InputNumber min={0} style={fullWidth} />)}
|
|
166
|
+ </Form.Item>
|
|
167
|
+ </GroupItem>
|
|
168
|
+ <GroupItem>
|
|
169
|
+ <Form.Item label="所在城市" {...groupItemLayout.a } >
|
|
170
|
+ {getFieldDecorator('cityId', {
|
|
171
|
+ rules: [{ required: true, message: '请选择城市' }],
|
|
172
|
+ })(
|
|
173
|
+ <SelectCity style={fullWidth} />,
|
|
174
|
+ )}
|
|
175
|
+ </Form.Item>
|
|
176
|
+ <Form.Item label="楼盘区域" {...groupItemLayout.b } >
|
|
177
|
+ {getFieldDecorator('buildingArea', {
|
|
178
|
+ rules: [{ required: true, message: '请输入楼盘区域' }],
|
|
179
|
+ })(<AreaSelect style={fullWidth} />)}
|
|
180
|
+ </Form.Item>
|
|
181
|
+ </GroupItem>
|
|
182
|
+ <Form.Item label="项目地址" >
|
|
183
|
+ {getFieldDecorator('address', {
|
|
184
|
+ rules: [{ required: true, message: '请输入项目地址' }],
|
|
185
|
+ })(<Input />)}
|
|
186
|
+ </Form.Item>
|
|
187
|
+ <Form.Item label="地图位置" >
|
|
188
|
+ {getFieldDecorator('mapCoordinate')(<Amap onChange={e => setFieldsValue({ coordinate: e })}/>)}
|
|
189
|
+ </Form.Item>
|
|
190
|
+ <GroupItem>
|
|
191
|
+ <Form.Item label="项目坐标" {...groupItemLayout.a } >
|
|
192
|
+ {getFieldDecorator('coordinate', {
|
|
193
|
+ rules: [{ required: true, message: '请输入项目坐标' }],
|
|
194
|
+ })(<Input disabled />)}
|
|
195
|
+ </Form.Item>
|
|
196
|
+ <Form.Item label="周边范围" {...groupItemLayout.b } >
|
|
197
|
+ {getFieldDecorator('mapScope', {
|
|
198
|
+ rules: [{ required: true, message: '请选择周边设施搜索范围' }],
|
|
199
|
+ })(
|
|
200
|
+ <Select placeholder="周边设施搜索范围" style={fullWidth} onChange={e => getMapScope(e)}>
|
|
201
|
+ <Option value={1000}>1公里</Option>
|
|
202
|
+ <Option value={3000}>3公里</Option>
|
|
203
|
+ <Option value={5000}>5公里</Option>
|
|
204
|
+ <Option value={10000}>10公里</Option>
|
|
205
|
+ </Select>,
|
|
206
|
+ )}
|
|
207
|
+ </Form.Item>
|
|
208
|
+ </GroupItem>
|
91
|
209
|
|
92
|
210
|
</Form>
|
93
|
211
|
)
|