liting2017 6 years ago
parent
commit
7e2bab6ba1

+ 3 - 1
css/base.less

@@ -8,7 +8,9 @@
  * 2. Prevent adjustments of font size after orientation changes in
  *    IE on Windows Phone and in iOS.
  */
-
+ #LRfloater0{
+  left: -200px!important;
+}
 html {
   line-height: 1.15; /* 1 */
   -ms-text-size-adjust: 100%; /* 2 */

+ 3 - 0
css/login.less

@@ -26,4 +26,7 @@
         padding: 30px 20px 0;
         background: #fff;
     }
+}
+#LRfloater0{
+    left: -200px!important;
 }

+ 5 - 1
js/admin/bottom.less

@@ -8,4 +8,8 @@
         z-index: 1;
         text-align: center;
         padding: 6px 0;
-    }
+    }
+    #LRdiv0{
+        left:-200px!important;
+    }
+ 

+ 3 - 1
js/admin/index/content.jsx

@@ -9,7 +9,8 @@ import BusinessProject from '@/administration/business/businessProject';
 import News from '@/administration/news/newsList';
 import Policy from '@/administration/policy/policyList';
 import Order from '@/administration/order/order';
-import SystemMessage from '@/administration/messagePush/systemMessage'
+import SystemMessage from '@/administration/messagePush/systemMessage';
+import Tags from '@/administration/tags/tags';
 
 import {hashHistory,Route,Router} from 'react-router';
 import {Layout} from 'antd';
@@ -24,6 +25,7 @@ export default class ContentRouter extends React.Component {
         <Router history={hashHistory}>
             <Route path="/library" component={DemandLibrary} />
             <Route path="/examine" component={DemandExamine} />
+            <Route path="/tags" component={Tags} />
             <Route path="/index" component={AdmianIndex} />
             <Route path="/achievementLibrary" component={AchievementLibrary} />
             <Route path="/achievementExamine" component={AchievementExamine} />

+ 1 - 1
js/admin/index/leftMenu.jsx

@@ -12,7 +12,7 @@ const LeftTab = React.createClass({
 			openKeys: [ 'sub1' ],
 			current: 'index',
 			switch: false,
-			rootSubmenuKeys :['sub1', 'sub2','sub3','sub4','sub5','sub6','sub7']
+			rootSubmenuKeys :['sub1', 'sub2','sub3','sub4','sub5','sub6','sub7','sub8']
 		};
 	},
 	menuClick(e) {

+ 1 - 1
js/admin/leftTab.less

@@ -45,4 +45,4 @@
 .ant-layout.ant-layout-has-sider{
     min-height:calc(100vh - 10px);
     margin-top:1px;
-}
+}

+ 8 - 0
js/admin/menu.jsx

@@ -54,6 +54,14 @@ module.exports = {
         ]
       },
       {
+        name: '标签库',
+        url: 'sub8',
+        icon: 'database',
+        children: [
+          { name: '我的标签库', url: 'tags' },
+        ]
+      },
+      {
         name: '系统消息管理',
         url: 'sub7',
         icon: 'notification',

+ 5 - 2
js/component/account/bottom.less

@@ -1,11 +1,14 @@
     .account-bottom {
         width: 100%;
         color: #d5e4f7;
-        background: #212831;
+        background: #212831;  
         position: fixed;
         bottom: 0;
         left: 0;
         z-index: 1;
         text-align: center;
         padding: 6px 0;
-    }
+    }
+    #LRfloater0{
+        left:-200px!important;
+    }

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

@@ -50,6 +50,7 @@ class DemandDesc extends React.Component {
 									categoryList={this.props.categoryList}
 									visible={this.state.visible}
 									handOk={this.handOk.bind(this)}
+									tagList={this.props.tagList}
 									/>
 									:
 									<DemandForm 
@@ -58,6 +59,7 @@ class DemandDesc extends React.Component {
 										categoryList={this.props.categoryList}
 										visible={this.state.visible}
 										handOk={this.handOk.bind(this)}
+										tagList={this.props.tagList}
 										/>
 								} 
 						</div>

+ 11 - 2
js/component/account/business/businessDetails.jsx

@@ -45,11 +45,20 @@ const DemandDetail = Form.create()(
 								}
 							})
 						}
-                    })
+					})
+					let tagFirst =thisData.tags?thisData.tags.split(','):[],tagTxt=[];
+					(this.props.tagList).map(item=>{
+						for(let j=0;j<tagFirst.length;j++){
+							if(item.id==tagFirst[j]){
+								tagTxt.push(item.name);
+							}
+						}
+					})
 					this.setState({
 						id: thisData.id,
                         data: thisData,
 						name:name,
+						tags:tagTxt.join(' - '),
 						createTime: thisData.createTime ? new Date(thisData.createTime).toLocaleString() : '',
 						auditStatus: thisData.auditStatus,
 						orgCodeUrl: thisData.minImgUrl
@@ -249,7 +258,7 @@ const DemandDetail = Form.create()(
 							</div>
 							<div className="clearfix">
 								<FormItem labelCol={{ span: 4 }} wrapperCol={{ span: 12 }} label="标签">
-									<span>{theData.tag}</span>
+									<span>{this.state.tags}</span>
 								</FormItem>
 							</div>
 							<div className="clearfix">

+ 107 - 9
js/component/account/business/businessForm.jsx

@@ -13,7 +13,9 @@ import {
 	Radio,
 	Form,
 	Cascader,
+	Checkbox,
 	Tag,
+	Row,Col,
 	InputNumber
 } from 'antd';
 import { citySelect } from '@/NewDicProvinceListAll';
@@ -151,6 +153,7 @@ const DemandDetailForm = Form.create()(
 	React.createClass({
 		getInitialState() {
 			return {
+				tagArr:[],
 				visible: false,
 				loading: false,
 				auditStatus: 0,
@@ -159,7 +162,7 @@ const DemandDetailForm = Form.create()(
 				pictureUrl: [],
 				orgCodeUrl: [],
 				companyLogoUrl: [],
-				tags: []
+				tags: [],
 			};
 		},
 		//左侧图片地址
@@ -240,11 +243,12 @@ const DemandDetailForm = Form.create()(
 					city: this.state.ProvinceCity ? this.state.ProvinceCity[1] : '',
 					introduce: this.state.introduce,
 					value: this.state.value,
-					tag:this.state.tags?this.state.tags.join(','):'',
+					// tag:this.state.tags?this.state.tags.join(','):'',
 					isHot: this.state.isHot,
 					minImgUrl: minPictureUrl.length ? minPictureUrl : '',
 					maxImgUrl: maxPictureUrl.length ? maxPictureUrl : '',
-					applyConditions: this.state.applyConditions
+					applyConditions: this.state.applyConditions,
+					tags:this.state.tagArr.join(',')
 				}
 			}).done(
 				function(data) {
@@ -289,11 +293,20 @@ const DemandDetailForm = Form.create()(
 								})
 							}
 						})
-
+						let tagFirst =thisdata.tags?thisdata.tags.split(','):[],tagTxt=[];
+						(this.props.tagList).map(item=>{
+							for(let j=0;j<tagFirst.length;j++){
+								if(item.id==tagFirst[j]){
+									tagTxt.push(item.name);
+								}
+							}
+						})
 						this.setState({
 							id: thisdata.id, //业务名称
 							name: thisdata.name, //业务名称
-							tags:thisdata.tag?thisdata.tag.split(','):[],
+							// tags:thisdata.tag?thisdata.tag.split(','):[],
+							tagTxt:tagTxt.join(' - '),
+							tagArr:tagFirst,
 							categoryId: categoryIdArr, //业务品类
 							number: thisdata.number,
 							auditInfo:thisdata.auditInfo,
@@ -358,21 +371,64 @@ const DemandDetailForm = Form.create()(
 				this.loadData(this.props.data.id);
 			}
 		},
+		
+		//标签
+		tagOk(){
+			this.setState({
+				visibleTag:false
+			})
+		},
+		tagCancel(){
+			this.setState({
+				visibleTag:false
+			})
+		},
+		selTag(){
+			this.setState({
+				visibleTag:true
+			})
+			this.state.tagArr=this.state.tagArr;
+		},
+		onChange(e){
+			this.setState({
+				tagArr:e
+			})
+		},
+		tagSubmit(e){
+			e.preventDefault();
+			let tags =[];
+			(this.props.tagList).map(item=>{
+				for(let i=0;i<(this.state.tagArr).length;i++){
+					if(item.id==(this.state.tagArr[i])){
+						tags.push(item.name)
+					}
+				}
+			})
+			this.tagCancel();
+			this.setState({
+				tagTxt:tags.join(' - ')
+			})
+		},
 		componentWillReceiveProps(nextProps) {
 			if (!this.props.visible && nextProps.visible) {
 				this.state.textFileList = [];
 				this.state.videoFileList = [];
 				if (nextProps.data.id) {
-					this.loadData(nextProps.data.id);
+						this.loadData(nextProps.data.id);
+					}
 				}
-			}
 			},
 		render() {
 			const FormItem = Form.Item;
+			const formItemLayout = {
+				labelCol: { span: 6 },
+				wrapperCol: { span: 16 },
+			};
 			let categoryList = this.props.categoryList||[];
+			let plainOptions= this.props.tagList||[];
 			return (
 				<div className="patent-desc">
-					<Form layout="horizontal" onSubmit={(e)=>{this.handleSubmit(e,0)}} id="demand-form">
+					<Form layout="horizontal" onSubmit={(e)=>{this.handleSubmit(e)}} id="demand-form">
 						<Spin spinning={this.state.loading}>
 							<div className="clearfix" style={{ paddingLeft: '86px' }}>
 								<FormItem
@@ -560,7 +616,7 @@ const DemandDetailForm = Form.create()(
 								</FormItem>
 							</div>	
 							<div className="clearfix">
-								<FormItem
+								{/* <FormItem
 									labelCol={{ span: 4 }}
 									wrapperCol={{ span: 18 }}
 									label={<span><span></span>标签</span>} >
@@ -568,6 +624,15 @@ const DemandDetailForm = Form.create()(
 										keyWordArr={this.state.tags}
 										tagsArr={(e)=>{this.setState({tags:e})}}
 										/>
+								</FormItem> */}
+								<FormItem
+									labelCol={{ span: 4 }}
+									wrapperCol={{ span: 12 }}
+									label="标签">
+										<div>
+											<span style={{marginRight:10}}>{this.state.tagTxt}</span>
+											<Button onClick={this.selTag}>选择</Button>
+										</div>
 								</FormItem>
 							</div>	
 							<div>
@@ -693,6 +758,39 @@ const DemandDetailForm = Form.create()(
 							</Button>
 						</Spin>
 					</Form>
+					<Modal
+						maskClosable={false}
+						visible={this.state.visibleTag}
+						onOk={this.tagOk}
+						onCancel={this.tagCancel}
+						width="450px"
+						title="新建标签"
+						footer=""
+					>
+						<Form layout="horizontal" onSubmit={(e)=>{this.tagSubmit(e)}} id="demand-form">
+							<Form.Item  {...formItemLayout} label={<span><strong style={{color:'#f00'}}> * </strong>标签</span>}>
+								<Checkbox.Group 
+									value={this.state.tagArr}
+									onChange={this.onChange}>
+									<Row>
+										{plainOptions.map((item)=>{
+											return <Col span={8} key={item.id} ><Checkbox  value={item.id}>{item.name}</Checkbox></Col>
+										})}
+									</Row>
+								</Checkbox.Group>
+							</Form.Item>
+							<div className="clearfix">
+								<Form.Item wrapperCol={{ span: 12, offset: 6 }}>
+									<Button className="set-submit" type="primary" htmlType="submit">
+										保存
+									</Button>
+									<Button className="set-submit" type="ghost" onClick={this.tagCancel}>
+										取消
+									</Button>
+								</Form.Item>
+							</div>
+						</Form>
+					</Modal>
 				</div>
 			);
 		}

+ 32 - 1
js/component/account/business/businessProject.jsx

@@ -165,6 +165,7 @@ const BusinessProject = Form.create()(
 		},
 		getInitialState() {
 			return {
+				tagList:[],
 				searchMore: true,
 				selectedRowKeys: [],
 				selectedRows: [],
@@ -330,7 +331,6 @@ const BusinessProject = Form.create()(
 				},
 				success: function(data) {
 					let theArr = [],thisdata=data.data;
-					
 					if (!data.data) {
 						if (data.error && data.error.length) {
 							message.warning(data.error[0].message);
@@ -417,7 +417,37 @@ const BusinessProject = Form.create()(
 				};
 			}.bind(this));
 		},
+		loadTag(){
+			$.ajax({
+				method: 'get',
+				dataType: 'json',
+				crossDomain: false,
+				url: globalConfig.context + '/portal/service/jtBusiness/getCategoryList',
+				data: {},
+				success:function(data){
+					if(!data.data){
+						if(data.error&&data.error.length){
+							message.error(data.error[0].message)
+							return;
+						}
+					}else{
+						let thisdata = data.data,theDate=[];
+						thisdata.map((item,index)=>{
+							theDate.push({
+								key:index,
+								id:item.id,
+								name:item.tagName
+							})
+						})
+						this.setState({
+							tagList:theDate
+						})
+					}
+				}.bind(this)
+			})
+		},
 		componentWillMount() {
+			this.loadTag();
 			this.topLevel();
 		},
 		
@@ -631,6 +661,7 @@ const BusinessProject = Form.create()(
 							showDesc={this.state.showDesc}
 							closeDesc={this.closeDesc}
 							categoryList={this.state.categoryList}
+							tagList={this.state.tagList}
 						/>
 						<div className="patent-desc">
 							<Modal

+ 0 - 1
js/component/account/index/content.jsx

@@ -25,7 +25,6 @@ import ProjectOrderX from "@/account/order/projectOrderX";
 import ProjectOrderS from "@/account/order/projectOrderS";
 
 
-
 import {hashHistory,Route,Router} from 'react-router';
 import {Layout} from 'antd';
 import '@/account/content.less';

+ 0 - 16
js/component/account/index/leftMenu.jsx

@@ -101,22 +101,6 @@ const LeftTab = React.createClass({
 		this.hashFun()
 	},
 	render() {
-		
-		// let demandList = [
-		// 	{
-		// 		name: '我的需求',
-		// 		url: 'sub3',
-		// 		icon: 'bulb',
-		// 		children: [ { name: '科技需求列表', url: 'demand' } ]
-		// 	},
-		// 	{
-		// 		name: '我的成果',
-		// 		url: 'sub4',
-		// 		icon: 'compass',
-		// 		children: [ { name: '科技成果列表', url: 'achievement' } ]
-		// 	}
-		// ];
-
 		let menuList = [],newMenu=[];
 		let menuNO = menu[1].children;
 		menuNO.map((item) => {

+ 1 - 2
js/component/account/menu.jsx

@@ -74,8 +74,7 @@ module.exports = {
         children: [
           { name: '常用功能', url: 'normal' },
           { name: '我的收藏', url: 'collection' },
-          { name: '我的关注', url: 'follow' },
-          // { name: '科技订单', url: 'techList' },
+          { name: '我的关注', url: 'follow' }
           // { name: '服务订单', url: 'serviceList' },
           // { name: '咨询订单', url: 'consultList' }
         ]

+ 246 - 0
js/component/administration/tags/tags.jsx

@@ -0,0 +1,246 @@
+import {Component} from 'react';
+import { Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Form } from 'antd';
+
+class Tags extends Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            selectedRowKeys:[],
+            selectedRows: [],
+            loading: false,
+            pagination: {
+                defaultCurrent: 1,
+                defaultPageSize: 10,
+                showQuickJumper: true,
+                pageSize: 10,
+                onChange: function (page) {
+                    this.loadData(page);
+                }.bind(this),
+                showTotal: function (total) {
+                    return '共' + total + '条数据';
+                }
+            },
+            columns: [
+                {
+                    title: '标签编号',
+                    dataIndex: 'serialNumber',
+                    key: 'serialNumber',
+                }, {
+                    title: '标签名称',
+                    dataIndex: 'name',
+                    key: 'name',
+                },  {
+                    title: '创建人',
+                    dataIndex: 'createName',
+                    key: 'createName'
+                },
+                {
+                    title: '创建时间',
+                    dataIndex: 'createTime',
+                    key: 'createTime'
+                }
+            ],
+            dataSource: []
+          }
+    }
+    loadData(pageNo) {
+        this.state.data = [];
+        this.setState({
+            page:pageNo,
+            loading: true
+        });
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/user/demand/list",
+            data: {
+                pageNo: pageNo || 1,
+                pageSize: this.state.pagination.pageSize,
+                name: this.state.name, //标签名称
+            },
+            success: function (data) {
+                let theArr = [];
+                if (!data.data || !data.data.list) {
+                    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];
+                        theArr.push({
+                            key: i,
+                            id: thisdata.id,
+                            serialNumber: thisdata.serialNumber, //编号
+                            name: thisdata.name,
+                            createTime:thisdata.createTime?(new Date(thisdata.createTime)).toLocaleString():'',
+                        });
+                    };
+                };
+                this.state.pagination.current = data.data.pageNo;
+                this.state.pagination.total = data.data.totalCount;
+                if(data.data&&data.data.list&&!data.data.list.length){
+					this.state.pagination.current=0
+					this.state.pagination.total=0
+				};
+                this.setState({
+                    dataSource: theArr,
+                    pagination: this.state.pagination
+                });
+            }.bind(this),
+        }).always(function () {
+            this.setState({
+                loading: false
+            });
+        }.bind(this));
+    }
+    handOk(){
+        this.setState({
+            visible:false
+        })
+        this.loadData(this.state.page)
+    }
+    handleCancel(){
+        this.setState({
+            visible:false
+        })
+    }
+    search(){
+        this.loadData();
+    }
+    reset(){
+        this.state.name='';
+        this.loadData();
+    }
+    addClick(){
+        this.state.tagName='';
+        this.setState({
+            visible:true
+        })
+    }
+    del(){
+        this.setState({
+            loading:true
+        })
+        let ids = this.state.selectedRowKeys;
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/user/demand/list",
+            data: {
+              id:ids[0]
+            },
+            success: function (data) {
+                let theArr = [];
+                if (!data.data.length) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message);
+                    };
+                } else {
+                     message.success('删除成功!');  
+                }
+            }
+        })
+    }
+    //新建
+    handleSubmit(e){
+        e.preventDefault();
+        if(!this.state.tagName){
+            message.warning('请填写标签名称!');
+            return;
+        }
+        this.setState({
+            loading:true
+        });
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,
+            url: globalConfig.context + "/api/user/demand/lis",
+            data: {
+              name:this.state.tagName
+            },
+            success: function (data) {
+                let theArr = [];
+                if (!data.data.length) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message);
+                    };
+                } else {
+                     message.success('新建成功!');
+                }
+            }
+        })
+    }
+    render() { 
+        const rowSelection = {
+            selectedRowKeys: this.state.selectedRowKeys,
+            onChange: (selectedRowKeys, selectedRows) => {
+                this.setState({
+                    selectedRows: selectedRows.slice(-1),
+                    selectedRowKeys: selectedRowKeys.slice(-1)
+                });
+            }
+        };
+        const formItemLayout = {
+            labelCol: { span: 6 },
+            wrapperCol: { span: 12 },
+		};
+        const hasSelected = this.state.selectedRowKeys.length > 0;
+        return (
+            <div className="user-content" >
+            <div className="content-title">
+                <span style={{fontSize:20}}>我的标签库</span>
+                <div className="patent-addNew">
+                    <Button type="primary" onClick={this.addClick.bind(this)}>新增标签<Icon type="plus" /></Button>
+                </div>
+            </div>
+            <div className="user-search">
+                <Input placeholder="标签名称"
+                    value={this.state.name}
+                    onChange={(e) => { this.setState({ name: e.target.value }); }} />
+                <Button type="primary" onClick={this.search}>搜索</Button>
+                <Button onClick={this.reset}>重置</Button>
+                <Button type="danger" onClick={this.del.bind(this)} disabled={!hasSelected}>删除</Button>
+            </div>
+            <div className="patent-table">
+                <Spin spinning={this.state.loading}>
+                    <Table columns={this.state.columns}
+                        dataSource={this.state.dataSource}
+                        rowSelection={rowSelection}
+                        pagination={this.state.pagination}
+                        onRowClick={this.tableRowClick} />
+                </Spin>
+            </div>
+            <Modal
+					maskClosable={false}
+					visible={this.state.visible}
+					onOk={this.handOk.bind(this)}
+					onCancel={this.handleCancel.bind(this)}
+					width="400px"
+					title="新建标签"
+					footer=""
+				>
+                <Form layout="horizontal" onSubmit={(e)=>{this.handleSubmit(e)}} id="demand-form">
+                        <Form.Item  {...formItemLayout} label={<span><strong style={{color:'#f00'}}> * </strong>标签</span>}>
+                            <Input value={this.state.tagName} onChange={(e)=>{this.setState({tagName:e.target.value})}} placeholder="标签名称"/>
+						</Form.Item>
+                        <div className="clearfix">
+						<Form.Item wrapperCol={{ span: 12, offset: 6 }}>
+						    <Button className="set-submit" type="primary" htmlType="submit">
+								保存
+							</Button>
+							<Button className="set-submit" type="ghost" onClick={this.handleCancel.bind(this)}>
+								取消
+							</Button>
+						</Form.Item>
+					</div>
+                </Form>
+             </Modal>
+        </div >
+         );
+    }
+}
+ 
+export default Tags;