|
@@ -1,15 +1,202 @@
|
1
|
1
|
import React, { useState, useEffect } from 'react';
|
2
|
|
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
|
3
|
|
-import { FormattedMessage } from 'umi-plugin-react/locale';
|
|
2
|
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, Table, notification, Modal } from 'antd';
|
4
|
3
|
import moment from 'moment';
|
5
|
|
-import router from 'umi/router';
|
|
4
|
+import request from '../../../../utils/request';
|
6
|
5
|
import apis from '../../../../services/apis';
|
|
6
|
+import Styles from './style.less';
|
|
7
|
+import { router } from 'umi';
|
7
|
8
|
|
8
|
|
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
9
|
|
-const { TextArea } = Input;
|
|
9
|
+/**
|
|
10
|
+ *图片设置
|
|
11
|
+ *
|
|
12
|
+ * @param {*} props
|
|
13
|
+ * @returns
|
|
14
|
+ */
|
|
15
|
+function House(props) {
|
|
16
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
17
|
+ const [data, setData] = useState([])
|
10
|
18
|
|
11
|
|
-const House = props => {
|
12
|
|
- return <div><span>房源信息</span></div>
|
13
|
|
-}
|
|
19
|
+ useEffect(() => {
|
|
20
|
+ getList()
|
|
21
|
+ }, [])
|
|
22
|
+
|
|
23
|
+ function openNotificationWithIcon(type, message) {
|
|
24
|
+ notification[type]({
|
|
25
|
+ message,
|
|
26
|
+ description:
|
|
27
|
+ '',
|
|
28
|
+ });
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+ function getList(params) {
|
|
32
|
+ // 网路请求
|
|
33
|
+ request({ ...apis.house.taHousingResources, params: { ...params,salesBatchId: props.salesBatchId,buildingId: props.buildingId } }).then(res => {
|
|
34
|
+ console.log(res,"resresres")
|
|
35
|
+ setData(res)
|
|
36
|
+ }).catch(err => {
|
|
37
|
+ openNotificationWithIcon('error', err.message)
|
|
38
|
+ })
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+ // 重置搜索
|
|
42
|
+ function handleReset () {
|
|
43
|
+ props.form.resetFields();
|
|
44
|
+ getList({ pageNumber: 1, pageSize: 10 })
|
|
45
|
+ }
|
|
46
|
+
|
|
47
|
+ // 分页
|
|
48
|
+ function changePageNum(pageNumber) {
|
|
49
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
50
|
+ getList({ pageNumber: pageNumber, pageSize: 10})
|
|
51
|
+ }
|
14
|
52
|
|
15
|
|
-export default House
|
|
53
|
+ const rowSelection = {
|
|
54
|
+ onChange: (selectedRowKeys, selectedRows) => {
|
|
55
|
+ console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
|
|
56
|
+ },
|
|
57
|
+ };
|
|
58
|
+
|
|
59
|
+ function showEdi() {
|
|
60
|
+ window.location.href = "/house/add";
|
|
61
|
+ }
|
|
62
|
+
|
|
63
|
+ /**
|
|
64
|
+ * 删除
|
|
65
|
+ *
|
|
66
|
+ * @param {*} record
|
|
67
|
+ */
|
|
68
|
+ function deleteApartment(record) {
|
|
69
|
+ confirm({
|
|
70
|
+ title: '确认删除当前数据?',
|
|
71
|
+ content: '确定后成功删除,点击取消则放弃当前操作',
|
|
72
|
+ okText: '确定',
|
|
73
|
+ cancelText: '取消',
|
|
74
|
+ onOk() {
|
|
75
|
+ // 网路请求
|
|
76
|
+ request({ ...apis.building.buildingApartmentDelete, urlData: { id: record.apartmentId } }).then(res => {
|
|
77
|
+ getList()
|
|
78
|
+ openNotificationWithIcon('success', '操作成功')
|
|
79
|
+ }).catch(err => {
|
|
80
|
+ // openNotificationWithIcon('error', err.message)
|
|
81
|
+ })
|
|
82
|
+ },
|
|
83
|
+ onCancel() {},
|
|
84
|
+ });
|
|
85
|
+ }
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+ const columns = [
|
|
89
|
+ {
|
|
90
|
+ title: '房源编号',
|
|
91
|
+ dataIndex: 'houseId',
|
|
92
|
+ key: 'houseId',
|
|
93
|
+ },
|
|
94
|
+ {
|
|
95
|
+ title: '楼栋',
|
|
96
|
+ dataIndex: 'blockName',
|
|
97
|
+ key: 'blockName',
|
|
98
|
+ },
|
|
99
|
+ {
|
|
100
|
+ title: '单元',
|
|
101
|
+ dataIndex: 'unitName',
|
|
102
|
+ key: 'unitName',
|
|
103
|
+ },
|
|
104
|
+ {
|
|
105
|
+ title: '层',
|
|
106
|
+ dataIndex: 'floorName',
|
|
107
|
+ key: 'floorName',
|
|
108
|
+ },
|
|
109
|
+ {
|
|
110
|
+ title: '房号',
|
|
111
|
+ dataIndex: 'roomName',
|
|
112
|
+ key: 'roomName',
|
|
113
|
+ },
|
|
114
|
+ {
|
|
115
|
+ title: '价格(万元)',
|
|
116
|
+ dataIndex: 'price',
|
|
117
|
+ key: 'price',
|
|
118
|
+ },
|
|
119
|
+ {
|
|
120
|
+ title: '对应户型',
|
|
121
|
+ dataIndex: 'apartmentName',
|
|
122
|
+ key: 'apartmentName',
|
|
123
|
+ },
|
|
124
|
+ {
|
|
125
|
+ title: '预选基础热度',
|
|
126
|
+ dataIndex: 'heat',
|
|
127
|
+ key: 'heat',
|
|
128
|
+ },
|
|
129
|
+ {
|
|
130
|
+ title: '预选实际热度',
|
|
131
|
+ dataIndex: 'realHeat',
|
|
132
|
+ key: 'realHeat',
|
|
133
|
+ },
|
|
134
|
+ {
|
|
135
|
+ title: '发布状态',
|
|
136
|
+ dataIndex: 'status',
|
|
137
|
+ key: 'status',
|
|
138
|
+ },
|
|
139
|
+ {
|
|
140
|
+ title: '最后修改人',
|
|
141
|
+ dataIndex: 'updateName',
|
|
142
|
+ key: 'updateName',
|
|
143
|
+ },
|
|
144
|
+ {
|
|
145
|
+ title: '操作',
|
|
146
|
+ dataIndex: 'apartmentId',
|
|
147
|
+ key: 'apartmentId',
|
|
148
|
+ render: (_, record) => (
|
|
149
|
+ <>
|
|
150
|
+ <Button type="link" style={{ color: 'red' }} onClick={() => showEdi(record)}>编辑</Button>
|
|
151
|
+ <Button type="link" style={{ color: 'red' }} onClick={() => deleteApartment(record)}>删除</Button>
|
|
152
|
+ </>
|
|
153
|
+ ),
|
|
154
|
+ },
|
|
155
|
+ ]
|
|
156
|
+ const { getFieldDecorator } = props.form
|
|
157
|
+ return (
|
|
158
|
+ <>
|
|
159
|
+ <Form layout="inline" onSubmit={e => handleSubmit(e)}>
|
|
160
|
+ <Form.Item>
|
|
161
|
+ {getFieldDecorator('cityId')(
|
|
162
|
+ <Input
|
|
163
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
164
|
+ placeholder="请输入标题"
|
|
165
|
+ />,
|
|
166
|
+ )}
|
|
167
|
+ </Form.Item>
|
|
168
|
+ <Form.Item>
|
|
169
|
+ {getFieldDecorator('buildingId')(
|
|
170
|
+ <Input
|
|
171
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
172
|
+ placeholder="请输入标题"
|
|
173
|
+ />,
|
|
174
|
+ )}
|
|
175
|
+ </Form.Item>
|
|
176
|
+ <Form.Item>
|
|
177
|
+ {getFieldDecorator('title')(
|
|
178
|
+ <Input
|
|
179
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
180
|
+ placeholder="请输入标题"
|
|
181
|
+ />,
|
|
182
|
+ )}
|
|
183
|
+ </Form.Item>
|
|
184
|
+ <Form.Item>
|
|
185
|
+ <Button type="primary" htmlType="submit" >
|
|
186
|
+ 搜索
|
|
187
|
+ </Button>
|
|
188
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
189
|
+ 重置
|
|
190
|
+ </Button>
|
|
191
|
+ </Form.Item>
|
|
192
|
+ </Form>
|
|
193
|
+ <Button type="primary" onClick={() => showEdi()}>新增房源</Button>
|
|
194
|
+ <Button type="primary" onClick={() => showEdi()} style={{ marginLeft: '18px'}}>批量导入房源</Button>
|
|
195
|
+ <Button type="primary" onClick={() => showEdi()} style={{ marginLeft: '18px'}}>批量修改对应户型</Button>
|
|
196
|
+ <Button type="danger" style={{ marginLeft: '18px'}} onClick={() => router.go(-1)}>返回</Button>
|
|
197
|
+ <Table rowSelection={rowSelection} dataSource={data.records} columns={columns} pagination={{ total: data.total, onChange: e => this.changePageNum(e) }} rowKey="House" />
|
|
198
|
+ </>
|
|
199
|
+ )
|
|
200
|
+}
|
|
201
|
+const WrappedHeader = Form.create({ name: 'House' })(House);
|
|
202
|
+export default WrappedHeader
|