傅行帆 5 gadus atpakaļ
vecāks
revīzija
4c75382110

+ 20
- 10
src/pages/house/edit/components/house.jsx Parādīt failu

9
 import UnitSelect from '../../../../components/HouseSelect/UnitSelect'
9
 import UnitSelect from '../../../../components/HouseSelect/UnitSelect'
10
 import FloorSelect from '../../../../components/HouseSelect/FloorSelect'
10
 import FloorSelect from '../../../../components/HouseSelect/FloorSelect'
11
 import RoomSelect from '../../../../components/HouseSelect/RoomSelect'
11
 import RoomSelect from '../../../../components/HouseSelect/RoomSelect'
12
+import ApartmentSelect from '../../../../components/HouseSelect/ApartmentSelect';
12
 
13
 
13
 /**
14
 /**
14
  *图片设置
15
  *图片设置
150
       title: '发布状态',
151
       title: '发布状态',
151
       dataIndex: 'status',
152
       dataIndex: 'status',
152
       key: 'status',
153
       key: 'status',
154
+      render: status => <><span>{status == 0 ? '否' : status == 1 ? '是' : ''}</span></>,
153
     },
155
     },
154
     {
156
     {
155
       title: '最后修改人',
157
       title: '最后修改人',
162
       key: 'apartmentId',
164
       key: 'apartmentId',
163
       render: (_, record) => (
165
       render: (_, record) => (
164
         <>
166
         <>
165
-          <Button type="link" style={{ color: 'red' }} onClick={() => showEdi({type: "edit",record})}>编辑</Button>
167
+          <Button type="link" style={{ color: 'red' }} onClick={() => showEdi({type: "add",houseId: record.houseId})}>编辑</Button>
166
           <Button type="link" style={{ color: 'red' }} onClick={() => deleteApartment(record)}>删除</Button>
168
           <Button type="link" style={{ color: 'red' }} onClick={() => deleteApartment(record)}>删除</Button>
167
         </>
169
         </>
168
       ),
170
       ),
173
     <>
175
     <>
174
     <Form layout="inline" onSubmit={e => handleSubmit(e)}>
176
     <Form layout="inline" onSubmit={e => handleSubmit(e)}>
175
         <Form.Item>
177
         <Form.Item>
176
-          {getFieldDecorator('blockId')(
178
+          {getFieldDecorator('termName')(
179
+            <Input placeholder="请输入期/区"/>
180
+          )}
181
+        </Form.Item>
182
+        <Form.Item>
183
+          {getFieldDecorator('blockName')(
177
             <Input placeholder="请输入楼栋"/>
184
             <Input placeholder="请输入楼栋"/>
178
           )}
185
           )}
179
         </Form.Item>
186
         </Form.Item>
180
         <Form.Item>
187
         <Form.Item>
181
-          {getFieldDecorator('unitId')(
188
+          {getFieldDecorator('unitName')(
182
             <Input placeholder="请输入单元"/>
189
             <Input placeholder="请输入单元"/>
183
           )}
190
           )}
184
         </Form.Item>
191
         </Form.Item>
185
         <Form.Item>
192
         <Form.Item>
186
-          {getFieldDecorator('floorId')(
193
+          {getFieldDecorator('floorName')(
187
             <Input placeholder="请输入楼层"/>
194
             <Input placeholder="请输入楼层"/>
188
           )}
195
           )}
189
         </Form.Item>
196
         </Form.Item>
190
         <Form.Item>
197
         <Form.Item>
191
-          {getFieldDecorator('roomId')(
198
+          {getFieldDecorator('roomName')(
192
              <Input placeholder="请输入房间号"/>
199
              <Input placeholder="请输入房间号"/>
193
           )}
200
           )}
194
         </Form.Item>
201
         </Form.Item>
195
         <Form.Item>
202
         <Form.Item>
196
-          {getFieldDecorator('roomId')(
197
-             <Input placeholder="请输入户型"/>
203
+          {getFieldDecorator('apartmentId')(
204
+             <ApartmentSelect buildingId={props.buildingId} />
198
           )}
205
           )}
199
         </Form.Item>
206
         </Form.Item>
200
         <Form.Item>
207
         <Form.Item>
201
-          {getFieldDecorator('roomId')(
202
-             <Input placeholder="发布状态"/>
208
+          {getFieldDecorator('status')(
209
+             <Select placeholder="发布状态" style={{width: '120px'}}>
210
+             <Option value="0">否</Option>
211
+             <Option value="1">是</Option>
212
+           </Select>,
203
           )}
213
           )}
204
         </Form.Item>
214
         </Form.Item>
205
         <Form.Item>
215
         <Form.Item>
216
             </Button>
226
             </Button>
217
         </Form.Item>
227
         </Form.Item>
218
       </Form>
228
       </Form>
219
-      <Button type="primary" onClick={() => showEdi({type: "add"})}>新增房源</Button>
229
+      <Button type="primary" onClick={() => showEdi({type: "add",houseId: ''})}>新增房源</Button>
220
       <Button type="primary" onClick={() => showEdi()} style={{ marginLeft: '18px'}}>批量导入房源</Button>
230
       <Button type="primary" onClick={() => showEdi()} style={{ marginLeft: '18px'}}>批量导入房源</Button>
221
       <Button type="primary" onClick={() => showEdi()} style={{ marginLeft: '18px'}}>批量修改对应户型</Button>
231
       <Button type="primary" onClick={() => showEdi()} style={{ marginLeft: '18px'}}>批量修改对应户型</Button>
222
       <Button type="danger" style={{ marginLeft: '18px'}} onClick={() => router.go(-1)}>返回</Button>
232
       <Button type="danger" style={{ marginLeft: '18px'}} onClick={() => router.go(-1)}>返回</Button>

+ 57
- 54
src/pages/house/edit/components/houseAdd.jsx Parādīt failu

3
 import { FormattedMessage } from 'umi-plugin-react/locale';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
 import moment from 'moment';
4
 import moment from 'moment';
5
 import router from 'umi/router';
5
 import router from 'umi/router';
6
+import request from '../../../../utils/request';
6
 import apis from '../../../../services/apis';
7
 import apis from '../../../../services/apis';
7
 import XForm, { FieldTypes } from '../../../../components/XForm';
8
 import XForm, { FieldTypes } from '../../../../components/XForm';
9
+import ApartmentSelect from '../../../../components/HouseSelect/ApartmentSelect';
8
 
10
 
9
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
11
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
10
 const { TextArea } = Input;
12
 const { TextArea } = Input;
15
 };
17
 };
16
 
18
 
17
 function HouseAdd(props) {
19
 function HouseAdd(props) {
20
+  console.log(props,"props222")
21
+  const houseId = props.houseId
22
+    
23
+  useEffect(() => {
24
+    if (houseId && houseId !== '') {
25
+      getById(houseId)
26
+    }
27
+  }, [houseId])
28
+
29
+  function getById(houseId) {
30
+    request({ ...apis.house.getById, urlData: { id: houseId } }).then(data => {
31
+      props.form.setFieldsValue(data)
32
+    }).catch((err) => {
33
+      message.info(err.msg || err.message)
34
+    })
35
+  }
36
+
37
+  //校验房源
18
   function checkValues() {
38
   function checkValues() {
19
-    props.form.validateFields((err, values) => {
20
-      if (!err) {
21
-        console.log(values,"valuesvaluesvalues")
22
-      }
23
-    });
39
+    request({ ...apis.house.checked, data: { ...props.form.getFieldsValue(), buildingId: props.buildingId } }).then(data => {
40
+      message.warn(data)
41
+    }).catch((err) => {
42
+      message.info(err.msg || err.message)
43
+    })
24
   }
44
   }
25
 
45
 
26
   function handleSubmit(e) {
46
   function handleSubmit(e) {
27
     e.preventDefault();
47
     e.preventDefault();
28
     props.form.validateFields((err, values) => {
48
     props.form.validateFields((err, values) => {
29
       if (!err) {
49
       if (!err) {
30
-        console.log('Received values of form: ', values);
31
-        const { activityTime, signupTime } = values
32
-        const [startDate, endDate] = activityTime
33
-        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
34
-        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
35
-        if (signupTime) {
36
-          const [enlistStart, enlistEnd] = signupTime
37
-          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
38
-          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
39
-        }
40
-        
41
-        console.log('submit data --->', values)
42
-        if (dynamicId) {
43
-          values.dynamicId = dynamicId
44
-          request({ ...apis.activity.update, data: values }).then(data => {
45
-            message.info('保存成功')
46
-            // router.go(-1)
47
-          }).catch((err) => {
48
-            message.info(err.msg || err.message)
49
-          })
50
-        } else {
51
-          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
52
-            message.info('保存成功')
53
-            router.push({
54
-              pathname: '/activity/editActivity',
55
-              query: {
56
-                dynamicId: data.dynamicId,
57
-              },
58
-            });
59
-            // router.go(-1)
60
-          }).catch((err) => {
61
-            message.info(err.msg || err.message)
62
-          })
63
-        }
50
+          if(houseId){
51
+            request({ ...apis.house.houseEdit,urlData: {id: houseId}, data: { ...values,buildingId: props.buildingId, salesBatchId: props.salesBatchId } }).then((data) => {
52
+              message.info('保存成功')
53
+              props.onSuccess({type: "house"})
54
+            }).catch((err) => {
55
+              // message.info(err.msg || err.message)
56
+            })
57
+          }else{
58
+            request({ ...apis.house.houseAdd, data: { ...values,buildingId: props.buildingId, salesBatchId: props.salesBatchId } }).then((data) => {
59
+              message.info('保存成功')
60
+              props.onSuccess({type: "house"})
61
+            }).catch((err) => {
62
+              // message.info(err.msg || err.message)
63
+            })
64
+          }
64
       }
65
       }
65
     });
66
     });
66
   }
67
   }
67
 
68
 
68
   function cancelPage(e) {
69
   function cancelPage(e) {
69
-    
70
+    props.onSuccess({type: "house"})
70
   }
71
   }
71
 
72
 
72
   const { getFieldDecorator } = props.form;
73
   const { getFieldDecorator } = props.form;
73
   return (
74
   return (
74
     <>
75
     <>
75
       <Form {...formItemLayout} onSubmit={handleSubmit}>
76
       <Form {...formItemLayout} onSubmit={handleSubmit}>
77
+      <Form.Item label="期">
78
+        {getFieldDecorator('termName', {
79
+          rules: [
80
+            {
81
+              required: true,
82
+              message: '请输入楼栋',
83
+            },
84
+          ],
85
+        })(<Input/>)}
86
+        </Form.Item>
76
         <Form.Item label="楼栋">
87
         <Form.Item label="楼栋">
77
         {getFieldDecorator('blockName', {
88
         {getFieldDecorator('blockName', {
78
           rules: [
89
           rules: [
111
               message: '请输入房号',
122
               message: '请输入房号',
112
             },
123
             },
113
           ],
124
           ],
114
-        })(<Input/>)}
125
+        })(<Input/> )}
126
+         <Button type="primary" onClick={() => checkValues()}>
127
+            校验房源
128
+          </Button>
115
         </Form.Item>
129
         </Form.Item>
116
-        <Form.Item label="价格">
130
+        <Form.Item label="价格" help="单位:万元">
117
         {getFieldDecorator('price', {
131
         {getFieldDecorator('price', {
118
           rules: [
132
           rules: [
119
             {
133
             {
134
         })(<Input/>)}
148
         })(<Input/>)}
135
         </Form.Item>
149
         </Form.Item>
136
         <Form.Item label="户型">
150
         <Form.Item label="户型">
137
-        {getFieldDecorator('apartmentId', {
138
-          rules: [
139
-            {
140
-              required: true,
141
-              message: '请输入楼栋',
142
-            },
143
-          ],
144
-        })(<Input/>)}
151
+        {getFieldDecorator('apartmentId')(<ApartmentSelect buildingId={props.buildingId} />)}
145
         </Form.Item>
152
         </Form.Item>
146
         <Form.Item label="发布状态">
153
         <Form.Item label="发布状态">
147
         {getFieldDecorator('status', {
154
         {getFieldDecorator('status', {
163
             确认
170
             确认
164
           </Button>
171
           </Button>
165
           &nbsp;&nbsp;&nbsp;&nbsp;
172
           &nbsp;&nbsp;&nbsp;&nbsp;
166
-          <Button type="primary" onClick={() => checkValues()}>
167
-            校验
168
-          </Button>
169
-          &nbsp;&nbsp;&nbsp;&nbsp;
170
           <Button onClick={() => cancelPage({type: "house"})}>
173
           <Button onClick={() => cancelPage({type: "house"})}>
171
             取消
174
             取消
172
           </Button>
175
           </Button>

+ 5
- 2
src/pages/house/edit/components/houseTab.jsx Parādīt failu

12
 
12
 
13
 function EditHouse(props) {
13
 function EditHouse(props) {
14
   const [tab, setTab] = useState('house')
14
   const [tab, setTab] = useState('house')
15
+  const [houseId, setHouseId] = useState('')
15
 
16
 
16
   function changeTab(e) {
17
   function changeTab(e) {
17
-    console.log(e,"eeeee")
18
     setTab(e.type)
18
     setTab(e.type)
19
+    if(e.type === "add"){
20
+      setHouseId(e.houseId)
21
+    }
19
   }
22
   }
20
 
23
 
21
   return (
24
   return (
22
     <>
25
     <>
23
       <div style={{ marginTop: '20px' }}>
26
       <div style={{ marginTop: '20px' }}>
24
         { (tab === 'house' && <House salesBatchId={props.salesBatchId} buildingId={props.buildingId} onSuccess={e => changeTab(e)}/>)} 
27
         { (tab === 'house' && <House salesBatchId={props.salesBatchId} buildingId={props.buildingId} onSuccess={e => changeTab(e)}/>)} 
25
-        { (tab === 'add' && <HouseAdd salesBatchId={props.salesBatchId} buildingId={props.buildingId} onSuccess={e => changeTab(e)}/>)} 
28
+        { (tab === 'add' && <HouseAdd salesBatchId={props.salesBatchId} buildingId={props.buildingId} houseId={houseId} onSuccess={e => changeTab(e)}/>)} 
26
       </div>
29
       </div>
27
     </>
30
     </>
28
   )
31
   )

+ 2
- 4
src/pages/house/edit/index.jsx Parādīt failu

40
 function EditHouse(props) {
40
 function EditHouse(props) {
41
   const {salesBatchId} = props.location.query.id;
41
   const {salesBatchId} = props.location.query.id;
42
   console.log(props.location.query.id)
42
   console.log(props.location.query.id)
43
-  const [tab, setTab] = useState('base')
43
+  const [tab, setTab] = useState('house')
44
   const [salesBatchData, setSalesBatchData] = useState({ salesBatchId: undefined })
44
   const [salesBatchData, setSalesBatchData] = useState({ salesBatchId: undefined })
45
 
45
 
46
-  // const [tab, setTab] = useState('house')
47
-  
48
   function tabsCallback(e) {
46
   function tabsCallback(e) {
49
     setTab(e.target.value)
47
     setTab(e.target.value)
50
   }
48
   }
68
       </Radio.Group>
66
       </Radio.Group>
69
       <div style={{ marginTop: '20px' }}>
67
       <div style={{ marginTop: '20px' }}>
70
         { (tab === 'base' && <Base salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }} onSuccess={e => buildingOnSuccess(e)}/>)} 
68
         { (tab === 'base' && <Base salesBatchId={{ salesBatchId: salesBatchData.salesBatchId || (props.location.query && props.location.query.id) }} onSuccess={e => buildingOnSuccess(e)}/>)} 
71
-        { (tab === 'house' && <HouseTab salesBatchId="1" buildingId="1"/>)}
69
+        { (tab === 'house' && <HouseTab salesBatchId={props.location.query.id} buildingId={props.location.query.buildingId}/>)}
72
         { (tab === 'poster' && <Poster />)}
70
         { (tab === 'poster' && <Poster />)}
73
         { (tab === 'share' && <Share />)}
71
         { (tab === 'share' && <Share />)}
74
         { (tab === 'preselectionImg' && <PreselectionImg />)}
72
         { (tab === 'preselectionImg' && <PreselectionImg />)}

+ 5
- 4
src/pages/house/list/index.jsx Parādīt failu

34
   }, [])
34
   }, [])
35
 
35
 
36
   // 跳转到编辑商品
36
   // 跳转到编辑商品
37
-  const toAddHouse = id => () => {
38
-    if(id) {
37
+  const toAddHouse = rowData => () => {
38
+    if(rowData) {
39
       router.push({
39
       router.push({
40
       pathname: '/house/edit',
40
       pathname: '/house/edit',
41
       query: {
41
       query: {
42
-        id
42
+        id: rowData.salesBatchId,
43
+        buildingId: rowData.buildingId,
43
       },
44
       },
44
     });
45
     });
45
       return
46
       return
94
       dataIndex: 'salesBatchName',
95
       dataIndex: 'salesBatchName',
95
       key: 'salesBatchName',
96
       key: 'salesBatchName',
96
       align: 'center',
97
       align: 'center',
97
-      render:  (x, row) => <><span style={{color: 'blue',cursor: 'pointer'}} onClick={toAddHouse(row.salesBatchId)}>{row.salesBatchName}</span></>,
98
+      render:  (x, row) => <><span style={{color: 'blue',cursor: 'pointer'}} onClick={toAddHouse(row)}>{row.salesBatchName}</span></>,
98
     },
99
     },
99
     {
100
     {
100
       title: '楼盘名称',
101
       title: '楼盘名称',

+ 25
- 0
src/services/apis.js Parādīt failu

1128
     method: 'GET',
1128
     method: 'GET',
1129
     url: `${prefix}/taBuildingFloor`,
1129
     url: `${prefix}/taBuildingFloor`,
1130
     action: 'admin.taBuildingFloor.get',
1130
     action: 'admin.taBuildingFloor.get',
1131
+  },
1132
+  apartmentList: {
1133
+    method: 'GET',
1134
+    url: `${prefix}/apartmentList`,
1135
+    action: 'admin.apartmentList.get',
1136
+  },
1137
+  checked: {
1138
+    method: 'PUT',
1139
+    url: `${prefix}/house/checked`,
1140
+    action: 'admin.house.checked.get',
1141
+  },
1142
+  houseAdd: {
1143
+    url: `${prefix}/taHousingResources`,
1144
+    method: 'POST',
1145
+    action: 'admin.taHousingResources.get',
1146
+  },
1147
+  getById: {
1148
+    method: 'GET',
1149
+    url: `${prefix}/taHousingResources/:id`,
1150
+    action: 'admin.taHousingResources.id.get',
1151
+  },
1152
+  houseEdit: {
1153
+    url: `${prefix}/taHousingResources/:id`,
1154
+    method: 'PUT',
1155
+    action: 'admin.taHousingResources.id.put',
1131
   }
1156
   }
1132
  },
1157
  },
1133
 }
1158
 }