import React,{Component} from "react"; import {Button, message, Modal, Popconfirm, Spin, Table} from "antd"; import $ from "jquery"; class PatentCheck extends Component{ constructor(props) { super(props); this.state={ loading:false, columns:[ { title: '操作人', dataIndex: 'aname', key: 'aname', }, { title: '状态', dataIndex: 'statusName', key: 'statusName', }, { title: '操作时间', dataIndex: 'createTimes', key: 'createTimes', }, { title: '备注', dataIndex: 'remarks', key: 'remarks', }, ], dataSource:[], addProjectCheckLoading:false, } this.addProjectCheck = this.addProjectCheck.bind(this); this.getProjectCheckLog = this.getProjectCheckLog.bind(this); } addProjectCheck(){ this.setState({ addProjectCheckLoading: true, }) $.ajax({ method: 'POST', dataType: 'json', crossDomain: false, url: globalConfig.context + '/api/admin/orderProject/addProjectCheck', data: { tid:this.props.id }, }).done( function (data) { this.setState({ addProjectCheckLoading: false, }) if (!data.error.length) { message.success('发起成功!'); this.props.onRefresh && this.props.onRefresh(); } else { message.warning(data.error[0].message) } }.bind(this) ) } getProjectCheckLog(){ this.setState({ loading: true, }) $.ajax({ method: 'get', dataType: 'json', crossDomain: false, url: globalConfig.context + '/api/admin/orderProject/projectCheckLog', data: { tid:this.props.id }, }).done( function (data) { this.setState({ loading: false, }) if (data.error.length === 0) { this.setState({ dataSource:data.data }) } else { message.warning(data.error[0].message) } }.bind(this) ) } render() { return ( this.props.projectType === 1 && this.props.startType === 1 ? <div style={this.props.style}> <div style={{display:'flex',alignItems:'center',whiteSpace:"nowrap"}}> {/*startType 1供应商 0外包*/} {/*patentTypeName 官费类型名称*/} {/*projectType 项目类型 0正常 1专利 2软著 3审计 */} {/*patentType 专利类型 0专利申请 1专利买卖*/} {/*orderTaskOfficialCost 1含官费 0不含官费*/} {/*orderTaskCostReduction: 1有费减 0无费减*/} <span style={{paddingLeft:'10px',paddingRight:'20px',color:'#4472f5'}}> <span style={{color:"#333"}}>官费类型:</span>{this.props.patentTypeName} </span> <span style={{paddingRight:'20px',color:'#4472f5'}}> { this.props.orderTaskOfficialCost === 1? '有官费' : '不含官费' } </span> {this.props.patentTypeId === 0 || this.props.patentTypeId === 2 ? <span style={{color:'#4472f5'}}> { this.props.orderTaskCostReduction === 1? '有费减' : '无费减' } </span> : null} </div> {this.props.patentType === 0 ? <div style={{display:'flex',alignItems:'center'}}> {/*checkStatus 核对状态 0未发起 1核对中 2核对完成 3已申请付款*/} <span style={{color:'#f00',paddingLeft:'20px',marginRight: '10px',whiteSpace:"nowrap"}}> { this.props.checkStatus === 1 ? '营销员核对中' : this.props.checkStatus === 2 ? '核对已完成' : this.props.checkStatus === 3 ? '已申请付款' : '' } </span> { (this.props.checkStatus === 0 || this.props.checkStatus === 2) && !this.props.isAuditPayment && !this.props.isAuditPaymentGLY ? <Popconfirm title="您确认是否发起核对?发起核对后已发布的官费支付申请将被取消." onConfirm={() => { this.addProjectCheck(); }} okText="发起" cancelText="取消" > <Button loading={this.state.addProjectCheckLoading} onClick={(e) => { e.stopPropagation() }} type="primary" style={{ marginRight: '10px', border: 'none', background:'#f00', }} > 核对 </Button> </Popconfirm> : null } {!this.props.isAuditPayment && !this.props.isAuditPaymentGLY ? <Button loading={this.state.loading} onClick={(e) => { this.setState({ visible:true },()=>{ this.getProjectCheckLog(); }) e.stopPropagation() }} type="primary" style={{ marginRight: '10px', border: 'none', }} > 核对日志 </Button> : null} </div> : null} {this.state.visible ? <Modal title="核对日志" visible={this.state.visible} onCancel={()=>{ this.setState({ visible:false }) }} width={800} footer={null} > <Spin spinning={this.state.loading}> <Table columns={this.state.columns} dataSource={this.state.dataSource} pagination={false} bordered size="small" /> </Spin> </Modal> : null} {!this.props.isAuditPayment && !this.props.isAuditPaymentGLY ? <Button type="primary" style={{ marginLeft: '10px', }} disabled={!(this.props.isPreviewPay && (this.props.status === 1 || parseInt(this.props.startType) === 1) && this.props.orderTaskOfficialCost === 1)} onClick={()=>{ if(this.props.checkStatus === 1){ message.warning('您已发起官费核对,暂不可发起付官费!') }else{ this.props.onPayOfficialExpenses() } }}> 付官费 </Button> : null} </div> : null ) } } export default PatentCheck;