|
@@ -125,7 +125,7 @@ function AddBuilding(props) {
|
125
|
125
|
}
|
126
|
126
|
|
127
|
127
|
/**
|
128
|
|
- * 把 xxx,xxx,xxx 这样的格式转换成 [{ tagName: xxx, delete: true }, { tagName: xxx, delete: true }]
|
|
128
|
+ * 把 xxx,xxx,xxx 这样的格式转换成 [{ tagName: xxx, delete: true, automatic: false }, { tagName: xxx, delete: true, automatic: false }]
|
129
|
129
|
* @param {*} str
|
130
|
130
|
* @return 如果返回 str 为空 或者 非 string,则返回 str 本身,否则返回转换成功的数组
|
131
|
131
|
*/
|
|
@@ -139,11 +139,11 @@ function AddBuilding(props) {
|
139
|
139
|
}
|
140
|
140
|
|
141
|
141
|
/**
|
142
|
|
- * 把 [xxx,xxx,xxx] 这样的格式转换成 [{ tagName: xxx, delete: true }, { tagName: xxx, delete: true }]
|
|
142
|
+ * 把 [xxx,xxx,xxx] 这样的格式转换成 [{ tagName: xxx, delete: true, automatic: false }, { tagName: xxx, delete: true, automatic: false }]
|
143
|
143
|
* @param {*} arr
|
144
|
144
|
*/
|
145
|
145
|
function arrayTransition(arr) {
|
146
|
|
- return arr.map(x => ({ tagName: x, delete: true }))
|
|
146
|
+ return arr.map(x => ({ tagName: x, delete: true, automatic: false }))
|
147
|
147
|
}
|
148
|
148
|
|
149
|
149
|
function handleSubmit(e) {
|
|
@@ -181,22 +181,22 @@ function AddBuilding(props) {
|
181
|
181
|
}
|
182
|
182
|
|
183
|
183
|
if (data.buildingTransport) {
|
184
|
|
- data.buildingTransport = data.buildingTransport.filter(f => f.delete === true).map(x => x.tagName).join(',')
|
|
184
|
+ data.buildingTransport = tagFilter(data.buildingTransport, 'Transport')
|
185
|
185
|
}
|
186
|
186
|
if (data.buildingMall) {
|
187
|
|
- data.buildingMall = data.buildingMall.filter(f => f.delete === true).map(x => x.tagName).join(',')
|
|
187
|
+ data.buildingMall = tagFilter(data.buildingMall, 'Mall')
|
188
|
188
|
}
|
189
|
189
|
if (data.buildingEdu) {
|
190
|
|
- data.buildingEdu = data.buildingEdu.filter(f => f.delete === true).map(x => x.tagName).join(',')
|
|
190
|
+ data.buildingEdu = tagFilter(data.buildingEdu, 'Edu')
|
191
|
191
|
}
|
192
|
192
|
if (data.buildingHospital) {
|
193
|
|
- data.buildingHospital = data.buildingHospital.filter(f => f.delete === true).map(x => x.tagName).join(',')
|
|
193
|
+ data.buildingHospital = tagFilter(data.buildingHospital, 'Hospital')
|
194
|
194
|
}
|
195
|
195
|
if (data.buildingBank) {
|
196
|
|
- data.buildingBank = data.buildingBank.filter(f => f.delete === true).map(x => x.tagName).join(',')
|
|
196
|
+ data.buildingBank = tagFilter(data.buildingBank, 'Bank')
|
197
|
197
|
}
|
198
|
198
|
if (data.buildingRestaurant) {
|
199
|
|
- data.buildingRestaurant = data.buildingRestaurant.filter(f => f.delete === true).map(x => x.tagName).join(',')
|
|
199
|
+ data.buildingRestaurant = tagFilter(data.buildingRestaurant, 'Restaurant')
|
200
|
200
|
}
|
201
|
201
|
|
202
|
202
|
const api = data.buildingId === undefined ? apis.building.addBuilding : apis.building.updateBuilding
|
|
@@ -209,6 +209,33 @@ function AddBuilding(props) {
|
209
|
209
|
})
|
210
|
210
|
}
|
211
|
211
|
|
|
212
|
+ /**
|
|
213
|
+ * 过滤 tag
|
|
214
|
+ * @param {*} tags
|
|
215
|
+ */
|
|
216
|
+ function tagFilter(tags, keyType) {
|
|
217
|
+ console.log(tags)
|
|
218
|
+ if (!tags) {
|
|
219
|
+ return null
|
|
220
|
+ }
|
|
221
|
+
|
|
222
|
+ // 过滤 tag 更新 useState()
|
|
223
|
+
|
|
224
|
+ // 获取地图周边
|
|
225
|
+ const automaticTag = tags.filter(f => f.automatic === true).map(x => x.tagName)
|
|
226
|
+ const determineTag = poi.map(p => {
|
|
227
|
+ if (p.key === keyType) {
|
|
228
|
+ if (typeof p.data === 'string') {
|
|
229
|
+ p.data = JSON.parse(p.data).filter(f => automaticTag.includes(f.name))
|
|
230
|
+ }
|
|
231
|
+ }
|
|
232
|
+ return p
|
|
233
|
+ })
|
|
234
|
+
|
|
235
|
+ setPoi(determineTag)
|
|
236
|
+ return tags.filter(f => f.automatic === false).map(x => x.tagName).join(',')
|
|
237
|
+ }
|
|
238
|
+
|
212
|
239
|
// 视频文件上传前 回调
|
213
|
240
|
function fileUploadBeforeUpload(file, fileList) {
|
214
|
241
|
// console.log('视频文件上传前 回调: ', file, fileList)
|
|
@@ -274,7 +301,7 @@ function AddBuilding(props) {
|
274
|
301
|
}
|
275
|
302
|
|
276
|
303
|
function setFormMapScopeTagValue(keyType, item) {
|
277
|
|
- const tag = item.data.map(t => ({ tagName: t.name, delete: false }))
|
|
304
|
+ const tag = item.data.map(t => ({ tagName: t.name, delete: true, automatic: true }))
|
278
|
305
|
switch (keyType) {
|
279
|
306
|
case POI_TYPES_KETY.Transport:
|
280
|
307
|
const buildingTransportValue = (stringHandleTag(buildingData.buildingTransport) || [])
|
|
@@ -345,8 +372,8 @@ function AddBuilding(props) {
|
345
|
372
|
],
|
346
|
373
|
})(<Input />)}
|
347
|
374
|
</Form.Item>
|
348
|
|
- <Form.Item label="项目动态" >
|
349
|
|
- {getFieldDecorator('dynamic')(<Input />)}
|
|
375
|
+ <Form.Item label="项目说明" >
|
|
376
|
+ {getFieldDecorator('dynamic')(<Input placeholder="项目动态等,不超过15个字" maxLength = "15"/>)}
|
350
|
377
|
</Form.Item>
|
351
|
378
|
<Form.Item label="物业类型" >
|
352
|
379
|
{getFieldDecorator('propertyType')(
|
|
@@ -377,7 +404,7 @@ function AddBuilding(props) {
|
377
|
404
|
</Select>,
|
378
|
405
|
)}
|
379
|
406
|
</Form.Item>
|
380
|
|
- <Form.Item label="项目视频" help="视频仅支持mp4格式,建议图片尺寸:750*600,比例5:4,用于楼盘详情">
|
|
407
|
+ <Form.Item label="项目视频" help="视频仅支持mp4格式,建议尺寸:750*600,比例5:4,用于楼盘详情">
|
381
|
408
|
{getFieldDecorator('videoUrl')(
|
382
|
409
|
// disabled={fileUploadDisabled}
|
383
|
410
|
<FileUpload accept=".mp4" beforeUpload={fileUploadBeforeUpload} label="上传视频" size={1} />,
|
|
@@ -417,9 +444,9 @@ function AddBuilding(props) {
|
417
|
444
|
<Form.Item label="排序" >
|
418
|
445
|
{getFieldDecorator('orderNo')(<Input />)}
|
419
|
446
|
</Form.Item>
|
420
|
|
- <Form.Item label="优惠信息" >
|
|
447
|
+ {/* <Form.Item label="优惠信息" >
|
421
|
448
|
{getFieldDecorator('discount')(<Input />)}
|
422
|
|
- </Form.Item>
|
|
449
|
+ </Form.Item> */}
|
423
|
450
|
<Form.Item label="首页推荐" >
|
424
|
451
|
{getFieldDecorator('isMain', {
|
425
|
452
|
initialValue: 1,
|
|
@@ -437,11 +464,11 @@ function AddBuilding(props) {
|
437
|
464
|
<SelectCity />,
|
438
|
465
|
)}
|
439
|
466
|
</Form.Item>
|
440
|
|
- <Form.Item label="楼盘区域" >
|
|
467
|
+ {/* <Form.Item label="楼盘区域" >
|
441
|
468
|
{getFieldDecorator('buildingArea', {
|
442
|
469
|
rules: [{ required: true, message: '请输入楼盘区域' }],
|
443
|
470
|
})(<Input />)}
|
444
|
|
- </Form.Item>
|
|
471
|
+ </Form.Item> */}
|
445
|
472
|
<Form.Item label="项目地址" >
|
446
|
473
|
{getFieldDecorator('address', {
|
447
|
474
|
rules: [{ required: true, message: '请输入项目地址' }],
|
|
@@ -518,13 +545,13 @@ function AddBuilding(props) {
|
518
|
545
|
<Form.Item label="装修标准" >
|
519
|
546
|
{getFieldDecorator('decoration')(<Input />)}
|
520
|
547
|
</Form.Item>
|
521
|
|
- <Form.Item label="交房时间" >
|
|
548
|
+ {/* <Form.Item label="交房时间" >
|
522
|
549
|
{getFieldDecorator('receivedDate')(<DatePicker />)}
|
523
|
|
- </Form.Item>
|
524
|
|
- <Form.Item label="产权年限" >
|
|
550
|
+ </Form.Item> */}
|
|
551
|
+ {/* <Form.Item label="产权年限" >
|
525
|
552
|
{getFieldDecorator('rightsYear')(<InputNumber />)}
|
526
|
|
- </Form.Item>
|
527
|
|
- <Form.Item label="预售许可证" >
|
|
553
|
+ </Form.Item> */}
|
|
554
|
+ {/* <Form.Item label="预售许可证" >
|
528
|
555
|
{getFieldDecorator('preSalePermit')(
|
529
|
556
|
<ImageUpload />,
|
530
|
557
|
)}
|
|
@@ -533,7 +560,7 @@ function AddBuilding(props) {
|
533
|
560
|
{getFieldDecorator('remark')(
|
534
|
561
|
<Wangedit />,
|
535
|
562
|
)}
|
536
|
|
- </Form.Item>
|
|
563
|
+ </Form.Item> */}
|
537
|
564
|
<Form.Item style={{ width: '400px', margin: 'auto', display: 'flex', justifyContent: 'space-between' }}>
|
538
|
565
|
<Button type="primary" htmlType="submit">
|
539
|
566
|
确定
|