12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139 |
- import React from 'react';
- import { Icon, Tabs, Table, 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, splitUrl, companySearch, getTechField, getDemandType, getAchievementCategory } from '../../tools.js';
- const KeyWordTagGroup = React.createClass({
- getInitialState() {
- return {
- tags: [],
- inputVisible: false,
- inputValue: ''
- };
- },
- handleClose(removedTag) {
- const tags = this.state.tags.filter(tag => tag !== removedTag);
- this.props.tagsArr(tags);
- this.setState({ tags });
- },
- showInput() {
- this.setState({ inputVisible: true }, () => this.input.focus());
- },
- handleInputChange(e) {
- this.setState({ inputValue: e.target.value });
- },
- handleInputConfirm() {
- const state = this.state;
- const inputValue = state.inputValue;
- let tags = state.tags;
- 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,
- inputVisible: false,
- inputValue: '',
- });
- },
- componentWillMount() {
- this.state.tags = this.props.keyWordArr;
- },
- componentWillReceiveProps(nextProps) {
- if (this.props.keyWordArr != nextProps.keyWordArr) {
- this.state.tags = nextProps.keyWordArr;
- };
- },
- render() {
- const { tags, inputVisible, inputValue } = this.state;
- return (
- <div className="keyWord-tips">
- {tags.map((tag, index) => {
- const isLongTag = tag.length > 10;
- const tagElem = (
- <Tag key={tag} closable={index !== -1} afterClose={() => this.handleClose(tag)}>
- {isLongTag ? `${tag.slice(0, 10)}...` : tag}
- </Tag>
- );
- return isLongTag ? <Tooltip title={tag}>{tagElem}</Tooltip> : tagElem;
- })}
- {inputVisible && (
- <Input
- ref={input => this.input = input}
- type="text"
- style={{ width: 78 }}
- value={inputValue}
- onChange={this.handleInputChange}
- onBlur={this.handleInputConfirm}
- onPressEnter={this.handleInputConfirm}
- />
- )}
- {!inputVisible && <Button className="addtips" type="dashed" disabled={tags.length > 9 ? true : false} onClick={this.showInput}>+ 新关键词</Button>}
- </div>
- );
- }
- });
- const PicturesWall = React.createClass({
- getInitialState() {
- return {
- previewVisible: false,
- previewImage: '',
- fileList: [],
- }
- },
- handleCancel() {
- this.setState({ previewVisible: false })
- },
- handlePreview(file) {
- this.setState({
- previewImage: file.url || file.thumbUrl,
- previewVisible: true,
- });
- },
- handleChange(info) {
- let fileList = info.fileList;
- this.setState({ fileList });
- this.props.fileList(fileList);
- },
- componentWillReceiveProps(nextProps) {
- this.state.fileList = nextProps.pictureUrl;
- },
- render() {
- const { previewVisible, previewImage, fileList } = this.state;
- const uploadButton = (
- <div>
- <Icon type="plus" />
- <div className="ant-upload-text">点击上传</div>
- </div>
- );
- return (
- <div className="clearfix">
- <Upload
- action={globalConfig.context + "/api/user/demand/uploadPicture"}
- data={{ 'sign': 'demand_picture', 'uid': this.props.uid }}
- listType="picture-card"
- fileList={fileList}
- onPreview={this.handlePreview}
- onChange={this.handleChange} >
- {fileList.length >= 5 ? null : uploadButton}
- </Upload>
- <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
- <img alt="example" style={{ width: '100%' }} src={previewImage} />
- </Modal>
- </div>
- );
- }
- });
- const DemandDetailShow = Form.create()(React.createClass({
- getInitialState() {
- return {
- visible: false,
- loading: false,
- contactsObj: {},
- salesmanObj: {},
- pictureUrl: [],
- tags: []
- };
- },
- loadData(id) {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + (window.userData.type == '1' ? '/api/user/demand/orgDemandDetail' : '/api/user/demand/userDemandDetail'),
- data: {
- id: id
- },
- success: function (data) {
- let thisData = data.data;
- if (!thisData) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- thisData = {};
- };
- this.setState({
- data: thisData,
- tags: thisData.keyword ? thisData.keyword.split(",") : [],
- pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
- });
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- offShelf() {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/user/demand/offShelf",
- data: { "id": this.props.data.id }
- }).done(function (data) {
- this.setState({
- loading: false
- });
- if (!data.error.length) {
- message.success('撤销成功!');
- this.setState({
- visible: false,
- releaseSubmitVisible: false
- });
- this.props.handleOk();
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this));
- },
- componentWillMount() {
- if (this.props.data.id) {
- this.loadData(this.props.data.id);
- } else {
- this.state.data = {};
- };
- },
- componentWillReceiveProps(nextProps) {
- if (!this.props.visible && nextProps.visible) {
- if (nextProps.data.id) {
- this.loadData(nextProps.data.id);
- } else {
- this.state.data = {};
- };
- this.props.form.resetFields();
- };
- },
- render() {
- const theData = this.state.data || {};
- const { getFieldDecorator } = this.props.form;
- const FormItem = Form.Item
- const formItemLayout = {
- labelCol: { span: 6 },
- wrapperCol: { span: 12 },
- };
- return (
- <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
- <Spin spinning={this.state.loading}>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="编号" >
- <span>{theData.serialNumber}</span>
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="需求名称" >
- <span>{theData.name}</span>
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="雇主名称" >
- <span>{theData.username}</span>
- </FormItem>
- {window.userData.type == '1' ? <FormItem className="half-item"
- {...formItemLayout}
- label="联系人" >
- <span>{this.props.contactsObj[theData.contacts]}</span>
- </FormItem> : <div></div>}
- {window.userData.type == '0' ? <FormItem className="half-item"
- {...formItemLayout}
- label="联系方式" >
- <span>{theData.mobile}</span>
- </FormItem> : <div></div>}
- </div>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="是否发布" >
- {(() => {
- switch (theData.releaseStatus) {
- case "0":
- return <span>未发布</span>;
- case "1":
- return <div>
- <span>已发布</span>
- <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>撤消发布</Button>
- <Modal maskClosable={false} title="确认"
- visible={this.state.releaseSubmitVisible}
- width='300px'
- footer={null}
- onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
- <span>确认要撤销发布吗?</span>
- <Button className="modal-submit" type="primary" onClick={this.offShelf} >确认</Button>
- <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
- </Modal>
- </div>;
- }
- })()}
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="发布时间" >
- <span>{theData.releaseDateFormattedDate}</span>
- </FormItem>
- </div>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="需求状态" >
- {(() => {
- switch (theData.status) {
- case "0":
- return <span>未解决</span>;
- case "1":
- return <span>已解决</span>;
- }
- })()}
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="审核状态" >
- {(() => {
- switch (theData.auditStatus) {
- case "0":
- return <span>未提交审核(草稿)</span>;
- case "1":
- return <span>提交审核</span>;
- case "2":
- return <span>审核中</span>;
- case "3":
- return <span>审核通过</span>;
- case "4":
- return <span>审核未通过</span>;
- }
- })()}
- </FormItem>
- </div>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="信息来源" >
- {(() => {
- switch (theData.infoSources) {
- case "0":
- return <span>平台采集</span>;
- case "1":
- return <span>客户发布</span>;
- case "2":
- return <span>批量导入</span>;
- case "3":
- return <span>三方对接</span>;
- }
- })()}
- </FormItem>
- </div>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 20 }}
- label="关键词" >
- {this.state.tags.map((tag) => {
- return <Tooltip key={tag} title={tag}>
- <Tag key={tag}>{tag}</Tag>
- </Tooltip>;
- })}
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="行业类别" >
- <span>{getIndustryCategory(theData.industryCategoryA, theData.industryCategoryB)}</span>
- </FormItem>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="需求类型" >
- <span>{getDemandType(theData.demandType)}</span>
- </FormItem>
- </div>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="问题说明" >
- <span>{theData.problemDes}</span>
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="技术指标要求" >
- <span>{theData.technicalRequirements}</span>
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="需求文件(图片)" >
- <div className="clearfix">
- <Upload className="demandDetailShow-upload"
- listType="picture-card"
- fileList={this.state.pictureUrl}
- onPreview={(file) => {
- this.setState({
- previewImage: file.url || file.thumbUrl,
- previewVisible: true,
- });
- }} >
- </Upload>
- <Modal maskClosable={false} footer={null}
- visible={this.state.previewVisible}
- onCancel={() => { this.setState({ previewVisible: false }) }}>
- <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
- </Modal>
- </div>
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 6 }}
- label="需求文件(文本)" >
- <div>{theData.textFileUrl ?
- <span className="download-file">
- <a onClick={() => { window.open(globalConfig.context + '/api/user/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
- </span>
- : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</div>
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="需求文件(视频地址)" >
- <span>{theData.videoUrl}</span>
- </FormItem>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="固定周期" >
- <span>{theData.fixedCycle}</span>
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="固定人数" >
- <span>{theData.peopleNumber} 人</span>
- </FormItem>
- </div>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="固定方案" >
- <span>{theData.fixedScheme}</span>
- </FormItem>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="预算费用" >
- <span>{theData.budgetCost} 万元</span>
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="费用托管" >
- {(() => {
- switch (theData.costEscrow) {
- case 0:
- return <span>否</span>;
- case 1:
- return <span>是</span>;
- }
- })()}
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="有效期限" >
- <span>{theData.validityPeriodFormattedDate}</span>
- </FormItem>
- </div>
- <FormItem wrapperCol={{ span: 12, offset: 3 }}>
- <Button className="set-submit" type="primary" onClick={this.props.closeDesc}>取消</Button>
- </FormItem>
- </Spin>
- </Form >
- )
- }
- }));
- const DemandDetailForm = Form.create()(React.createClass({
- getInitialState() {
- return {
- visible: false,
- loading: false,
- auditStatus: 0,
- textFileList: [],
- videoFileList: [],
- pictureUrl: [],
- tags: []
- };
- },
- loadData(id) {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + (window.userData.type == '1' ? '/api/user/demand/orgDemandDetail' : '/api/user/demand/userDemandDetail'),
- data: {
- id: id
- },
- success: function (data) {
- let thisData = data.data;
- if (!thisData) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- thisData = {};
- };
- this.setState({
- data: thisData,
- tags: thisData.keyword ? thisData.keyword.split(",") : [],
- pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
- });
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- getTagsArr(e) {
- this.setState({ tags: e });
- },
- getPictureUrl(e) {
- this.setState({ pictureUrl: e });
- },
- handleSubmit(e) {
- e.preventDefault();
- this.props.form.validateFields((err, values) => {
- //keyword长度判断
- if (this.state.tags.length < 3) {
- message.warning('关键词数量不能小于3个!');
- return;
- };
- //url转化
- let thePictureUrl = [];
- if (this.state.pictureUrl.length) {
- let picArr = [];
- this.state.pictureUrl.map(function (item) {
- picArr.push(item.response.data);
- });
- thePictureUrl = picArr.join(",");
- };
- if (!err) {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: this.props.data.id ? globalConfig.context + '/api/user/demand/update' : globalConfig.context + '/api/user/demand/apply',
- data: {
- id: this.props.data.id,
- dataCategory: Number(window.userData.type),
- serialNumber: this.props.data.serialNumber,
- name: values.name,
- keyword: this.state.tags ? this.state.tags.join(",") : [],
- keywords: this.state.tags,
- infoSources: 1,
- industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
- industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,
- demandType: values.demandType,
- problemDes: values.problemDes,
- technicalRequirements: values.technicalRequirements,
- pictureUrl: thePictureUrl,
- textFileUrl: this.state.textFileUrl,
- videoUrl: values.videoUrl,
- fixedBudget: values.fixedBudget,
- fixedCycle: values.fixedCycle,
- peopleNumber: values.peopleNumber,
- fixedScheme: values.fixedScheme,
- costEscrow: values.costEscrow,
- budgetCost: values.budgetCost,
- employerId: values.employerId || this.state.data.employerId,
- 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
- }
- }).done(function (data) {
- this.state.auditStatus = 0;
- this.setState({
- loading: false
- });
- if (!data.error.length) {
- message.success('保存成功!');
- this.setState({
- visible: false
- });
- this.props.handleOk();
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this));
- }
- });
- },
- componentWillMount() {
- if (this.props.data.id) {
- this.loadData(this.props.data.id);
- } else {
- this.state.data = {};
- };
- },
- componentWillReceiveProps(nextProps) {
- if (!this.props.visible && nextProps.visible) {
- this.state.textFileList = [];
- this.state.videoFileList = [];
- if (nextProps.data.id) {
- this.loadData(nextProps.data.id);
- } else {
- this.state.data = {};
- this.state.tags = [];
- this.state.pictureUrl = [];
- };
- this.props.form.resetFields();
- };
- },
- render() {
- const theData = this.state.data || {};
- const { getFieldDecorator } = this.props.form;
- const FormItem = Form.Item
- const formItemLayout = {
- labelCol: { span: 6 },
- wrapperCol: { span: 12 },
- };
- return (
- <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
- <Spin spinning={this.state.loading}>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="编号" >
- <span>{theData.serialNumber}</span>
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="需求名称" >
- {getFieldDecorator('name', {
- rules: [{ required: true, message: '此项为必填项!' }],
- initialValue: theData.name
- })(
- <Input />
- )}
- </FormItem>
- {theData.username ? <FormItem className="half-item"
- {...formItemLayout}
- label="雇主名称" >
- <span>{theData.username}</span>
- </FormItem> : <div></div>}
- {window.userData.type == "1" ? <FormItem className="half-item"
- {...formItemLayout}
- label="联系人" >
- {getFieldDecorator('contacts', {
- initialValue: theData.contacts
- })(
- <Select style={{ width: 260 }}
- placeholder="请选择联系人"
- notFoundContent="未获取到联系人列表"
- showSearch
- filterOption={companySearch}>
- {this.props.contactsOption}
- </Select>
- )}
- </FormItem> : <div></div>}
- {window.userData.type == "0" ? <FormItem className="half-item"
- {...formItemLayout}
- label="联系方式" >
- <span>{theData.mobile}</span>
- </FormItem> : <div></div>}
- </div>
- {theData.releaseStatus ? <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="是否发布" >
- {(() => {
- switch (theData.releaseStatus) {
- case "0":
- return <span>未发布</span>;
- case "1":
- return <span>已发布</span>;
- }
- })()}
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="发布时间" >
- <span>{theData.releaseDateFormattedDate}</span>
- </FormItem>
- </div> : <div></div>}
- <div className="clearfix">
- {theData.releaseStatus == "1" ? <FormItem className="half-item"
- {...formItemLayout}
- label="需求状态" >
- {getFieldDecorator('status', {
- initialValue: theData.status
- })(
- <Radio.Group>
- <Radio value="0">未解决</Radio>
- <Radio value="1">已解决</Radio>
- </Radio.Group>
- )}
- </FormItem> : <div></div>}
- <FormItem className="half-item"
- {...formItemLayout}
- label="审核状态" >
- {(() => {
- switch (theData.auditStatus) {
- case "0":
- return <span>未提交审核(草稿)</span>;
- case "1":
- return <span>提交审核</span>;
- case "2":
- return <span>审核中</span>;
- case "3":
- return <span>审核通过</span>;
- case "4":
- return <span>审核未通过</span>;
- }
- })()}
- </FormItem>
- </div>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 20 }}
- label="关键词" >
- <KeyWordTagGroup
- keyWordArr={this.state.tags}
- tagsArr={this.getTagsArr}
- visible={this.props.visible} />
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="行业类别" >
- {getFieldDecorator('industryCategory', {
- rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
- initialValue: [theData.industryCategoryA, theData.industryCategoryB]
- })(
- <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="请选择一个行业" />
- )}
- </FormItem>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="需求类型" >
- {getFieldDecorator('demandType', {
- rules: [{ required: true, message: '此项为必填项!' }],
- initialValue: theData.demandType
- })(
- <Select style={{ width: 160 }} placeholder="请选择需求类型">
- {this.props.demandTypeOption}
- </Select>
- )}
- </FormItem>
- </div>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="问题说明" >
- {getFieldDecorator('problemDes', {
- rules: [{ required: true, message: '此项为必填项!' }],
- initialValue: theData.problemDes
- })(
- <Input type="textarea" rows={4} />
- )}
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="技术指标要求" >
- {getFieldDecorator('technicalRequirements', {
- initialValue: theData.technicalRequirements
- })(
- <Input type="textarea" rows={2} />
- )}
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="需求文件(图片)" >
- <PicturesWall
- uid={theData.employerId}
- fileList={this.getPictureUrl}
- pictureUrl={this.state.pictureUrl}
- visible={this.props.visible} />
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 6 }}
- label="需求文件(文本)" >
- <Upload
- name="ratepay"
- action={globalConfig.context + "/api/user/demand/uploadTextFile"}
- data={{ 'sign': 'demand_text_file', 'uid': theData.employerId }}
- beforeUpload={beforeUploadFile}
- fileList={this.state.textFileList}
- onChange={(info) => {
- if (info.file.status !== 'uploading') {
- console.log(info.file, info.fileList);
- }
- if (info.file.status === 'done') {
- if (!info.file.response.error.length) {
- message.success(`${info.file.name} 文件上传成功!`);
- } else {
- message.warning(info.file.response.error[0].message);
- return;
- };
- this.state.textFileUrl = info.file.response.data;
- } else if (info.file.status === 'error') {
- message.error(`${info.file.name} 文件上传失败。`);
- };
- this.setState({ textFileList: info.fileList.slice(-1) });
- }} >
- <Button><Icon type="upload" /> 上传需求文本文件 </Button>
- </Upload>
- <p style={{ marginTop: '10px' }}>{theData.textFileUrl ?
- <span className="download-file">
- <a onClick={() => { window.open(globalConfig.context + '/api/user/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
- </span>
- : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
- </FormItem>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="需求文件(视频地址)" >
- {getFieldDecorator('videoUrl', {
- initialValue: theData.videoUrl
- })(
- <Input />
- )}
- </FormItem>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="固定周期" >
- {getFieldDecorator('fixedCycle', {
- initialValue: theData.fixedCycle
- })(
- <Input />
- )}
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="固定人数" >
- {getFieldDecorator('peopleNumber', {
- initialValue: theData.peopleNumber
- })(
- <InputNumber min={0} max={9999} step={1}/>
- )}
- <span style={{ marginLeft: '20px' }}>人</span>
- </FormItem>
- </div>
- <FormItem
- labelCol={{ span: 3 }}
- wrapperCol={{ span: 18 }}
- label="固定方案" >
- {getFieldDecorator('fixedScheme', {
- initialValue: theData.fixedScheme
- })(
- <Input type="textarea" rows={2} />
- )}
- </FormItem>
- <div className="clearfix">
- <FormItem className="half-item"
- {...formItemLayout}
- label="预算费用" >
- {getFieldDecorator('budgetCost', {
- initialValue: theData.budgetCost
- })(
- <InputNumber min={0} max={999999} step={0.01}/>
- )}
- <span style={{ marginLeft: '20px' }}>万元</span>
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="费用托管" >
- {getFieldDecorator('costEscrow', {
- initialValue: theData.costEscrow
- })(
- <Radio.Group>
- <Radio value={0}>否</Radio>
- <Radio value={1}>是</Radio>
- </Radio.Group>
- )}
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="有效期限" >
- {getFieldDecorator('validityPeriod', {
- initialValue: theData.validityPeriod ? moment(theData.validityPeriod) : null
- })(
- <DatePicker />
- )}
- </FormItem>
- </div>
- <div className="clearfix" style={{ display: 'none' }}>
- <FormItem className="half-item"
- {...formItemLayout}
- label="雇主地址" >
- <span>{theData.employerAddress}</span>
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="雇主联系人名称" >
- <span>{theData.employerContacts}</span>
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="雇主联系人电话" >
- <span>{theData.employerContactsMobile}</span>
- </FormItem>
- <FormItem className="half-item"
- {...formItemLayout}
- label="雇主联系人邮箱" >
- <span>{theData.employerContactsMailbox}</span>
- </FormItem>
- </div>
- <FormItem wrapperCol={{ span: 12, offset: 3 }}>
- <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
- <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
- <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
- </FormItem>
- </Spin>
- </Form >
- )
- }
- }));
- const DemandDetail = React.createClass({
- getInitialState() {
- return {
- visible: false,
- contactsObj: {},
- tabsKey: "1",
- columns: [
- {
- title: '编号',
- dataIndex: 'serialNumber',
- key: 'serialNumber',
- }, {
- title: '数据类型',
- dataIndex: 'dataCategory',
- key: 'dataCategory',
- render: text => {
- switch (text) {
- case "0":
- return <span>个人需求</span>;
- case "1":
- return <span>团体需求</span>;
- }
- }
- }, {
- title: '名称',
- dataIndex: 'name',
- key: 'name',
- }, {
- title: '关键字',
- dataIndex: 'keyword',
- key: 'keyword',
- }, {
- title: '类型',
- dataIndex: 'category',
- key: 'category',
- render: text => { return getAchievementCategory(text); }
- }, {
- title: '所有人名称',
- dataIndex: 'theName',
- key: 'theName',
- }, {
- title: '所有人类型',
- dataIndex: 'ownerType',
- key: 'ownerType',
- render: text => {
- switch (text) {
- case "0":
- return <span>个人</span>;
- case "1":
- return <span>组织</span>
- }
- }
- }, {
- title: '发布时间',
- dataIndex: 'releaseDateFormattedDate',
- key: 'releaseDateFormattedDate',
- }
- ],
- dataSource: [],
- };
- },
- getContactsList() {
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/user/cognizance/getContacts",
- success: function (data) {
- let theOption = [];
- if (!data.data) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- } else {
- for (let item in data.data) {
- let theData = data.data[item];
- theOption.push(
- <Select.Option value={item} key={theData}>{theData}</Select.Option>
- );
- };
- };
- this.setState({
- contactsOption: theOption,
- contactsObj: data.data || {}
- });
- }.bind(this),
- });
- },
- getTableList() {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/user/demand/achievementDemand",
- data: { id: this.props.data.id },
- success: function (data) {
- let theArr = [];
- if (!data.data) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- };
- } else if (data.data.length) {
- for (let i = 0; i < data.data.length; i++) {
- let thisdata = data.data[i];
- theArr.push({
- key: i,
- id: thisdata.id,
- serialNumber: thisdata.serialNumber,
- dataCategory: thisdata.dataCategory,
- name: thisdata.name,
- keyword: thisdata.keyword,
- category: thisdata.category,
- ownerType: thisdata.ownerType,
- theName: thisdata.username || thisdata.unitName,
- releaseDate: thisdata.releaseDate,
- releaseDateFormattedDate: thisdata.releaseDateFormattedDate
- });
- };
- };
- this.setState({
- dataSource: theArr,
- });
- }.bind(this),
- }).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- tableRowClick(record, index) {
- if (record.ownerType == "0") {
- window.open(globalConfig.context + '/user/account/achievement.html?rid=' + record.id + '#orgTechAchievement');
- } else if (record.ownerType == "1") {
- window.open(globalConfig.context + '/user/account/achievement.html?rid=' + record.id + '#userTechAchievement')
- };
- },
- showModal() {
- this.setState({
- visible: true,
- });
- },
- handleCancel(e) {
- this.setState({
- visible: false,
- });
- this.props.closeDesc(false);
- },
- handleOk(e) {
- this.setState({
- visible: false,
- });
- this.props.closeDesc(false, true);
- },
- componentWillMount() {
- this.getContactsList();
- },
- componentWillReceiveProps(nextProps) {
- if (nextProps.showDesc) {
- this.state.tabsKey = "1";
- this.state.tabBool = true;
- };
- this.state.visible = nextProps.showDesc;
- },
- render() {
- if (this.props.data) {
- return (
- <div className="patent-desc">
- <Modal maskClosable={false} visible={this.state.visible}
- onOk={this.checkPatentProcess} onCancel={this.handleCancel}
- width='1000px'
- footer=''
- className="admin-desc-content">
- <Tabs activeKey={this.state.tabsKey}
- onChange={(e) => {
- this.setState({ tabsKey: e });
- if (e == "2" && this.state.tabBool) {
- this.getTableList();
- this.state.tabBool = false;
- };
- }} >
- <Tabs.TabPane tab="需求详情" key="1">
- {(() => {
- if (this.props.data.auditStatus && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
- return <DemandDetailShow
- data={this.props.data}
- demandTypeOption={this.props.demandTypeOption}
- contactsObj={this.state.contactsObj}
- closeDesc={this.handleCancel}
- visible={this.state.visible}
- handleOk={this.handleOk} />
- } else {
- return <DemandDetailForm
- data={this.props.data}
- contactsOption={this.state.contactsOption}
- demandTypeOption={this.props.demandTypeOption}
- closeDesc={this.handleCancel}
- visible={this.state.visible}
- handleOk={this.handleOk} />
- }
- })()}
- </Tabs.TabPane>
- <Tabs.TabPane tab="匹配列表" key="2">
- <Table columns={this.state.columns}
- dataSource={this.state.dataSource}
- pagination={false}
- onRowClick={this.tableRowClick} />
- </Tabs.TabPane>
- </Tabs>
- </Modal>
- </div>
- );
- } else {
- return <div></div>
- }
- },
- });
- export default DemandDetail;
|