|
@@ -1,11 +1,12 @@
|
|
|
import React from 'react';
|
|
|
-import { Icon, Tooltip, Modal, message, Spin, Upload, Input, InputNumber, Select, DatePicker, Button, Radio, Form, Cascader, Tag } from 'antd';
|
|
|
+import { Icon, Tooltip, Modal, message, AutoComplete, Spin, Upload, Input, InputNumber, Select, DatePicker, Button, Radio, Form, Cascader, Tag } from 'antd';
|
|
|
import moment from 'moment';
|
|
|
import './techAchievement.less';
|
|
|
import ajax from 'jquery/src/ajax/xhr.js';
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
import { IndustryObject, getIndustryCategory } from '../../DicIndustryList.js';
|
|
|
import { beforeUploadFile, splitUrl, companySearch, getAchievementCategory } from '../../tools.js';
|
|
|
+import throttle from '../../throttle.js';
|
|
|
|
|
|
const KeyWordTagGroup = React.createClass({
|
|
|
getInitialState() {
|
|
@@ -30,9 +31,9 @@ const KeyWordTagGroup = React.createClass({
|
|
|
const state = this.state;
|
|
|
const inputValue = state.inputValue;
|
|
|
let tags = state.tags;
|
|
|
- if (inputValue && tags.indexOf(inputValue) === -1) {
|
|
|
- tags = [...tags, inputValue];
|
|
|
- }
|
|
|
+ if (inputValue && tags.indexOf(inputValue) === -1 && inputValue.replace(/(^\s*)|(\s*$)/g, "").length != 0) {
|
|
|
+ tags = [...tags, inputValue.replace(/(^\s*)|(\s*$)/g, "")];
|
|
|
+ };
|
|
|
this.props.tagsArr(tags);
|
|
|
this.setState({
|
|
|
tags,
|
|
@@ -151,7 +152,7 @@ const AchievementDetailShow = Form.create()(React.createClass({
|
|
|
method: "get",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
- url: globalConfig.context + "/api/admin/achievement/detail",
|
|
|
+ url: globalConfig.context + this.props.detailApiUrl,
|
|
|
data: {
|
|
|
id: id
|
|
|
},
|
|
@@ -523,7 +524,7 @@ const AchievementDetailShow = Form.create()(React.createClass({
|
|
|
})()}
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
- {theData.ownerType == "1" ? <div className="clearfix">
|
|
|
+ {theData.ownerType == "0" ? <div className="clearfix">
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
label="所属组织名称" >
|
|
@@ -737,7 +738,7 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
method: "get",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
- url: globalConfig.context + "/api/admin/achievement/detail",
|
|
|
+ url: globalConfig.context + this.props.detailApiUrl,
|
|
|
data: {
|
|
|
id: id
|
|
|
},
|
|
@@ -763,6 +764,70 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
});
|
|
|
}.bind(this));
|
|
|
},
|
|
|
+ getCompanyList() {
|
|
|
+ this.setState({
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + "/api/admin/demand/unitNames",
|
|
|
+ success: function (data) {
|
|
|
+ let theArr = [];
|
|
|
+ if (!data.data) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ data.data.map(function (item) {
|
|
|
+ theArr.push(
|
|
|
+ <Select.Option value={item.uid} key={item.uid}>{item.unitName}</Select.Option>
|
|
|
+ )
|
|
|
+ });
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ companyOption: theArr
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ }).always(function () {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ getUserList() {
|
|
|
+ this.setState({
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + "/api/admin/demand/userNames",
|
|
|
+ success: function (data) {
|
|
|
+ let theArr = [];
|
|
|
+ if (!data.data) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ data.data.map(function (item) {
|
|
|
+ theArr.push(
|
|
|
+ <Select.Option value={item.uid} key={item.uid}>{item.username}</Select.Option>
|
|
|
+ )
|
|
|
+ });
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ userOption: theArr
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ }).always(function () {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
getTagsArr(e) {
|
|
|
this.setState({ tags: e });
|
|
|
},
|
|
@@ -772,6 +837,12 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
getTechnicalPictureUrl(e) {
|
|
|
this.setState({ technicalPictureUrl: e });
|
|
|
},
|
|
|
+ handleSearch(e) {
|
|
|
+ console.log(e);
|
|
|
+ },
|
|
|
+ therottleSearch(e) {
|
|
|
+ throttle(this.handleSearch, 500).bind(this);
|
|
|
+ },
|
|
|
handleSubmit(e) {
|
|
|
e.preventDefault();
|
|
|
this.props.form.validateFields((err, values) => {
|
|
@@ -812,6 +883,7 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
serialNumber: this.props.data.serialNumber,
|
|
|
name: values.name,
|
|
|
keyword: this.state.tags ? this.state.tags.join(",") : [],
|
|
|
+ keywords: this.state.tags,
|
|
|
category: values.category,
|
|
|
summary: values.summary,
|
|
|
introduction: values.introduction,
|
|
@@ -823,12 +895,8 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
maturityTextFileUrl: this.state.maturityTextFileUrl,
|
|
|
maturityVideoUrl: values.maturityVideoUrl,
|
|
|
innovation: values.innovation,
|
|
|
- ownerName: values.ownerName,
|
|
|
+ ownerId: values.ownerId,
|
|
|
ownerType: values.ownerType,
|
|
|
- ownerIdNumber: values.ownerIdNumber,
|
|
|
- ownerMobile: values.ownerMobile,
|
|
|
- ownerEmail: values.ownerEmail,
|
|
|
- ownerPostalAddress: values.ownerPostalAddress,
|
|
|
cooperationMode: values.cooperationMode,
|
|
|
transferMode: values.transferMode,
|
|
|
bargainingMode: values.bargainingMode,
|
|
@@ -839,12 +907,6 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
awards: values.awards,
|
|
|
teamDes: values.teamDes,
|
|
|
parameter: values.parameter,
|
|
|
- orgId: values.orgId,
|
|
|
- orgName: values.orgName,
|
|
|
- orgAddress: values.orgAddress,
|
|
|
- orgEmail: values.orgEmail,
|
|
|
- orgContacts: values.orgContacts,
|
|
|
- orgContactsMobile: values.orgContactsMobile,
|
|
|
releaseStatus: values.releaseStatus,
|
|
|
techPlanUrl: this.state.techPlanUrl,
|
|
|
businessPlanUrl: this.state.businessPlanUrl,
|
|
@@ -866,6 +928,8 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
});
|
|
|
},
|
|
|
componentWillMount() {
|
|
|
+ this.getCompanyList();
|
|
|
+ this.getUserList();
|
|
|
if (this.props.data.id) {
|
|
|
this.loadData(this.props.data.id);
|
|
|
} else {
|
|
@@ -1116,58 +1180,6 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
<Input />
|
|
|
)}
|
|
|
</FormItem>
|
|
|
- <div className="clearfix" >
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="成果所有人名称" >
|
|
|
- {getFieldDecorator('ownerName', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.ownerName
|
|
|
- })(
|
|
|
- <Input />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="所有人证件号" >
|
|
|
- {getFieldDecorator('ownerIdNumber', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.ownerIdNumber
|
|
|
- })(
|
|
|
- <Input />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="所有人联系电话" >
|
|
|
- {getFieldDecorator('ownerMobile', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.ownerMobile
|
|
|
- })(
|
|
|
- <Input />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="所有人电子邮箱" >
|
|
|
- {getFieldDecorator('ownerEmail', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.ownerEmail
|
|
|
- })(
|
|
|
- <Input />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="所有人通信地址" >
|
|
|
- {getFieldDecorator('ownerPostalAddress', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.ownerPostalAddress
|
|
|
- })(
|
|
|
- <Input />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- </div>
|
|
|
<div className="clearfix">
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
@@ -1176,57 +1188,26 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
initialValue: theData.ownerType
|
|
|
})(
|
|
|
- <Radio.Group onChange={(e) => { this.setState({ orgDisplay: e.target.value }); }}>
|
|
|
+ <Radio.Group>
|
|
|
<Radio value="0">个人</Radio>
|
|
|
<Radio value="1">组织</Radio>
|
|
|
</Radio.Group>
|
|
|
)}
|
|
|
</FormItem>
|
|
|
</div>
|
|
|
- <div className="clearfix" style={{ display: this.state.orgDisplay == '1' ? 'block' : 'none' }}>
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="所属组织名称" >
|
|
|
- {getFieldDecorator('orgName', {
|
|
|
- initialValue: theData.orgName
|
|
|
- })(
|
|
|
- <Input />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="所属组织地址" >
|
|
|
- {getFieldDecorator('orgAddress', {
|
|
|
- initialValue: theData.orgAddress
|
|
|
- })(
|
|
|
- <Input />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="所属组织邮箱" >
|
|
|
- {getFieldDecorator('orgEmail', {
|
|
|
- initialValue: theData.orgEmail
|
|
|
- })(
|
|
|
- <Input />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="所属组织联系人名称" >
|
|
|
- {getFieldDecorator('orgContacts', {
|
|
|
- initialValue: theData.orgContacts
|
|
|
- })(
|
|
|
- <Input />
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
+ <div className="clearfix" >
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
- label="所属组织联系人电话" >
|
|
|
- {getFieldDecorator('orgContactsMobile', {
|
|
|
- initialValue: theData.orgContactsMobile
|
|
|
+ label="成果所有人" >
|
|
|
+ {getFieldDecorator('ownerId', {
|
|
|
+ rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
+ initialValue: theData.ownerId
|
|
|
})(
|
|
|
- <Input />
|
|
|
+ <AutoComplete
|
|
|
+ dataSource={this.state.dataSource}
|
|
|
+ style={{ width: 200 }}
|
|
|
+ onSearch={this.therottleSearch}
|
|
|
+ placeholder="输入成果所有人" />
|
|
|
)}
|
|
|
</FormItem>
|
|
|
</div>
|
|
@@ -1497,6 +1478,7 @@ const AchievementDetail = React.createClass({
|
|
|
if (this.props.data.auditStatus && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
|
|
|
return <AchievementDetailShow
|
|
|
data={this.props.data}
|
|
|
+ detailApiUrl={this.props.detailApiUrl}
|
|
|
techBrodersOption={this.state.techBrodersOption}
|
|
|
techBrodersObj={this.state.techBrodersObj}
|
|
|
closeDesc={this.handleCancel}
|
|
@@ -1505,6 +1487,7 @@ const AchievementDetail = React.createClass({
|
|
|
} else {
|
|
|
return <AchievementDetailForm
|
|
|
data={this.props.data}
|
|
|
+ detailApiUrl={this.props.detailApiUrl}
|
|
|
companyOption={this.props.companyOption}
|
|
|
userOption={this.props.userOption}
|
|
|
achievementCategoryOption={this.props.achievementCategoryOption}
|