Bladeren bron

新需求

傅行帆 5 jaren geleden
bovenliggende
commit
20f1c7ee8d

+ 1
- 1
src/pages/fundManagement/Finance.jsx Bestand weergeven

@@ -125,7 +125,7 @@ function header(props) {
125 125
             okText: '确定',
126 126
             cancelText: '取消',
127 127
             onOk() {
128
-                request({ ...apis.fund.delContact, data: contactList, }).then((data) => {
128
+                request({ ...apis.fund.delContact, data: contactList, params: {contactType: "finance"} }).then((data) => {
129 129
                     message.info("操作成功")
130 130
                     getList({ pageNum: 1, pageSize: 10 });
131 131
                     setContactList([])

+ 1
- 1
src/pages/fundManagement/components/SelectContact.jsx Bestand weergeven

@@ -58,7 +58,7 @@ const SelectContact = props => {
58 58
     }
59 59
 
60 60
     const selectData = (record) => {
61
-        request({ ...apis.fund.addContact, urlData: { id: record.contactId } }).then((data) => {
61
+        request({ ...apis.fund.addContact, urlData: { id: record.contactId }, params: {contactType: "finance"} }).then((data) => {
62 62
             message.success('新增成功!');
63 63
             props.onClick()
64 64
             setVisible(false)

+ 197
- 0
src/pages/promote/components/SelectContact.jsx Bestand weergeven

@@ -0,0 +1,197 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Modal, Button, Table, message, Input, Icon, Pagination } from 'antd';
3
+import request from '../../../utils/request';
4
+import apis from '../../../services/apis';
5
+import router from 'umi/router';
6
+import styles from './style.less'
7
+
8
+const { Column, ColumnGroup } = Table;
9
+const SelectContact = props => {
10
+
11
+    const [data, setData] = useState([]);
12
+    const [visible, setVisible] = useState(false);
13
+    const [group, setGroup] = useState({ groupId: undefined, groupName: '新增' })
14
+
15
+    useEffect(() => {
16
+
17
+    }, [props.value])
18
+
19
+    // 查询列表
20
+    const getList = (params) => {
21
+        request({ ...apis.contact.list, params: { ...params } }).then((data) => {
22
+            console.log(data)
23
+            setData(data)
24
+        })
25
+    }
26
+
27
+    useEffect(() => {
28
+        getList({ pageNum: 1, pageSize: 10, })
29
+    }, []);
30
+
31
+
32
+
33
+
34
+    // 提交事件
35
+    const handleSubmit = (e, props) => {
36
+        e.preventDefault();
37
+        e.stopPropagation();
38
+        props.form.validateFields((err, values) => {
39
+            if (!err) {
40
+                getList({ pageNum: 1, pageSize: 10, ...values })
41
+            }
42
+        });
43
+    }
44
+
45
+    function handleReset() {
46
+        props.form.resetFields();
47
+        getList({ pageNum: 1, pageSize: 10 })
48
+    }
49
+
50
+    const changePageNum = (pageNumber) => {
51
+        getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
52
+    }
53
+
54
+    const toAdd = () => {
55
+        router.push({
56
+            pathname: '/contact/contact/add',
57
+        });
58
+    }
59
+
60
+    const selectData = (record) => {
61
+        request({ ...apis.fund.addContact, urlData: { id: record.contactId }, params: {contactType: "promote"} }).then((data) => {
62
+            message.success('新增成功!');
63
+            props.onClick()
64
+            setVisible(false)
65
+        })
66
+    }
67
+
68
+
69
+    const columns = [
70
+        {
71
+            title: '姓名',
72
+            dataIndex: 'contactName',
73
+            key: 'contactName',
74
+            align: 'center',
75
+            ellipsis: true,
76
+        },
77
+        {
78
+            title: '性别',
79
+            dataIndex: 'sex',
80
+            key: 'sex',
81
+            align: 'center',
82
+            ellipsis: true,
83
+            render: text => <span>{text == 1 ? '男' : text == 2 ? '女' : ''}</span>,
84
+        },
85
+        {
86
+            title: '头像',
87
+            dataIndex: 'avatar',
88
+            key: 'avatar',
89
+            align: 'center',
90
+            ellipsis: true,
91
+            render: text => <img src={text} width="40px" height="40px" />,
92
+        },
93
+        {
94
+            title: '固话',
95
+            dataIndex: 'telephone',
96
+            key: 'telephone',
97
+            align: 'center',
98
+            ellipsis: true,
99
+        },
100
+        {
101
+            title: '手机号',
102
+            dataIndex: 'phone',
103
+            key: 'phone',
104
+            align: 'center',
105
+            ellipsis: true,
106
+        },
107
+        {
108
+            title: '对外头衔',
109
+            dataIndex: 'appellation',
110
+            key: 'appellation',
111
+            align: 'center',
112
+            ellipsis: true,
113
+        },
114
+        {
115
+            title: '操作',
116
+            align: 'center',
117
+            width: '20%',
118
+            render: (text, record) => (
119
+                <span>
120
+                    <a onClick={() => selectData(record)} style={{ color: 'blue' }}>选择</a>
121
+                </span>
122
+            ),
123
+        },
124
+    ];
125
+
126
+    const { getFieldDecorator } = props.form
127
+
128
+    return (
129
+        <div >
130
+
131
+            <Button type="danger" onClick={() => setVisible(true)} className={styles.addBtn} >{group.groupName}
132
+                {/* <SelectContact type="danger" onClick={() => getList({ pageNum: 1, pageSize: 10 })} /> */}
133
+            </Button>
134
+            {/* <div style={{ color: '#fff', padding: '0 15px', height: '32px', lineHeight: '32px' }} onClick={() => setVisible(true)}>{group.groupName}</div> */}
135
+
136
+            <Modal
137
+                title="选择联系人"
138
+                width="1200px"
139
+                visible={visible}
140
+                onCancel={() => setVisible(false)}
141
+                footer={[]}
142
+            >
143
+
144
+                <Form layout="inline" onSubmit={e => handleSubmit(e, props)} style={{ marginBottom: '16px' }}>
145
+                    <Form.Item>
146
+                        {getFieldDecorator('contactName')(
147
+                            <Input
148
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
149
+                                placeholder="姓名"
150
+                            />,
151
+                        )}
152
+                    </Form.Item>
153
+                    <Form.Item>
154
+                        {getFieldDecorator('telephone')(
155
+                            <Input
156
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
157
+                                placeholder="固话"
158
+                            />,
159
+                        )}
160
+                    </Form.Item>
161
+                    <Form.Item>
162
+                        {getFieldDecorator('phone')(
163
+                            <Input
164
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
165
+                                placeholder="手机号"
166
+                            />,
167
+                        )}
168
+                    </Form.Item>
169
+                    <Form.Item>
170
+                        {getFieldDecorator('appellation')(
171
+                            <Input
172
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
173
+                                placeholder="对外头衔"
174
+                            />,
175
+                        )}
176
+                    </Form.Item>
177
+                    <Form.Item>
178
+                        <Button type="primary" htmlType="submit" >
179
+                            搜索
180
+              </Button>
181
+                        <Button style={{ marginLeft: 8 }} onClick={handleReset}>
182
+                            重置
183
+              </Button>
184
+                    </Form.Item>
185
+                </Form>
186
+                <div style={{ marginBottom: '20px', textAlign: 'right' }}>没有想要的联系人? <a onClick={() => toAdd()}>去新增</a> </div>
187
+                <Table dataSource={data.records || []} columns={columns} pagination={false} />
188
+                <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
189
+                    <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
190
+                </div>
191
+            </Modal>
192
+        </div>
193
+    )
194
+}
195
+
196
+const WrappedRegistrationForm = Form.create()(SelectContact);
197
+export default WrappedRegistrationForm;

+ 109
- 0
src/pages/promote/components/style.less Bestand weergeven

@@ -0,0 +1,109 @@
1
+  .mask{
2
+    width: 100vw;
3
+    height: 100vh;
4
+    background-color: rgba(0,0,0,0.32);
5
+    position: fixed;
6
+    z-index: 999;
7
+    top: 0;
8
+    left: 0;
9
+}
10
+
11
+.content{
12
+    width: 32vw;
13
+    min-width: 757px;
14
+    height: 21.3vw;
15
+    min-height: 504px;
16
+    position: absolute;
17
+    left: 50%;
18
+    top: 110px;
19
+    transform: translateX(-50%);
20
+    border-radius: 10px;
21
+    .close{
22
+        width: 40px;
23
+        height: 40px;
24
+        position: absolute;
25
+        top: -22px;
26
+        right: -22px;
27
+        z-index: 9;
28
+    }
29
+}
30
+
31
+.dots{
32
+    position: absolute;
33
+    bottom: 11px;
34
+    width: 100%;
35
+    padding: 0;
36
+    margin: 0;
37
+    list-style: none;
38
+    text-align: center;
39
+    li {
40
+        position: relative;
41
+        display: inline-block;
42
+        width: 14px;
43
+        height: 2px;
44
+        margin: 0 3px;
45
+        padding: 0;
46
+        cursor: pointer;
47
+        background: #fff;
48
+        opacity: 0.6;
49
+        &.active{
50
+            width: 16px;
51
+            height: 3px;
52
+            background: #fff;
53
+            opacity: 1;
54
+        }
55
+    }
56
+}
57
+.carousel {
58
+    width: 32vw;
59
+    min-width: 757px;
60
+    height: 21.3vw;
61
+    min-height: 504px;
62
+    border-radius: 10px;
63
+    // overflow: hidden;
64
+    
65
+    .carouselItem{
66
+        width: 32vw;
67
+        min-width: 757px;
68
+        height: 21.3vw;
69
+        min-height: 504px;
70
+        position: relative;
71
+        display: inline-block;
72
+        .title{
73
+            font-size: 0.12rem;
74
+            color: #fff;
75
+            position: absolute;
76
+            display: block;
77
+            width: 100%;
78
+            height: 0.16rem;
79
+            bottom: 30px ;
80
+            padding: 0 40px;
81
+            text-align: center;
82
+            overflow: hidden;
83
+            white-space: nowrap;
84
+            text-overflow: ellipsis;
85
+
86
+        }
87
+    }
88
+}
89
+
90
+.swiperImg{
91
+    max-height: 504px;
92
+     border-radius: 10px;
93
+     object-fit: contain;
94
+}
95
+
96
+.ant-carousel .slick-slide {
97
+    
98
+    text-align: center;
99
+    width: 32vw;
100
+    min-width: 757px;
101
+    height: 21.3vw;
102
+    min-height: 504px;
103
+    background: #364d79;
104
+    overflow: hidden;
105
+  }
106
+  
107
+  .ant-carousel .slick-slide h3 {
108
+    color: #fff;
109
+  }

+ 112
- 132
src/pages/promote/contact.jsx Bestand weergeven

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