mainBusinessLog.jsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import React,{Component} from "react";
  2. import {message, Modal, Spin, Table, Tooltip} from "antd";
  3. import $ from "jquery/src/ajax";
  4. class MainBusinessLog extends Component{
  5. constructor(props) {
  6. super(props);
  7. this.state={
  8. loading: false,
  9. dataSource:[],
  10. columns:[
  11. {
  12. title: '序号',
  13. dataIndex: 'id',
  14. key: 'id',
  15. },
  16. {
  17. title: '内容',
  18. dataIndex: 'remarks',
  19. key: 'remarks',
  20. width:500,
  21. render: text => {
  22. return (
  23. <Tooltip title={text}>
  24. <div style={{
  25. maxWidth:'500px',
  26. overflow:'hidden',
  27. textOverflow: "ellipsis",
  28. whiteSpace:'nowrap',
  29. }}>{text}</div>
  30. </Tooltip>
  31. )
  32. }
  33. },
  34. {
  35. title: '时间',
  36. dataIndex: 'createTimes',
  37. key: 'createTimes',
  38. },
  39. ],
  40. }
  41. }
  42. loadData() {
  43. this.setState({
  44. loading: true,
  45. });
  46. $.ajax({
  47. method: 'get',
  48. dataType: "json",
  49. crossDomain: false,
  50. url: globalConfig.context + '/api/admin/customer/userDateLogList',
  51. data:{
  52. uid:this.props.uid
  53. },
  54. success: function(data) {
  55. if(data.error.length === 0){
  56. this.setState({
  57. dataSource: data.data,
  58. });
  59. }else{
  60. message.warning(data.error[0].message);
  61. }
  62. }.bind(this),
  63. }).always(function() {
  64. this.setState({
  65. loading: false
  66. });
  67. }.bind(this));
  68. }
  69. componentDidMount() {
  70. this.loadData();
  71. }
  72. render() {
  73. return (
  74. <Modal
  75. maskClosable={false}
  76. className="customeDetails"
  77. footer=""
  78. title="主营日志"
  79. width="800px"
  80. visible={this.props.visible}
  81. onOk={this.props.onCancel}
  82. onCancel={this.props.onCancel}
  83. >
  84. <div>
  85. <Spin spinning={this.state.loading}>
  86. <Table
  87. size="middle"
  88. columns={this.state.columns}
  89. dataSource={this.state.dataSource}
  90. />
  91. </Spin>
  92. </div>
  93. </Modal>
  94. )
  95. }
  96. }
  97. export default MainBusinessLog;