resolutionDetail.jsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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: "receiverName",
  27. key: "receiverName"
  28. },
  29. {
  30. title: "拆分时间",
  31. dataIndex: "splitTimes",
  32. key: "splitTimes"
  33. }
  34. ]
  35. };
  36. },
  37. componentWillReceiveProps(nextProps) {
  38. this.setState({
  39. visible: nextProps.visible
  40. });
  41. },
  42. componentWillMount() {
  43. this.loadData();
  44. },
  45. loadData() {
  46. this.setState({
  47. loading: true
  48. });
  49. $.ajax({
  50. method: "get",
  51. dataType: "json",
  52. crossDomain: false,
  53. url: globalConfig.context + "/api/admin/orderProject/splitProjectList",
  54. data: {
  55. tid: this.props.detail.id
  56. },
  57. success: function(data) {
  58. let thedata = data.data;
  59. let theArr = [];
  60. if (!thedata) {
  61. if (data.error && data.error.length) {
  62. message.warning(data.error[0].message);
  63. }
  64. } else {
  65. this.setState({
  66. dataSource: thedata
  67. });
  68. }
  69. }.bind(this)
  70. }).always(
  71. function() {
  72. this.setState({
  73. loading: false
  74. });
  75. }.bind(this)
  76. );
  77. },
  78. render() {
  79. return (
  80. <Modal
  81. style={{ position: "relative" }}
  82. title="拆分记录"
  83. visible={this.props.visible}
  84. onCancel={this.props.cancel}
  85. footer={null}
  86. key={"chaifen"}
  87. destroyOnClose={true}
  88. >
  89. <div>
  90. <div>当前项目名称:{this.props.detail.commodityName}</div>
  91. <div>
  92. 当前项目数量:
  93. {this.props.detail.commodityQuantity}
  94. </div>
  95. <div>拆分项目列表:</div>
  96. <Table
  97. columns={this.state.columns}
  98. dataSource={this.state.dataSource}
  99. size="small"
  100. pagination={false}
  101. bordered
  102. />
  103. </div>
  104. </Modal>
  105. );
  106. }
  107. });
  108. export default ResolutionDetail;