傅行帆 5 years ago
parent
commit
bbf3227af1
4 changed files with 159 additions and 7 deletions
  1. 1
    0
      config/routes.js
  2. 119
    0
      src/pages/promote/components/ModelForm.jsx
  3. 34
    7
      src/pages/promote/index.jsx
  4. 5
    0
      src/services/apis.js

+ 1
- 0
config/routes.js View File

252
               {
252
               {
253
                 path: '/promote/detail',
253
                 path: '/promote/detail',
254
                 name: '查看详情',
254
                 name: '查看详情',
255
+                hideInMenu: true,
255
                 component: './promote/detail',
256
                 component: './promote/detail',
256
               },
257
               },
257
             ],
258
             ],

+ 119
- 0
src/pages/promote/components/ModelForm.jsx View File

1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Modal, Button, Table, message, Input, Icon, Pagination,Radio } 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 ModelForm = props => {
10
+    const formItemLayout = {
11
+        labelCol: { span: 6 },
12
+        wrapperCol: { span: 14 },
13
+      };
14
+
15
+    const {visible,currentData} = props;
16
+
17
+    const { getFieldDecorator } = props.form
18
+
19
+    const onCancel = () => {
20
+        props.onCancel()
21
+    }
22
+
23
+    const updateContact = () => {
24
+        request({ ...apis.promote.update, urlData: { id: currentData.serialNo }, data: {...props.form.getFieldsValue()} }).then((data) => {
25
+            message.success('添加成功!');
26
+            props.onCancel("success")
27
+        })
28
+    }
29
+
30
+    return (
31
+        <Modal
32
+                title={currentData.status ==2 ? "立即跟进" : '添加备注'}
33
+                width="900px"
34
+                visible={visible}
35
+                onCancel={onCancel}
36
+                onOk={updateContact}
37
+            >
38
+                <Form {...formItemLayout} >
39
+                    <Form.Item label="公司名称">
40
+                        {getFieldDecorator('company',{
41
+                            initialValue: currentData.company,
42
+                        })(
43
+                            <Input
44
+                                disabled
45
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
46
+                                placeholder="公司名称"
47
+                            />,
48
+                        )}
49
+                    </Form.Item>
50
+                   { currentData.status ==2 && <Form.Item label="联系人">
51
+                        {getFieldDecorator('name',{
52
+                            initialValue: currentData.name
53
+                        })(
54
+                            <Input
55
+                                disabled
56
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
57
+                                placeholder="联系人"
58
+                            />,
59
+                        )}
60
+                    </Form.Item>}
61
+                    {currentData.status ==2 && <Form.Item label="手机号">
62
+                        {getFieldDecorator('phone',{
63
+                            initialValue: currentData.phone
64
+                        })(
65
+                            <Input
66
+                                disabled
67
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
68
+                                placeholder="手机号"
69
+                            />,
70
+                        )}
71
+                    </Form.Item>}
72
+                    {currentData.status ==2 && <Form.Item label="需求备注">
73
+                        {getFieldDecorator('demand',{
74
+                            initialValue: currentData.demand
75
+                        })(
76
+                            <Input
77
+                                disabled
78
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
79
+                                placeholder="需求备注"
80
+                            />,
81
+                        )}
82
+                    </Form.Item>}
83
+                    {currentData.status ==2 && <Form.Item label="跟进状态">
84
+                        {getFieldDecorator('status',{
85
+                            initialValue: "0"
86
+                        })(
87
+                            <Radio.Group>
88
+                                <Radio value="1">有效表单</Radio>
89
+                                <Radio value="0">无效表单</Radio>
90
+                            </Radio.Group>,
91
+                        )}
92
+                    </Form.Item>}
93
+                 {currentData.status ==2 &&  <Form.Item label="跟进备注">
94
+                        {getFieldDecorator('follow',{
95
+                            initialValue: currentData.follow
96
+                        })(
97
+                            <Input
98
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
99
+                                placeholder="跟进备注"
100
+                            />,
101
+                        )}
102
+                    </Form.Item>}
103
+             {   currentData.status !=2 &&    <Form.Item label="备注信息">
104
+                        {getFieldDecorator('remark',{
105
+                            initialValue: currentData.remark
106
+                        })(
107
+                            <Input
108
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
109
+                                placeholder="备注信息"
110
+                            />,
111
+                        )}
112
+                    </Form.Item>}
113
+                </Form>
114
+            </Modal>
115
+    )
116
+}
117
+
118
+const WrappedRegistrationForm = Form.create()(ModelForm);
119
+export default WrappedRegistrationForm;

+ 34
- 7
src/pages/promote/index.jsx View File

1
 import React, { useState, useEffect } from 'react';
1
 import React, { useState, useEffect } from 'react';
2
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
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, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb,Radio } from 'antd';
4
 import router from 'umi/router';
4
 import router from 'umi/router';
5
 import moment from 'moment';
5
 import moment from 'moment';
6
 import styles from './style.less';
6
 import styles from './style.less';
8
 import request from '../../utils/request';
8
 import request from '../../utils/request';
9
 import AuthButton from '@/components/AuthButton';
9
 import AuthButton from '@/components/AuthButton';
10
 import Navigate from '@/components/Navigate';
10
 import Navigate from '@/components/Navigate';
11
+import ModelForm from './components/ModelForm';
11
 
12
 
12
 function header(props) {
13
 function header(props) {
13
     
14
     
14
     const [taNoticeList, setTaNoticeList] = useState([])
15
     const [taNoticeList, setTaNoticeList] = useState([])
15
     const [ data, setData ] = useState({})
16
     const [ data, setData ] = useState({})
17
+    const [visible, setVisible] = useState(false);
18
+    const [currentData, setCurrentData] = useState(false);
16
 
19
 
17
     useEffect(() => {
20
     useEffect(() => {
18
         getList({ pageNum: 1, pageSize: 10 });
21
         getList({ pageNum: 1, pageSize: 10 });
34
         });
37
         });
35
     }
38
     }
36
 
39
 
37
-    const publishNew = (row) => () => {
38
-        row.status = row.status === 1 ? 0 : 1
39
-        editNewsById(row)
40
+    const openModel = (row) => () => {
41
+        setVisible(true)
42
+        setCurrentData(row)
40
     }
43
     }
41
 
44
 
42
     const topNew = (row) => () => {
45
     const topNew = (row) => () => {
94
         getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
97
         getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
95
     }
98
     }
96
 
99
 
100
+    const deleteContact =(row) => () => {
101
+        Modal.confirm({
102
+            title: '确认将所选数据删除?',
103
+            okText: '确定',
104
+            cancelText: '取消',
105
+            onOk() {
106
+                request({ ...apis.promote.update, urlData: { id: row.serialNo }, data: { status: -1} }).then((data) => {
107
+                    message.info("操作成功")
108
+                    getList({ pageNum: 1, pageSize: 10 });
109
+                })
110
+            },
111
+        });
112
+    }
113
+
97
 
114
 
98
     const columns = [
115
     const columns = [
99
         {
116
         {
148
             align: 'center',
165
             align: 'center',
149
             render: (x, row) => (
166
             render: (x, row) => (
150
                 <>
167
                 <>
151
-                    <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={publishNew(row)}>
168
+                    <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={openModel(row)}>
152
                         {row.status === 2 ? "立即跟进" : '添加备注'}<Icon type="form" className={styles.edit} />
169
                         {row.status === 2 ? "立即跟进" : '添加备注'}<Icon type="form" className={styles.edit} />
153
                     </span>
170
                     </span>
154
-                    <span style={{ color: '#FF925C', cursor: 'pointer', marginLeft: '20px'  }} onClick={publishNew(row)}>
155
-                        {row.status === 0 ? "删除" : ''}<Icon type="form" className={styles.edit} />
171
+                    <span style={{ color: '#FF925C', cursor: 'pointer', marginLeft: '20px'  }} onClick={deleteContact(row)}>
172
+                        {row.status === 0 ? <span>删除<Icon type="form" className={styles.edit} /></span> : ''}
156
                     </span>
173
                     </span>
157
                 </>
174
                 </>
158
             ),
175
             ),
167
           setTaNoticeList(selectedRows)
184
           setTaNoticeList(selectedRows)
168
         },
185
         },
169
       };
186
       };
187
+
188
+
189
+      const modelCancel = (state) => {
190
+            setVisible(false)
191
+            if(state === "success"){
192
+                getList({ pageNum: 1, pageSize: 10 });
193
+            }
194
+      }
170
  
195
  
171
     return (
196
     return (
172
 
197
 
227
                     <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />
252
                     <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />
228
                 </div>
253
                 </div>
229
             </div>
254
             </div>
255
+
256
+            <ModelForm visible={visible} currentData={currentData} onCancel={(state) => modelCancel(state)}/>
230
         </>
257
         </>
231
     )
258
     )
232
 }
259
 }

+ 5
- 0
src/services/apis.js View File

444
       method: 'GET',
444
       method: 'GET',
445
       action: 'channel',
445
       action: 'channel',
446
     },
446
     },
447
+    update: {
448
+      url: `${prefix}/taOfficeContact/:id`,
449
+      method: 'PUT',
450
+      action: 'channel',
451
+    },
447
   },
452
   },
448
 }
453
 }
449
 
454