index.jsx 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. import React,{Component} from "react";
  2. import {Button, message, Modal, Popconfirm, Spin, Table} from "antd";
  3. import $ from "jquery";
  4. class PatentCheck extends Component{
  5. constructor(props) {
  6. super(props);
  7. this.state={
  8. loading:false,
  9. columns:[
  10. {
  11. title: '操作人',
  12. dataIndex: 'aname',
  13. key: 'aname',
  14. },
  15. {
  16. title: '状态',
  17. dataIndex: 'statusName',
  18. key: 'statusName',
  19. },
  20. {
  21. title: '操作时间',
  22. dataIndex: 'createTimes',
  23. key: 'createTimes',
  24. },
  25. {
  26. title: '备注',
  27. dataIndex: 'remarks',
  28. key: 'remarks',
  29. },
  30. ],
  31. dataSource:[]
  32. }
  33. this.addProjectCheck = this.addProjectCheck.bind(this);
  34. this.getProjectCheckLog = this.getProjectCheckLog.bind(this);
  35. }
  36. addProjectCheck(){
  37. this.setState({
  38. loading: true,
  39. })
  40. $.ajax({
  41. method: 'POST',
  42. dataType: 'json',
  43. crossDomain: false,
  44. url: globalConfig.context + '/api/admin/orderProject/addProjectCheck',
  45. data: {
  46. tid:this.props.id
  47. },
  48. }).done(
  49. function (data) {
  50. this.setState({
  51. loading: false,
  52. })
  53. if (!data.error.length) {
  54. message.success('发起成功!')
  55. } else {
  56. message.warning(data.error[0].message)
  57. }
  58. }.bind(this)
  59. )
  60. }
  61. getProjectCheckLog(){
  62. this.setState({
  63. loading: true,
  64. })
  65. $.ajax({
  66. method: 'get',
  67. dataType: 'json',
  68. crossDomain: false,
  69. url: globalConfig.context + '/api/admin/orderProject/projectCheckLog',
  70. data: {
  71. tid:this.props.id
  72. },
  73. }).done(
  74. function (data) {
  75. this.setState({
  76. loading: false,
  77. })
  78. if (data.error.length === 0) {
  79. this.setState({
  80. dataSource:data.data
  81. })
  82. } else {
  83. message.warning(data.error[0].message)
  84. }
  85. }.bind(this)
  86. )
  87. }
  88. render() {
  89. return (
  90. this.props.projectType === 1 ? <div style={this.props.style}>
  91. {/*&& this.props.startType === 1*/}
  92. <div style={{display:'flex',alignItems:'center',paddingBottom:'10px'}}>
  93. <span style={{paddingRight:'15px'}}>官费信息:</span>
  94. {/*startType 1供应商 0外包*/}
  95. {/*orderTaskOfficialCost 1含官费 0不含官费*/}
  96. {/*orderTaskCostReduction: 1有费减 0无费减*/}
  97. <span style={{paddingRight:'20px',color:'#4472f5'}}>
  98. {
  99. this.props.orderTaskOfficialCost === 1?
  100. '有官费' : '不含官费'
  101. }
  102. </span>
  103. <span style={{color:'#4472f5'}}>
  104. {
  105. this.props.orderTaskCostReduction === 1?
  106. '有费减' : '无费减'
  107. }
  108. </span>
  109. </div>
  110. <div style={{display:'flex',alignItems:'center'}}>
  111. <Button
  112. loading={this.state.loading}
  113. onClick={(e) => {
  114. this.setState({
  115. visible:true
  116. },()=>{
  117. this.getProjectCheckLog();
  118. })
  119. e.stopPropagation()
  120. }}
  121. type="primary"
  122. style={{
  123. marginRight: '25px',
  124. border: 'none',
  125. }}
  126. >
  127. 核对日志
  128. </Button>
  129. <div>
  130. <Popconfirm
  131. title="是否发起核对?"
  132. onConfirm={() => {
  133. this.addProjectCheck();
  134. }}
  135. okText="发起"
  136. cancelText="取消"
  137. >
  138. <Button
  139. loading={this.state.loading}
  140. onClick={(e) => {
  141. e.stopPropagation()
  142. }}
  143. type="primary"
  144. style={{
  145. marginRight: '10px',
  146. border: 'none',
  147. }}
  148. >
  149. 核对
  150. </Button>
  151. </Popconfirm>
  152. </div>
  153. </div>
  154. {this.state.visible ? <Modal
  155. title="核对日志"
  156. visible={this.state.visible}
  157. onCancel={()=>{
  158. this.setState({
  159. visible:false
  160. })
  161. }}
  162. width={800}
  163. footer={null}
  164. >
  165. <Spin spinning={this.state.loading}>
  166. <Table
  167. columns={this.state.columns}
  168. dataSource={this.state.dataSource}
  169. pagination={false}
  170. bordered
  171. size="small"
  172. />
  173. </Spin>
  174. </Modal> : null}
  175. </div> : null
  176. )
  177. }
  178. }
  179. export default PatentCheck;