|
@@ -0,0 +1,99 @@
|
|
1
|
+import React, { useState, useEffect } from 'react'
|
|
2
|
+import { Select, Spin, Table, Button, Form, Input, Divider, Modal, Rate, Popconfirm } from 'antd'
|
|
3
|
+import NavLink from 'umi/navlink'
|
|
4
|
+import { fetchList, apis, fetch } from '@/utils/request'
|
|
5
|
+import Search from '../components/Search'
|
|
6
|
+import List from '../components/List'
|
|
7
|
+
|
|
8
|
+const lifeConsultant = fetchList(apis.propUser.lifeConsultant)
|
|
9
|
+
|
|
10
|
+const Condition = props => {
|
|
11
|
+ return (
|
|
12
|
+ <Search
|
|
13
|
+ onSearch={props.onSearch}
|
|
14
|
+ onReset={props.onReset}
|
|
15
|
+ render={form => {
|
|
16
|
+ const { getFieldDecorator } = form
|
|
17
|
+
|
|
18
|
+ return (
|
|
19
|
+ <>
|
|
20
|
+ <Form.Item label="管家名称">
|
|
21
|
+ {
|
|
22
|
+ getFieldDecorator('userName')(<Input placeholder="管家名称" />)
|
|
23
|
+ }
|
|
24
|
+ </Form.Item>
|
|
25
|
+ <Form.Item label="手机号">
|
|
26
|
+ {
|
|
27
|
+ getFieldDecorator('phone')(<Input placeholder="手机号" />)
|
|
28
|
+ }
|
|
29
|
+ </Form.Item>
|
|
30
|
+ </>
|
|
31
|
+ )
|
|
32
|
+ }}
|
|
33
|
+ />
|
|
34
|
+ )
|
|
35
|
+}
|
|
36
|
+
|
|
37
|
+export default props => {
|
|
38
|
+ const [loading, setLoading] = useState(false)
|
|
39
|
+ const [listData, setListData] = useState([])
|
|
40
|
+ const [pagination, setPagination] = useState({})
|
|
41
|
+ const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
|
|
42
|
+
|
|
43
|
+ const handleSearch = vals => {
|
|
44
|
+ setQueryParams({
|
|
45
|
+ ...queryParams,
|
|
46
|
+ ...vals,
|
|
47
|
+ pageNum: 1,
|
|
48
|
+ })
|
|
49
|
+ }
|
|
50
|
+
|
|
51
|
+ const handlePageChange = (pageNum, pageSize) => {
|
|
52
|
+ setQueryParams({
|
|
53
|
+ ...queryParams,
|
|
54
|
+ pageNum,
|
|
55
|
+ pageSize,
|
|
56
|
+ })
|
|
57
|
+ }
|
|
58
|
+
|
|
59
|
+ useEffect(() => {
|
|
60
|
+ setLoading(true)
|
|
61
|
+ lifeConsultant(queryParams).then(res => {
|
|
62
|
+ const [list, pageInfo] = res || {}
|
|
63
|
+ setListData(list)
|
|
64
|
+ setPagination(pageInfo)
|
|
65
|
+ setLoading(false)
|
|
66
|
+ }).catch(() => setLoading(false))
|
|
67
|
+ }, [queryParams])
|
|
68
|
+
|
|
69
|
+ return (
|
|
70
|
+ <div>
|
|
71
|
+ <Condition onSearch={handleSearch} onReset={handleSearch} />
|
|
72
|
+ <div style={{ margin: '24px 0' }}>
|
|
73
|
+ {/* <NavLink to={`/staff/editStaff`}>
|
|
74
|
+ <Button type="primary">添加管家</Button>
|
|
75
|
+ </NavLink> */}
|
|
76
|
+ </div>
|
|
77
|
+ <List dataSource={listData} loading={loading} pagination={pagination} onPageChange={handlePageChange} rowKey="id">
|
|
78
|
+ <Table.Column title="管家名称" dataIndex="userName" key="userName" />
|
|
79
|
+ <Table.Column title="电话" dataIndex="phone" key="phone" />
|
|
80
|
+ <Table.Column title="说明" dataIndex="description" key="description" />
|
|
81
|
+ <Table.Column title="月评分" dataIndex="averageScore" key="averageScore" render={t => <Rate disabled value={t} />} />
|
|
82
|
+ <Table.Column
|
|
83
|
+ title="操作"
|
|
84
|
+ key="action"
|
|
85
|
+ render={(_, row) => {
|
|
86
|
+ return (
|
|
87
|
+ <>
|
|
88
|
+ <NavLink to={`/property/life-consultant/score?userId=${row.userId}`}>
|
|
89
|
+ <Button type="link">评分详情</Button>
|
|
90
|
+ </NavLink>
|
|
91
|
+ </>
|
|
92
|
+ )
|
|
93
|
+ }}
|
|
94
|
+ />
|
|
95
|
+ </List>
|
|
96
|
+
|
|
97
|
+ </div>
|
|
98
|
+ )
|
|
99
|
+}
|