liting2017 6 anni fa
parent
commit
6bba2f76ff

+ 2 - 2
js/component/account/business/businessDesc.jsx

@@ -47,7 +47,7 @@ class DemandDesc extends React.Component {
 									<DemandDetaiel
 									closeDesc={this.handleCancel.bind(this)}
 									data={this.props.data}
-									firstData={this.props.firstData}
+									categoryList={this.props.categoryList}
 									visible={this.state.visible}
 									handOk={this.handOk.bind(this)}
 									/>
@@ -55,7 +55,7 @@ class DemandDesc extends React.Component {
 									<DemandForm 
 										closeDesc={this.handleCancel.bind(this)}
 										data={this.props.data}
-										firstData={this.props.firstData}
+										categoryList={this.props.categoryList}
 										visible={this.state.visible}
 										handOk={this.handOk.bind(this)}
 										/>

+ 15 - 5
js/component/account/business/businessDetails.jsx

@@ -35,11 +35,16 @@ const DemandDetail = Form.create()(
 						}
 						thisData = {};
                     }
-                    let firstData = this.props.firstData,name='';
-                    firstData.map(item=>{
-                        if(item.id==thisData.categoryId){
-                            name=item.name;
-                        }
+                    let categoryList = this.props.categoryList,name='';
+                    categoryList.map(item=>{
+						if((item.children).length){
+							(item.children).map(atem=>{
+								if(atem.value==thisData.categoryId){
+									name=item.label+'/'+atem.label;
+									return;
+								}
+							})
+						}
                     })
 					this.setState({
 						id: thisData.id,
@@ -243,6 +248,11 @@ const DemandDetail = Form.create()(
 								</FormItem>
 							</div>
 							<div className="clearfix">
+								<FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 12 }} label="项目营销说明">
+									<span>{theData.advertisement}</span>
+								</FormItem>
+							</div>
+							<div className="clearfix">
 								<FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 12 }} label="业务项目服务内容">
 									<span>{theData.introduce}</span>
 								</FormItem>

+ 39 - 15
js/component/account/business/businessForm.jsx

@@ -160,8 +160,8 @@ const DemandDetailForm = Form.create()(
 				message.warning('项目名称在16个字以内');
 				return false;
 			};
-			if (!this.state.categoryId) {
-				message.warning('请选择项目业务品类');
+			if (!this.state.categoryId||!this.state.categoryId[1]) {
+				message.warning('请选择项目二级业务品类');
 				return;
 			}
 			if (!this.state.ProvinceCity.length) {
@@ -172,6 +172,10 @@ const DemandDetailForm = Form.create()(
 				message.warning('请输入正确的市场价');
 				return;
 			}
+			if(this.state.advertisement&&(this.state.advertisement).length>30){
+				message.warning('项目营销说明字数不得超过30个字。');
+				return;
+			}
 			this.setState({
 				loading: true
 			});
@@ -204,8 +208,9 @@ const DemandDetailForm = Form.create()(
 					auditStatus:index,
 					id: this.state.id, //业务名称
 					name: this.state.name, //业务名称
-					categoryId: this.state.categoryId, //业务品类
+					categoryId: this.state.categoryId[1], //业务品类
 					price: this.state.price, //市场价
+					advertisement:this.state.advertisement,//项目营销说明
 					activityPrice: this.state.activityPrice ? this.state.activityPrice : '0', //最低折扣
 					memberPrice: this.state.memberPrice ? this.state.memberPrice : '0', //会员价
 					offset: this.state.offset ? this.state.offset : '0',
@@ -249,13 +254,23 @@ const DemandDetailForm = Form.create()(
 							message.warning(data.error[0].message);
 						}
 					} else {
+						let categoryIdArr=[];
 						let thisdata = data.data;
 						let ProvinceCityArr = [];
 						ProvinceCityArr.push(thisdata.province, thisdata.city);
+						(this.props.categoryList).map(item=>{
+							if(item.children.length){
+								(item.children).map(atem=>{
+									if(atem.value==thisdata.categoryId){
+										categoryIdArr.push(item.value,atem.value)
+									}
+								})
+							}
+						})
 						this.setState({
 							id: thisdata.id, //业务名称
 							name: thisdata.name, //业务名称
-							categoryId: thisdata.categoryId, //业务品类
+							categoryId: categoryIdArr, //业务品类
 							number: thisdata.number,
 							auditInfo:thisdata.auditInfo,
 							price: thisdata.price, //市场价
@@ -327,10 +342,10 @@ const DemandDetailForm = Form.create()(
 					this.loadData(nextProps.data.id);
 				}
 			}
-		},
+			},
 		render() {
 			const FormItem = Form.Item;
-			let firstData = this.props.firstData || [];
+			let categoryList = this.props.categoryList||[];
 			return (
 				<div className="patent-desc">
 					<Form layout="horizontal" onSubmit={(e)=>{this.handleSubmit(e,0)}} id="demand-form">
@@ -364,18 +379,14 @@ const DemandDetailForm = Form.create()(
 										</span>
 									}
 								>
-									<Select
-										placeholder="请选择业务品类"
+									<Cascader
+										options={categoryList}
 										value={this.state.categoryId}
-										onChange={(e) => {
+										placeholder="业务品类"
+										onChange={(e, pre) => {
 											this.setState({ categoryId: e });
 										}}
-										notFoundContent="未获取到业务品类列表"
-									>
-										{firstData.map(function(item) {
-											return <Select.Option key={item.id}>{item.name}</Select.Option>;
-										})}
-									</Select>
+									/>
 								</FormItem>
 							</div>
 							<div className="clearfix" style={{ paddingLeft: '86px' }}>
@@ -553,6 +564,19 @@ const DemandDetailForm = Form.create()(
 								</FormItem>
 							</div>
 							<div className="clearfix">
+								<FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 12 }} label="项目营销说明">
+									<Input
+										type="textarea"
+										rows={4}
+										placeholder="项目营销说明"
+										value={this.state.advertisement}
+										onChange={(e) => {
+											this.setState({ advertisement: e.target.value });
+										}}
+									/>
+								</FormItem>
+							</div>
+							<div className="clearfix">
 								<FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 12 }} label="业务项目价值及作用">
 									<Input
 										type="textarea"

+ 34 - 55
js/component/account/business/businessProject.jsx

@@ -89,7 +89,8 @@ const BusinessProject = Form.create()(
 				data: {
 					pageNo: pageNo || 1,
 					pageSize: this.state.pagination.pageSize,
-					secondId: this.state.cid,
+					topId: this.state.typeSearch[0]? this.state.typeSearch[0]:'',
+					secondId:this.state.typeSearch[1]?this.state.typeSearch[1]:'',
 					name: this.state.nameSearch,
 					privateProject: 0
 				},
@@ -162,6 +163,7 @@ const BusinessProject = Form.create()(
 				selectedRowKeys: [],
 				selectedRows: [],
 				loading: false,
+				typeSearch:[],
 				orgCodeUrl: [],
 				companyLogoUrl: [],
 				pagination: {
@@ -316,40 +318,36 @@ const BusinessProject = Form.create()(
 				method: 'get',
 				dataType: 'json',
 				crossDomain: false,
-				url: globalConfig.context + '/api/user/jtBusiness/category/list',
+				url: globalConfig.context + '/portal/service/jtBusiness/getCategoryList',
 				data: {
-					pageNo: 1,
-					pageSize: 999
+					
 				},
 				success: function(data) {
-					let theArr = [],
-						firstData = [];
-					if (!data.data || !data.data.list) {
+					let theArr = [],thisdata=data.data;
+					
+					if (!data.data) {
 						if (data.error && data.error.length) {
 							message.warning(data.error[0].message);
 						}
 					} else {
-						for (let i = 0; i < data.data.list.length; i++) {
-							let thisdata = data.data.list[i];
+						thisdata.map((item,index) => {
 							theArr.push({
-								key: i,
-								id: thisdata.id,
-								name: thisdata.name,
-								superName: thisdata.superName //上级品类
-							});
-							if (thisdata.layer == '2') {
-								firstData.push({
-									key: i,
-									id: thisdata.id,
-									name: thisdata.name,
-									superName: thisdata.superName //上级品类
-								});
+								'value':item.topLevelId,
+								'label':item.topLevel,
+								'children':[]
+							})
+							if (item.children) {
+								item.children.map(atem => {
+									(theArr[index].children).push({
+										'value':atem.id,
+										'label':atem.name
+									})
+								})
 							}
-						}
+						})
 					}
 					this.setState({
 						categoryList: theArr,
-						firstData: firstData
 					});
 					this.loadData();
 				}.bind(this)
@@ -435,8 +433,8 @@ const BusinessProject = Form.create()(
 				message.warning('项目名称在16个字以内');
 				return false;
 			};
-			if (!this.state.addCid) {
-				message.warning('请选择项目品类');
+			if (!this.state.addCid||!this.state.addCid[1]) {
+				message.warning('请选择项目二级品类');
 				return false;
 			}
 			this.setState({
@@ -450,7 +448,7 @@ const BusinessProject = Form.create()(
 				url: globalConfig.context + '/api/user/jtBusiness/project/apply',
 				data: {
 					name: this.state.categoryName, //项目名称
-					categoryId: this.state.addCid,
+					categoryId: this.state.addCid[1],
 					isHot: this.state.isHot,
 					province: this.state.ProvinceCity ? this.state.ProvinceCity[0] : '', //是否全国
 					city: this.state.ProvinceCity ? this.state.ProvinceCity[1] : ''
@@ -529,6 +527,7 @@ const BusinessProject = Form.create()(
 		reset() {
 			this.state.nameSearch = ''; //项目名称清零
 			this.state.cid = undefined; //品类名称清零
+			this.typeSearch=undefined;
 			this.state.ressSearch = undefined; //省市区清零
 			this.state.activityFlag = undefined; //活动生效清零
 			this.state.status = undefined; //项目状态清零
@@ -564,8 +563,6 @@ const BusinessProject = Form.create()(
 			};
 			const hasSelected = this.state.selectedRowKeys.length > 0;
 			const { RangePicker } = DatePicker;
-			const categoryList = this.state.categoryList || [];
-			const firstData = this.state.firstData || [];
 			return (
 				<div className="user-content">
 					<div className="content-title">
@@ -586,19 +583,10 @@ const BusinessProject = Form.create()(
 									this.setState({ nameSearch: e.target.value });
 								}}
 							/>
-							<Select
-								placeholder="业务品类"
-								style={{ width: '200px', marginRight: '10px' }}
-								value={this.state.cid}
-								onChange={(e) => {
-									this.setState({ cid: e });
-								}}
-								notFoundContent="未获取到上级品类列表"
-							>
-								{firstData.map(function(item) {
-									return <Select.Option key={item.id}>{item.name}</Select.Option>;
-								})}
-							</Select>
+							<Cascader placeholder='业务项目品类' 
+								options={this.state.categoryList} 
+								style={{width:200,marginRight:10}} 
+								value={this.state.typeSearch} onChange={(e)=>{this.setState({typeSearch:e})}}/>
 							<Button type="primary" onClick={this.search} style={{ marginRight: '10px' }}>
 								搜索
 							</Button>
@@ -636,7 +624,7 @@ const BusinessProject = Form.create()(
 							data={this.state.RowData}
 							showDesc={this.state.showDesc}
 							closeDesc={this.closeDesc}
-							firstData={this.state.firstData}
+							categoryList={this.state.categoryList}
 						/>
 						<div className="patent-desc">
 							<Modal
@@ -669,20 +657,11 @@ const BusinessProject = Form.create()(
 										</div>
 										<div className="clearfix">
 											<FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="业务品类">
-												<Select
-													placeholder="请选择业务品类"
-													value={this.state.addCid}
-													onChange={(e) => {
-														this.setState({ addCid: e });
-													}}
-													notFoundContent="未获取到业务品类列表"
+												<Cascader placeholder='业务项目品类' 
+													options={this.state.categoryList} 
+													value={this.state.addCid} 
 													style={{ width: '94%' }}
-													required="required"
-												>
-													{firstData.map(function(item) {
-														return <Select.Option key={item.id}>{item.name}</Select.Option>;
-													})}
-												</Select>
+													onChange={(e)=>{this.setState({addCid:e})}}/>
 												<span className="mandatory" style={{ color: 'red', marginLeft: '5px' }}>
 													*
 												</span>