|
@@ -2,12 +2,8 @@ import React, { useRef, useState, useEffect } from 'react'
|
2
|
2
|
import { Form, Input, Select, Button, Radio, Modal, Descriptions } from 'antd'
|
3
|
3
|
import router from 'umi/router'
|
4
|
4
|
import { fetch, apis } from '@/utils/request'
|
|
5
|
+import useRoomSelect from '../utils/hooks/useRoomSelect'
|
5
|
6
|
|
6
|
|
-const fetchPhaseList = fetch(apis.buildingOwnerInfo.getPhaseList)
|
7
|
|
-const fetchBuildingList = fetch(apis.buildingOwnerInfo.getBuildingList)
|
8
|
|
-const fetchUnitList = fetch(apis.buildingOwnerInfo.getUnitList)
|
9
|
|
-const fetchLevelList = fetch(apis.buildingOwnerInfo.getLevelList)
|
10
|
|
-const fetchRoomNoList = fetch(apis.buildingOwnerInfo.getRoomNoList)
|
11
|
7
|
const addPerson = fetch(apis.buildingOwnerInfo.addBuilding)
|
12
|
8
|
const taUserHasOwner = fetch(apis.propUser.taUserHasOwner)
|
13
|
9
|
const taUserHas = fetch(apis.propUser.taUserHas)
|
|
@@ -37,17 +33,23 @@ const tailFormItemLayout = {
|
37
|
33
|
}
|
38
|
34
|
|
39
|
35
|
export default Form.create()(props => {
|
40
|
|
- const [phaseList, setPhaseList] = useState([])
|
41
|
|
- const [buildingList, setBuildingList] = useState([])
|
42
|
|
- const [unitList, setUnitList] = useState([])
|
43
|
|
- const [levelList, setLevelList] = useState([])
|
44
|
|
- const [roomNoList, setRoomNoList] = useState([])
|
45
|
|
-
|
46
|
|
- const [phaseId, setPhaseId] = useState()
|
47
|
|
- const [buildingId, setBuildingId] = useState()
|
48
|
|
- const [unitId, setUnitId] = useState()
|
49
|
|
- const [levelId, setLevelId] = useState()
|
50
|
|
- const [roomNoId, setRoomNoId] = useState()
|
|
36
|
+ const {
|
|
37
|
+ phaseId,
|
|
38
|
+ setPhaseId,
|
|
39
|
+ buildingId,
|
|
40
|
+ setBuildingId,
|
|
41
|
+ unitId,
|
|
42
|
+ setUnitId,
|
|
43
|
+ levelId,
|
|
44
|
+ setLevelId,
|
|
45
|
+ roomNoId,
|
|
46
|
+ setRoomNoId,
|
|
47
|
+ phaseList,
|
|
48
|
+ buildingList,
|
|
49
|
+ unitList,
|
|
50
|
+ levelList,
|
|
51
|
+ roomNoList
|
|
52
|
+ } = useRoomSelect()
|
51
|
53
|
|
52
|
54
|
const [owerExist, setOwnerExist] = useState(false)
|
53
|
55
|
const [telAccUser, setTelAccUser] = useState()
|
|
@@ -66,43 +68,6 @@ export default Form.create()(props => {
|
66
|
68
|
}
|
67
|
69
|
}
|
68
|
70
|
|
69
|
|
- // 获取期
|
70
|
|
- useEffect(() => {
|
71
|
|
- fetchPhaseList().then(res => setPhaseList(res))
|
72
|
|
- }, [])
|
73
|
|
-
|
74
|
|
- // 楼栋
|
75
|
|
- useEffect(() => {
|
76
|
|
- if (phaseId) {
|
77
|
|
- fetchBuildingList({params: {phaseId}}).then(res => setBuildingList(res))
|
78
|
|
- }
|
79
|
|
- setBuildingId()
|
80
|
|
- }, [phaseId])
|
81
|
|
-
|
82
|
|
- // 单元
|
83
|
|
- useEffect(() => {
|
84
|
|
- if (phaseId && buildingId) {
|
85
|
|
- fetchUnitList({params: {phaseId, buildingId}}).then(res => setUnitList(res))
|
86
|
|
- }
|
87
|
|
- setUnitId()
|
88
|
|
- }, [phaseId, buildingId])
|
89
|
|
-
|
90
|
|
- // 楼层
|
91
|
|
- useEffect(() => {
|
92
|
|
- if (phaseId && buildingId && unitId) {
|
93
|
|
- fetchLevelList({params: {phaseId, buildingId, unitId}}).then(res => setLevelList(res))
|
94
|
|
- }
|
95
|
|
- setLevelId()
|
96
|
|
- }, [phaseId, buildingId, unitId])
|
97
|
|
-
|
98
|
|
- // 房号
|
99
|
|
- useEffect(() => {
|
100
|
|
- if (phaseId && buildingId && unitId && levelId) {
|
101
|
|
- fetchRoomNoList({params: {phaseId, buildingId, unitId, levelId}}).then(res => setRoomNoList(res))
|
102
|
|
- }
|
103
|
|
- setRoomNoId()
|
104
|
|
- }, [phaseId, buildingId, unitId, levelId])
|
105
|
|
-
|
106
|
71
|
useEffect(() => {
|
107
|
72
|
if (roomNoId) {
|
108
|
73
|
taUserHasOwner({ params: {phaseId, buildingId, unitId, levelId, roomNoId} }).then(res => {
|