forked from nsjcy/frontEnd/nsjcy

1
liuwh
2020-02-26 b321fc6111c6483e3b2e501620d2e7ffc6a22f15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/**
 * 徐祥健<xuxj@hugeinfo.com.cn>
 * 2018年7月17日 14:57
 *
 */
import React from 'react';
import { Divider, Table, Badge, Modal, Popconfirm } from 'antd';
import MsgReplyView from '../MsgReplyView'
const { Column } = Table;
import './style.scss';
import { domain } from '../../fetch/_fetch';
 
 
export default class MsgView extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      senderId: '',
      visible: false,
    };
  }
 
  componentDidMount() {
 
  }
 
  showModal = (senderId) => {
    this.setState({
      senderId: senderId,
      visible: true
    });
  }
 
  wordOut = (senderId) => {
    location.href = domain + '/api/v1/contact/wordOut?senderId=' + senderId;
  }
 
  handleCancel = (e) => {
    this.setState({
      visible: false,
    });
  }
 
  render() {
    const { senderId } = this.state;
    const { dataSource, msgType, loading } = this.props;
    return (
 
      <div className="table-view-main">
        <Table
          rowKey={record => record.id}
          dataSource={dataSource}
          size='middle'
          pagination={{
            showTotal: total => `共 ${total} 条`
          }}
          loading={loading}
        >
          <Column
            width='10px'
            title=""
            dataIndex="status"
            render={(text, record) => (
              record.count == '0' ? <div className="not-circle"></div> : <div className="circle"></div>
            )}
          />
          <Column
            title="发送人"
            dataIndex="sendName"
            key="sendName"
          />
          <Column
            title="消息内容"
            dataIndex="msgContent"
            key="msgContent"
          />
          <Column
            title="消息类型"
            dataIndex="msgType"
            key="msgType"
          />
          <Column
            title="创建时间"
            dataIndex="createTime"
            key="createTime"
          />
          <Column
            title="操作选项"
            key="action"
            render={(text, record) => (
              <span style={{ cursor: 'pointer' }}>
                <Badge count={record.count} offset={[-5, 3]}>
                  <label onClick={() => this.showModal(record.senderId)} style={{ cursor: 'pointer' }} className="theme-color">回复</label>
                </Badge>
                <Divider type="vertical" />
                <span className="ant-badge">
                  <Popconfirm placement="topRight" title={'你确定要导出该条聊天记录吗'} onConfirm={() => { this.wordOut(record.senderId) }} okText="确定" cancelText="取消">
                    <label className="theme-color" style={{ cursor: 'pointer' }}>导出</label>
                  </Popconfirm>
                </span>
              </span>
            )}
          />
        </Table>
        <Modal
          destroyOnClose
          width='1000px'
          title="咨询回复"
          visible={this.state.visible}
          footer={null}
          onCancel={this.handleCancel}
        >
          <MsgReplyView senderId={senderId} msgType={msgType} />
        </Modal>
      </div>
 
    );
  }
 
}