transferRecords.jsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. import React from "react";
  2. import {Spin, Table, message, Modal, Tooltip} from "antd";
  3. import $ from "jquery/src/ajax";
  4. import {getTransferType} from '@/tools.js';
  5. const TransferRecords = 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: "userName",
  18. key: "userName",
  19. },
  20. {
  21. title: "原管理员",
  22. dataIndex: "usedAName",
  23. key: "usedAName",
  24. },
  25. {
  26. title: "现管理员",
  27. dataIndex: "newAName",
  28. key: "newAName",
  29. },
  30. {
  31. title: "转交类型",
  32. dataIndex: "type",
  33. key: "type",
  34. render: text => {
  35. return (
  36. <span>
  37. {getTransferType(text)}
  38. </span>
  39. )
  40. }
  41. },
  42. {
  43. title: "项目名称",
  44. dataIndex: "pName",
  45. key: "pName",
  46. },
  47. {
  48. title: "创建时间",
  49. dataIndex: "createDate",
  50. key: "createDate",
  51. },
  52. {
  53. title: "备注",
  54. dataIndex: "remarks",
  55. key: "remarks",
  56. render: (text) => {
  57. return (
  58. <Tooltip placement="topLeft" title={text}>
  59. <div style={{
  60. maxWidth:'150px',
  61. overflow:'hidden',
  62. textOverflow: "ellipsis",
  63. whiteSpace:'nowrap',
  64. }}>{text}</div>
  65. </Tooltip>
  66. )
  67. }
  68. },
  69. ]
  70. };
  71. },
  72. loadData() {
  73. this.setState({
  74. loading: true
  75. });
  76. $.ajax({
  77. method: "get",
  78. dataType: "json",
  79. crossDomain: false,
  80. url: globalConfig.context + "/api/admin/customer/transferList",
  81. data: {
  82. uid: this.props.id,
  83. },
  84. success: function (data) {
  85. if (data.error.length || data.data.list == "") {
  86. if (data.error && data.error.length) {
  87. message.warning(data.error[0].message);
  88. }
  89. } else {
  90. this.setState({
  91. dataSource: data.data,
  92. });
  93. }
  94. }.bind(this),
  95. }).always(
  96. function () {
  97. this.setState({
  98. loading: false,
  99. });
  100. }.bind(this)
  101. );
  102. },
  103. componentWillMount() {
  104. this.loadData()
  105. },
  106. render() {
  107. return (
  108. <Modal
  109. style={{ position: "relative" }}
  110. // title={this.props.type === 1 ? '转交记录' : this.props.type === 2 ? '回收记录' : '分配记录'}
  111. title='日志'
  112. visible={this.props.visible}
  113. onCancel={this.props.cancel}
  114. footer={null}
  115. width={1000}
  116. destroyOnClose={true}
  117. >
  118. <Spin spinning={this.state.loading} >
  119. <Table
  120. columns={this.state.colunmn}
  121. dataSource={this.state.dataSource}
  122. pagination={false}
  123. scroll={{ x: "max-content", y: 0 }}
  124. bordered
  125. size="small"
  126. />
  127. </Spin>
  128. </Modal>
  129. );
  130. },
  131. });
  132. export default TransferRecords;