Explorar el Código

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

zhoulisen hace 5 años
padre
commit
11124983ee

+ 25
- 5
src/pages/carouselFigure/customImg/edit.jsx Ver fichero

@@ -14,9 +14,9 @@ const { TextArea } = Input;
14 14
 const { Option } = Select;
15 15
 
16 16
 let activityVisible = true
17
+let helpTips = ''
17 18
 
18 19
 const setExtraData = (data) => {
19
-    console.log(data, 'data');
20 20
     activityVisible = data.imgType === 'index';
21 21
   }
22 22
 
@@ -36,7 +36,21 @@ const header = props => {
36 36
   } = props;
37 37
 
38 38
   const imgId = props.location.query.imgId
39
-  const [ data, setData ] = useState({'imgUrl':'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1574145199853-97feda7895c65be33aa234a7b81b37f.jpg','imgType':'index','imgDesc':'小程序首页分享配图','imgDocument': currentUser.orgName+' 精准获客平台'})
39
+  const imgType = props.location.query.imgType
40
+
41
+  const [ data, setData ] = useState(imgType === 'index' ? 
42
+  {
43
+    'imgUrl':'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1574145199853-97feda7895c65be33aa234a7b81b37f.jpg',
44
+    'imgType':'index',
45
+    'imgDesc':'小程序首页分享配图',
46
+    'imgDocument': currentUser.orgName+' 精准获客平台'
47
+  } : 
48
+  {
49
+    'imgUrl':'http://njcj.oss-cn-shanghai.aliyuncs.com/icon.png',
50
+    'imgType':'indexNews',
51
+  }
52
+  )
53
+
40 54
   if(imgId){
41 55
     useEffect(() => {
42 56
       getData(imgId);
@@ -48,8 +62,10 @@ const header = props => {
48 62
         console.log(data)
49 63
         if (data.imgType === 'index'){
50 64
             activityVisible = true;
65
+            helpTips = '建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:首页分享';
51 66
         }else{
52 67
             activityVisible = false;
68
+            helpTips = '建议尺寸:80*80px,比例1:1,格式:jpg,用于:首页资讯logo'
53 69
         }
54 70
         setData(data)
55 71
     })
@@ -62,7 +78,7 @@ const header = props => {
62 78
       name: 'imgUrl',
63 79
       type: FieldTypes.ImageUploader,
64 80
       value: data.imgUrl,
65
-      help: '建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:首页分享',
81
+      help: helpTips,
66 82
       rules: [
67 83
         {required: true, message: '请选择图片'},
68 84
       ]
@@ -71,17 +87,21 @@ const header = props => {
71 87
       label: '类型',
72 88
       name: 'imgType',
73 89
       type: FieldTypes.Select,
74
-      value: 'index',
90
+      value: data.imgType,
75 91
       dict: [{
76 92
           label: '首页分享',
77 93
           value: 'index',
78 94
         },
95
+        {
96
+          label: '首页资讯',
97
+          value: 'indexNews',
98
+        },
79 99
       ],
80 100
       rules: [
81 101
         { required: true, message: '请选择类型' },
82 102
       ],
83 103
     },
84
-    {
104
+    data.imgType === 'index' && {
85 105
       label: '分享文案',
86 106
       name: 'imgDocument',
87 107
       type: FieldTypes.Text,

+ 9
- 5
src/pages/carouselFigure/customImg/list.jsx Ver fichero

@@ -26,18 +26,22 @@ function header(props) {
26 26
         if(data.records.length > 0){
27 27
           setData(data.records)
28 28
         }else{
29
-          setData([{'imgUrl':'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1574145199853-97feda7895c65be33aa234a7b81b37f.jpg','imgType':'index','imgDesc':'小程序首页分享配图'}])
29
+          setData([
30
+            {'imgUrl':'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1574145199853-97feda7895c65be33aa234a7b81b37f.jpg','imgType':'index','imgDesc':'小程序首页分享配图'},
31
+            {'imgUrl':'http://njcj.oss-cn-shanghai.aliyuncs.com/icon.png','imgType':'indexNews','imgDesc':'首页资讯logo'}
32
+          ])
30 33
         }
31 34
         
32 35
     })
33 36
   }
34 37
   
35 38
     // 跳转到编辑商品
36
-  const toEditCustom = (imgId) => () => {
39
+  const toEditCustom = (imgId, imgType) => () => {
37 40
     router.push({
38 41
       pathname: '/carouselFigure/customImg/edit',
39 42
       query: {
40
-        imgId
43
+        imgId,
44
+        imgType:imgType
41 45
       },
42 46
     });
43 47
   }
@@ -55,7 +59,7 @@ function header(props) {
55 59
         <Column title="类型" dataIndex="imgType" key="imgType" 
56 60
         render={(text, record) => (
57 61
           <span>
58
-            {record.imgType === 'index' ?'首页分享':'请编辑'}
62
+            {record.imgType === 'index' ?'首页分享': record.imgType === 'indexNews' ? '首页资讯' : '请编辑'}
59 63
           </span>
60 64
           )}
61 65
         />
@@ -65,7 +69,7 @@ function header(props) {
65 69
         key="handle" 
66 70
         render={(text, record) => (
67 71
           <AuthButton name="admin.custom.put" noRight={null}>
68
-            <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditCustom(record.imgId)}>
72
+            <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditCustom(record.imgId, record.imgType)}>
69 73
               编辑<Icon type="form" className={styles.edit} />
70 74
             </span>
71 75
           </AuthButton>

+ 4
- 21
src/pages/staff/components/BatchAssistConsultant.jsx Ver fichero

@@ -31,19 +31,12 @@ class ModalAttribution extends React.Component {
31 31
   }
32 32
 
33 33
   componentDidUpdate(preProps, preState) {
34
-    console.log(this.props.preState,"111111111111111")
35 34
     if (this.props.visible !== preState.visibleData.visible) {
36
-      this.getList({ pageNumber: 1, pageSize: 5, buildingId: this.props.buildingId })
35
+      this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: this.props.buildingId })
37 36
       this.setState({ visibleData: { visible: this.props.visible, buildingId: this.props.buildingId } });
38 37
     }
39 38
   }
40 39
 
41
-  // 弹框确定按钮
42
-  // eslint-disable-next-line react/sort-comp
43
-  handleOk() {
44
-    this.props.onCancel()
45
-  }
46
-
47 40
   // 弹框取消按钮
48 41
   handleCancel() {
49 42
     this.props.onCancel()
@@ -62,16 +55,6 @@ class ModalAttribution extends React.Component {
62 55
     })
63 56
   }
64 57
 
65
-  getList(params) {
66
-    // 网路请求
67
-    console.log('params: ', params)
68
-    request({ ...apis.customer.buildingConsultant }).then(res => {
69
-      this.setState({ dataSource: res })
70
-    }).catch(err => {
71
-      
72
-    })
73
-  }
74
-
75 58
   openNotificationWithIcon = (type, message) => {
76 59
     notification[type]({
77 60
       message,
@@ -88,7 +71,7 @@ class ModalAttribution extends React.Component {
88 71
 
89 72
   // 提交
90 73
   submitGm(record) {
91
-    console.log(record,"111111")
74
+    this.props.onCancel(record)
92 75
   }
93 76
 
94 77
   render() {
@@ -118,7 +101,7 @@ class ModalAttribution extends React.Component {
118 101
         dataIndex: 'personId',
119 102
         key: 'personId',
120 103
         // eslint-disable-next-line no-nested-ternary
121
-        render: (_, record) => <>{ <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>, },
104
+        render: (_, record) => <>{record.userId !== this.props.userId ? <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button> : ''}</>, },
122 105
     ]
123 106
     return (
124 107
       <>
@@ -130,7 +113,7 @@ class ModalAttribution extends React.Component {
130 113
             visible={this.state.visibleData.visible}
131 114
             onCancel={(e) => this.handleCancel(e)}
132 115
           >
133
-            <Table rowKey="BatchAssistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
116
+            <Table rowKey="userId" dataSource={this.state.dataSource.records} columns={columns} pagination={{pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
134 117
           </Modal>
135 118
       </>
136 119
     );

+ 58
- 0
src/pages/staff/components/BuildingSelection.jsx Ver fichero

@@ -0,0 +1,58 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Tooltip, Tabs, Radio, Divider, Tag, Select, Form, Alert, Modal } from 'antd';
3
+import request from '../../../utils/request';
4
+import apis from '../../../services/apis';
5
+import CustomerChange from './CustomerChange'
6
+import BuildSelect from '@/components/SelectButton/BuildSelect'
7
+
8
+let building = null
9
+const BuildingSelection = (props) => {
10
+    const [visible, setVisible] = useState(false) 
11
+    const { userData } = props;
12
+
13
+     //授权项目改变
14
+  const consultantBuildingChange =(e) => {
15
+    building = e
16
+    if(userData.isConsultant && props.value !== e){
17
+      request({ ...apis.staff.check, params: { userId: userData.userId, personId: userData.consultantPersonId, buildingId: userData.buildingId } }).then(res => {
18
+        if(res.length > 0){
19
+          Modal.confirm({
20
+            title: '此项目下有私客,是否转移私客?',
21
+            okText: '确认',
22
+            cancelText: '取消',
23
+            onOk () {
24
+              setVisible(true)
25
+            },
26
+          });
27
+        }else{
28
+            props.onChange(e)
29
+        }
30
+     })
31
+    }else{
32
+        props.onChange(e)
33
+    }
34
+  }
35
+
36
+   //迁移私客成功回调
37
+   const moveSuccess = (e) => {
38
+       if(e === 'success'){
39
+        props.onChange(building)
40
+       }
41
+       setVisible(false)
42
+  }
43
+
44
+     return (<>
45
+        <BuildSelect value={props.value} onChange={consultantBuildingChange} />
46
+        <Modal
47
+              visible={visible}
48
+              title="分配归属"
49
+              onCancel={() => setVisible(false)}
50
+              footer={null}
51
+              width={900}
52
+            >
53
+                <CustomerChange userId={userData.userId} consultantPersonId={userData.consultantPersonId} buildingId={userData.buildingId} onSuccess={moveSuccess} />
54
+            </Modal>
55
+     </>)
56
+  }
57
+  
58
+  export default BuildingSelection;

+ 52
- 4
src/pages/staff/components/CustomerChange.jsx Ver fichero

@@ -11,13 +11,59 @@ import BatchAssistConsultant from './BatchAssistConsultant'
11 11
 const CustomerChange = (props) => {
12 12
   const [data, setData] = useState([])
13 13
   const [consultantVisible, setConsultantVisible] = useState(false)
14
+  const [selectIds, setSelectIds] = useState([])
14 15
 
15 16
   const rowSelection = {
17
+    selectedRowKeys: selectIds,
16 18
     onChange: (selectedRowKeys, selectedRows) => {
17 19
       console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
20
+      setSelectIds(selectedRowKeys)
18 21
     },
19 22
   };
20 23
 
24
+  const batchAssistConsultant = () => {
25
+    if(selectIds.length < 1){
26
+      message.info("请至少选择一条数据");
27
+      return
28
+    }
29
+    setConsultantVisible(true)
30
+  }
31
+
32
+  const consulatanChange = (e) => {
33
+    if(e){
34
+      data.map(x =>{ 
35
+        selectIds.map(y => {
36
+          if(x.customerId === y){
37
+            x.realtyConsultant = e.userId
38
+            x.moveUserId = e.userId
39
+            x.moveUserName = e.userName
40
+          }
41
+        })
42
+      })
43
+    }
44
+    setConsultantVisible(false)
45
+    setSelectIds([])
46
+  }
47
+
48
+  //批量保存
49
+  const batchSaveConsultant = () =>{
50
+    const unMoveData = data.filter(x => !x.moveUserId)
51
+    if(unMoveData.length > 0){
52
+      message.info("存在未分配归属客户");
53
+      return
54
+    }
55
+    request({ ...apis.staff.move, data }).then(data => {
56
+      message.info('操作成功')
57
+      props.onSuccess('success')
58
+    })
59
+  }
60
+
61
+  //取消按钮
62
+  const cancelConsultant = () => {
63
+    props.onSuccess('cancel')
64
+  }
65
+
66
+
21 67
   const columns = [
22 68
     {
23 69
       title: '用户名',
@@ -39,8 +85,8 @@ const CustomerChange = (props) => {
39 85
     },
40 86
     {
41 87
       title: '调整后归属',
42
-      dataIndex: 'buildingId',
43
-      key: 'buildingId',
88
+      dataIndex: 'moveUserName',
89
+      key: 'moveUserName',
44 90
       align: 'center',
45 91
     }
46 92
   ];
@@ -53,9 +99,11 @@ const CustomerChange = (props) => {
53 99
 
54 100
   return (
55 101
     <div>
56
-        <Button type="primary" onClick={() => setConsultantVisible(true)} style={{ float: 'right', margin: '20px 0', marginLeft: '20px', zIndex: 1 }}>分配置业顾问</Button>
102
+        <Button type="primary" onClick={() => batchAssistConsultant()} style={{ float: 'right', margin: '20px 0', marginLeft: '20px', zIndex: 1 }}>分配置业顾问</Button>
57 103
         <Table rowSelection={rowSelection} dataSource={data} columns={columns} rowKey="customerId" pagination={false} scroll={{ y: 500 }}/>
58
-        <BatchAssistConsultant visible={consultantVisible} buildingId={props.buildingId} />
104
+        <BatchAssistConsultant visible={consultantVisible} userId={props.userId} buildingId={props.buildingId} onCancel={consulatanChange} />
105
+        <Button type="primary" onClick={() => batchSaveConsultant()} style={{}}>保存</Button>
106
+        <Button onClick={() => cancelConsultant()} style={{}}>取消</Button>
59 107
     </div>
60 108
   )
61 109
 }

+ 23
- 5
src/pages/staff/list/StaffList.jsx Ver fichero

@@ -40,8 +40,8 @@ const CartBody = props => {
40 40
     // console.log(data, "11111")
41 41
     if (data.status === 1) {
42 42
       if(data.isConsultant){
43
-        request({ ...apis.staff.check, params: { userId: data.userId, personId: data.consultantPersonId, buildingId: data.buildingId } }).then(data => {
44
-          if(data){
43
+        request({ ...apis.staff.check, params: { userId: data.userId, personId: data.consultantPersonId, buildingId: data.buildingId } }).then(res => {
44
+          if(res.length > 0){
45 45
             Modal.confirm({
46 46
               title: '此置业顾问下有私客,是否转移私客?',
47 47
               okText: '确认',
@@ -50,6 +50,19 @@ const CartBody = props => {
50 50
                 setVisible(true)
51 51
               },
52 52
             });
53
+          }else{
54
+            const titleMessahe = data.isConsultant ? '停用后此员工无法继续登录后台(若为置业顾问停用后在小程序端将成为普通用户)确认进行停用操作?' : '停用后此员工无法继续登录后台,确认进行停用操作?';
55
+            Modal.confirm({
56
+              title: titleMessahe,
57
+              okText: '确认',
58
+              cancelText: '取消',
59
+              onOk () {
60
+                request({ ...apis.staff.change, urlData: { id: data.userId, type: 'off' } }).then(res => {
61
+                  message.info('操作成功')
62
+                  props.onFresh()
63
+                })
64
+              },
65
+            });
53 66
           }
54 67
        })
55 68
       }else{
@@ -59,7 +72,7 @@ const CartBody = props => {
59 72
           okText: '确认',
60 73
           cancelText: '取消',
61 74
           onOk () {
62
-            request({ ...apis.staff.change, urlData: { id: data.userId, type: 'off' } }).then(data => {
75
+            request({ ...apis.staff.change, urlData: { id: data.userId, type: 'off' } }).then(res => {
63 76
               message.info('操作成功')
64 77
               props.onFresh()
65 78
             })
@@ -72,7 +85,7 @@ const CartBody = props => {
72 85
         okText: '确认',
73 86
         cancelText: '取消',
74 87
         onOk () {
75
-          request({ ...apis.staff.change, urlData: { id: data.userId, type: 'on' } }).then(data => {
88
+          request({ ...apis.staff.change, urlData: { id: data.userId, type: 'on' } }).then(res => {
76 89
             message.info('操作成功')
77 90
             props.onFresh()
78 91
           })
@@ -81,6 +94,11 @@ const CartBody = props => {
81 94
     }
82 95
   }
83 96
 
97
+  //迁移私客成功回调
98
+  const moveSuccess = (e) => {
99
+    setVisible(false)
100
+  }
101
+
84 102
   // 员工离职
85 103
   const departure = row => {
86 104
     // 是置业顾问
@@ -159,7 +177,7 @@ const CartBody = props => {
159 177
         footer={null}
160 178
         width={900}
161 179
       >
162
-          <CustomerChange userId={data.userId} consultantPersonId={data.consultantPersonId} buildingId={data.buildingId} />
180
+          <CustomerChange userId={data.userId} consultantPersonId={data.consultantPersonId} buildingId={data.buildingId} onSuccess={moveSuccess} />
163 181
       </Modal>
164 182
     </div>
165 183
   )

+ 40
- 4
src/pages/staff/list/editStaff.jsx Ver fichero

@@ -1,6 +1,6 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 
3
-import { Input, Menu, Dropdown, Button, Icon, message, Table, Tooltip, Tabs, Radio, Divider, Tag, Select, Form, Alert } from 'antd';
3
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Tooltip, Tabs, Radio, Divider, Tag, Select, Form, Alert, Modal } from 'antd';
4 4
 import { FormattedMessage } from 'umi-plugin-react/locale';
5 5
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
6 6
 import router from 'umi/router';
@@ -11,6 +11,7 @@ import channels from './channelList.less';
11 11
 import Tagss from '../components/Tagss.jsx';
12 12
 import apis from '../../../services/apis';
13 13
 import request from '../../../utils/request'
14
+import BuildingSelection from '../components/BuildingSelection'
14 15
 
15 16
 const { TextArea } = Input;
16 17
 const { Option } = Select;
@@ -38,6 +39,7 @@ const Edit = (props) => {
38 39
   const [tagData, setTagData] = useState([])
39 40
   const [roleData, setRoleData] = useState([])
40 41
   const [buildData, setBuildData] = useState([])
42
+  const [visible, setVisible] = useState(false)
41 43
 
42 44
   const getTagList = () => {
43 45
     request({ ...apis.staff.taTags, params: { pageNum: 1, pageSize: 999 } }).then((data) => {
@@ -123,6 +125,29 @@ const Edit = (props) => {
123 125
     return isLt100k;
124 126
   }
125 127
 
128
+  //授权项目改变
129
+  const consultantBuildingChange =(e) => {
130
+    if(userData.isConsultant){
131
+      request({ ...apis.staff.check, params: { userId: userData.userId, personId: userData.consultantPersonId, buildingId: userData.buildingId } }).then(res => {
132
+        if(res.length > 0){
133
+          Modal.confirm({
134
+            title: '此项目下有私客,是否转移私客?',
135
+            okText: '确认',
136
+            cancelText: '取消',
137
+            onOk () {
138
+              setVisible(true)
139
+            },
140
+          });
141
+        }
142
+     })
143
+    }
144
+  }
145
+
146
+   //迁移私客成功回调
147
+   const moveSuccess = (e) => {
148
+    setVisible(false)
149
+  }
150
+
126 151
   const fields = [
127 152
     {
128 153
       label: '姓名',
@@ -190,7 +215,7 @@ const Edit = (props) => {
190 215
       type: FieldTypes.Text,
191 216
       placeholder: '请输入登录名',
192 217
       value: userData.loginName,
193
-      hidden: () => consultantChecked,
218
+      // hidden: () => consultantChecked,
194 219
       help: '默认密码:123456',
195 220
     },
196 221
     {
@@ -212,7 +237,7 @@ const Edit = (props) => {
212 237
     {
213 238
       label: '授权项目',
214 239
       name: 'buildingId',
215
-      render: <BuildSelect />,
240
+      render: <BuildingSelection userData={userData} />,
216 241
       value: userData.buildingId,
217 242
       hidden: () => !consultantChecked,
218 243
       rules: [
@@ -282,7 +307,18 @@ const Edit = (props) => {
282 307
 
283 308
   console.log('--------->', fields)
284 309
 
285
-  return <XForm onChange={console.log} onSubmit={handleSubmit} fields={fields.filter(Boolean)} onCancel={() => router.go(-1)}></XForm>
310
+  return <div>
311
+            <XForm onChange={console.log} onSubmit={handleSubmit} fields={fields.filter(Boolean)} onCancel={() => router.go(-1)}></XForm>
312
+            {/* <Modal
313
+              visible={visible}
314
+              title="分配归属"
315
+              onCancel={() => setVisible(false)}
316
+              footer={null}
317
+              width={900}
318
+            >
319
+                <CustomerChange userId={userData.userId} consultantPersonId={userData.consultantPersonId} buildingId={userData.buildingId} onSuccess={moveSuccess} />
320
+            </Modal> */}
321
+        </div>
286 322
 }
287 323
 
288 324
 export default Edit

+ 5
- 0
src/services/apis.js Ver fichero

@@ -836,6 +836,11 @@ export default {
836 836
       method: 'GET',
837 837
       action: 'admin.consultant.customer.list.put',
838 838
     },
839
+    move: {
840
+      url: `${prefix}/consultant/customer/move`,
841
+      method: 'PUT',
842
+      action: 'admin.user.departure.put',
843
+    },
839 844
     departure: {
840 845
       url: `${prefix}/user/departure/:id`,
841 846
       method: 'PUT',