reminderLog.jsx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import React from "react";
  2. import {Spin, Table, message, Modal, Tooltip} from "antd";
  3. import $ from "jquery/src/ajax";
  4. import moment from 'moment';
  5. import './customer.less';
  6. const ReminderLog = React.createClass({
  7. getInitialState() {
  8. return {
  9. loading: false,
  10. colunmn: [
  11. {
  12. title: "序号",
  13. dataIndex: "id",
  14. key: "id",
  15. width: 50,
  16. },
  17. {
  18. title: "内容",
  19. dataIndex: "content",
  20. key: "content",
  21. width:700,
  22. render: (text,record) => {
  23. let arr = text.split(',');
  24. return (
  25. <Tooltip
  26. placement="topLeft"
  27. overlayClassName='tooltipContent'
  28. title={arr.map((v,k) => {return (<div key={k} style={{marginBottom:'10px'}}>{v}</div>)})}
  29. >
  30. <div style={{
  31. maxWidth:'700px',
  32. overflow:'hidden',
  33. textOverflow: "ellipsis",
  34. whiteSpace:'nowrap',
  35. }}>{text}</div>
  36. </Tooltip>
  37. )
  38. }
  39. },
  40. {
  41. title: "时间",
  42. dataIndex: "createTime",
  43. key: "createTime",
  44. width: 130,
  45. render: (text) => (
  46. moment(text).format('YYYY-MM-DD HH:mm:ss')
  47. )
  48. }
  49. ]
  50. };
  51. },
  52. loadData() {
  53. this.setState({
  54. loading: true
  55. });
  56. $.ajax({
  57. method: "get",
  58. dataType: "json",
  59. crossDomain: false,
  60. url: globalConfig.context + "/api/admin/patentNew/selectPatentNewLog",
  61. data: {
  62. id: this.props.id,
  63. },
  64. success: function (data) {
  65. if (data.error.length || data.data.list == "") {
  66. if (data.error && data.error.length) {
  67. message.warning(data.error[0].message);
  68. }
  69. } else {
  70. this.setState({
  71. dataSource: data.data,
  72. });
  73. }
  74. }.bind(this),
  75. }).always(
  76. function () {
  77. this.setState({
  78. loading: false,
  79. });
  80. }.bind(this)
  81. );
  82. },
  83. componentWillMount() {
  84. this.loadData()
  85. },
  86. render() {
  87. return (
  88. <Modal
  89. style={{ position: "relative" }}
  90. title='日志'
  91. visible={this.props.visible}
  92. onCancel={this.props.cancel}
  93. footer={null}
  94. width={1000}
  95. destroyOnClose={true}
  96. >
  97. <Spin spinning={this.state.loading} >
  98. <Table
  99. columns={this.state.colunmn}
  100. dataSource={this.state.dataSource}
  101. pagination={false}
  102. scroll={{ x: "max-content", y: 320 }}
  103. bordered
  104. size="small"
  105. />
  106. </Spin>
  107. </Modal>
  108. );
  109. },
  110. });
  111. export default ReminderLog;