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