|
@@ -0,0 +1,217 @@
|
|
1
|
+import React, { useState, useEffect } from 'react';
|
|
2
|
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
|
3
|
+import { Form, Pagination, Button, Icon, message, Modal, Table, Input,Row,Col,Card,Avatar } from 'antd';
|
|
4
|
+import router from 'umi/router';
|
|
5
|
+import moment from 'moment';
|
|
6
|
+import className from 'classnames';
|
|
7
|
+import Cell from '../../components/Cell';
|
|
8
|
+import styles from './style.less';
|
|
9
|
+import { fetch, apis } from '../../utils/request';
|
|
10
|
+import request from '../../utils/request';
|
|
11
|
+import AuthButton from '@/components/AuthButton';
|
|
12
|
+import SelectContact from './components/SelectContact';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+function header(props) {
|
|
16
|
+ const { Meta } = Card;
|
|
17
|
+
|
|
18
|
+ // 获取初始化数据
|
|
19
|
+ const [data, setData] = useState({})
|
|
20
|
+ const [contactList, setContactList] = useState([])
|
|
21
|
+
|
|
22
|
+ useEffect(() => {
|
|
23
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
24
|
+ }, [])
|
|
25
|
+
|
|
26
|
+ // 查询列表
|
|
27
|
+ const getList = (params) => {
|
|
28
|
+ request({ ...apis.fund.contactList, params: { ...params, contentType: 'sell' } }).then((data) => {
|
|
29
|
+ console.log(data)
|
|
30
|
+ setData(data)
|
|
31
|
+ })
|
|
32
|
+ }
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+ // 提交事件
|
|
36
|
+ const handleSubmit = (e, props) => {
|
|
37
|
+ e.preventDefault();
|
|
38
|
+ props.form.validateFields((err, values) => {
|
|
39
|
+ if (!err) {
|
|
40
|
+ let { ...submitValue } = values
|
|
41
|
+
|
|
42
|
+ getList({ pageNum: 1, pageSize: 10, ...submitValue })
|
|
43
|
+ }
|
|
44
|
+ });
|
|
45
|
+ }
|
|
46
|
+
|
|
47
|
+ const changePageNum = (pageNumber) => {
|
|
48
|
+ let { ...submitValue } = props.form.getFieldsValue()
|
|
49
|
+
|
|
50
|
+ getList({ pageNum: pageNumber, pageSize: 10, ...submitValue })
|
|
51
|
+ }
|
|
52
|
+
|
|
53
|
+ /**
|
|
54
|
+ *
|
|
55
|
+ *
|
|
56
|
+ * @param {*} props
|
|
57
|
+ * @returns
|
|
58
|
+ */
|
|
59
|
+ const columns = [
|
|
60
|
+ {
|
|
61
|
+ title: '姓名',
|
|
62
|
+ dataIndex: 'contactName',
|
|
63
|
+ key: 'contactName',
|
|
64
|
+ align: 'center',
|
|
65
|
+ },
|
|
66
|
+ {
|
|
67
|
+ title: '性别',
|
|
68
|
+ dataIndex: 'sex',
|
|
69
|
+ key: 'sex',
|
|
70
|
+ align: 'center',
|
|
71
|
+ render: (text, record) => <span>{record.sex == '1' ? '男' : record.sex == '2' ? '女' : '未知'}</span>
|
|
72
|
+
|
|
73
|
+ },
|
|
74
|
+ {
|
|
75
|
+ title: '头像',
|
|
76
|
+ dataIndex: 'avatar',
|
|
77
|
+ key: 'avatar',
|
|
78
|
+ align: 'center',
|
|
79
|
+ render: (text, record) => <img src={record.avatar} className={styles.touxiang} />,
|
|
80
|
+ },
|
|
81
|
+ {
|
|
82
|
+ title: '固话',
|
|
83
|
+ dataIndex: 'telephone',
|
|
84
|
+ key: 'telephone',
|
|
85
|
+ align: 'center',
|
|
86
|
+ },
|
|
87
|
+ {
|
|
88
|
+ title: '手机号',
|
|
89
|
+ dataIndex: 'phone',
|
|
90
|
+ key: 'phone',
|
|
91
|
+ align: 'center',
|
|
92
|
+ },
|
|
93
|
+ {
|
|
94
|
+ title: '对外头衔',
|
|
95
|
+ dataIndex: 'appellation',
|
|
96
|
+ key: 'appellation',
|
|
97
|
+ align: 'center',
|
|
98
|
+ },
|
|
99
|
+ {
|
|
100
|
+ title: '权重',
|
|
101
|
+ dataIndex: 'orderNo',
|
|
102
|
+ key: 'orderNo',
|
|
103
|
+ align: 'center',
|
|
104
|
+ },
|
|
105
|
+
|
|
106
|
+ ];
|
|
107
|
+ function handleReset() {
|
|
108
|
+ props.form.resetFields();
|
|
109
|
+ getList({ pageNum: 1, pageSize: 10 })
|
|
110
|
+ }
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+ const rowSelection = {
|
|
114
|
+ onChange: (selectedRowKeys, selectedRows) => {
|
|
115
|
+ console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
|
|
116
|
+ setContactList(selectedRows)
|
|
117
|
+ },
|
|
118
|
+ };
|
|
119
|
+
|
|
120
|
+ const toDel = () => {
|
|
121
|
+ Modal.confirm({
|
|
122
|
+ title: `确认将所有条数据删除`,
|
|
123
|
+ okText: '确定',
|
|
124
|
+ cancelText: '取消',
|
|
125
|
+ onOk() {
|
|
126
|
+ request({ ...apis.fund.delContact, data: data.records,params: {contactType: 'sell'} }).then((data) => {
|
|
127
|
+ message.info("操作成功")
|
|
128
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
129
|
+ setContactList([])
|
|
130
|
+ }).catch((err) => {
|
|
131
|
+
|
|
132
|
+ })
|
|
133
|
+ },
|
|
134
|
+ onCancel() { },
|
|
135
|
+ });
|
|
136
|
+ }
|
|
137
|
+ const { getFieldDecorator } = props.form
|
|
138
|
+ return (
|
|
139
|
+
|
|
140
|
+ <>
|
|
141
|
+ <Form layout="inline" onSubmit={e => handleSubmit(e, props)} >
|
|
142
|
+ <Form.Item>
|
|
143
|
+ {getFieldDecorator('contactName')(
|
|
144
|
+ <Input
|
|
145
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
146
|
+ placeholder="姓名"
|
|
147
|
+ />,
|
|
148
|
+ )}
|
|
149
|
+ </Form.Item>
|
|
150
|
+ <Form.Item>
|
|
151
|
+ {getFieldDecorator('telephone')(
|
|
152
|
+ <Input
|
|
153
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
154
|
+ placeholder="固话"
|
|
155
|
+ />,
|
|
156
|
+ )}
|
|
157
|
+ </Form.Item>
|
|
158
|
+ <Form.Item>
|
|
159
|
+ {getFieldDecorator('phone')(
|
|
160
|
+ <Input
|
|
161
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
162
|
+ placeholder="手机号"
|
|
163
|
+ />,
|
|
164
|
+ )}
|
|
165
|
+ </Form.Item>
|
|
166
|
+ <Form.Item>
|
|
167
|
+ {getFieldDecorator('appellation')(
|
|
168
|
+ <Input
|
|
169
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
170
|
+ placeholder="对外头衔"
|
|
171
|
+ />,
|
|
172
|
+ )}
|
|
173
|
+ </Form.Item>
|
|
174
|
+ <Form.Item>
|
|
175
|
+ <Button type="primary" htmlType="submit" className={styles.searchBtn}>
|
|
176
|
+ 搜索
|
|
177
|
+ </Button>
|
|
178
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
179
|
+ 重置
|
|
180
|
+ </Button>
|
|
181
|
+ </Form.Item>
|
|
182
|
+ </Form>
|
|
183
|
+ <div style={{ margin: '10px 0 16px 0', display: 'flex' }}>
|
|
184
|
+ <SelectContact type="danger" onClick={() => getList({ pageNum: 1, pageSize: 10 })} />
|
|
185
|
+ <Button type="primary" onClick={() => toDel()} style={{ marginLeft: '30px' }} >删除</Button>
|
|
186
|
+ </div>
|
|
187
|
+
|
|
188
|
+ <Row>
|
|
189
|
+ {(data.records || []).map((x, index) => (
|
|
190
|
+ <Col key={index} span={6}>
|
|
191
|
+ <Card
|
|
192
|
+ style={{ width: 300, marginTop: 16 }}
|
|
193
|
+ actions={[
|
|
194
|
+ <span>{"TEL:" + x.phone}</span>,
|
|
195
|
+ <span>{x.wxCardImg ? "微信" : "暂未上传微信二维码"}</span>,
|
|
196
|
+ ]}
|
|
197
|
+ >
|
|
198
|
+ <Meta
|
|
199
|
+ style={{ height: 100 }}
|
|
200
|
+ avatar={<Avatar src={x.avatar ? x.avatar : "https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"} />}
|
|
201
|
+ title={x.contactName}
|
|
202
|
+ description={x.appellation}
|
|
203
|
+ />
|
|
204
|
+ </Card>
|
|
205
|
+ </Col>
|
|
206
|
+ ))}
|
|
207
|
+ </Row>
|
|
208
|
+
|
|
209
|
+ <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
|
210
|
+ <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
|
|
211
|
+ </div>
|
|
212
|
+ </>
|
|
213
|
+ )
|
|
214
|
+}
|
|
215
|
+const WrappedHeader = Form.create({ name: 'header' })(header);
|
|
216
|
+
|
|
217
|
+export default WrappedHeader
|