傅行帆 преди 5 години
родител
ревизия
bbf3227af1
променени са 4 файла, в които са добавени 159 реда и са изтрити 7 реда
  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 Целия файл

@@ -252,6 +252,7 @@ export default [
252 252
               {
253 253
                 path: '/promote/detail',
254 254
                 name: '查看详情',
255
+                hideInMenu: true,
255 256
                 component: './promote/detail',
256 257
               },
257 258
             ],

+ 119
- 0
src/pages/promote/components/ModelForm.jsx Целия файл

@@ -0,0 +1,119 @@
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 Целия файл

@@ -1,6 +1,6 @@
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, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb,Radio } from 'antd';
4 4
 import router from 'umi/router';
5 5
 import moment from 'moment';
6 6
 import styles from './style.less';
@@ -8,11 +8,14 @@ import { fetch, apis } from '../../utils/request';
8 8
 import request from '../../utils/request';
9 9
 import AuthButton from '@/components/AuthButton';
10 10
 import Navigate from '@/components/Navigate';
11
+import ModelForm from './components/ModelForm';
11 12
 
12 13
 function header(props) {
13 14
     
14 15
     const [taNoticeList, setTaNoticeList] = useState([])
15 16
     const [ data, setData ] = useState({})
17
+    const [visible, setVisible] = useState(false);
18
+    const [currentData, setCurrentData] = useState(false);
16 19
 
17 20
     useEffect(() => {
18 21
         getList({ pageNum: 1, pageSize: 10 });
@@ -34,9 +37,9 @@ function header(props) {
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 45
     const topNew = (row) => () => {
@@ -94,6 +97,20 @@ function header(props) {
94 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 115
     const columns = [
99 116
         {
@@ -148,11 +165,11 @@ function header(props) {
148 165
             align: 'center',
149 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 169
                         {row.status === 2 ? "立即跟进" : '添加备注'}<Icon type="form" className={styles.edit} />
153 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 173
                     </span>
157 174
                 </>
158 175
             ),
@@ -167,6 +184,14 @@ function header(props) {
167 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 196
     return (
172 197
 
@@ -227,6 +252,8 @@ function header(props) {
227 252
                     <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />
228 253
                 </div>
229 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 Целия файл

@@ -444,6 +444,11 @@ const apis = {
444 444
       method: 'GET',
445 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