reminderLog.jsx 3.2 KB

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