resolutionDetail.jsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import React from "react";
  2. import { Spin, Button, Tabs, Table, message, Modal } from "antd";
  3. import $ from "jquery/src/ajax";
  4. const ResolutionDetail = React.createClass({
  5. getInitialState() {
  6. return {
  7. visible: false,
  8. columns: [
  9. {
  10. title: "子项目名称",
  11. dataIndex: "taskName",
  12. key: "taskName"
  13. },
  14. {
  15. title: "子项目数量",
  16. dataIndex: "commodityQuantity",
  17. key: "commodityQuantity"
  18. },
  19. {
  20. title: "拆分操作人",
  21. dataIndex: "splitAname",
  22. key: "splitAname"
  23. },
  24. {
  25. title: "拆分时间人",
  26. dataIndex: "splitTimes",
  27. key: "splitTimes"
  28. }
  29. ]
  30. };
  31. },
  32. componentWillReceiveProps(nextProps) {
  33. this.setState({
  34. visible: nextProps.visible
  35. });
  36. },
  37. componentWillMount() {
  38. this.loadData();
  39. },
  40. loadData() {
  41. this.setState({
  42. loading: true
  43. });
  44. $.ajax({
  45. method: "get",
  46. dataType: "json",
  47. crossDomain: false,
  48. url: globalConfig.context + "/api/admin/orderProject/splitProjectList",
  49. data: {
  50. tid: this.props.detail.id
  51. },
  52. success: function(data) {
  53. let thedata = data.data;
  54. let theArr = [];
  55. if (!thedata) {
  56. if (data.error && data.error.length) {
  57. message.warning(data.error[0].message);
  58. }
  59. } else {
  60. this.setState({
  61. dataSource: thedata
  62. });
  63. }
  64. }.bind(this)
  65. }).always(
  66. function() {
  67. this.setState({
  68. loading: false
  69. });
  70. }.bind(this)
  71. );
  72. },
  73. render() {
  74. return (
  75. <Modal
  76. style={{ position: "relative" }}
  77. title="拆分记录"
  78. visible={this.props.visible}
  79. onCancel={this.props.cancel}
  80. footer={null}
  81. key={"chaifen"}
  82. destroyOnClose={true}
  83. >
  84. <div>
  85. <div>当前项目名称:{this.props.detail.commodityName}</div>
  86. <div>
  87. 当前项目数量:
  88. {this.props.detail.commodityQuantity}
  89. </div>
  90. <div>拆分项目列表:</div>
  91. <Table
  92. columns={this.state.columns}
  93. dataSource={this.state.dataSource}
  94. size="small"
  95. pagination={false}
  96. bordered
  97. />
  98. </div>
  99. </Modal>
  100. );
  101. }
  102. });
  103. export default ResolutionDetail;