projectLog.jsx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import React,{Component} from "react";
  2. import {message, Modal, Spin, Table} from "antd";
  3. import $ from "jquery/src/ajax";
  4. class ProjectLog extends Component{
  5. constructor(props) {
  6. super(props);
  7. this.state={
  8. loading:false,
  9. dataSource:[],
  10. colunmn:[
  11. {
  12. title: "序号",
  13. dataIndex: "key",
  14. key: "key",
  15. },
  16. // {
  17. // title: "客户姓名",
  18. // dataIndex: "key",
  19. // key: "key",
  20. // },
  21. // {
  22. // title: "项目名称",
  23. // dataIndex: "key",
  24. // key: "key",
  25. // },
  26. {
  27. title: "操作人",
  28. dataIndex: "aName",
  29. key: "aName",
  30. },
  31. {
  32. title: "接收人",
  33. dataIndex: "receiveName",
  34. key: "receiveName",
  35. },
  36. {
  37. title: "操作类型",
  38. dataIndex: "statusName",
  39. key: "statusName",
  40. },
  41. {
  42. title: "操作时间",
  43. dataIndex: "createTimes",
  44. key: "createTimes",
  45. },
  46. ]
  47. }
  48. this.loadData = this.loadData.bind(this);
  49. }
  50. loadData() {
  51. this.setState({
  52. loading: true
  53. });
  54. $.ajax({
  55. method: "get",
  56. dataType: "json",
  57. crossDomain: false,
  58. url: globalConfig.context + "/api/admin/orderProject/taskAttributionLog",
  59. data: {
  60. tid: this.props.projectLogId,
  61. },
  62. success: function (data) {
  63. if (data.error && data.error.length) {
  64. message.warning(data.error[0].message);
  65. }else{
  66. let theArr = [];
  67. for (let i = 0; i < data.data.length; i++) {
  68. let thisdata = data.data[i];
  69. thisdata.key = i+1 ;
  70. theArr.push(thisdata)
  71. }
  72. this.setState({
  73. dataSource: theArr,
  74. })
  75. }
  76. }.bind(this),
  77. }).always(
  78. function () {
  79. this.setState({
  80. loading: false,
  81. });
  82. }.bind(this)
  83. );
  84. }
  85. componentDidMount() {
  86. this.loadData();
  87. }
  88. render() {
  89. return (
  90. <Modal
  91. style={{ position: "relative" }}
  92. title="项目日志"
  93. visible={this.props.visible}
  94. onCancel={this.props.onCancel}
  95. footer={null}
  96. width={800}
  97. destroyOnClose={true}
  98. >
  99. <Spin spinning={this.state.loading} >
  100. <Table
  101. columns={this.state.colunmn}
  102. dataSource={this.state.dataSource}
  103. pagination={false}
  104. scroll={{ x: "max-content", y: 0 }}
  105. bordered
  106. size="small"
  107. />
  108. </Spin>
  109. </Modal>
  110. )
  111. }
  112. }
  113. export default ProjectLog;