|
@@ -727,6 +727,7 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
businessPlanFileList: [],
|
|
|
maturityPictureUrl: [],
|
|
|
technicalPictureUrl: [],
|
|
|
+ dataSource: [],
|
|
|
tags: []
|
|
|
};
|
|
|
},
|
|
@@ -764,70 +765,6 @@ 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 });
|
|
|
},
|
|
@@ -838,10 +775,59 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
this.setState({ technicalPictureUrl: e });
|
|
|
},
|
|
|
handleSearch(e) {
|
|
|
- console.log(e);
|
|
|
- },
|
|
|
- therottleSearch(e) {
|
|
|
- throttle(this.handleSearch, 500).bind(this);
|
|
|
+ if (this.props.detailApiUrl.indexOf('org') != -1) {
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + "/api/admin/achievement/orgOwner",
|
|
|
+ data: { name: e },
|
|
|
+ success: function (data) {
|
|
|
+ let theArr = [];
|
|
|
+ let theObj = {};
|
|
|
+ if (!data.data) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ } else if (!$.isEmptyObject(data.data)) {
|
|
|
+ data.data.map(function (item) {
|
|
|
+ theArr.push(item.unitName);
|
|
|
+ theObj[item.unitName] = item.uid;
|
|
|
+ });
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ dataSource: theArr,
|
|
|
+ dataSourceObj: theObj
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + "/api/admin/achievement/userOwner",
|
|
|
+ data: { name: e },
|
|
|
+ success: function (data) {
|
|
|
+ let theArr = [];
|
|
|
+ let theObj = {};
|
|
|
+ if (!data.data) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ } else if (!$.isEmptyObject(data.data)) {
|
|
|
+ for (let item in data.data) {
|
|
|
+ theArr.push(data.data[item]);
|
|
|
+ theObj[data.data[item]] = item;
|
|
|
+ };
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ dataSource: theArr,
|
|
|
+ dataSourceObj: theObj
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ });
|
|
|
+ };
|
|
|
},
|
|
|
handleSubmit(e) {
|
|
|
e.preventDefault();
|
|
@@ -851,6 +837,10 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
message.warning('关键词数量不能小于3个!');
|
|
|
return;
|
|
|
};
|
|
|
+ if (!this.state.dataSourceObj[values.ownerId]) {
|
|
|
+ message.warning('请选择一个有效的公司!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
//url转化
|
|
|
let theTechnicalPictureUrl = [];
|
|
|
if (this.state.technicalPictureUrl.length) {
|
|
@@ -895,8 +885,8 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
maturityTextFileUrl: this.state.maturityTextFileUrl,
|
|
|
maturityVideoUrl: values.maturityVideoUrl,
|
|
|
innovation: values.innovation,
|
|
|
- ownerId: values.ownerId,
|
|
|
- ownerType: values.ownerType,
|
|
|
+ ownerId: this.state.dataSourceObj[values.ownerId],
|
|
|
+ ownerType: this.props.detailApiUrl.indexOf('org') != -1 ? 1 : 0,
|
|
|
cooperationMode: values.cooperationMode,
|
|
|
transferMode: values.transferMode,
|
|
|
bargainingMode: values.bargainingMode,
|
|
@@ -928,8 +918,7 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
});
|
|
|
},
|
|
|
componentWillMount() {
|
|
|
- this.getCompanyList();
|
|
|
- this.getUserList();
|
|
|
+ this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
|
|
|
if (this.props.data.id) {
|
|
|
this.loadData(this.props.data.id);
|
|
|
} else {
|
|
@@ -1180,21 +1169,6 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
<Input />
|
|
|
)}
|
|
|
</FormItem>
|
|
|
- <div className="clearfix">
|
|
|
- <FormItem className="half-item"
|
|
|
- {...formItemLayout}
|
|
|
- label="所有人类型" >
|
|
|
- {getFieldDecorator('ownerType', {
|
|
|
- rules: [{ required: true, message: '此项为必填项!' }],
|
|
|
- initialValue: theData.ownerType
|
|
|
- })(
|
|
|
- <Radio.Group>
|
|
|
- <Radio value="0">个人</Radio>
|
|
|
- <Radio value="1">组织</Radio>
|
|
|
- </Radio.Group>
|
|
|
- )}
|
|
|
- </FormItem>
|
|
|
- </div>
|
|
|
<div className="clearfix" >
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
@@ -1206,7 +1180,7 @@ const AchievementDetailForm = Form.create()(React.createClass({
|
|
|
<AutoComplete
|
|
|
dataSource={this.state.dataSource}
|
|
|
style={{ width: 200 }}
|
|
|
- onSearch={this.therottleSearch}
|
|
|
+ onSearch={this.state.therottleSearch}
|
|
|
placeholder="输入成果所有人" />
|
|
|
)}
|
|
|
</FormItem>
|
|
@@ -1488,14 +1462,12 @@ const AchievementDetail = React.createClass({
|
|
|
return <AchievementDetailForm
|
|
|
data={this.props.data}
|
|
|
detailApiUrl={this.props.detailApiUrl}
|
|
|
- companyOption={this.props.companyOption}
|
|
|
- userOption={this.props.userOption}
|
|
|
achievementCategoryOption={this.props.achievementCategoryOption}
|
|
|
techBrodersObj={this.state.techBrodersObj}
|
|
|
closeDesc={this.handleCancel}
|
|
|
visible={this.state.visible}
|
|
|
handleOk={this.handleOk} />
|
|
|
- }
|
|
|
+ };
|
|
|
})()}
|
|
|
</Modal>
|
|
|
</div>
|