yee 7 years ago
parent
commit
6079c2a415

+ 3 - 6
js/component/account/demand/techDemand.jsx

@@ -138,10 +138,8 @@ const DemandList = React.createClass({
                     render: text => {
                         switch (text) {
                             case "0":
-                                return <span>进行中</span>;
-                            case "1":
                                 return <span>未解决</span>;
-                            case "2":
+                            case "1":
                                 return <span>已解决</span>;
                         }
                     }
@@ -279,9 +277,8 @@ const DemandList = React.createClass({
                     <Select placeholder="选择需求状态" style={{ width: 120 }}
                         value={this.state.status}
                         onChange={(e) => { this.setState({ status: e }) }}>
-                        <Select.Option value="0" >进行中</Select.Option>
-                        <Select.Option value="1" >未解决</Select.Option>
-                        <Select.Option value="2" >已解决</Select.Option>
+                        <Select.Option value="0" >未解决</Select.Option>
+                        <Select.Option value="1" >已解决</Select.Option>
                     </Select>
                     <Select placeholder="选择审核状态" style={{ width: 160 }}
                         value={this.state.auditStatus}

+ 1 - 0
js/component/account/services/activityCostList.jsx

@@ -63,6 +63,7 @@ const ActivityDescFrom = Form.create()(React.createClass({
                 _me.state.activityNumberObj[item.aid] = item.activityNumber;
             });
             this.state.fileList = [];
+            this.state.accountUrl = undefined;
         };
     },
     handleSubmit(e) {

+ 3 - 3
js/component/account/services/annualReport.jsx

@@ -492,6 +492,9 @@ const AnnualReportAdd = React.createClass({
                 state: 0
             }
         }).done(function (data) {
+            this.setState({
+                loading: false
+            }); 
             if (!data.error.length) {
                 message.success('保存成功!');
                 this.setState({
@@ -500,9 +503,6 @@ const AnnualReportAdd = React.createClass({
                 this.props.closeAdd(false, true);
             } else {
                 message.warning(data.error[0].message);
-                this.setState({
-                    loading: false
-                });
             }
         }.bind(this));
     },

+ 4 - 1
js/component/account/services/technology.jsx

@@ -145,7 +145,8 @@ const Technology = React.createClass({
                     };
                 };
                 this.setState({
-                    departmentOption: theOption
+                    departmentOption: theOption,
+                    departmentObj: data.data
                 });
             }.bind(this),
         });
@@ -289,12 +290,14 @@ const Technology = React.createClass({
                     data={this.state.RowData}
                     contactsOption={this.state.contactsOption}
                     departmentOption={this.state.departmentOption}
+                    departmentObj={this.state.departmentObj}
                     showDesc={this.state.showDesc}
                     closeDesc={this.closeDesc} />
                 <ApplyAdd
                     authorOption={this.state.authorOption}
                     contactsOption={this.state.contactsOption}
                     departmentOption={this.state.departmentOption}
+                    departmentObj={this.state.departmentObj}                    
                     showAdd={this.state.showAdd}
                     closeAdd={this.closeAdd} />
             </div >

+ 2 - 2
js/component/account/services/technologyChange.jsx

@@ -199,7 +199,7 @@ const ApplyChangeFrom = Form.create()(React.createClass({
                                 label="联系人:"
                             >
                                 {getFieldDecorator('contacts', {
-                                    initialValue: String(theData.contacts)
+                                    initialValue: theData.contacts
                                 })(
                                     <Select>{this.props.contactsOption}</Select>
                                     )}
@@ -212,7 +212,7 @@ const ApplyChangeFrom = Form.create()(React.createClass({
                             label="科技部门"
                         >
                             {getFieldDecorator('department', {
-                                initialValue: this.state.department
+                                initialValue: theData.department
                             })(
                                 <Select placeholder="请选择申报部门"
                                     style={{ width: 300 }}

+ 76 - 89
js/component/manageCenter/achievement/achievementOrder.jsx

@@ -1,5 +1,5 @@
 import React from 'react';
-import { Icon, Button, Input, InputNumber, Select, Spin, Table, message, Modal, Row, Col, DatePicker } from 'antd';
+import { AutoComplete, Icon, Button, Input, InputNumber, Select, Spin, Table, message, Modal, Row, Col, DatePicker } from 'antd';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 import moment from 'moment';
@@ -7,6 +7,7 @@ import './techAchievement.less';
 import { orderStatusList } from '../../dataDic.js';
 import { befoFile, getSearchUrl, getOrderStatus, companySearch } from '../../tools.js';
 import BatchImport from './batchImport';
+import throttle from '../../throttle.js';
 
 const AchievementDetail = React.createClass({
     getInitialState() {
@@ -278,9 +279,9 @@ const AchievementOrderList = React.createClass({
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
-                uid: this.state.uid,
-                username: this.state.username,
-                unitName: this.state.unitName
+                status: this.state.status,
+                username: ((apiUrl || this.props['data-listApiUrl']).indexOf('org') != -1) ? null : this.state.searchName,
+                unitName: ((apiUrl || this.props['data-listApiUrl']).indexOf('org') != -1) ? this.state.searchName : null
             },
             success: function (data) {
                 let theArr = [];
@@ -325,10 +326,66 @@ const AchievementOrderList = React.createClass({
             });
         }.bind(this));
     },
+    handleSearch(e) {
+        if (this.props['data-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({
+                        searchData: 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),
+            });
+        };
+    },
     getInitialState() {
         return {
             selectedRowKeys: [],
             selectedRows: [],
+            searchData: [],
             loading: false,
             pagination: {
                 defaultCurrent: 1,
@@ -402,71 +459,8 @@ const AchievementOrderList = React.createClass({
             dataSource: [],
         };
     },
-    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));
-    },
     componentWillMount() {
+        this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
         let theArr = [], typeArr = [];
         orderStatusList.map(function (item) {
             theArr.push(
@@ -485,14 +479,15 @@ const AchievementOrderList = React.createClass({
         //     };
         // };
         this.loadData();
-        this.getCompanyList();
-        this.getUserList();
     },
     componentWillReceiveProps(nextProps) {
         if (this.props['data-listApiUrl'] != nextProps['data-listApiUrl']) {
-            this.loadData(null, nextProps['data-listApiUrl']);
             this.state.selectedRowKeys = [];
             this.state.selectedRows = [];
+            this.state.status = undefined;
+            this.state.searchName = undefined;
+            this.state.searchData = [];
+            this.loadData(null, nextProps['data-listApiUrl']);
         };
     },
     tableRowClick(record, index) {
@@ -512,8 +507,7 @@ const AchievementOrderList = React.createClass({
     },
     reset() {
         this.state.uid = undefined;
-        this.state.username = undefined;
-        this.state.unitName = undefined;
+        this.state.searchName = undefined;
         this.state.status = undefined;
         this.loadData();
     },
@@ -539,22 +533,15 @@ const AchievementOrderList = React.createClass({
                         onChange={(e) => { this.setState({ status: e }) }}>
                         {this.state.orderStatusOption}
                     </Select>
-                    {this.props['data-listApiUrl'].indexOf('org') == -1 ? <Select placeholder="选择用户名" style={{ width: 260 }}
-                        value={this.state.username}
-                        notFoundContent="未获取到用户列表"
-                        showSearch
-                        filterOption={companySearch}
-                        onChange={(e) => { this.setState({ username: e }) }}>
-                        {this.state.userOption}
-                    </Select> :
-                        <Select placeholder="选择用户名" style={{ width: 260 }}
-                            value={this.state.unitName}
-                            notFoundContent="未获取到用户列表"
-                            showSearch
-                            filterOption={companySearch}
-                            onChange={(e) => { this.setState({ unitName: e }) }}>
-                            {this.state.companyOption}
-                        </Select>}
+                    <AutoComplete
+                        dataSource={this.state.searchData}
+                        style={{ width: 200 }}
+                        onSearch={this.state.therottleSearch}
+                        placeholder="输入成果所有人"
+                        onSelect={(e) => {
+                            //this.setState({ searchName: e });
+                            this.state.searchName = e;
+                        }} />
                     <Button type="primary" onClick={this.search}>搜索</Button>
                     <Button onClick={this.reset}>重置</Button>
                 </div>

+ 1 - 2
js/component/manageCenter/achievement/techAchievementDesc.jsx

@@ -173,7 +173,6 @@ const AchievementDetailShow = Form.create()(React.createClass({
                     technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
                     maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', globalConfig.avatarHost + '/upload') : []
                 });
-                console.log(this.state.tags);
             }.bind(this),
         }).always(function () {
             this.setState({
@@ -1485,7 +1484,7 @@ const AchievementDetail = React.createClass({
             dataType: "json",
             crossDomain: false,
             url: globalConfig.context + "/api/admin/achievement/achievementDemand",
-            data: { id: this.state.data.id },
+            data: { id: this.props.data.id },
             success: function (data) {
                 let theArr = [];
                 if (!data.data) {

+ 68 - 83
js/component/manageCenter/demand/demandOrder.jsx

@@ -1,5 +1,5 @@
 import React from 'react';
-import { Icon, Button, Input, InputNumber, Select, Spin, Table, message, Modal, Row, Col, DatePicker } from 'antd';
+import { AutoComplete, Icon, Button, Input, InputNumber, Select, Spin, Table, message, Modal, Row, Col, DatePicker } from 'antd';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 import moment from 'moment';
@@ -7,6 +7,7 @@ import './techDemand.less';
 import { orderStatusList } from '../../dataDic.js';
 import { befoFile, getSearchUrl, getOrderStatus, companySearch } from '../../tools.js';
 import BatchImport from './batchImport';
+import throttle from '../../throttle.js';
 
 const DemandDetail = React.createClass({
     getInitialState() {
@@ -287,9 +288,9 @@ const DemandOrderList = React.createClass({
             data: {
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
-                uid: this.state.uid,
-                username: this.state.username,
-                unitName: this.state.unitName
+                status: this.state.status,
+                username: ((apiUrl || this.props['data-listApiUrl']).indexOf('org') != -1) ? null : this.state.searchName,
+                unitName: ((apiUrl || this.props['data-listApiUrl']).indexOf('org') != -1) ? this.state.searchName : null
             },
             success: function (data) {
                 let theArr = [];
@@ -339,6 +340,7 @@ const DemandOrderList = React.createClass({
         return {
             selectedRowKeys: [],
             selectedRows: [],
+            searchData: [],
             loading: false,
             pagination: {
                 defaultCurrent: 1,
@@ -412,71 +414,63 @@ const DemandOrderList = React.createClass({
             dataSource: [],
         };
     },
-    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);
+    handleSearch(e) {
+        if (this.props['data-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;
+                        });
                     };
-                } else {
-                    data.data.map(function (item) {
-                        theArr.push(
-                            <Select.Option value={item.uid} key={item.uid}>{item.unitName}</Select.Option>
-                        )
+                    this.setState({
+                        searchData: theArr,
+                        dataSourceObj: theObj
                     });
-                };
-                this.setState({
-                    companyOption: theArr
-                });
-            }.bind(this),
-        }).always(function () {
-            this.setState({
-                loading: false
+                }.bind(this),
             });
-        }.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 {
+            $.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;
+                        };
                     };
-                } else {
-                    data.data.map(function (item) {
-                        theArr.push(
-                            <Select.Option value={item.uid} key={item.uid}>{item.username}</Select.Option>
-                        )
+                    this.setState({
+                        dataSource: theArr,
+                        dataSourceObj: theObj
                     });
-                };
-                this.setState({
-                    userOption: theArr
-                });
-            }.bind(this),
-        }).always(function () {
-            this.setState({
-                loading: false
+                }.bind(this),
             });
-        }.bind(this));
+        };
     },
     componentWillMount() {
+        this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
         let theArr = [], typeArr = [];
         orderStatusList.map(function (item) {
             theArr.push(
@@ -495,14 +489,15 @@ const DemandOrderList = React.createClass({
         //     };
         // };
         this.loadData();
-        this.getCompanyList();
-        this.getUserList();
     },
     componentWillReceiveProps(nextProps) {
         if (this.props['data-listApiUrl'] != nextProps['data-listApiUrl']) {
-            this.loadData(null, nextProps['data-listApiUrl']);
             this.state.selectedRowKeys = [];
             this.state.selectedRows = [];
+            this.state.status = undefined;
+            this.state.searchName = null;
+            this.state.searchData = [];
+            this.loadData(null, nextProps['data-listApiUrl']);
         };
     },
     tableRowClick(record, index) {
@@ -559,9 +554,7 @@ const DemandOrderList = React.createClass({
         this.loadData();
     },
     reset() {
-        this.state.uid = undefined;
-        this.state.username = undefined;
-        this.state.unitName = undefined;
+        this.state.searchName = undefined;
         this.state.status = undefined;
         this.loadData();
     },
@@ -587,22 +580,14 @@ const DemandOrderList = React.createClass({
                         onChange={(e) => { this.setState({ status: e }) }}>
                         {this.state.orderStatusOption}
                     </Select>
-                    {this.props['data-listApiUrl'].indexOf('org') == -1 ? <Select placeholder="选择用户名" style={{ width: 260 }}
-                        value={this.state.username}
-                        notFoundContent="未获取到用户列表"
-                        showSearch
-                        filterOption={companySearch}
-                        onChange={(e) => { this.setState({ username: e }) }}>
-                        {this.state.userOption}
-                    </Select> :
-                        <Select placeholder="选择用户名" style={{ width: 260 }}
-                            value={this.state.unitName}
-                            notFoundContent="未获取到用户列表"
-                            showSearch
-                            filterOption={companySearch}
-                            onChange={(e) => { this.setState({ unitName: e }) }}>
-                            {this.state.companyOption}
-                        </Select>}
+                    <AutoComplete
+                        dataSource={this.state.searchData}
+                        style={{ width: 200 }}
+                        onSearch={this.state.therottleSearch}
+                        placeholder="输入成果所有人"
+                        onSelect={(e) => {
+                            this.state.searchName = e;
+                        }} />
                     <Button type="primary" onClick={this.search}>搜索</Button>
                     <Button onClick={this.reset}>重置</Button>
                 </div>