Procházet zdrojové kódy

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into dev

zhoulisen před 5 roky
rodič
revize
06d77d001b

+ 32
- 31
src/pages/customer/customerlist/components/BatchAssistConsultant.jsx Zobrazit soubor

@@ -22,9 +22,8 @@ class ModalAttribution extends React.Component {
22 22
     super(props);
23 23
     console.log(props, 'props')
24 24
     this.state = {
25
-      dataSource: { records: [] },
26
-      visibleData: { visible: false, customerId: [], buildingName: '' },
27
-      buildingId: ''
25
+       dataSource: { records: [] },
26
+       visibleData: { visible: false, customerId: [], buildingName: '' },
28 27
     }
29 28
   }
30 29
 
@@ -34,11 +33,9 @@ class ModalAttribution extends React.Component {
34 33
   }
35 34
 
36 35
   componentDidUpdate(preProps, preState) {
37
-    // this.setState({ buildingId: this.props.visibleData.buildingId })
38 36
     console.log(this.props.visibleData)
39 37
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
40
-
41
-      this.getList({ pageNumber: 1, pageSize: 5, buildingId: this.props.visibleData.buildingId })
38
+      this.getList({ pageNumber: 1, pageSize: 5,buildingId: this.props.visibleData.buildingId})
42 39
       this.setState({ visibleData: this.props.visibleData });
43 40
     }
44 41
   }
@@ -54,12 +51,12 @@ class ModalAttribution extends React.Component {
54 51
     this.props.onCancel()
55 52
   }
56 53
 
57
-  changBuilding(buildingId) {
54
+  changBuilding(buildingId){
58 55
     this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
59 56
     this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
60 57
   }
61 58
 
62
-  getUserList(params) {
59
+  getUserList(params){
63 60
     console.log('params: ', params)
64 61
     if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
65 62
       return
@@ -75,10 +72,10 @@ class ModalAttribution extends React.Component {
75 72
   getList(params) {
76 73
     // 网路请求
77 74
     console.log('params: ', params)
78
-    request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
75
+    request({ ...apis.customer.buildingConsultant , params: { ...params }}).then(res => {
79 76
       this.setState({ dataSource: res })
80 77
     }).catch(err => {
81
-
78
+      
82 79
     })
83 80
   }
84 81
 
@@ -90,26 +87,31 @@ class ModalAttribution extends React.Component {
90 87
     });
91 88
   };
92 89
 
93
-  // 分页
90
+   // 分页
94 91
   onChange(pageNum) {
95
-    this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName ||this.props.visibleData.buildingId})
92
+    console.log(this.state.visibleData.buildingName,"222222222222222222222222")
93
+
94
+    this.getUserList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName })
96 95
   }
97 96
 
98 97
   // 提交
99 98
   submitGm(record) {
99
+    console.log(this.state.visibleData.buildingName,"3333333333333333333")
100 100
     // 网路请求
101
-    request({ ...apis.customer.batchConsultantAssist, data: { userId: record.userId, customerIds: this.state.visibleData.customerId } }).then(res => {
101
+    request({ ...apis.customer.batchConsultantAssist, data: { userId: record.userId
102
+      ,buildingId:this.state.visibleData.buildingName  || this.props.visibleData.buildingId
103
+      , customerIds: this.state.visibleData.customerId } }).then(res => {
102 104
       // eslint-disable-next-line no-unused-expressions
103
-
104
-      if (res != null && res.failNum > 0) {
105
-        this.openNotificationWithIcon('success', '共' + res.totalNum + '条数据,失败操作' + res.failNum + '条')
106
-      } else {
105
+      debugger
106
+      if(res!= null && res.failNum > 0 ){
107
+        this.openNotificationWithIcon('success', '共'+res.totalNum+'条数据,失败操作'+res.failNum+'条')
108
+      }else{
107 109
         this.openNotificationWithIcon('success', '操作成功')
108 110
       }
109 111
       this.handleCancel()
110 112
     }).catch(err => {
111 113
       // eslint-disable-next-line no-unused-expressions
112
-
114
+  
113 115
     })
114 116
   }
115 117
 
@@ -145,23 +147,22 @@ class ModalAttribution extends React.Component {
145 147
         dataIndex: 'personId',
146 148
         key: 'personId',
147 149
         // eslint-disable-next-line no-nested-ternary
148
-        render: (_, record) => <>{<Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
149
-      },
150
+        render: (_, record) => <>{ <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>, },
150 151
     ]
151 152
     return (
152 153
       <>
153 154
         <Modal
154
-          title="分配置业顾问"
155
-          width={800}
156
-          destroyOnClose="true"
157
-          footer={null}
158
-          visible={this.state.visibleData.visible}
159
-          onCancel={(e) => this.handleCancel(e)}
160
-        >
161
-          <span>你正在为{this.props.visibleData.customerId.length}位公客分配置业顾问</span><br /><br />
162
-          {this.props.visibleData.buildingId == null && <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
163
-          <Table rowKey="BatchAssistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{ pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
164
-        </Modal>
155
+            title="分配置业顾问"
156
+            width={800}
157
+            destroyOnClose="true"
158
+            footer={null}
159
+            visible={this.state.visibleData.visible}
160
+            onCancel={(e) => this.handleCancel(e)}
161
+          >
162
+            <span>你正在为{this.props.visibleData.customerId.length}位公客分配置业顾问</span><br/><br/>
163
+            {this.props.visibleData.buildingId == null && <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
164
+            <Table rowKey="BatchAssistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
165
+          </Modal>
165 166
       </>
166 167
     );
167 168
   }

+ 24
- 25
src/pages/customer/customerlist/components/assistConsultant.jsx Zobrazit soubor

@@ -21,8 +21,8 @@ class ModalAttribution extends React.Component {
21 21
   constructor(props) {
22 22
     super(props);
23 23
     this.state = {
24
-      dataSource: { records: [] },
25
-      visibleData: { visible: false, customerId: '', buildingName: '' },
24
+       dataSource: { records: [] },
25
+       visibleData: { visible: false, customerId: '', buildingName: '' },
26 26
     }
27 27
   }
28 28
 
@@ -34,7 +34,7 @@ class ModalAttribution extends React.Component {
34 34
   componentDidUpdate(preProps, preState) {
35 35
     console.log(this.props.visibleData)
36 36
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
37
-      this.getList({ pageNumber: 1, pageSize: 5, customerId: this.props.visibleData.customerId, buildingId: this.props.visibleData.buildingId })
37
+      this.getList({ pageNumber: 1, pageSize: 5, customerId: this.props.visibleData.customerId,buildingId:this.props.visibleData.buildingId })
38 38
       this.setState({ visibleData: this.props.visibleData });
39 39
     }
40 40
   }
@@ -50,13 +50,12 @@ class ModalAttribution extends React.Component {
50 50
     this.props.onCancel()
51 51
   }
52 52
 
53
-  changBuilding(buildingId) {
54
-    console.log(buildingId,'buildingId')
53
+  changBuilding(buildingId){
55 54
     this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
56 55
     this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
57 56
   }
58 57
 
59
-  getUserList(params) {
58
+  getUserList(params){
60 59
     console.log('params: ', params)
61 60
     if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
62 61
       return
@@ -65,7 +64,7 @@ class ModalAttribution extends React.Component {
65 64
     request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
66 65
       this.setState({ dataSource: res })
67 66
     }).catch(err => {
68
-      message.err(err)
67
+      
69 68
     })
70 69
   }
71 70
 
@@ -74,7 +73,7 @@ class ModalAttribution extends React.Component {
74 73
     request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
75 74
       this.setState({ dataSource: res })
76 75
     }).catch(err => {
77
-      message.err(err)
76
+      
78 77
     })
79 78
   }
80 79
 
@@ -86,22 +85,23 @@ class ModalAttribution extends React.Component {
86 85
     });
87 86
   };
88 87
 
89
-  // 分页
88
+   // 分页
90 89
   onChange(pageNum) {
91
-    console.log(this.state.visibleData.buildingName,this.props.visibleData.buildingId)
92
-    this.getList({ pageNumber: pageNum, pageSize: 5, customerId: this.props.visibleData.customerId, buildingId: this.state.visibleData.buildingName ||this.props.visibleData.buildingId})
90
+    this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName })
93 91
   }
94 92
 
95 93
   // 提交
96 94
   submitGm(record) {
95
+    debugger
97 96
     // 网路请求
98
-    request({ ...apis.customer.consultantAssist, urlData: { id: this.state.visibleData.customerId }, data: { userId: record.userId } }).then(res => {
97
+    request({ ...apis.customer.consultantAssist, urlData: { id: this.state.visibleData.customerId }, 
98
+      data: { userId: record.userId,buildingId:this.state.visibleData.buildingName  || this.props.visibleData.buildingId } }).then(res => {
99 99
       // eslint-disable-next-line no-unused-expressions
100
+      
100 101
       this.openNotificationWithIcon('success', '操作成功')
101 102
       this.handleCancel()
102 103
     }).catch(err => {
103 104
       // eslint-disable-next-line no-unused-expressions
104
-
105 105
     })
106 106
   }
107 107
 
@@ -137,22 +137,21 @@ class ModalAttribution extends React.Component {
137 137
         dataIndex: 'personId',
138 138
         key: 'personId',
139 139
         // eslint-disable-next-line no-nested-ternary
140
-        render: (_, record) => <>{<Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
141
-      },
140
+        render: (_, record) => <>{ <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>, },
142 141
     ]
143 142
     return (
144 143
       <>
145 144
         <Modal
146
-          title="分配置业顾问"
147
-          width={800}
148
-          destroyOnClose="true"
149
-          footer={null}
150
-          visible={this.state.visibleData.visible}
151
-          onCancel={(e) => this.handleCancel(e)}
152
-        >
153
-          {this.props.visibleData.buildingId == null && <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
154
-          <Table rowKey="assistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{ pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
155
-        </Modal>
145
+            title="分配置业顾问"
146
+            width={800}
147
+            destroyOnClose="true"
148
+            footer={null}
149
+            visible={this.state.visibleData.visible}
150
+            onCancel={(e) => this.handleCancel(e)}
151
+          >
152
+            {this.props.visibleData.buildingId == null && <BuildSelect  onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
153
+            <Table rowKey="assistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
154
+          </Modal>
156 155
       </>
157 156
     );
158 157
   }