yee 7 years ago
parent
commit
d4e96047d3

+ 3 - 128
js/component/account/achievement/techAchievementDesc.jsx

@@ -30,8 +30,8 @@ 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({
@@ -711,6 +711,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,
@@ -722,12 +723,6 @@ const AchievementDetailForm = Form.create()(React.createClass({
                         maturityTextFileUrl: this.state.maturityTextFileUrl,
                         maturityVideoUrl: values.maturityVideoUrl,
                         innovation: values.innovation,
-                        ownerName: values.ownerName,
-                        ownerType: values.ownerType,
-                        ownerIdNumber: values.ownerIdNumber,
-                        ownerMobile: values.ownerMobile,
-                        ownerEmail: values.ownerEmail,
-                        ownerPostalAddress: values.ownerPostalAddress,
                         cooperationMode: values.cooperationMode,
                         transferMode: values.transferMode,
                         bargainingMode: values.bargainingMode,
@@ -738,12 +733,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,
@@ -1015,120 +1004,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}
-                        label="所有人类型" >
-                        {getFieldDecorator('ownerType', {
-                            rules: [{ required: true, message: '此项为必填项!' }],
-                            initialValue: theData.ownerType
-                        })(
-                            <Radio.Group onChange={(e) => { this.setState({ orgDisplay: e.target.value }); }}>
-                                <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>
-                    <FormItem className="half-item"
-                        {...formItemLayout}
-                        label="所属组织联系人电话" >
-                        {getFieldDecorator('orgContactsMobile', {
-                            initialValue: theData.orgContactsMobile
-                        })(
-                            <Input />
-                            )}
-                    </FormItem>
-                </div>
                 <div className="clearfix">
                     <FormItem className="half-item"
                         {...formItemLayout}

+ 3 - 2
js/component/account/demand/techDemandDesc.jsx

@@ -30,8 +30,8 @@ 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({
@@ -534,6 +534,7 @@ const DemandDetailForm = Form.create()(React.createClass({
                         serialNumber: this.props.data.serialNumber,
                         name: values.name,
                         keyword: this.state.tags ? this.state.tags.join(",") : [],
+                        keywords: this.state.tags,
                         infoSources: values.infoSources,
                         industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
                         industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,

+ 2 - 2
js/component/account/set/ablt.jsx

@@ -34,8 +34,8 @@ class EditableTagGroup extends React.Component {
         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({

+ 19 - 5
js/component/manageCenter/achievement/content.jsx

@@ -16,16 +16,28 @@ class Content extends Component {
         if (window.location.hash) {
             this.getKey(window.location.hash.substr(1));
         } else {
-            this.getKey("techAchievement");
+            this.getKey("orgTechAchievement");
         };
     }
     getKey(key) {
         switch (key) {
-            case 'techAchievement':
+            case 'orgTechAchievement':
                 require.ensure([], () => {
-                    const TechDemand = require('./techAchievement').default;
+                    const TechAchievement = require('./techAchievement').default;
                     this.setState({
-                        component: TechAchievement
+                        component: TechAchievement,
+                        listApiUrl: '/api/admin/achievement/orgList',
+                        detailApiUrl: '/api/admin/achievement/orgDemandDetail'
+                    });
+                });
+                break;
+            case 'userTechAchievement':
+                require.ensure([], () => {
+                    const TechAchievement = require('./techAchievement').default;
+                    this.setState({
+                        component: TechAchievement,
+                        listApiUrl: '/api/admin/achievement/userList',
+                        detailApiUrl: '/api/admin/achievement/userDemandDetail'
                     });
                 });
                 break;
@@ -37,7 +49,9 @@ class Content extends Component {
             <div className="manage-content">
                 <LeftTab handlekey={this.getKey.bind(this)} />
                 <div className="content-right">
-                    <this.state.component />
+                    <this.state.component
+                        data-listApiUrl={this.state.listApiUrl}
+                        data-detailApiUrl={this.state.detailApiUrl} />
                 </div>
             </div>
         )

+ 6 - 3
js/component/manageCenter/achievement/leftTab.jsx

@@ -8,7 +8,7 @@ const MenuItemGroup = Menu.ItemGroup;
 const LeftTab = React.createClass({
     getInitialState() {
         return {
-            current: 'techAchievement'
+            current: 'orgTechAchievement'
         };
     },
     handleClick(e) {
@@ -29,8 +29,11 @@ const LeftTab = React.createClass({
                 mode="vertical"
                 className="account-left"
             >
-                <Menu.Item key="techAchievement">
-                    科技成果列表
+                <Menu.Item key="orgTechAchievement">
+                    组织科技成果列表
+                </Menu.Item>
+                <Menu.Item key="userTechAchievement">
+                    个人科技成果列表
                 </Menu.Item>
             </Menu>
         );

+ 12 - 4
js/component/manageCenter/achievement/techAchievement.jsx

@@ -9,7 +9,7 @@ import { provinceArr, achievementCategoryList, techAuditStatusList } from '../..
 import { companySearch, getAchievementCategory, getSearchUrl, getTechAuditStatus } from '../../tools.js';
 
 const AchievementList = React.createClass({
-    loadData(pageNo) {
+    loadData(pageNo, apiUrl) {
         this.state.data = [];
         this.setState({
             loading: true
@@ -18,7 +18,7 @@ const AchievementList = React.createClass({
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + '/api/admin/achievement/list',
+            url: globalConfig.context + (apiUrl || this.props['data-listApiUrl']),
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
@@ -49,7 +49,7 @@ const AchievementList = React.createClass({
                             name: thisdata.name,
                             keyword: thisdata.keyword,
                             category: thisdata.category,
-                            ownerName: thisdata.ownerName,
+                            ownerName: thisdata.username ? thisdata.username : thisdata.ownerName,
                             ownerType: thisdata.ownerType,
                             ownerMobile: thisdata.ownerMobile,
                             status: thisdata.status,
@@ -167,6 +167,13 @@ const AchievementList = React.createClass({
         };
         this.loadData();
     },
+    componentWillReceiveProps(nextProps) {
+        if (this.props['data-listApiUrl'] != nextProps['data-listApiUrl']) {
+            this.loadData(null, nextProps['data-listApiUrl']);
+            this.state.selectedRowKeys = [];
+            this.state.selectedRows = [];
+        };
+    },
     tableRowClick(record, index) {
         this.state.RowData = record;
         this.setState({
@@ -251,7 +258,7 @@ const AchievementList = React.createClass({
         return (
             <div className="user-content" >
                 <div className="content-title">
-                    <span>科技成果管理</span>
+                    {this.props['data-listApiUrl'].indexOf('org') == -1 ? <span>个人科技成果管理</span> : <span>组织科技成果管理</span>}
                     <div className="patent-addNew">
                         <Button type="primary" onClick={this.addClick}>发布成果<Icon type="plus" /></Button>
                     </div>
@@ -315,6 +322,7 @@ const AchievementList = React.createClass({
                 </div>
                 <TechAchievementDesc
                     data={this.state.RowData}
+                    detailApiUrl={this.props['data-detailApiUrl']}
                     achievementCategoryOption={this.state.achievementCategoryOption}
                     showDesc={this.state.showDesc}
                     closeDesc={this.closeDesc} />

+ 95 - 112
js/component/manageCenter/achievement/techAchievementDesc.jsx

@@ -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}

+ 3 - 2
js/component/manageCenter/demand/techDemandDesc.jsx

@@ -30,8 +30,8 @@ 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({
@@ -690,6 +690,7 @@ const DemandDetailForm = Form.create()(React.createClass({
                         serialNumber: this.props.data.serialNumber,
                         name: values.name,
                         keyword: this.state.tags ? this.state.tags.join(",") : [],
+                        keywords: this.state.tags,
                         infoSources: values.infoSources,
                         industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
                         industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,

+ 43 - 0
js/component/throttle.js

@@ -0,0 +1,43 @@
+module.exports = function (func, wait, value, options) {
+    /* options的默认值
+     *  表示首次调用返回值方法时,会马上调用func;否则仅会记录当前时刻,当第二次调用的时间间隔超过wait时,才调用func。
+     *  options.leading = true;
+     * 表示当调用方法时,未到达wait指定的时间间隔,则启动计时器延迟调用func函数,若后续在既未达到wait指定的时间间隔和func函数又未被调用的情况下调用返回值方法,则被调用请求将被丢弃。
+     *  options.trailing = true; 
+     * 注意:当options.trailing = false时,效果与上面的简单实现效果相同
+     */
+    var context, args, result;
+    var timeout = null;
+    var previous = 0;
+    if (!options) options = {};
+    var later = function () {
+        previous = options.leading === false ? 0 : new Date().getTime();
+        timeout = null;
+        result = func.apply(context, args);
+        if (!timeout) context = args = null;
+    };
+    return function () {
+        var now = new Date().getTime();
+        if (!previous && options.leading === false) previous = now;
+        // 计算剩余时间
+        var remaining = wait - (now - previous);
+        context = this;
+        args = arguments;
+        // 当到达wait指定的时间间隔,则调用func函数
+        // 精彩之处:按理来说remaining <= 0已经足够证明已经到达wait的时间间隔,但这里还考虑到假如客户端修改了系统时间则马上执行func函数。
+        if (remaining <= 0 || remaining > wait) {
+            // 由于setTimeout存在最小时间精度问题,因此会存在到达wait的时间间隔,但之前设置的setTimeout操作还没被执行,因此为保险起见,这里先清理setTimeout操作
+            if (timeout) {
+                clearTimeout(timeout);
+                timeout = null;
+            }
+            previous = now;
+            result = func.apply(context, args);
+            if (!timeout) context = args = null;
+        } else if (!timeout && options.trailing !== false) {
+            // options.trailing=true时,延时执行func函数
+            timeout = setTimeout(later, remaining);
+        }
+        return result;
+    };
+};