/**
|
* 徐祥健<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>
|
|
);
|
}
|
|
}
|