Baozhangchao пре 3 година
родитељ
комит
6efa81a072
1 измењених фајлова са 7 додато и 3 уклоњено
  1. 7
    3
      src/components/BuildingSelect/index.jsx

+ 7
- 3
src/components/BuildingSelect/index.jsx Прегледај датотеку

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