index.jsx 8.2 KB

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