123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- 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 (
- <div className='login'>
- <Form layout="horizontal" id="demand-form">
- <Spin spinning={this.state.loading}>
- <div className="clearfix">
- <FormItem className="half-item" {...formItemLayout} label="标题">
- <span>{theData.name}</span>
- </FormItem>
- </div>
- <div className="clearfix">
- <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="发个成果吧">
- <span>{theData.introduction}</span>
- </FormItem>
- <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="知识产权情况">
- <span>{theData.patentCase}</span>
- </FormItem>
- <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="技术参数">
- <span>{theData.parameter}</span>
- </FormItem>
- <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="团队情况">
- <span>{theData.teamDes}</span>
- </FormItem>
- </div>
- <div className="clearfix">
- <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="关键字">
- <span>{theData.keywords&&theData.keywords.length?(theData.keywords).join(','):''}</span>
- </FormItem>
- </div>
- <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="行业领域">
- <span>{getIndustryCategory(theData.fieldA,theData.fieldB)}</span>
- </FormItem>
- <div className="clearfix">
- <FormItem className="half-item" {...formItemLayout} label="成果类型">
- <span>{getAchievementType(theData.dataCategory)}</span>
- </FormItem>
- <FormItem className="half-item" {...formItemLayout} label="知识产权类型">
- <span>{getAchievementCategory(theData.category)}</span>
- </FormItem>
- <FormItem className="half-item" {...formItemLayout} label="创新度">
- <span>{getInnovation(theData.innovation)}</span>
- </FormItem>
- <FormItem className="half-item" {...formItemLayout} label="成熟度">
- <span>{getMaturity(theData.maturity)}</span>
- </FormItem>
- <FormItem className="half-item" {...formItemLayout} label="交易形式">
- <span>{getTransaction(theData.transferMode)}</span>
- </FormItem>
- </div>
- <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="成果(大图)">
- <div className="clearfix">
- <Upload className="demandDetailShow-upload"
- listType="picture-card"
- fileList={this.state.pictureUrl}
- onPreview={(file) => {
- this.setState({
- previewImage: file.url || file.thumbUrl,
- previewVisible: true,
- });
- }} >
- </Upload>
- <Modal maskClosable={false} footer={null}
- visible={this.state.previewVisible}
- onCancel={() => { this.setState({ previewVisible: false }) }}>
- <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
- </Modal>
- </div>
- </FormItem>
- <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="成果(小图)">
- <div className="clearfix">
- <Upload className="demandDetailShow-upload"
- listType="picture-card"
- fileList={this.state.pictureUrlMin}
- onPreview={(file) => {
- this.setState({
- previewImage: file.url || file.thumbUrl,
- previewVisible: true,
- });
- }} >
- </Upload>
- <Modal maskClosable={false} footer={null}
- visible={this.state.previewVisible}
- onCancel={() => { this.setState({ previewVisible: false }) }}>
- <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
- </Modal>
- </div>
- </FormItem>
- <div className="clearfix">
- <FormItem className="half-item" {...formItemLayout} label="精品成果">
- <span>{theData.boutique?'精品':'非精品'}</span>
- </FormItem>
- <FormItem className="half-item" {...formItemLayout} label="热点成果">
- <span>{theData.isHot?'热点':'非热点'}</span>
- </FormItem>
- </div>
- <div>
- <FormItem className="half-item" {...formItemLayout} label="发布状态">
- <span>{getReleaseStateList(theData.auditStatus)}</span>
- </FormItem>
- </div>
- <div>
- <FormItem className="half-item" labelCol={{ span: 6 }}
- wrapperCol={{ span: 18 }} label="发布位置">
- <span>{getAchievementPosition(theData.publishPages)}</span>
- </FormItem>
- </div>
- <div className="clearfix">
- {this.props.examineState&&<FormItem wrapperCol={{ span: 12, offset: 3 }}>
- <Button className="set-submit" type="primary" onClick={(e)=>{this.updateFun(1)}} >
- 审核通过
- </Button>
- <Button type="danger" style={{marginRight:20}} onClick={(e)=>{this.refuse()}}>
- 审核拒绝
- </Button>
- <Button className="set-submit" type="ghost" onClick={this.cancelFun}>
- 取消
- </Button>
- </FormItem>}
- </div>
- </Spin>
- </Form>
- <Modal
- title="审核拒绝"
- visible={this.state.refuseVisible}
- onOk={this.refuseOk}
- onCancel={this.refuseCancel}
- >
- <div>
- <FormItem labelCol={{ span:4 }} wrapperCol={{ span: 18 }} label="拒绝原因">
- <Input type="textarea" rows={4} value={this.state.refuseValue} placeholder="输入拒绝原因" onChange={(e)=>{this.setState({refuseValue:e.target.value})}}/>
- </FormItem>
- </div>
- </Modal>
- </div>
- )
- }
- }));
- export default DemandDetail;
|