魏熙美 5 years ago
parent
commit
b2688375c5

+ 11
- 3
src/pages/customer/recommendCustomer/audit.jsx View File

38
   const { getFieldDecorator } = props.form
38
   const { getFieldDecorator } = props.form
39
 
39
 
40
   // eslint-disable-next-line react-hooks/rules-of-hooks
40
   // eslint-disable-next-line react-hooks/rules-of-hooks
41
-  const [visibleData, setVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
41
+  const [visibleData, setVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
42
 
42
 
43
   // eslint-disable-next-line react-hooks/rules-of-hooks
43
   // eslint-disable-next-line react-hooks/rules-of-hooks
44
   const [dataSource, setDataSource] = useState({ picture: '' })
44
   const [dataSource, setDataSource] = useState({ picture: '' })
90
 
90
 
91
   // 显示选择置业顾问的窗口
91
   // 显示选择置业顾问的窗口
92
   function showConsultant() {
92
   function showConsultant() {
93
-    setVisibleData({ visible: true, customerId: props.form.getFieldValue('customerId'), realtyConsultant: props.form.getFieldValue('realtyConsultant') })
93
+    setVisibleData({ visible: true, customerId: props.form.getFieldValue('customerId'), realtyConsultant: props.form.getFieldValue('realtyConsultant'), buildingId: props.form.getFieldValue('buildingId') })
94
   }
94
   }
95
 
95
 
96
   // 关闭选择置业顾问的窗口
96
   // 关闭选择置业顾问的窗口
97
   function closeConsultant() {
97
   function closeConsultant() {
98
-    setVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
98
+    setVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
99
   }
99
   }
100
 
100
 
101
   // 选择置业顾问弹窗
101
   // 选择置业顾问弹窗
102
   function consultantSuccess(e) {
102
   function consultantSuccess(e) {
103
+    console.log(e)
103
     props.form.setFieldsValue({ realtyConsultant: e.realtyConsultant, consultantName: e.name })
104
     props.form.setFieldsValue({ realtyConsultant: e.realtyConsultant, consultantName: e.name })
104
   }
105
   }
105
 
106
 
113
             />,
114
             />,
114
           )}
115
           )}
115
         </Form.Item>
116
         </Form.Item>
117
+        <Form.Item label="项目ID" style={{ display: 'none' }}>
118
+          {getFieldDecorator('buildingId')(
119
+            <Input
120
+              placeholder="项目ID"
121
+            />,
122
+          )}
123
+        </Form.Item>
116
         <Form.Item label="归属人" style={{ display: 'none' }}>
124
         <Form.Item label="归属人" style={{ display: 'none' }}>
117
           {getFieldDecorator('realtyConsultant')(
125
           {getFieldDecorator('realtyConsultant')(
118
             <Input
126
             <Input

+ 26
- 16
src/pages/customer/recommendCustomer/components/attribution.jsx View File

21
     super(props);
21
     super(props);
22
     this.state = {
22
     this.state = {
23
        dataSource: { records: [] },
23
        dataSource: { records: [] },
24
-       visibleData: { visible: false, customerId: '', realtyConsultant: '' },
24
+       visibleData: { visible: false, customerId: '', realtyConsultant: '', buildingId: '' },
25
     }
25
     }
26
   }
26
   }
27
 
27
 
28
   // 挂载之后
28
   // 挂载之后
29
   componentDidMount() {
29
   componentDidMount() {
30
-    this.getList({ pageNumber: 1, pageSize: 5 })
30
+    // this.getList({ pageNumber: 1, pageSize: 5 })
31
   }
31
   }
32
 
32
 
33
   componentDidUpdate(preProps, preState) {
33
   componentDidUpdate(preProps, preState) {
34
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
34
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
35
-      this.getList({ pageNumber: 1, pageSize: 5 })
35
+      this.getList({ pageNumber: 1, pageSize: 5, buildingId: this.props.visibleData.buildingId })
36
       this.setState({ visibleData: this.props.visibleData });
36
       this.setState({ visibleData: this.props.visibleData });
37
     }
37
     }
38
   }
38
   }
49
   }
49
   }
50
 
50
 
51
   getList(params) {
51
   getList(params) {
52
+    if (params.buildingId === '') {
53
+      return
54
+    }
55
+
52
     // 网路请求
56
     // 网路请求
53
-    request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
57
+    request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
54
       this.setState({ dataSource: res })
58
       this.setState({ dataSource: res })
55
     }).catch(err => {
59
     }).catch(err => {
56
       // eslint-disable-next-line no-unused-expressions
60
       // eslint-disable-next-line no-unused-expressions
68
 
72
 
69
    // 分页
73
    // 分页
70
   onChange(pageNum) {
74
   onChange(pageNum) {
71
-    this.getList({ pageNumber: pageNum, pageSize: 5 })
75
+    this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.props.visibleData.buildingId })
72
   }
76
   }
73
 
77
 
74
   // 提交
78
   // 提交
75
   submitGm(record) {
79
   submitGm(record) {
76
-    // 网路请求
77
-    request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.personId } }).then(res => {
78
-      // eslint-disable-next-line no-unused-expressions
79
-      this.openNotificationWithIcon('success', '操作成功')
80
-      this.handleCancel()
81
-      this.props.onSuccess({ realtyConsultant: record.personId, name: record.name })
82
-    }).catch(err => {
83
-      // eslint-disable-next-line no-unused-expressions
84
-      // this.openNotificationWithIcon('error', err)
85
-    })
80
+
81
+    console.log('传递之前:', record)
82
+    this.handleCancel()
83
+    this.props.onSuccess({ realtyConsultant: record.userId, name: record.userName })
84
+
85
+
86
+    // // 网路请求
87
+    // request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.personId } }).then(res => {
88
+    //   // eslint-disable-next-line no-unused-expressions
89
+    //   this.openNotificationWithIcon('success', '操作成功')
90
+    //   this.handleCancel()
91
+    //   this.props.onSuccess({ realtyConsultant: record.personId, name: record.name })
92
+    // }).catch(err => {
93
+    //   // eslint-disable-next-line no-unused-expressions
94
+    //   // this.openNotificationWithIcon('error', err)
95
+    // })
86
   }
96
   }
87
 
97
 
88
   render() {
98
   render() {
117
         dataIndex: 'personId',
127
         dataIndex: 'personId',
118
         key: 'personId',
128
         key: 'personId',
119
         // eslint-disable-next-line no-nested-ternary
129
         // eslint-disable-next-line no-nested-ternary
120
-        render: (_, record) => <>{ this.props.visibleData.realtyConsultant !== record.personId && <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
130
+        render: (_, record) => <>{ this.props.visibleData.realtyConsultant !== record.userId && <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
121
       },
131
       },
122
     ]
132
     ]
123
     return (
133
     return (