resolutionDetail.jsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. width="700px"
  84. visible={this.props.visible}
  85. onCancel={this.props.cancel}
  86. footer={null}
  87. key={"chaifen"}
  88. destroyOnClose={true}
  89. >
  90. <Spin spinning={this.state.loading}>
  91. <div>
  92. <div>当前项目名称:{this.props.detail.commodityName}</div>
  93. <div>
  94. 当前项目数量:
  95. {this.props.detail.commodityQuantity}
  96. </div>
  97. <div>拆分项目列表:</div>
  98. <Table
  99. columns={this.state.columns}
  100. dataSource={this.state.dataSource}
  101. size="small"
  102. pagination={false}
  103. bordered
  104. />
  105. </div>
  106. </Spin>
  107. </Modal>
  108. );
  109. }
  110. });
  111. export default ResolutionDetail;