achievementDetaiel.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. import React from 'react';
  2. import $ from 'jquery/src/ajax';
  3. import {
  4. Modal,
  5. message,
  6. Spin,
  7. Upload,
  8. Input,
  9. Button,
  10. Form,
  11. } from 'antd';
  12. import { getIndustryCategory } from '@/industryList.js';
  13. import { splitUrl ,getMaturity,getAchievementType,getTransaction,getAchievementPosition,getAchievementCategory,getReleaseStateList,getInnovation} from '@/tools.js';
  14. const FormItem = Form.Item;
  15. const DemandDetail = Form.create()(React.createClass({
  16. getInitialState() {
  17. return {
  18. visible: false,
  19. loading: false,
  20. auditStatus: 0,
  21. textFileList: [],
  22. videoFileList: [],
  23. pictureUrl: [],
  24. pictureUrlMin:[]
  25. };
  26. },
  27. loadData(id) {
  28. this.setState({
  29. loading: true
  30. });
  31. $.ajax({
  32. method: "get",
  33. dataType: "json",
  34. crossDomain: false,
  35. url: globalConfig.context + '/api/admin/achievement/achievementDetail' ,
  36. data: {
  37. id: id
  38. },
  39. success: function (data) {
  40. let thisData = data.data;
  41. if (!thisData) {
  42. if (data.error && data.error.length) {
  43. message.warning(data.error[0].message);
  44. };
  45. thisData = {};
  46. };
  47. let publishPagesArr = [];
  48. thisData.publishPages.map(item=>{
  49. publishPagesArr.push(item.publishPage)
  50. })
  51. this.setState({
  52. id:thisData.id,
  53. publishPagesArr:publishPagesArr,
  54. data: thisData,
  55. isHot:thisData.isHot,
  56. isUrgent:thisData.isUrgent,
  57. status:thisData.status,
  58. isHot:thisData.isHot,
  59. pictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  60. pictureUrlMin: thisData.pictureUrlMin ? splitUrl(thisData.pictureUrlMin, ',', globalConfig.avatarHost + '/upload') : []
  61. });
  62. }.bind(this),
  63. }).always(function () {
  64. this.setState({
  65. loading: false
  66. });
  67. }.bind(this));
  68. },
  69. getPictureUrl(e) {
  70. this.setState({ pictureUrl: e });
  71. },
  72. cancelFun(){
  73. this.props.closeDesc();
  74. },
  75. //审核通过/拒绝
  76. updateFun(index){
  77. this.setState({
  78. loading:true
  79. })
  80. $.ajax({
  81. method: "post",
  82. dataType: "JSON",
  83. crossDomain: false,
  84. url: globalConfig.context + '/api/admin/achievement/audit',
  85. data: {
  86. id: this.state.id,
  87. auditResult:index,
  88. auditInfo:this.state.refuseValue
  89. }
  90. }).done(function (data) {
  91. if (!data.error.length) {
  92. message.success('操作成功!');
  93. this.setState({
  94. loading: false,
  95. });
  96. this.props.handOk()
  97. } else {
  98. message.warning(data.error[0].message);
  99. };
  100. }.bind(this));
  101. },
  102. //审核拒绝
  103. refuse(){
  104. this.setState({
  105. refuseValue:'',
  106. refuseVisible:true
  107. })
  108. },
  109. refuseOk(){
  110. if(!this.state.refuseValue){
  111. message.warning('请填写拒绝原因。')
  112. return;
  113. }
  114. this.setState({
  115. refuseVisible:false
  116. })
  117. this.updateFun(0)
  118. },
  119. refuseCancel(){
  120. this.setState({
  121. refuseValue:'',
  122. refuseVisible:false
  123. })
  124. },
  125. componentWillMount() {
  126. if (this.props.data.id) {
  127. this.loadData(this.props.data.id);
  128. } else {
  129. this.state.data = {};
  130. };
  131. },
  132. componentWillReceiveProps(nextProps) {
  133. if (!this.props.visible && nextProps.visible) {
  134. this.state.textFileList = [];
  135. this.state.videoFileList = [];
  136. if (nextProps.data.id) {
  137. this.loadData(nextProps.data.id);
  138. } else {
  139. this.state.data = {};
  140. this.state.pictureUrl = [];
  141. this.state.pictureUrlMin=[];
  142. };
  143. this.props.form.resetFields();
  144. };
  145. },
  146. render() {
  147. const theData = this.state.data || {};
  148. const { getFieldDecorator } = this.props.form;
  149. const FormItem = Form.Item
  150. const formItemLayout = {
  151. labelCol: { span: 6 },
  152. wrapperCol: { span: 12 },
  153. };
  154. return (
  155. <div className='login'>
  156. <Form layout="horizontal" id="demand-form">
  157. <Spin spinning={this.state.loading}>
  158. <div className="clearfix">
  159. <FormItem className="half-item" {...formItemLayout} label="标题">
  160. <span>{theData.name}</span>
  161. </FormItem>
  162. </div>
  163. <div className="clearfix">
  164. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="发个成果吧">
  165. <span>{theData.introduction}</span>
  166. </FormItem>
  167. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="知识产权情况">
  168. <span>{theData.patentCase}</span>
  169. </FormItem>
  170. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="技术参数">
  171. <span>{theData.parameter}</span>
  172. </FormItem>
  173. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="团队情况">
  174. <span>{theData.teamDes}</span>
  175. </FormItem>
  176. </div>
  177. <div className="clearfix">
  178. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="关键字">
  179. <span>{theData.keywords&&theData.keywords.length?(theData.keywords).join(','):''}</span>
  180. </FormItem>
  181. </div>
  182. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="行业领域">
  183. <span>{getIndustryCategory(theData.fieldA,theData.fieldB)}</span>
  184. </FormItem>
  185. <div className="clearfix">
  186. <FormItem className="half-item" {...formItemLayout} label="成果类型">
  187. <span>{getAchievementType(theData.dataCategory)}</span>
  188. </FormItem>
  189. <FormItem className="half-item" {...formItemLayout} label="知识产权类型">
  190. <span>{getAchievementCategory(theData.category)}</span>
  191. </FormItem>
  192. <FormItem className="half-item" {...formItemLayout} label="创新度">
  193. <span>{getInnovation(theData.innovation)}</span>
  194. </FormItem>
  195. <FormItem className="half-item" {...formItemLayout} label="成熟度">
  196. <span>{getMaturity(theData.maturity)}</span>
  197. </FormItem>
  198. <FormItem className="half-item" {...formItemLayout} label="交易形式">
  199. <span>{getTransaction(theData.transferMode)}</span>
  200. </FormItem>
  201. </div>
  202. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="成果(大图)">
  203. <div className="clearfix">
  204. <Upload className="demandDetailShow-upload"
  205. listType="picture-card"
  206. fileList={this.state.pictureUrl}
  207. onPreview={(file) => {
  208. this.setState({
  209. previewImage: file.url || file.thumbUrl,
  210. previewVisible: true,
  211. });
  212. }} >
  213. </Upload>
  214. <Modal maskClosable={false} footer={null}
  215. visible={this.state.previewVisible}
  216. onCancel={() => { this.setState({ previewVisible: false }) }}>
  217. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  218. </Modal>
  219. </div>
  220. </FormItem>
  221. <FormItem labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} label="成果(小图)">
  222. <div className="clearfix">
  223. <Upload className="demandDetailShow-upload"
  224. listType="picture-card"
  225. fileList={this.state.pictureUrlMin}
  226. onPreview={(file) => {
  227. this.setState({
  228. previewImage: file.url || file.thumbUrl,
  229. previewVisible: true,
  230. });
  231. }} >
  232. </Upload>
  233. <Modal maskClosable={false} footer={null}
  234. visible={this.state.previewVisible}
  235. onCancel={() => { this.setState({ previewVisible: false }) }}>
  236. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  237. </Modal>
  238. </div>
  239. </FormItem>
  240. <div className="clearfix">
  241. <FormItem className="half-item" {...formItemLayout} label="精品成果">
  242. <span>{theData.boutique?'精品':'非精品'}</span>
  243. </FormItem>
  244. <FormItem className="half-item" {...formItemLayout} label="热点成果">
  245. <span>{theData.isHot?'热点':'非热点'}</span>
  246. </FormItem>
  247. </div>
  248. <div>
  249. <FormItem className="half-item" {...formItemLayout} label="发布状态">
  250. <span>{getReleaseStateList(theData.auditStatus)}</span>
  251. </FormItem>
  252. </div>
  253. <div>
  254. <FormItem className="half-item" labelCol={{ span: 6 }}
  255. wrapperCol={{ span: 18 }} label="发布位置">
  256. <span>{getAchievementPosition(theData.publishPages)}</span>
  257. </FormItem>
  258. </div>
  259. <div className="clearfix">
  260. {this.props.examineState&&<FormItem wrapperCol={{ span: 12, offset: 3 }}>
  261. <Button className="set-submit" type="primary" onClick={(e)=>{this.updateFun(1)}} >
  262. 审核通过
  263. </Button>
  264. <Button type="danger" style={{marginRight:20}} onClick={(e)=>{this.refuse()}}>
  265. 审核拒绝
  266. </Button>
  267. <Button className="set-submit" type="ghost" onClick={this.cancelFun}>
  268. 取消
  269. </Button>
  270. </FormItem>}
  271. </div>
  272. </Spin>
  273. </Form>
  274. <Modal
  275. title="审核拒绝"
  276. visible={this.state.refuseVisible}
  277. onOk={this.refuseOk}
  278. onCancel={this.refuseCancel}
  279. >
  280. <div>
  281. <FormItem labelCol={{ span:4 }} wrapperCol={{ span: 18 }} label="拒绝原因">
  282. <Input type="textarea" rows={4} value={this.state.refuseValue} placeholder="输入拒绝原因" onChange={(e)=>{this.setState({refuseValue:e.target.value})}}/>
  283. </FormItem>
  284. </div>
  285. </Modal>
  286. </div>
  287. )
  288. }
  289. }));
  290. export default DemandDetail;