weiximei 5 years ago
parent
commit
30dc44acce
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      src/pages/building/list/add/components/base.jsx

+ 5
- 3
src/pages/building/list/add/components/base.jsx View File

45
 
45
 
46
   const [poi, setPoi] = useState([])
46
   const [poi, setPoi] = useState([])
47
 
47
 
48
-  console.log('props.building: ', props.building)
48
+  // console.log('props.building: ', props.building)
49
   if (props.building.buildingId !== undefined) {
49
   if (props.building.buildingId !== undefined) {
50
     const { buildingId } = props.building
50
     const { buildingId } = props.building
51
      // eslint-disable-next-line react-hooks/rules-of-hooks
51
      // eslint-disable-next-line react-hooks/rules-of-hooks
76
       if (res.videoUrl) {
76
       if (res.videoUrl) {
77
         res.videoUrl = [].concat(res.videoUrl)
77
         res.videoUrl = [].concat(res.videoUrl)
78
       }
78
       }
79
+      setPoi(res.mapJson || [])
79
       props.form.setFieldsValue(res)
80
       props.form.setFieldsValue(res)
80
       props.onSuccess(res)
81
       props.onSuccess(res)
81
     })
82
     })
91
   }
92
   }
92
 
93
 
93
   function addBuilding(data) {
94
   function addBuilding(data) {
94
-    console.log('poi: ', poi)
95
+    // console.log('poi: ', poi)
95
     data.mapJson = poi
96
     data.mapJson = poi
96
     data.openingDate = moment(data.openingDate, 'yyyy-MM-dd HH:mm:ss')
97
     data.openingDate = moment(data.openingDate, 'yyyy-MM-dd HH:mm:ss')
97
     data.receivedDate = moment(data.receivedDate, 'yyyy-MM-dd HH:mm:ss')
98
     data.receivedDate = moment(data.receivedDate, 'yyyy-MM-dd HH:mm:ss')
162
     // 设置表单值
163
     // 设置表单值
163
     getFormMapScopeName(key, { data: poiArray })
164
     getFormMapScopeName(key, { data: poiArray })
164
 
165
 
165
-    const newPoi = poi.map(m => {
166
+    const poiData = [].concat(POI_TYPES)
167
+    const newPoi = poiData.map(m => {
166
       if (m.key === key) {
168
       if (m.key === key) {
167
         m.data = poiArray
169
         m.data = poiArray
168
       }
170
       }