changelog.jsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import React from "react";
  2. import {
  3. Button,
  4. Input,
  5. message,
  6. Modal,
  7. Popconfirm,
  8. Spin,
  9. Table,
  10. Tooltip,
  11. } from "antd";
  12. import $ from "jquery/src/ajax";
  13. const ChangeLog = React.createClass({
  14. getInitialState() {
  15. return {
  16. visible: false,
  17. enterpriseName: "",
  18. loading: false,
  19. colunmn: [
  20. {
  21. title: "操作人名称",
  22. dataIndex: "adminName",
  23. key: "adminName",
  24. },
  25. {
  26. title: "客户名称",
  27. dataIndex: "name",
  28. key: "name",
  29. render: (text) => {
  30. return (
  31. <Tooltip title={text}>
  32. <div
  33. // style={{
  34. // maxWidth: "150px",
  35. // overflow: "hidden",
  36. // textOverflow: "ellipsis",
  37. // whiteSpace: "nowrap",
  38. // }}
  39. >
  40. {text}
  41. </div>
  42. </Tooltip>
  43. );
  44. },
  45. },
  46. {
  47. title: "操作时间",
  48. dataIndex: "createTimes",
  49. key: "createTimes",
  50. },
  51. ],
  52. dataSource: [],
  53. };
  54. },
  55. loadData() {
  56. this.setState({
  57. loading: true,
  58. });
  59. $.ajax({
  60. method: "get",
  61. dataType: "json",
  62. crossDomain: false,
  63. url: globalConfig.context + "/api/admin/customer/listUserName",
  64. data: {
  65. uid: this.props.id,
  66. },
  67. success: function (data) {
  68. if (data.error.length || data.data.list == "") {
  69. if (data.error && data.error.length) {
  70. message.warning(data.error[0].message);
  71. }
  72. } else {
  73. this.setState({
  74. initialName: data.data[0] ? data.data[0].name : "",
  75. });
  76. data.data.splice(0, 1);
  77. this.setState({
  78. dataSource: data.data,
  79. });
  80. }
  81. }.bind(this),
  82. }).always(
  83. function () {
  84. this.setState({
  85. loading: false,
  86. });
  87. }.bind(this)
  88. );
  89. },
  90. componentWillMount() {
  91. this.loadData();
  92. },
  93. render() {
  94. return (
  95. <Modal
  96. footer={null}
  97. maskClosable={false}
  98. width={"1200px"}
  99. title={"更名日志"}
  100. visible={this.props.visible == "changelog"}
  101. onCancel={this.props.cancel}
  102. >
  103. <div>
  104. <div>
  105. {this.state.initialName ? (
  106. <div style={{ paddingBottom: "20px" }}>
  107. 初始客户名称:{this.state.initialName}
  108. </div>
  109. ) : null}
  110. <Spin spinning={this.state.loading}>
  111. <Table
  112. columns={this.state.colunmn}
  113. dataSource={this.state.dataSource}
  114. pagination={false}
  115. scroll={{ x: "max-content", y: 0 }}
  116. bordered
  117. size="small"
  118. />
  119. </Spin>
  120. </div>
  121. </div>
  122. </Modal>
  123. );
  124. },
  125. });
  126. export default ChangeLog;