Baozhangchao 3 years ago
parent
commit
6efa81a072
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      src/components/BuildingSelect/index.jsx

+ 7
- 3
src/components/BuildingSelect/index.jsx View File

@@ -21,6 +21,7 @@ export default (props) => {
21 21
   const [visible, setVisible] = useState(false)
22 22
   const [loading, setLoading] = useState(false)
23 23
   const [val, setVal] = useState({ buildingName: '意向楼盘' })
24
+  const [buildingTitle, setBuildingTitle] = useState({ buildingName: '意向楼盘' })
24 25
 
25 26
   useEffect(() => {
26 27
     if (dicts) {
@@ -49,11 +50,14 @@ export default (props) => {
49 50
     const buildingId = e.detail.value
50 51
     const building = dicts.filter(x => x.buildingId === buildingId)[0] || { buildingName: '意向楼盘' }
51 52
 
52
-    setVal(building)
53
+    setBuildingTitle(building)
54
+
53 55
   }
54 56
   const handleSubmit = (e) => {
55 57
     e.stopPropagation()
56 58
     setVisible(false)
59
+    setVal(buildingTitle)
60
+
57 61
     onChange(val.buildingId, val)
58 62
   }
59 63
 
@@ -67,7 +71,7 @@ export default (props) => {
67 71
               <view className='frame'>
68 72
                 {/* 标题  */}
69 73
                 <view className='title-wrapper'>
70
-                  <view>{val.buildingName}</view>
74
+                  <view>{buildingTitle.buildingName}</view>
71 75
                 </view>
72 76
                 {/* 内容 */}
73 77
                 <view style='overflow-x: hidden;'>
@@ -102,7 +106,7 @@ export default (props) => {
102 106
                   {/* <view className='bottom-text' onClick={handleTextNext}> */}
103 107
                   <view style={{ display: 'flex', margin: '2em auto' }}>
104 108
                     <Button className='checkBtn' onClick={() => setVisible(false)}  >取消</Button>
105
-                    <Button className='okBtn' disabled={!val.buildingId} onClick={handleSubmit}> 确定</Button>
109
+                    <Button className='okBtn' disabled={!buildingTitle.buildingId} onClick={handleSubmit}> 确定</Button>
106 110
                   </view>
107 111
                   {/* <view className='Btn'>
108 112
                     <Button onClick={() => setVisible(false)} >取消</Button>