dengzhiguo 7 years ago
parent
commit
db7473f94f

+ 164 - 3
js/component/manageCenter/demand/myTechDemand.jsx

@@ -132,8 +132,13 @@ const DemandList = React.createClass({
                     };
                 } else {
                     for (let i = 0; i < data.data.list.length; i++) {
-                        let thisdata = data.data.list[i];
-                        theArr.push({
+                    	let thisdata = data.data.list[i];
+                    	let thisdataDet=data.data.list[i].demandFollowDetail;
+                    	let followUp='';
+                    	for(let j=0;j<thisdataDet.length;j++){
+                    		followUp+=(j+1)+'. '+thisdataDet[j].createTimeFormattedDate+' '+thisdataDet[j].remarks+' \n';
+                    	}
+                    	theArr.push({
                             key: i,//序列号
                             id: thisdata.id,//匹配跟进ID
                             demandId: thisdata.demandId,//需求ID
@@ -152,6 +157,7 @@ const DemandList = React.createClass({
                             lastFollowTimeFormattedDate: thisdata.lastFollowTimeFormattedDate,//跟进时间转格式
                             adminName: thisdata.adminName,//录入人
                             remark:thisdata.remark,//备注
+                            followUp:followUp,
                         });
                     };
                     this.state.matepagination.current = data.data.pageNo;
@@ -408,6 +414,52 @@ const DemandList = React.createClass({
             ],
             mateDataSource: [],
             searchTime: [],
+            mateColumnsExport: [
+                {
+                    title: '企业名称',
+                    dataIndex: 'employerName',
+                    key: 'employerName',
+                }, {
+                    title: '需求名称',
+                    dataIndex: 'name',
+                    key: 'name',
+                },{
+                    title: '联系人',
+                    dataIndex: 'employerContactsMobile',
+                    key: 'employerContactsMobile',
+                },{
+                    title: '联系人邮箱',
+                    dataIndex: 'employerContactsMailbox',
+                    key: 'employerContactsMailbox',
+                },{
+                    title: '匹配机构',
+                    dataIndex: 'organization',
+                    key: 'organization',
+                },{
+                    title: '成果联系人',
+                    dataIndex: 'contacts',
+                    key: 'contacts',
+                },{
+                    title: '成果方联系方式',
+                    dataIndex: 'contactMobile',
+                    key: 'contactMobile',
+                },{
+                    title: '来源',
+                    dataIndex: 'sources',
+                    key: 'sources',
+                },{
+                    title: '备注',
+                    dataIndex: 'remark',
+                    key: 'remark',
+                },{
+                    title: '跟进汇总',
+                    dataIndex: 'followUp',
+                    key: 'followUp',
+                    
+                }
+            ],
+            mateDataSource: [],
+            searchTime: [],
             lookColumns: [
                  {
                     title: '跟进时间',
@@ -614,6 +666,101 @@ const DemandList = React.createClass({
             this.mateLoadData();
         }.bind(this));
     },
+    //判断浏览器类型
+	getExplorer() {
+		var explorer = window.navigator.userAgent;
+		//ie 
+		if(explorer.indexOf("MSIE") >= 0) {
+			return 'ie';
+		}
+		//firefox 
+		else if(explorer.indexOf("Firefox") >= 0) {
+			return 'Firefox';
+		}
+		//Chrome
+		else if(explorer.indexOf("Chrome") >= 0) {
+			return 'Chrome';
+		}
+		//Opera
+		else if(explorer.indexOf("Opera") >= 0) {
+			return 'Opera';
+		}
+		//Safari
+		else if(explorer.indexOf("Safari") >= 0) {
+			return 'Safari';
+		}
+	},
+    //导出为exel表格
+	tabExel() {
+		var table = document.querySelector('#daochu');
+		var idTmr;
+		//debugger;
+		//整个表格拷贝到EXCEL中
+		if(this.getExplorer() == 'ie') {
+			var curTbl = document.getElementById(tableid);
+			var oXL = new ActiveXObject("Excel.Application");
+			//创建AX对象excel 
+			var oWB = oXL.Workbooks.Add();
+			//获取workbook对象 
+			var xlsheet = oWB.Worksheets(1);
+			//激活当前sheet 
+			var sel = document.body.createTextRange();
+			sel.moveToElementText(curTbl);
+			//把表格中的内容移到TextRange中 
+			sel.select();
+			//全选TextRange中内容 
+			sel.execCommand("Copy");
+			//复制TextRange中内容  
+			xlsheet.Paste();
+			//粘贴到活动的EXCEL中       
+			oXL.Visible = true;
+			//设置excel可见属性
+			try {
+				var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
+			} catch(e) {
+				print("Nested catch caught " + e);
+			} finally {
+				oWB.SaveAs(fname);
+
+				oWB.Close(savechanges = false);
+				//xls.visible = false;
+				oXL.Quit();
+				oXL = null;
+				//结束excel进程,退出完成
+				//window.setInterval("Cleanup();",1);
+				idTmr = window.setInterval("Cleanup();", 1);
+			}
+		} else {
+			console.log(table);
+			this.tableToExcel(table,this.getExplorer());
+		}
+		function Cleanup() {
+			window.clearInterval(idTmr);
+			CollectGarbage();
+		}
+	},
+	tableToExcel(table,name) {
+		var uri = 'data:application/vnd.ms-excel;base64,',
+			template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
+			base64 = function(s) {
+				return window.btoa(unescape(encodeURIComponent(s)))
+			},
+			format = function(s, c) {
+				return s.replace(/{(\w+)}/g,
+					function(m, p) {
+						return c[p];
+					})
+			}
+			console.log(table.nodeType);
+			if(!table.nodeType) table = document.getElementById(table);
+			console.log(table);
+			var ctx = {
+				worksheet: name || 'Worksheet',
+				table: table.innerHTML
+			};
+			window.location.href = uri + base64(format(template, ctx))
+	},
+    //匹配跟进的显示和隐藏
     mate(){
     	this.setState({ 
     		matevisible: true 
@@ -1049,8 +1196,9 @@ const DemandList = React.createClass({
 							        <Button className="ContactsList" type="primary" onClick={this.addmate1} style={{float:'left',marginBottom:'10px',marginRight:'20px'}} disabled={!matehasSelected}>添加跟进情况</Button>
 							        <Button className="ContactsList" type="primary" onClick={this.lookmate} style={{float:'left',marginBottom:'10px',marginRight:'20px'}} disabled={!matehasSelected}>查看跟进情况</Button>
 							        <Button className="ContactsList"  onClick={this.delect} style={{float:'left',marginBottom:'10px',marginRight:'20px'}} disabled={!matehasSelected}>删除</Button>
+							        <Button type="primary" onClick={this.tabExel}>导出到表格</Button>
 						        </div>
-			                    <div className="clearfix">
+			                    <div className="clearfix" >
 	                			  <Spin spinning={this.state.loading}>
 	                			     <Form horizontal id="demand-form" onSubmit={this.contactSave} >
 								      <Table 
@@ -1063,6 +1211,19 @@ const DemandList = React.createClass({
 						            </Form> 
 								   </Spin> 
 								</div>
+								<div className="clearfix" id='daochu' style={{'display':'none'}}>
+	                			  <Spin spinning={this.state.loading}>
+	                			     <Form horizontal id="demand-form" onSubmit={this.contactSave} >
+								      <Table 
+						            	 pagination={this.state.matepagination}
+						            	 columns={this.state.mateColumnsExport} 
+						            	 dataSource={this.state.mateDataSource}
+						            	 rowSelection={materowSelection}
+						            	 onRowClick={this.mateTableRowClick}
+						            	 />
+						            </Form> 
+								   </Spin> 
+								</div>
 			                </Spin>
 			            </Form >
                     </Modal>

+ 67 - 94
js/component/manageCenter/demand/techDemandDesc.jsx

@@ -405,7 +405,7 @@ const DemandDetailShow = Form.create()(React.createClass({
 	                        </div>
 	                   	 </FormItem>
                     </div> :<div></div>}                
-                    {this.state.switchValue ? <div>
+                    <div>
                         <FormItem className="half-item"
                             {...formItemLayout}
                             label="雇主名称" >
@@ -418,6 +418,16 @@ const DemandDetailShow = Form.create()(React.createClass({
                         </FormItem>
                         <FormItem className="half-item"
                             {...formItemLayout}
+                            label="需求联系人" >
+                            <span>{theData.contacts}</span>
+                        </FormItem>
+                        <FormItem className="half-item"
+                            {...formItemLayout}
+                            label="需求联系人电话" >
+                            <span>{theData.contactMobile}</span>
+                        </FormItem>
+                        <FormItem className="half-item"
+                            {...formItemLayout}
                             label="电子邮箱" >
                             <span>{theData.employerContactsMailbox}</span>
                         </FormItem>
@@ -426,36 +436,34 @@ const DemandDetailShow = Form.create()(React.createClass({
                             label="通讯地址" >
                             <span>{theData.employerAddress}</span>
                         </FormItem>
-                    </div> : <div className="clearfix">
-                            <FormItem className="half-item"
-                                {...formItemLayout}
-                                label="雇主名称" >
-                                <span>{theData.username}</span>
-                            </FormItem>
-                            {this.props.data.dataCategory ? <FormItem className="half-item"
-                                {...formItemLayout}
-                                label="联系人" >
-                                <span>{this.state.contactsObj[theData.contacts]}</span>
-                            </FormItem> : <FormItem className="half-item"
-                                {...formItemLayout}
-                                label="联系人" >
-                                    <span>{theData.contactsName}</span>
-                                </FormItem>}
-                        </div>}
-                    <div className="clearfix">
                         <FormItem className="half-item"
                             {...formItemLayout}
                             label="负责人" >
                             <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
                         </FormItem>
-                    </div>
+                    </div> 
                     <div className="clearfix">
-                       
                         <FormItem className="half-item"
                             {...formItemLayout}
                             label="发布时间" >
                             <span>{theData.releaseDateFormattedDate}</span>
                         </FormItem>
+                        <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 className="half-item"
                         {...formItemLayout}
@@ -499,24 +507,7 @@ const DemandDetailShow = Form.create()(React.createClass({
                             })()}
                         </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 }}
@@ -867,17 +858,19 @@ const DemandDetailForm = Form.create()(React.createClass({
                         costEscrow: values.costEscrow,                        
                         budgetCost: values.budgetCost,
                         //
-                        switchSign: this.state.switchValue ? 1 : 0,
+                        switchSign: 1,
                         //
                         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,
-                        urgentDays: this.state.switchValue ? values.urgentDays : null,
-                        urgentMoney: this.state.switchValue ? values.urgentMoney : null,
-                        employerAddress: this.state.switchValue ? values.employerAddress : null,
-                        employerContactsMobile: this.state.switchValue ? values.employerContactsMobile : null,
-                        employerContactsMailbox: this.state.switchValue ? values.employerContactsMailbox : null,
+                        contacts:values.contacts,
+                        contactMobile:values.contactMobile,
+                        employerName:values.employerName ,
+                        urgentDays:values.urgentDays,
+                        urgentMoney:values.urgentMoney ,
+                        employerAddress:values.employerAddress,
+                        employerContactsMobile:values.employerContactsMobile,
+                        employerContactsMailbox:values.employerContactsMailbox ,
                         //
                         releaseStatus: values.releaseStatus,
                         principalId: values.principalId,
@@ -1042,11 +1035,7 @@ const DemandDetailForm = Form.create()(React.createClass({
 	                    </FormItem>
 	                    
                     </div> :<div></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" >
+                    <div className="clearfix" >
                         <FormItem className="half-item"
                             {...formItemLayout}
                             label="雇主名称" >
@@ -1058,7 +1047,7 @@ const DemandDetailForm = Form.create()(React.createClass({
                         </FormItem>
                         <FormItem className="half-item"
                             {...formItemLayout}
-                            label="联系电话" >
+                            label="雇主电话" >
                             {getFieldDecorator('employerContactsMobile', {
                                 initialValue: theData.employerContactsMobile
                             })(
@@ -1067,6 +1056,24 @@ const DemandDetailForm = Form.create()(React.createClass({
                         </FormItem>
                         <FormItem className="half-item"
                             {...formItemLayout}
+                            label="需求联系人" >
+                            {getFieldDecorator('contacts', {
+                                initialValue: theData.contacts
+                            })(
+                                <Input />
+                                )}
+                        </FormItem>
+                        <FormItem className="half-item"
+                            {...formItemLayout}
+                            label="需求联系人电话" >
+                            {getFieldDecorator('contactMobile', {
+                                initialValue: theData.contactMobile
+                            })(
+                                <Input />
+                                )}
+                        </FormItem>
+                        <FormItem className="half-item"
+                            {...formItemLayout}
                             label="电子邮箱" >
                             {getFieldDecorator('employerContactsMailbox', {
                                 initialValue: theData.employerContactsMailbox
@@ -1083,39 +1090,7 @@ const DemandDetailForm = Form.create()(React.createClass({
                                 <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> 
                     <div className="clearfix">
                         {theData.techBrokerId ? <FormItem className="half-item"
                             {...formItemLayout}
@@ -1171,11 +1146,10 @@ const DemandDetailForm = Form.create()(React.createClass({
                             visible={this.props.visible} />
                     </FormItem>
                     
-                    <FormItem
-                        labelCol={{ span: 3 }}
-                        wrapperCol={{ span: 20 }}
+                    <FormItem className="half-item"
+                        {...formItemLayout}
                         label="需求类别" >
-                        <Select placeholder="选择需求类别" style={{ width: 120 }}
+                        <Select placeholder="选择需求类别" 
                             value={this.state.dataCategory}
                             onChange={(e) => { this.setState({ dataCategory: e }) }}>
                             <Select.Option value="0" >个人</Select.Option>
@@ -1183,15 +1157,14 @@ const DemandDetailForm = Form.create()(React.createClass({
                         </Select>
                         
                     </FormItem>
-                    <FormItem
-                        labelCol={{ span: 3 }}
-                        wrapperCol={{ span: 18 }}
+                    <FormItem className="half-item"
+                        {...formItemLayout}
                         label="行业类别" >
                         {getFieldDecorator('industryCategory', {
                             rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
                             initialValue: [theData.industryCategoryA, theData.industryCategoryB]
                         })(
-                            <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="请选择一个行业" />
+                            <Cascader options={IndustryObject} placeholder="请选择一个行业" />
                             )}
                     </FormItem>
                     <FormItem className="half-item"
@@ -1222,7 +1195,7 @@ const DemandDetailForm = Form.create()(React.createClass({
                                 rules: [{ required: true, message: '此项为必填项!' }],
                                 initialValue: theData.demandType
                             })(
-                                <Select style={{ width: 160 }} placeholder="请选择需求类型">
+                                <Select  placeholder="请选择需求类型">
                                     {this.props.demandTypeOption}
                                 </Select>
                                 )}