liting2017 7 år sedan
förälder
incheckning
6b8ee861c0

+ 2 - 2
js/component/manageCenter/achievement/achievementOrder.jsx

@@ -285,8 +285,8 @@ const AchievementOrderList = React.createClass({
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
                 status: this.state.status,
-                unitName: ((apiUrl || this.props['data-listApiUrl']).indexOf('org') != -1) ? null : this.state.searchName,
-                username: ((apiUrl || this.props['data-listApiUrl']).indexOf('org') != -1) ? this.state.searchName : null
+                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 = [];

+ 20 - 16
js/component/manageCenter/customer/myClient.jsx

@@ -243,14 +243,22 @@ const AchievementList = Form.create()(React.createClass({
 //				let companyArr=[]; 				
 // 				let companyString=thisData.companyIntention;				
 // 				companyArr=companyString.split(",") ; 				
- 				let creatMent=thisData.createTime.substr(10,9);
- 				let createYear=thisData.createTime.substr(0,10);
- 				let followSituationTxt=getfllowSituation(thisData.followSituation.toString()); 				
+// 				let creatMent=thisData.createTime.substr(10,9);
+// 				let createYear=thisData.createTime.substr(0,10);
+ 				let followSituationTxt=getfllowSituation(thisData.followSituation.toString()); 
+ 				let yearMonth = new Date().toLocaleDateString();           
+	            let yearString = yearMonth.split('/').join('-');                                          	           
+	        	let days = new Date(); 
+	            let hours = parseInt(days.getHours())<10 ? "0"+days.getHours():days.getHours();            
+	            let minutes =parseInt(days.getMinutes())<10 ? "0"+days.getMinutes():days.getMinutes();            
+	            let seconds =parseInt(days.getSeconds())<10 ? "0"+days.getSeconds():days.getSeconds();           
+	            let	pjstringY=hours+':'+minutes+':'+seconds ; 
+ 				
                 this.setState({
                 	locationProvince:thisData.locationProvince,
                 	addId:thisData.id,                	
-                	creatMent:creatMent,
-                	createYear:createYear,
+                	creatMent:pjstringY,
+                	createYear:yearString,
                 	addCid:thisData.cid,
                     datak: thisData,
                     companyIndustry:thisData.companyIndustry,
@@ -1410,7 +1418,7 @@ const AchievementList = Form.create()(React.createClass({
         this.loadData();        
     },
     tableRowClick(record, index) {    	
-        this.state.RowData = record;
+        //this.state.RowData = record;
         this.setModal5VisibleOk(record);
         this.contactList(record.id);
         this.rescordlist(record.id);
@@ -1647,12 +1655,11 @@ const AchievementList = Form.create()(React.createClass({
         }.bind(this));
     },
     addClick() {
-        this.state.RowData = {};
+        this.state.RowData={};       
         this.setState({
-            showDesc: true
-        });
-    },
-    
+            showDesc: true,           
+        });       
+    },    
     closeDesc(e, s) {
         this.state.showDesc = e;
         if (s) {
@@ -2539,12 +2546,9 @@ const AchievementList = Form.create()(React.createClass({
 										</Spin>
 								    </Modal>
                 <CustomerDetail
-                    data={this.state.RowData}
-                    detailApiUrl={this.props['data-detailApiUrl']}
-                    achievementCategoryOption={this.state.achievementCategoryOption}
+                    data={this.state.RowData}                                        
                     showDesc={this.state.showDesc}
-                    closeDesc={this.closeDesc} />
-               
+                    closeDesc={this.closeDesc} />               
             </div >
         );
     }

+ 77 - 57
js/component/manageCenter/customer/myClientDesc.jsx

@@ -3,24 +3,34 @@ import { Tabs, Table, Icon, Tooltip, Modal, message, AutoComplete, Spin, DatePic
 import './myClient.less';
 import ajax from 'jquery/src/ajax/xhr.js';
 import moment from 'moment';
-import { areaSelect } from '../../NewDicProvinceList';
 import $ from 'jquery/src/ajax';
+import { areaSelect } from '../../NewDicProvinceList';
 import { maturityList, innovationList, transferModeList,cityArr ,newFollow,customerStatus,intentionalService,tag} from '../../dataDic';
 import { IndustryObject, getIndustryCategory } from '../../DicIndustryList.js';
-import { beforeUploadFile, splitUrl, companySearch,getTag,getTransferMode, getAchievementCategory, getTechAuditStatus, getDemandType, getMaturity, getInnovation,beforeUpload, getBase64,getsex,getCompanyIntention,getcityArr,getfllowSituation,getcustomerStatue} from '../../tools.js';
+import { beforeUploadFile, splitUrl, companySearch, getTransferMode, getAchievementCategory, getTechAuditStatus, getDemandType, getMaturity, getInnovation,beforeUpload, getBase64,getsex,getCompanyIntention,getcityArr,getfllowSituation,getcustomerStatue} from '../../tools.js';
 import throttle from '../../throttle.js';
 
-const CustomerDetailForm = Form.create()(React.createClass({
+
+
+
+
+
+
+const AchievementDetailForm = Form.create()(React.createClass({
     getInitialState() {
         return {
-            loading: false,                                
+            loading: false,
+
             data: {},
-            tags: [],          
+            tags: [],
+
         };
     },
+
     handleSubmit(e) {
         e.preventDefault();
         this.props.form.validateFields((err, values) => {                                 
+
             //意向服务多选
 //          let companyMore = [];
 //          if (values.companyIntention.length) {
@@ -30,9 +40,9 @@ const CustomerDetailForm = Form.create()(React.createClass({
 //              });
 //              companyMore = companyList.join(",");
 //          };
-			let yearMonth = new Date(values.createYear).toLocaleDateString();           
+            let yearMonth = new Date().toLocaleDateString();           
             let yearString = yearMonth.split('/').join('-');                                          	           
-        	let days = new Date(values.creatMent); 
+        	let days = new Date(); 
             let hours = parseInt(days.getHours())<10 ? "0"+days.getHours():days.getHours();            
             let minutes =parseInt(days.getMinutes())<10 ? "0"+days.getMinutes():days.getMinutes();            
             let seconds =parseInt(days.getSeconds())<10 ? "0"+days.getSeconds():days.getSeconds();           
@@ -46,14 +56,16 @@ const CustomerDetailForm = Form.create()(React.createClass({
             if (!err) {
                 this.setState({
                     loading: true
-                });                
+                });
+                
                 $.ajax({
                     method: "POST",
                     dataType: "json",
                     crossDomain: false,
                     url: this.props.data.id ?  globalConfig.context + '/api/admin/customer/updCustomer' : globalConfig.context + '/api/admin/customer/addCustomer',
-                    data: {                       
-                        customerType:values.customerTyp ,//客户信息  1                                                            
+                    data: {
+                        id: this.props.data.id, //编号
+                        customerType:values.customerTyp ,//客户信息  1                                                                              
                         companyName: values.companyName,//公司名称  1
                         companyIndustry: values.companyIndustry,//公司行业  
                         companyIntention: values.companyIntention,//公司意向1
@@ -76,7 +88,8 @@ const CustomerDetailForm = Form.create()(React.createClass({
                         followDates:yearString+' '+pjstringY,//时间,
                         primaryFlg:0,
                     }
-                }).done(function (data) {                 
+                }).done(function (data) {
+                    this.state.auditStatus = 0;
                     this.setState({
                         loading: false
                     });
@@ -90,6 +103,31 @@ const CustomerDetailForm = Form.create()(React.createClass({
             }
         });
     },
+    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);
+        };  
+    },
+    componentWillReceiveProps(nextProps) {
+        if (!this.props.visible && nextProps.visible) {
+            if (nextProps.data && nextProps.data.id) {
+                this.loadData(nextProps.data.id, nextProps.detailApiUrl);
+            };
+            this.state.data = {};
+            this.state.tags = [];
+            this.state.switchValue = false;
+            this.state.radios = false;
+            this.state.technicalPictureUrl = [];
+            this.state.coverImg = [];
+            this.state.maturityPictureUrl = [];
+            this.state.textFileList = [];
+            this.state.techPlanFileList = [];
+            this.state.businessPlanFileList = [];
+            this.props.form.resetFields();
+        };
+    },
+   
     render() {
         const theData = this.state.data || {};
         const { getFieldDecorator } = this.props.form;
@@ -121,20 +159,8 @@ const CustomerDetailForm = Form.create()(React.createClass({
                         <div>	                    	
 				              <FormItem className="half-item"
 		                            {...formItemLayout}
-		                            label="录入时间" >
-		                            {getFieldDecorator('createYear', {
-		                            	rules: [{ required: true, message: '此项为必填项!' }],
-		                                initialValue: theData.createYear ? moment(theData.createYear) : null
-		                            })(
-		                                <DatePicker />
-		                                )}
-		                            {getFieldDecorator('creatMent', {
-		                            	rules: [{ required: true, message: '此项为必填项!' }],
-		                                initialValue: theData.creatMent ? moment(theData.creatMent) : null
-		                            })(
-		                                <TimePicker />
-		                                )}
-			                    </FormItem> 	                    
+		                            label="录入时间" >		                                                       
+			                   </FormItem> 	                    
                         </div>
                         <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>公司资料:</div>	                    		                           	                                                       	                                               
                         <div>
@@ -172,18 +198,6 @@ const CustomerDetailForm = Form.create()(React.createClass({
 	                                </Select>
 	                                )}
 	                        </FormItem>
-	                        {/*
-	                        <FormItem
-			                    {...formItemLayout}
-			                    label="地区"
-			                >
-			                    {getFieldDecorator('locationProvince', {
-			                        initialValue: theData.locationProvince
-			                    })(
-			                        <Cascader options={areaSelect()} />
-			                        )}
-			                </FormItem>
-			                */}
 	                        <FormItem className="half-item"
 	                            {...formItemLayout}
 	                            label="最新跟进" >
@@ -273,7 +287,7 @@ const CustomerDetailForm = Form.create()(React.createClass({
 			                </div>
                         </div>  
                         <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>联系资料:</div>
-                        <div className="clearfix">
+                        <div>
                         	<FormItem className="half-item"
 	                            {...formItemLayout}
 	                            label="姓名" >
@@ -283,7 +297,7 @@ const CustomerDetailForm = Form.create()(React.createClass({
 	                            })(
 	                                <Input />
 	                                )}
-	                        </FormItem>	                        
+	                        </FormItem>
                        		<FormItem className="half-item"
 	                            {...formItemLayout}
 	                            label="手机号码" >
@@ -293,12 +307,12 @@ const CustomerDetailForm = Form.create()(React.createClass({
 	                            })(
 	                                <Input />
 	                                )}
-	                        </FormItem>	
+	                        </FormItem>	                        
 	                        <FormItem className="half-item"
                                 {...formItemLayout}
                                 label="性别" >
                                 {getFieldDecorator('sex', {                                	
-                                    initialValue: theData.sex
+                                    initialValue: getsex(theData.sex)
                                 })(
                                     <Radio.Group>
                                         <Radio value="0">男</Radio>
@@ -363,10 +377,9 @@ const CustomerDetailForm = Form.create()(React.createClass({
                         </div>                        
         			</div>
                     <FormItem wrapperCol={{ span: 12, offset: 4 }}>
-                        <Button className="set-submit" type="primary" htmlType="submit">保存</Button>                       
+                        <Button className="set-submit" type="primary" htmlType="submit">保存</Button>                      
                         <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
-                    </FormItem>
-                   
+                    </FormItem>                   
                 </Spin>
             </Form >
         )
@@ -376,10 +389,12 @@ const CustomerDetailForm = Form.create()(React.createClass({
 const CustomerDetail = React.createClass({
     getInitialState() {
         return {
-            visible: false,            
-            loading: false,                        
+            visible: false,
+            tabsKey: 1,
+            loading: false,           
+            dataSource: [],
         };
-    },      
+    },    
     handleCancel(e) {
         this.setState({
             visible: false,
@@ -393,29 +408,34 @@ const CustomerDetail = React.createClass({
         this.props.closeDesc(false, true);
     },
     
-    componentWillReceiveProps(nextProps) {       
+    componentWillReceiveProps(nextProps) {
+        if (!this.state.visible && nextProps.showDesc) {
+            this.state.tabsKey = "1";
+        };
         this.state.visible = nextProps.showDesc;
     },
-    render() {       
+    render() {
+        
             return (
                 <div className="patent-desc">
                     <Modal maskClosable={false} visible={this.state.visible}
                         onOk={this.checkPatentProcess} onCancel={this.handleCancel}
-                        title='新建客户'
                         width='1000px'
+                        title='新建客户'                       
                         footer=''
                         className="admin-desc-content">
-                        <Spin spinning={this.state.loading}>                          
-                            <CustomerDetailForm
-                                data={this.props.data}                                                                                                
+                        <Spin spinning={this.state.loading}>               
+                            <AchievementDetailForm
+                                data={this.props.data}                               
                                 closeDesc={this.handleCancel}
-                                visible={this.state.visible} 
-                                handleOk={this.handleOk}
-                                />
+                                visible={this.state.visible}
+                                handleOk={this.handleOk} />
                         </Spin>
                     </Modal>
                 </div>
-            );
+            );        
     },
 });
+
+
 export default CustomerDetail;