import React from 'react'; import $ from 'jquery/src/ajax'; import { Modal, message, Spin, Upload, Input, Button, Form, } from 'antd'; import { getIndustryCategory } from '@/industryList.js'; import { splitUrl ,getMaturity,getAchievementType,getTransaction,getAchievementPosition,getAchievementCategory,getReleaseStateList,getInnovation} from '@/tools.js'; const FormItem = Form.Item; const DemandDetail = Form.create()(React.createClass({ getInitialState() { return { visible: false, loading: false, auditStatus: 0, textFileList: [], videoFileList: [], pictureUrl: [], pictureUrlMin:[] }; }, loadData(id) { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/achievement/achievementDetail' , data: { id: id }, success: function (data) { let thisData = data.data; if (!thisData) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thisData = {}; }; let publishPagesArr = []; thisData.publishPages.map(item=>{ publishPagesArr.push(item.publishPage) }) this.setState({ id:thisData.id, publishPagesArr:publishPagesArr, data: thisData, isHot:thisData.isHot, isUrgent:thisData.isUrgent, status:thisData.status, isHot:thisData.isHot, pictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [], pictureUrlMin: thisData.pictureUrlMin ? splitUrl(thisData.pictureUrlMin, ',', globalConfig.avatarHost + '/upload') : [] }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getPictureUrl(e) { this.setState({ pictureUrl: e }); }, cancelFun(){ this.props.closeDesc(); }, //审核通过/拒绝 updateFun(index){ this.setState({ loading:true }) $.ajax({ method: "post", dataType: "JSON", crossDomain: false, url: globalConfig.context + '/api/admin/achievement/audit', data: { id: this.state.id, auditResult:index, auditInfo:this.state.refuseValue } }).done(function (data) { if (!data.error.length) { message.success('操作成功!'); this.setState({ loading: false, }); this.props.handOk() } else { message.warning(data.error[0].message); }; }.bind(this)); }, //审核拒绝 refuse(){ this.setState({ refuseValue:'', refuseVisible:true }) }, refuseOk(){ if(!this.state.refuseValue){ message.warning('请填写拒绝原因。') return; } this.setState({ refuseVisible:false }) this.updateFun(0) }, refuseCancel(){ this.setState({ refuseValue:'', refuseVisible:false }) }, componentWillMount() { if (this.props.data.id) { this.loadData(this.props.data.id); } else { this.state.data = {}; }; }, componentWillReceiveProps(nextProps) { if (!this.props.visible && nextProps.visible) { this.state.textFileList = []; this.state.videoFileList = []; if (nextProps.data.id) { this.loadData(nextProps.data.id); } else { this.state.data = {}; this.state.pictureUrl = []; this.state.pictureUrlMin=[]; }; this.props.form.resetFields(); }; }, render() { const theData = this.state.data || {}; const { getFieldDecorator } = this.props.form; const FormItem = Form.Item const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 12 }, }; return (