|
@@ -1,11 +1,12 @@
|
|
|
import React from 'react';
|
|
|
-import { Tabs, Table, Icon, Tooltip, Modal, Popover, message, Spin, Upload, Input, InputNumber, Select, DatePicker, Button, Radio, Form, Cascader, Tag } from 'antd';
|
|
|
+import { AutoComplete, Switch, Tabs, Table, Icon, Tooltip, Modal, Popover, message, Spin, Upload, Input, InputNumber, Select, DatePicker, Button, Radio, Form, Cascader, Tag } from 'antd';
|
|
|
import moment from 'moment';
|
|
|
import './techDemand.less';
|
|
|
import ajax from 'jquery/src/ajax/xhr.js';
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
import { IndustryObject, getIndustryCategory } from '../../DicIndustryList.js';
|
|
|
import { beforeUploadFile, getTechAuditStatus, splitUrl, companySearch, getTechField, getDemandType, getAchievementCategory } from '../../tools.js';
|
|
|
+import throttle from '../../throttle.js';
|
|
|
|
|
|
const KeyWordTagGroup = React.createClass({
|
|
|
getInitialState() {
|
|
@@ -164,6 +165,7 @@ const DemandDetailShow = Form.create()(React.createClass({
|
|
|
};
|
|
|
this.setState({
|
|
|
data: thisData,
|
|
|
+ switchValue: Boolean(!thisData.employerId),
|
|
|
tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
|
|
|
pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
|
|
|
});
|
|
@@ -299,18 +301,43 @@ const DemandDetailShow = Form.create()(React.createClass({
|
|
|
label="需求名称" >
|
|
|
<span>{theData.name}</span>
|
|
|
</FormItem>
|
|
|
+ </div>
|
|
|
+ {this.state.switchValue ? <div>
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
label="雇主名称" >
|
|
|
- <span>{theData.username}</span>
|
|
|
+ <span>{theData.employerName}</span>
|
|
|
</FormItem>
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
- label="联系人" >
|
|
|
- <span>{this.state.contactsObj[theData.contacts]}</span>
|
|
|
+ label="联系电话" >
|
|
|
+ <span>{theData.employerContactsMobile}</span>
|
|
|
</FormItem>
|
|
|
<FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
+ label="电子邮箱" >
|
|
|
+ <span>{theData.employerContactsMailbox}</span>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="通讯地址" >
|
|
|
+ <span>{theData.employerAddress}</span>
|
|
|
+ </FormItem>
|
|
|
+ </div> : <div className="clearfix">
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="雇主名称" >
|
|
|
+ <span>{theData.username}</span>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="联系人" >
|
|
|
+ <span>{this.state.contactsObj[theData.contacts]}</span>
|
|
|
+ </FormItem>
|
|
|
+ </div>}
|
|
|
+ <div className="clearfix">
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
label="负责人" >
|
|
|
<span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
|
|
|
</FormItem>
|
|
@@ -560,13 +587,14 @@ const DemandDetailForm = Form.create()(React.createClass({
|
|
|
visible: false,
|
|
|
loading: false,
|
|
|
auditStatus: 0,
|
|
|
+ switchValue: false,
|
|
|
textFileList: [],
|
|
|
videoFileList: [],
|
|
|
contactsOption: [],
|
|
|
data: {},
|
|
|
tags: [],
|
|
|
- pictureUrl: []
|
|
|
-
|
|
|
+ pictureUrl: [],
|
|
|
+ dataSource: []
|
|
|
};
|
|
|
},
|
|
|
getContactsList(theUid) {
|
|
@@ -623,6 +651,7 @@ const DemandDetailForm = Form.create()(React.createClass({
|
|
|
};
|
|
|
this.setState({
|
|
|
data: thisData,
|
|
|
+ switchValue: Boolean(!thisData.employerId),
|
|
|
tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
|
|
|
pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
|
|
|
});
|
|
@@ -687,12 +716,21 @@ const DemandDetailForm = Form.create()(React.createClass({
|
|
|
fixedScheme: values.fixedScheme,
|
|
|
costEscrow: values.costEscrow,
|
|
|
budgetCost: values.budgetCost,
|
|
|
- employerId: values.employerId || this.state.data.employerId,
|
|
|
+ //
|
|
|
+ switchSign: this.state.switchValue ? 1 : 0,
|
|
|
+ //
|
|
|
+ employerId: !this.state.switchValue ? (this.state.dataSourceObj ? this.state.dataSourceObj[values.employerId] : this.props.data.employerId) : null,
|
|
|
+ contacts: !this.state.switchValue ? values.contacts : null,
|
|
|
+ //自定义
|
|
|
+ employerName: this.state.switchValue ? values.employerName : null,
|
|
|
+ employerAddress: this.state.switchValue ? values.employerAddress : null,
|
|
|
+ employerContactsMobile: this.state.switchValue ? values.employerContactsMobile : null,
|
|
|
+ employerContactsMailbox: this.state.switchValue ? values.employerContactsMailbox : null,
|
|
|
+ //
|
|
|
releaseStatus: values.releaseStatus,
|
|
|
principalId: values.principalId,
|
|
|
validityPeriodFormattedDate: values.validityPeriod ? values.validityPeriod.format('YYYY-MM-DD') : undefined,
|
|
|
//
|
|
|
- contacts: values.contacts,
|
|
|
status: this.state.status,
|
|
|
auditStatus: this.state.auditStatus
|
|
|
}
|
|
@@ -711,7 +749,63 @@ const DemandDetailForm = Form.create()(React.createClass({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ handleSearch(e) {
|
|
|
+ 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),
|
|
|
+ });
|
|
|
+ };
|
|
|
+ },
|
|
|
componentWillMount() {
|
|
|
+ this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
|
|
|
if (this.props.data && this.props.data.id) {
|
|
|
this.loadData(this.props.data.id, this.props.detailApiUrl);
|
|
|
};
|
|
@@ -724,6 +818,7 @@ const DemandDetailForm = Form.create()(React.createClass({
|
|
|
this.state.contactsOption = [];
|
|
|
this.state.data = {};
|
|
|
this.state.tags = [];
|
|
|
+ this.state.switchValue = false;
|
|
|
this.state.pictureUrl = [];
|
|
|
this.state.textFileList = [];
|
|
|
this.state.videoFileList = [];
|
|
@@ -758,48 +853,82 @@ const DemandDetailForm = Form.create()(React.createClass({
|
|
|
<Input />
|
|
|
)}
|
|
|
</FormItem>
|
|
|
- <FormItem className="half-item" style={{ display: theData.username ? 'block' : 'none' }}
|
|
|
+ </div>
|
|
|
+ <FormItem style={{ marginBottom: '10px' }} labelCol={{ span: 3 }}
|
|
|
+ label="自定义雇主" >
|
|
|
+ <Switch checked={this.state.switchValue} onChange={(e) => { this.setState({ switchValue: e }); }} />
|
|
|
+ </FormItem>
|
|
|
+ {this.state.switchValue ? <div className="clearfix" >
|
|
|
+ <FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
label="雇主名称" >
|
|
|
- <span>{theData.username}</span>
|
|
|
+ {getFieldDecorator('employerName', {
|
|
|
+ initialValue: theData.employerName
|
|
|
+ })(
|
|
|
+ <Input />
|
|
|
+ )}
|
|
|
</FormItem>
|
|
|
- <FormItem className="half-item" style={{ display: theData.username ? 'none' : 'block' }}
|
|
|
+ <FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
- label="雇主名称" >
|
|
|
- {getFieldDecorator('employerId', {
|
|
|
- initialValue: theData.employerId
|
|
|
+ label="联系电话" >
|
|
|
+ {getFieldDecorator('employerContactsMobile', {
|
|
|
+ initialValue: theData.employerContactsMobile
|
|
|
})(
|
|
|
- <Select
|
|
|
- placeholder="请选择"
|
|
|
- notFoundContent="未找到"
|
|
|
- style={{ width: 260 }}
|
|
|
- showSearch
|
|
|
- filterOption={companySearch}
|
|
|
- onSelect={(e, n) => {
|
|
|
- theData.uid = e;
|
|
|
- if (this.props.detailApiUrl.indexOf('org') >= 0) {
|
|
|
- this.getContactsList(e);
|
|
|
- };
|
|
|
- }}>
|
|
|
- {this.props.detailApiUrl.indexOf('org') >= 0 ? this.props.companyOption : this.props.userOption}
|
|
|
- </Select>
|
|
|
+ <Input />
|
|
|
)}
|
|
|
</FormItem>
|
|
|
- {this.props.detailApiUrl.indexOf('org') >= 0 ? <FormItem className="half-item"
|
|
|
+ <FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
- label="联系人" >
|
|
|
- {getFieldDecorator('contacts', {
|
|
|
- initialValue: theData.contacts
|
|
|
+ label="电子邮箱" >
|
|
|
+ {getFieldDecorator('employerContactsMailbox', {
|
|
|
+ initialValue: theData.employerContactsMailbox
|
|
|
})(
|
|
|
- <Select style={{ width: 260 }}
|
|
|
- placeholder="请选择联系人"
|
|
|
- notFoundContent="未获取到联系人列表"
|
|
|
- showSearch
|
|
|
- filterOption={companySearch}>
|
|
|
- {this.state.contactsOption}
|
|
|
- </Select>
|
|
|
+ <Input />
|
|
|
)}
|
|
|
- </FormItem> : <div></div>}
|
|
|
+ </FormItem>
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="通讯地址" >
|
|
|
+ {getFieldDecorator('employerAddress', {
|
|
|
+ initialValue: theData.employerAddress
|
|
|
+ })(
|
|
|
+ <Input />
|
|
|
+ )}
|
|
|
+ </FormItem>
|
|
|
+ </div> : <div className="clearfix">
|
|
|
+ <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="雇主名称" >
|
|
|
+ {getFieldDecorator('employerId', {
|
|
|
+ initialValue: theData.username || ''
|
|
|
+ })(
|
|
|
+ <AutoComplete
|
|
|
+ dataSource={this.state.dataSource}
|
|
|
+ style={{ width: 200 }}
|
|
|
+ onSearch={this.state.therottleSearch}
|
|
|
+ placeholder="雇主名称"
|
|
|
+ onSelect={(e) => {
|
|
|
+ this.getContactsList(this.state.dataSourceObj[e]);
|
|
|
+ }} />
|
|
|
+ )}
|
|
|
+ </FormItem>
|
|
|
+ {this.props.detailApiUrl.indexOf('org') >= 0 ? <FormItem className="half-item"
|
|
|
+ {...formItemLayout}
|
|
|
+ label="联系人" >
|
|
|
+ {getFieldDecorator('contacts', {
|
|
|
+ initialValue: theData.contacts
|
|
|
+ })(
|
|
|
+ <Select style={{ width: 260 }}
|
|
|
+ placeholder="请选择联系人"
|
|
|
+ notFoundContent="未获取到联系人列表"
|
|
|
+ showSearch
|
|
|
+ filterOption={companySearch}>
|
|
|
+ {this.state.contactsOption}
|
|
|
+ </Select>
|
|
|
+ )}
|
|
|
+ </FormItem> : <div></div>}
|
|
|
+ </div>}
|
|
|
+ <div className="clearfix">
|
|
|
{theData.techBrokerId ? <FormItem className="half-item"
|
|
|
{...formItemLayout}
|
|
|
label="负责人" >
|