张延森 4 年之前
父節點
當前提交
330b601ec3

+ 6
- 2
src/pages/building/Edit/components/BuildingTypeDetail.jsx 查看文件

1
-import React, { useState } from 'react'
1
+import React, { useEffect, useState } from 'react'
2
 import { Button, Drawer, Form, Radio, Input, Select } from 'antd'
2
 import { Button, Drawer, Form, Radio, Input, Select } from 'antd'
3
 import { formItemLayout } from '../utils'
3
 import { formItemLayout } from '../utils'
4
 import styles from '../style.less'
4
 import styles from '../style.less'
31
       };
31
       };
32
 
32
 
33
       const data = {
33
       const data = {
34
-        ...values,
35
         ...dataset || {},
34
         ...dataset || {},
35
+        ...values,
36
       }
36
       }
37
 
37
 
38
       onSubmit(data)
38
       onSubmit(data)
39
     })
39
     })
40
   }
40
   }
41
 
41
 
42
+  useEffect(() => {
43
+    form.setFieldsValue(dataset)
44
+  }, [dataset])
45
+
42
   return (
46
   return (
43
     <Drawer
47
     <Drawer
44
       width={600}
48
       width={600}

+ 3
- 4
src/pages/building/Edit/components/BuildingTypeSelect.jsx 查看文件

33
 
33
 
34
   const handleClick = (buildingType) => () => {
34
   const handleClick = (buildingType) => () => {
35
     const current = (value || []).filter((it) => it.buildingTypeId === buildingType.buildingTypeId)[0] || {buildingTypeId: buildingType.buildingTypeId}
35
     const current = (value || []).filter((it) => it.buildingTypeId === buildingType.buildingTypeId)[0] || {buildingTypeId: buildingType.buildingTypeId}
36
-    
36
+    console.log('-------------->', current)
37
     setCurRow(current)
37
     setCurRow(current)
38
     setBuildingType(buildingType)
38
     setBuildingType(buildingType)
39
     setShowDrawer(true)
39
     setShowDrawer(true)
84
               <Checkbox
84
               <Checkbox
85
                 checked={checked}
85
                 checked={checked}
86
                 onChange={handleChange(it)}
86
                 onChange={handleChange(it)}
87
-              >
88
-                {it.buildingTypeName}
89
-              </Checkbox>
87
+              />
88
+              <span style={{display: 'inline-block', margin: '0 .5em'}}>{it.buildingTypeName}</span>
90
               {checked && <a href="#" onClick={handleClick(it)}><Icon type="edit" /></a>}              
89
               {checked && <a href="#" onClick={handleClick(it)}><Icon type="edit" /></a>}              
91
             </Card.Grid>
90
             </Card.Grid>
92
           )
91
           )