张延森 3 年前
父节点
当前提交
330b601ec3

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

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

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

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