mysuspendlog.jsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // 项目暂停重启日志弹窗
  2. import React, { Component } from "react";
  3. import { Button, message, Modal, Spin, Table } from "antd";
  4. import { ShowModal } from "../../tools";
  5. import $ from "jquery/src/ajax";
  6. class MySuspendLog extends Component {
  7. constructor(props) {
  8. super(props);
  9. this.state = {
  10. loading: false,
  11. visible: false,
  12. columnsDate: [
  13. {
  14. title: "操作人",
  15. dataIndex: "createName",
  16. key: "createName",
  17. width: 150,
  18. },
  19. {
  20. title: "操作",
  21. dataIndex: "status",
  22. key: "status",
  23. width: 150,
  24. render: (text, record) => {
  25. return (
  26. <span>
  27. {this.props.stopType == 0 ? "项目暂停" : "项目重启"}
  28. <span style={{ color: ["", "green", "red"][text], fontWeight: "bold" }}>
  29. {" " + ["【发起】", "【通过】", "【拒绝】"][text] + " "}
  30. </span>
  31. </span>
  32. );
  33. },
  34. },
  35. {
  36. title: "操作时间",
  37. dataIndex: "createTimes",
  38. key: "createTimes",
  39. width: 150,
  40. },
  41. {
  42. title: "备注",
  43. dataIndex: "reason",
  44. key: "reason",
  45. },
  46. ],
  47. recordData: [],
  48. };
  49. }
  50. componentDidMount() { }
  51. // 日志
  52. getData() {
  53. this.setState({
  54. loading: true,
  55. });
  56. $.ajax({
  57. method: "get",
  58. dataType: "json",
  59. crossDomain: false,
  60. url: globalConfig.context + "/api/admin/orderProject/projectStopList",
  61. data: {
  62. taskStopId: this.props.id,
  63. },
  64. success: function (data) {
  65. ShowModal(this);
  66. if (!data.data) {
  67. if (data.error && data.error.length) {
  68. message.warning(data.error[0].message);
  69. }
  70. } else {
  71. this.setState({
  72. recordData: data.data,
  73. });
  74. }
  75. }.bind(this),
  76. }).always(
  77. function () {
  78. this.setState({
  79. loading: false,
  80. });
  81. }.bind(this)
  82. );
  83. }
  84. render() {
  85. return (
  86. <span>
  87. <Button
  88. type="primary"
  89. onClick={(e) => {
  90. e.stopPropagation();
  91. this.getData();
  92. this.setState({
  93. visible: true,
  94. })
  95. }}
  96. style={{ margin: 5 }}
  97. >
  98. 日志
  99. </Button>
  100. <Modal
  101. maskClosable={false}
  102. visible={this.state.visible}
  103. footer=""
  104. title="操作日志"
  105. className="admin-desc-content"
  106. width="800px"
  107. onCancel={(e) => {
  108. this.setState({
  109. visible: false,
  110. });
  111. }}
  112. style={{ zIndex: 10 }}
  113. >
  114. <Spin spinning={this.state.loading}>
  115. <div className="patent-table">
  116. <Table
  117. columns={this.state.columnsDate}
  118. dataSource={this.state.recordData || []}
  119. pagination={false}
  120. />
  121. </div>
  122. </Spin>
  123. </Modal>
  124. </span>
  125. );
  126. }
  127. }
  128. export default MySuspendLog;