index.jsx 8.5 KB

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