Przeglądaj źródła

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

张延森 5 lat temu
rodzic
commit
47f18d584e

+ 4
- 1
src/components/GlobalHeader/AvatarDropdown.jsx Wyświetl plik

@@ -42,10 +42,12 @@ class AvatarDropdown extends React.Component {
42 42
   }
43 43
 
44 44
   render() {
45
+    console.log(this.props, 'props')
45 46
     const {
46 47
       currentUser = {
47 48
         avatar: '',
48 49
         userName: '',
50
+        miniAppName: '',
49 51
       },
50 52
       menu,
51 53
     } = this.props;
@@ -80,7 +82,8 @@ class AvatarDropdown extends React.Component {
80 82
         <HeaderDropdown overlay={menuHeaderDropdown}>
81 83
             <span className={`${styles.action} ${styles.account}`}>
82 84
               <Avatar size="small" className={styles.avatar} src={currentUser.avatar === null ? currentUser.photo:currentUser.avatar} alt="avatar" />
83
-              <span className={styles.name}>{currentUser.userName}</span>
85
+              <span className={styles.name}>{currentUser.loginName}</span>
86
+              <span className={styles.name}>欢迎登录{currentUser.miniAppName}</span>
84 87
             </span>
85 88
         </HeaderDropdown>
86 89
 

+ 2
- 2
src/layouts/SecurityLayout.jsx Wyświetl plik

@@ -33,10 +33,10 @@ class SecurityLayout extends React.Component {
33 33
     if (!currentUser.userId) {
34 34
       return <Redirect to="/user/login"></Redirect>;
35 35
     }
36
-
36
+    console.log(window.location, "window.locationwindow.locationwindow.location")
37 37
     return <>
38 38
       {children}
39
-      <Swiper />
39
+      {window.location.hash == "#/index" && <Swiper />}
40 40
     </>;
41 41
   }
42 42
 }

+ 1
- 0
src/pages/building/list/add/components/base.jsx Wyświetl plik

@@ -434,6 +434,7 @@ function AddBuilding(props) {
434 434
                 <Option value="待售">待售</Option>
435 435
                 <Option value="在售">在售</Option>
436 436
                 <Option value="售罄">售罄</Option>
437
+                <Option value="在租">在租</Option>
437 438
               </Select>,
438 439
             )}
439 440
           </Form.Item>

+ 3
- 1
src/pages/building/list/add/components/buildingProjectType.jsx Wyświetl plik

@@ -98,12 +98,13 @@ class TypeForm extends React.Component {
98 98
                   <Radio.Group onChange={e => this.onChange(e, 'priceType')} >
99 99
                     <Radio value="average">均价</Radio>
100 100
                     <Radio value="total">总价</Radio>
101
+                    <Radio value="lease">租赁价</Radio>
101 102
                   </Radio.Group>
102 103
                 )}
103 104
               </Form.Item>
104 105
             <Form.Item label="价格区间" help='最高价与最低价一致时,只展示一个'>
105 106
               {getFieldDecorator('startPrice')(<Input type="number" placeholder="最低价" style={{width: '120px'}} maxLength="9" onChange={e => this.onChange(e, 'startPrice')} />)} --
106
-              {getFieldDecorator('endPrice')(<Input type="number" placeholder="最高价" style={{width: '120px'}} maxLength="9" onChange={e => this.onChange(e, 'endPrice')} />)}{this.props.type.priceType === "average" ? "元/㎡" : "万元/套"}
107
+              {getFieldDecorator('endPrice')(<Input type="number" placeholder="最高价" style={{width: '120px'}} maxLength="9" onChange={e => this.onChange(e, 'endPrice')} />)}{this.props.type.priceType === "average" ? "元/㎡" : this.props.type.priceType === "lease" ? "元/㎡/天" : "万元/套"}
107 108
             </Form.Item>
108 109
             <Form.Item label="销售状态" >
109 110
             {getFieldDecorator('marketStatus')(
@@ -111,6 +112,7 @@ class TypeForm extends React.Component {
111 112
                 <Option value="待售">待售</Option>
112 113
                 <Option value="在售">在售</Option>
113 114
                 <Option value="售罄">售罄</Option>
115
+                <Option value="在租">在租</Option>
114 116
               </Select>,
115 117
             )}
116 118
           </Form.Item>

+ 4
- 0
src/pages/building/list/add/components/imageSet.jsx Wyświetl plik

@@ -23,6 +23,10 @@ const saleType = [
23 23
     id: 3,
24 24
     name: '在售',
25 25
   },
26
+  {
27
+    id: 4,
28
+    name: '在租',
29
+  },
26 30
 ]
27 31
 
28 32
 const houseType = [

+ 4
- 0
src/pages/building/list/add/components/modalImage.jsx Wyświetl plik

@@ -40,6 +40,10 @@ const saleType = [
40 40
     id: 3,
41 41
     name: '在售',
42 42
   },
43
+  {
44
+    id: 4,
45
+    name: '在租',
46
+  },
43 47
 ]
44 48
 
45 49
 const houseType = [

+ 25
- 5
src/pages/carouselFigure/customImg/edit.jsx Wyświetl plik

@@ -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 Wyświetl plik

@@ -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>

+ 37
- 6
src/pages/customer/customerlist/index.jsx Wyświetl plik

@@ -374,7 +374,8 @@ function body(props) {
374 374
       key: 'picture',
375 375
       align: 'center',
376 376
       width: '15%',
377
-      render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
377
+      // render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
378
+      render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} src={record.picture } size={64} icon="user" />,
378 379
     },
379 380
     {
380 381
       title: '姓名',
@@ -383,7 +384,7 @@ function body(props) {
383 384
       align: 'center',
384 385
       width: '10%',
385 386
       // eslint-disable-next-line no-nested-ternary
386
-      render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} >{customerType === 'private' ? record.name : record.nickname}</span></>,
387
+      // render: (_, record) => <><span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} >{customerType === 'private' ? record.name : record.nickname}</span></>,
387 388
     },
388 389
     {
389 390
       title: '电话',
@@ -392,6 +393,21 @@ function body(props) {
392 393
       align: 'center',
393 394
       width: '15%',
394 395
     },
396
+    {
397
+      title: '是否归属项目',
398
+      dataIndex: '',
399
+      key: '',
400
+      align: 'center',
401
+      width: '15%',
402
+      render: (_, record) => <><span>{record.buildingId != null ? '是' : '否'}</span></>,
403
+    },
404
+    {
405
+      title: '归属项目',
406
+      dataIndex: 'buildingName',
407
+      key: 'buildingName',
408
+      align: 'center',
409
+      width: '15%',
410
+    },
395 411
     {
396 412
       title: '推广人员',
397 413
       dataIndex: 'sharePersonName',
@@ -401,12 +417,12 @@ function body(props) {
401 417
     },
402 418
     {
403 419
       title: '性别',
404
-      dataIndex: 'gender',
405
-      key: 'gender',
420
+      dataIndex: 'sex',
421
+      key: 'sex',
406 422
       align: 'center',
407 423
       width: '10%',
408 424
       // eslint-disable-next-line no-nested-ternary
409
-      render: (_, record) => <><span>{record.gender === '1' ? '男' : record.gender === '2' ? '女' : '未知'}</span></>,
425
+      render: (_, record) => <><span>{record.sex === '1' ? '男' : record.sex === '2' ? '女' : '未知'}</span></>,
410 426
     },
411 427
     {
412 428
       title: '操作',
@@ -484,6 +500,13 @@ function body(props) {
484 500
         </>
485 501
       ),
486 502
     },
503
+    {
504
+      title: '归属项目',
505
+      dataIndex: 'buildingName',
506
+      key: 'buildingName',
507
+      align: 'center',
508
+      width: '15%',
509
+    },
487 510
     {
488 511
       title: '推广人员',
489 512
       dataIndex: 'sharePersonName',
@@ -542,6 +565,14 @@ function body(props) {
542 565
   return (
543 566
     <>
544 567
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
568
+      {customerType === 'public' && <Form.Item>
569
+          {getFieldDecorator('belongStatus')(
570
+            <Select style={{ width: '180px' }} placeholder="是否归属项目" onChange={handleSelectChange}>
571
+              <Option value={1}>是</Option>
572
+              <Option value={0}>否</Option>
573
+            </Select>,
574
+          )}
575
+        </Form.Item>}
545 576
         <Form.Item>
546 577
           {getFieldDecorator('buildingId')(
547 578
             <BuildSelect />,
@@ -654,7 +685,7 @@ function body(props) {
654 685
           //     onClick: () => publicCustomerDetail(record),
655 686
           //   };
656 687
           // }}
657
-          dataSource={dataSource.records} columns={publicColumns} pagination={{ current: dataSource.current, total: dataSource.total, pageSize: dataSource.size, onChange }} rowKey={r => r.personId} />
688
+          dataSource={dataSource.records} columns={publicColumns} pagination={{ current: dataSource.current, total: dataSource.total, pageSize: dataSource.size, onChange }} rowKey={r => r.customerId} />
658 689
       }
659 690
 
660 691
       {/* 调整归属 */}

+ 123
- 0
src/pages/staff/components/BatchAssistConsultant.jsx Wyświetl plik

@@ -0,0 +1,123 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, notification } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../utils/request';
5
+import apis from '../../../services/apis';
6
+
7
+
8
+const { Option } = Select;
9
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
10
+const { Meta } = Card;
11
+
12
+/**
13
+ * 分配置业顾问
14
+ *
15
+ * @param {*} props
16
+ * @returns
17
+ */
18
+class ModalAttribution extends React.Component {
19
+  constructor(props) {
20
+    super(props);
21
+    // console.log(props, 'props')
22
+    this.state = {
23
+       dataSource: { records: [] },
24
+       visibleData: { visible: false, buildingId: '' },
25
+    }
26
+  }
27
+
28
+  // 挂载之后
29
+  componentDidMount() {
30
+    // this.getList({ pageNumber: 1, pageSize: 5 })
31
+  }
32
+
33
+  componentDidUpdate(preProps, preState) {
34
+    if (this.props.visible !== preState.visibleData.visible) {
35
+      this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: this.props.buildingId })
36
+      this.setState({ visibleData: { visible: this.props.visible, buildingId: this.props.buildingId } });
37
+    }
38
+  }
39
+
40
+  // 弹框取消按钮
41
+  handleCancel() {
42
+    this.props.onCancel()
43
+  }
44
+
45
+  getUserList(params){
46
+    console.log('params: ', params)
47
+    if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
48
+      return
49
+    }
50
+    // 网路请求
51
+    request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
52
+      this.setState({ dataSource: res })
53
+    }).catch(err => {
54
+      
55
+    })
56
+  }
57
+
58
+  openNotificationWithIcon = (type, message) => {
59
+    notification[type]({
60
+      message,
61
+      description:
62
+        '',
63
+    });
64
+  };
65
+
66
+   // 分页
67
+  onChange(pageNum) {
68
+
69
+    this.getUserList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingId })
70
+  }
71
+
72
+  // 提交
73
+  submitGm(record) {
74
+    this.props.onCancel(record)
75
+  }
76
+
77
+  render() {
78
+    const columns = [
79
+      {
80
+        title: '姓名',
81
+        dataIndex: 'userName',
82
+        key: 'userName',
83
+      },
84
+      {
85
+        title: '电话',
86
+        dataIndex: 'phone',
87
+        key: 'phone',
88
+      },
89
+      {
90
+        title: '部门',
91
+        dataIndex: 'department',
92
+        key: 'department',
93
+      },
94
+      {
95
+        title: '岗位',
96
+        dataIndex: 'position',
97
+        key: 'position',
98
+      },
99
+      {
100
+        title: '操作',
101
+        dataIndex: 'personId',
102
+        key: 'personId',
103
+        // eslint-disable-next-line no-nested-ternary
104
+        render: (_, record) => <>{record.userId !== this.props.userId ? <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button> : ''}</>, },
105
+    ]
106
+    return (
107
+      <>
108
+        <Modal
109
+            title="分配置业顾问"
110
+            width={500}
111
+            destroyOnClose="true"
112
+            footer={null}
113
+            visible={this.state.visibleData.visible}
114
+            onCancel={(e) => this.handleCancel(e)}
115
+          >
116
+            <Table rowKey="userId" dataSource={this.state.dataSource.records} columns={columns} pagination={{pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
117
+          </Modal>
118
+      </>
119
+    );
120
+  }
121
+}
122
+
123
+export default ModalAttribution

+ 58
- 0
src/pages/staff/components/BuildingSelection.jsx Wyświetl plik

@@ -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;

+ 111
- 0
src/pages/staff/components/CustomerChange.jsx Wyświetl plik

@@ -0,0 +1,111 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import echarts from 'echarts/lib/echarts';
3
+import EChart from '../../../components/EchartsTest/EChart';
4
+import request from '../../../utils/request';
5
+import apis from '../../../services/apis';
6
+import moment from 'moment';
7
+import router from 'umi/router';
8
+import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
+import BatchAssistConsultant from './BatchAssistConsultant'
10
+
11
+const CustomerChange = (props) => {
12
+  const [data, setData] = useState([])
13
+  const [consultantVisible, setConsultantVisible] = useState(false)
14
+  const [selectIds, setSelectIds] = useState([])
15
+
16
+  const rowSelection = {
17
+    selectedRowKeys: selectIds,
18
+    onChange: (selectedRowKeys, selectedRows) => {
19
+      console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
20
+      setSelectIds(selectedRowKeys)
21
+    },
22
+  };
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
+
67
+  const columns = [
68
+    {
69
+      title: '用户名',
70
+      dataIndex: 'name',
71
+      key: 'name',
72
+      align: 'center',
73
+    },
74
+    {
75
+      title: '手机号',
76
+      dataIndex: 'phone',
77
+      key: 'phone',
78
+      align: 'center',
79
+    },
80
+    {
81
+      title: '状态',
82
+      dataIndex: 'status',
83
+      key: 'status',
84
+      align: 'center',
85
+    },
86
+    {
87
+      title: '调整后归属',
88
+      dataIndex: 'moveUserName',
89
+      key: 'moveUserName',
90
+      align: 'center',
91
+    }
92
+  ];
93
+
94
+  useEffect(() => {
95
+    request({ ...apis.staff.check, params: { userId: props.userId, personId: props.consultantPersonId, buildingId: props.buildingId } }).then(data => {
96
+       setData(data)
97
+   })
98
+  }, [props.userId])
99
+
100
+  return (
101
+    <div>
102
+        <Button type="primary" onClick={() => batchAssistConsultant()} style={{ float: 'right', margin: '20px 0', marginLeft: '20px', zIndex: 1 }}>分配置业顾问</Button>
103
+        <Table rowSelection={rowSelection} dataSource={data} columns={columns} rowKey="customerId" pagination={false} scroll={{ y: 500 }}/>
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>
107
+    </div>
108
+  )
109
+}
110
+
111
+export default CustomerChange;

+ 104
- 48
src/pages/staff/list/StaffList.jsx Wyświetl plik

@@ -9,6 +9,7 @@ import apis from '../../../services/apis';
9 9
 import request from '../../../utils/request'
10 10
 import Styles from './style.less';
11 11
 import BuildingSelect from '@/components/SelectButton/BuildSelect';
12
+import CustomerChange from '../components/CustomerChange'
12 13
 
13 14
 const { Meta } = Card;
14 15
 const { Option } = Select;
@@ -32,29 +33,59 @@ const toEditStaff = userId => () => {
32 33
  */
33 34
 const CartBody = props => {
34 35
   const { data } = props
36
+  const [visible, setVisible] = useState(false)
35 37
   // console.log("data11:", data)
36 38
 
37 39
   const confirm = data => () => {
38 40
     // console.log(data, "11111")
39 41
     if (data.status === 1) {
40
-      Modal.confirm({
41
-        title: '停用后无法登录后台系统',
42
-        okText: '确认',
43
-        cancelText: '取消',
44
-        onOk () {
45
-          request({ ...apis.staff.change, urlData: { id: data.userId, type: 'off' } }).then(data => {
46
-            message.info('操作成功')
47
-            props.onFresh()
48
-          })
49
-        },
50
-      });
42
+      if(data.isConsultant){
43
+        request({ ...apis.staff.check, params: { userId: data.userId, personId: data.consultantPersonId, buildingId: data.buildingId } }).then(res => {
44
+          if(res.length > 0){
45
+            Modal.confirm({
46
+              title: '此置业顾问下有私客,是否转移私客?',
47
+              okText: '确认',
48
+              cancelText: '取消',
49
+              onOk () {
50
+                setVisible(true)
51
+              },
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
+            });
66
+          }
67
+       })
68
+      }else{
69
+        const titleMessahe = data.isConsultant ? '停用后此员工无法继续登录后台(若为置业顾问停用后在小程序端将成为普通用户)确认进行停用操作?' : '停用后此员工无法继续登录后台,确认进行停用操作?';
70
+        Modal.confirm({
71
+          title: titleMessahe,
72
+          okText: '确认',
73
+          cancelText: '取消',
74
+          onOk () {
75
+            request({ ...apis.staff.change, urlData: { id: data.userId, type: 'off' } }).then(res => {
76
+              message.info('操作成功')
77
+              props.onFresh()
78
+            })
79
+          },
80
+        });
81
+      }
51 82
     } else {
52 83
       Modal.confirm({
53 84
         title: '确认启用该角色?',
54 85
         okText: '确认',
55 86
         cancelText: '取消',
56 87
         onOk () {
57
-          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 => {
58 89
             message.info('操作成功')
59 90
             props.onFresh()
60 91
           })
@@ -63,6 +94,11 @@ const CartBody = props => {
63 94
     }
64 95
   }
65 96
 
97
+  //迁移私客成功回调
98
+  const moveSuccess = (e) => {
99
+    setVisible(false)
100
+  }
101
+
66 102
   // 员工离职
67 103
   const departure = row => {
68 104
     // 是置业顾问
@@ -95,45 +131,55 @@ const CartBody = props => {
95 131
   }
96 132
 
97 133
   return (
134
+    <div>
135
+      <Card className={Styles.card}>
136
+        <div>
137
+          <Avatar src={data.photo} style={{ width: '0.48rem', height: '0.48rem' }} />
138
+          <AuthButton name="admin.user.put" noRight={null}>
139
+          <Button type="link" style={{ color: '#FF925C', fontSize: '0.106rem', position: 'absolute', top: '40px', left: '0.56rem' }} onClick={toEditStaff(data.userId)}>
140
+            编辑
141
+                  <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
142
+          </Button>
143
+          </AuthButton>
144
+          {/* <Button type="link" style={{ fontSize: ' 0.106rem', color: '#cacaca', position: 'absolute', top: '40px', right: '0' }} onClick={() => departure(data)}>
145
+            离职
146
+                  <Icon type="exclamation-circle" style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
147
+          </Button> */}
148
+          <AuthButton name="admin.user.publish" noRight={null}>
149
+          <Button type="link" style={{ fontSize: ' 0.106rem', color: '#cacaca', position: 'absolute', top: '40px', right: '0' }} onClick={confirm(data)}>
150
+            {data.status === 1 ? '停用' : '启用'}
151
+            <Icon type={data.status === 1 ? 'close-circle' : 'form'} style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
152
+          </Button>
153
+          </AuthButton>
154
+        </div>
155
+        <div>
98 156
 
99
-    <Card className={Styles.card}>
100
-      <div>
101
-        <Avatar src={data.photo} style={{ width: '0.48rem', height: '0.48rem' }} />
102
-        <AuthButton name="admin.user.put" noRight={null}>
103
-        <Button type="link" style={{ color: '#FF925C', fontSize: '0.106rem', position: 'absolute', top: '40px', left: '0.56rem' }} onClick={toEditStaff(data.userId)}>
104
-          编辑
105
-                <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
106
-        </Button>
107
-        </AuthButton>
108
-        {/* <Button type="link" style={{ fontSize: ' 0.106rem', color: '#cacaca', position: 'absolute', top: '40px', right: '0' }} onClick={() => departure(data)}>
109
-          离职
110
-                <Icon type="exclamation-circle" style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
111
-        </Button> */}
112
-        <AuthButton name="admin.user.publish" noRight={null}>
113
-        <Button type="link" style={{ fontSize: ' 0.106rem', color: '#cacaca', position: 'absolute', top: '40px', right: '0' }} onClick={confirm(data)}>
114
-          {data.status === 1 ? '停用' : '启用'}
115
-          <Icon type={data.status === 1 ? 'close-circle' : 'form'} style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
116
-        </Button>
117
-        </AuthButton>
118
-      </div>
119
-      <div>
157
+          <span>
158
+            {
159
+              data.taTagsList.map((item, index) => <Tag className={Styles.cardTag} color={item.tagColor}>{item.tagName}</Tag>)
160
+            }
161
+          </span>
120 162
 
121
-        <span>
122
-          {
123
-            data.taTagsList.map((item, index) => <Tag className={Styles.cardTag} color={item.tagColor}>{item.tagName}</Tag>)
124
-          }
125
-        </span>
126
-
127
-        <p className={Styles.cardText} >姓名 : {data.userName}
128
-        </p>
129
-        {/* <p className={Styles.statusText} > 状态 : {data.status === 1 ? '启用' : '停用'} </p> */}
130
-        <p className={Styles.statusText} > 绑定状态 : {data.miniStatus === 1 ? '已绑定' : '未绑定'} </p>
131
-        <p className={Styles.phoneText} >
132
-          电话 : {data.phone}
133
-        </p>
134
-      </div>
163
+          <p className={Styles.cardText} >姓名 : {data.userName}
164
+          </p>
165
+          {/* <p className={Styles.statusText} > 状态 : {data.status === 1 ? '启用' : '停用'} </p> */}
166
+          <p className={Styles.statusText} > 绑定状态 : {data.miniStatus === 1 ? '已绑定' : '未绑定'} </p>
167
+          <p className={Styles.phoneText} >
168
+            电话 : {data.phone}
169
+          </p>
170
+        </div>
135 171
 
136
-    </Card>
172
+      </Card>
173
+      <Modal
174
+        visible={visible}
175
+        title="分配归属"
176
+        onCancel={() => setVisible(false)}
177
+        footer={null}
178
+        width={900}
179
+      >
180
+          <CustomerChange userId={data.userId} consultantPersonId={data.consultantPersonId} buildingId={data.buildingId} onSuccess={moveSuccess} />
181
+      </Modal>
182
+    </div>
137 183
   )
138 184
 }
139 185
 
@@ -219,6 +265,16 @@ const header = props => {
219 265
           )}
220 266
         </Form.Item>
221 267
 
268
+        <Form.Item>
269
+
270
+          {getFieldDecorator('miniStatus')(
271
+            <Select style={{ width: '180px' }} placeholder="是否绑定" >
272
+              <Option value="0">未绑定</Option>
273
+              <Option value="1">已绑定</Option>
274
+            </Select>,
275
+          )}
276
+        </Form.Item>
277
+
222 278
         <Form.Item>
223 279
         <AuthButton name="admin.user.search" noRight={null}>
224 280
           <Button type="primary" htmlType="submit" className={styles.searchBtn}>

+ 40
- 4
src/pages/staff/list/editStaff.jsx Wyświetl plik

@@ -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

+ 10
- 0
src/services/apis.js Wyświetl plik

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