index.jsx 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. addProjectCheckLoading:false,
  33. }
  34. this.addProjectCheck = this.addProjectCheck.bind(this);
  35. this.getProjectCheckLog = this.getProjectCheckLog.bind(this);
  36. }
  37. componentDidUpdate(prevProps, prevState, snapshot) {
  38. console.log(prevProps.checkStatus,'prevProps')
  39. console.log(prevState,'prevState')
  40. console.log('=================================')
  41. }
  42. addProjectCheck(){
  43. this.setState({
  44. addProjectCheckLoading: true,
  45. })
  46. $.ajax({
  47. method: 'POST',
  48. dataType: 'json',
  49. crossDomain: false,
  50. url: globalConfig.context + '/api/admin/orderProject/addProjectCheck',
  51. data: {
  52. tid:this.props.id
  53. },
  54. }).done(
  55. function (data) {
  56. this.setState({
  57. addProjectCheckLoading: false,
  58. })
  59. if (!data.error.length) {
  60. message.success('发起成功!');
  61. this.props.onRefresh && this.props.onRefresh();
  62. } else {
  63. message.warning(data.error[0].message)
  64. }
  65. }.bind(this)
  66. )
  67. }
  68. getProjectCheckLog(){
  69. this.setState({
  70. loading: true,
  71. })
  72. $.ajax({
  73. method: 'get',
  74. dataType: 'json',
  75. crossDomain: false,
  76. url: globalConfig.context + '/api/admin/orderProject/projectCheckLog',
  77. data: {
  78. tid:this.props.id
  79. },
  80. }).done(
  81. function (data) {
  82. this.setState({
  83. loading: false,
  84. })
  85. if (data.error.length === 0) {
  86. this.setState({
  87. dataSource:data.data
  88. })
  89. } else {
  90. message.warning(data.error[0].message)
  91. }
  92. }.bind(this)
  93. )
  94. }
  95. render() {
  96. return (
  97. this.props.projectType === 1 && this.props.startType === 1 ? <div style={this.props.style}>
  98. <div style={{display:'flex',alignItems:'center',whiteSpace:"nowrap"}}>
  99. {/*startType 1供应商 0外包*/}
  100. {/*patentTypeName 官费类型名称*/}
  101. {/*projectType 项目类型 0正常 1专利 2软著 3审计 */}
  102. {/*patentType 专利类型 0专利申请 1专利买卖*/}
  103. {/*orderTaskOfficialCost 1含官费 0不含官费*/}
  104. {/*orderTaskCostReduction: 1有费减 0无费减*/}
  105. <span style={{paddingLeft:'10px',paddingRight:'20px',color:'#4472f5'}}>
  106. <span style={{color:"#333"}}>官费类型:</span>{this.props.patentTypeName}
  107. </span>
  108. <span style={{paddingRight:'20px',color:'#4472f5'}}>
  109. {
  110. this.props.orderTaskOfficialCost === 1?
  111. '有官费' : '不含官费'
  112. }
  113. </span>
  114. <span style={{color:'#4472f5'}}>
  115. {
  116. this.props.orderTaskCostReduction === 1?
  117. '有费减' : '无费减'
  118. }
  119. </span>
  120. </div>
  121. {this.props.patentType === 0 ? <div style={{display:'flex',alignItems:'center'}}>
  122. {/*checkStatus 核对状态 0未发起 1核对中 2核对完成 3已申请付款*/}
  123. <span style={{color:'#f00',paddingLeft:'20px',marginRight: '10px',whiteSpace:"nowrap"}}>
  124. {
  125. this.props.checkStatus === 1 ? '营销员核对中' :
  126. this.props.checkStatus === 2 ? '核对已完成' :
  127. this.props.checkStatus === 3 ? '已申请付款' : ''
  128. }
  129. </span>
  130. {
  131. this.props.checkStatus === 0 || this.props.checkStatus === 2 ?
  132. <Popconfirm
  133. title="是否发起核对?"
  134. onConfirm={() => {
  135. this.addProjectCheck();
  136. }}
  137. okText="发起"
  138. cancelText="取消"
  139. >
  140. <Button
  141. loading={this.state.addProjectCheckLoading}
  142. onClick={(e) => {
  143. e.stopPropagation()
  144. }}
  145. type="primary"
  146. style={{
  147. marginRight: '10px',
  148. border: 'none',
  149. background:'#f00',
  150. }}
  151. >
  152. 核对
  153. </Button>
  154. </Popconfirm> : null
  155. }
  156. <Button
  157. loading={this.state.loading}
  158. onClick={(e) => {
  159. this.setState({
  160. visible:true
  161. },()=>{
  162. this.getProjectCheckLog();
  163. })
  164. e.stopPropagation()
  165. }}
  166. type="primary"
  167. style={{
  168. marginRight: '10px',
  169. border: 'none',
  170. }}
  171. >
  172. 核对日志
  173. </Button>
  174. </div> : null}
  175. {this.state.visible ? <Modal
  176. title="核对日志"
  177. visible={this.state.visible}
  178. onCancel={()=>{
  179. this.setState({
  180. visible:false
  181. })
  182. }}
  183. width={800}
  184. footer={null}
  185. >
  186. <Spin spinning={this.state.loading}>
  187. <Table
  188. columns={this.state.columns}
  189. dataSource={this.state.dataSource}
  190. pagination={false}
  191. bordered
  192. size="small"
  193. />
  194. </Spin>
  195. </Modal> : null}
  196. <Button
  197. type="primary"
  198. style={{
  199. marginLeft: '10px',
  200. }}
  201. disabled={!(this.props.isPreviewPay && (this.props.status === 1 || parseInt(this.props.startType) === 1) && this.props.orderTaskOfficialCost === 1)}
  202. onClick={()=>{
  203. if(this.props.checkStatus === 1){
  204. message.warning('您已发起官费核对,暂不可发起付官费!')
  205. }else{
  206. this.props.onPayOfficialExpenses()
  207. }
  208. }}>
  209. 付官费
  210. </Button>
  211. </div> : null
  212. )
  213. }
  214. }
  215. export default PatentCheck;