mysuspendlog.jsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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={{
  29. color: text == 1
  30. ? "green" : text == 2
  31. ? "red" : " ", fontWeight: "bold"
  32. }}>
  33. {text == 0
  34. ? "【发起】" : text == 1
  35. ? "【通过】" : text == 2
  36. ? "【拒绝】" : " " }
  37. </span>
  38. </span>
  39. );
  40. },
  41. },
  42. {
  43. title: "操作时间",
  44. dataIndex: "createTimes",
  45. key: "createTimes",
  46. width: 150,
  47. },
  48. {
  49. title: "备注",
  50. dataIndex: "reason",
  51. key: "reason",
  52. },
  53. ],
  54. recordData: [],
  55. };
  56. }
  57. componentDidMount() { }
  58. // 日志
  59. getData() {
  60. this.setState({
  61. loading: true,
  62. });
  63. $.ajax({
  64. method: "get",
  65. dataType: "json",
  66. crossDomain: false,
  67. url: globalConfig.context + "/api/admin/orderProject/projectStopList",
  68. data: {
  69. taskStopId: this.props.id,
  70. },
  71. success: function (data) {
  72. ShowModal(this);
  73. if (!data.data) {
  74. if (data.error && data.error.length) {
  75. message.warning(data.error[0].message);
  76. }
  77. } else {
  78. this.setState({
  79. recordData: data.data,
  80. });
  81. }
  82. }.bind(this),
  83. }).always(
  84. function () {
  85. this.setState({
  86. loading: false,
  87. });
  88. }.bind(this)
  89. );
  90. }
  91. render() {
  92. return (
  93. <span>
  94. <Button
  95. type="primary"
  96. onClick={(e) => {
  97. e.stopPropagation();
  98. this.getData();
  99. this.setState({
  100. visible: true,
  101. })
  102. }}
  103. style={{ margin: 5 }}
  104. >
  105. 日志
  106. </Button>
  107. <Modal
  108. maskClosable={false}
  109. visible={this.state.visible}
  110. footer=""
  111. title="操作日志"
  112. className="admin-desc-content"
  113. width="800px"
  114. onCancel={(e) => {
  115. this.setState({
  116. visible: false,
  117. });
  118. }}
  119. style={{ zIndex: 10 }}
  120. >
  121. <Spin spinning={this.state.loading}>
  122. <div className="patent-table">
  123. <Table
  124. columns={this.state.columnsDate}
  125. dataSource={this.state.recordData || []}
  126. pagination={false}
  127. />
  128. </div>
  129. </Spin>
  130. </Modal>
  131. </span>
  132. );
  133. }
  134. }
  135. export default MySuspendLog;