Browse Source

品类置顶

liting2017 6 years ago
parent
commit
7c374158c8

+ 55 - 2
js/component/administration/business/businessCategory.jsx

@@ -73,7 +73,8 @@ const BusinessCategory=Form.create()(React.createClass({
                 pageNo: pageNo || 1,
 				pageSize: this.state.pagination.pageSize,
 				name: this.state.nameSearch, //品类名称
-				layer: this.state.layerSearch //组织层级
+                layer: this.state.layerSearch, //组织层级
+                module:this.state.moduleSearch
             },
             success: function (data) {
                 let theArr = [];
@@ -186,6 +187,10 @@ const BusinessCategory=Form.create()(React.createClass({
                     dataIndex: 'layerName',
                     key: 'layerName'
                 }, {
+                    title: '序号',
+                    dataIndex: 'sort',
+                    key: 'sort'
+                }, {
                     title: '上级品类',
                     dataIndex: 'superName',
                     key: 'superName',
@@ -199,7 +204,9 @@ const BusinessCategory=Form.create()(React.createClass({
                     render:(text,recard)=>{
                         return (
                             <div>
-                                 {recard.layer<2&&<Button onClick={(e)=>{e.stopPropagation();this.nextAdd(recard)}}>新建下级品类</Button>}
+                                 {recard.layer<2&&<Button style={{background:'#51a351',color:'#fff'}} onClick={(e)=>{e.stopPropagation();this.nextAdd(recard)}}>新建下级品类</Button>}
+                                 <Button type="primary" style={{margin:10}} onClick={(e)=>{e.stopPropagation();this.movePre(recard)}}>上移</Button>
+                                 <Button type="primary" onClick={(e)=>{e.stopPropagation();this.moveTop(recard)}}>置顶</Button>
                             </div>
                          )
                     }
@@ -209,6 +216,44 @@ const BusinessCategory=Form.create()(React.createClass({
             dataSource: [],
         };
     },
+    //上移动
+    movePre(recard){
+        this.setState({
+            loading:false
+        })
+        $.ajax({
+            method:'POST',
+            url: globalConfig.context + "/api/admin/jtBusiness/project/moveUp",
+            data:{
+                id:recard.id
+            }
+        }).done((data)=>{
+            if(data&&(data.error).length){
+                message.error(data.error[0].message);
+            }
+            this.setState({loading:false});
+            this.loadData(this.state.page);
+        })
+    },
+    //置顶
+    moveTop(recard){
+        this.setState({
+            loading:false
+        })
+        $.ajax({
+            method:'POST',
+            url: globalConfig.context + "/api/admin/jtBusiness/project/setTop",
+            data:{
+                id:recard.id
+            }
+        }).done((data)=>{
+            if(data&&(data.error).length){
+                message.error(data.error[0].message);
+            }
+            this.setState({loading:false});
+            this.loadData(this.state.page);
+        })
+    },
     componentWillMount() {
         this.loadData();
         this.loadMenu();
@@ -402,6 +447,7 @@ const BusinessCategory=Form.create()(React.createClass({
     },
     reset() {
         this.state.nameSearch = '';//品类名称清零
+        this.state.moduleSearch=undefined;
         this.state.layerSearch = undefined;//品类层级清零
         this.loadData();       
     },
@@ -452,6 +498,13 @@ const BusinessCategory=Form.create()(React.createClass({
                             <Select.Option value="1">一级</Select.Option>
                             <Select.Option value="2">二级</Select.Option>
 		                </Select>
+                        <Select  style={{ width:'200px',marginRight:'10px' }} value ={this.state.moduleSearch} placeholder="模块" onChange={(e)=>{this.setState({moduleSearch:e})}}>
+                            {
+                                typeModule.map(item=>{
+                                return <Select.Option key={item.value} value={item.value}>{item.key}</Select.Option>
+                                })
+                            }
+                        </Select>
 	                    <Button type="primary" onClick={this.search} style={{marginRight:'10px'}}>搜索</Button>
 	                    <Button onClick={this.reset} style={{marginRight:'10px'}}>重置</Button>
                         <Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">

+ 1 - 1
package.json

@@ -12,7 +12,7 @@
     "buildtest": "node bin/clean.js && webpack --progress --colors --env.deploy test",
     "buildstage": "node bin/clean.js && webpack --progress --colors --env.deploy stage",
     "pro": "node bin/clean.js && webpack --progress --colors --env.deploy prod",
-    "dev": "webpack-dev-server --port 80 --devtool eval --progress --colors --hot --content-base build --env.deploy dev --env.watch watch"
+    "dev": "webpack-dev-server --port 8088 --devtool eval --progress --colors --hot --content-base build --env.deploy dev --env.watch watch"
   },
   "repository": {
     "type": "git",

+ 2 - 2
webpack.config.js

@@ -121,7 +121,7 @@ module.exports = (function () {
         }));
     }
 
-    let staticHost = 'http://192.168.0.190';    
+    let staticHost = 'http://192.168.0.188:8088';    
     switch (argv.env.deploy) {
         case 'test':
             staticHost = 'http://statics.jishutao.com';
@@ -156,7 +156,7 @@ module.exports = (function () {
         plugins: plugins,
         devServer: {
             disableHostCheck: true,
-            host: '192.168.0.190',
+            host: '192.168.0.188',
             port: 80,
             allowedHosts: ['127.0.0.1','192.168.0.20','192.168.0.99'],
             headers: {

+ 7 - 7
webpack/entry.config.js

@@ -11,32 +11,32 @@ module.exports = {
     'admin/index': './js/admin/index.js',
   },
   watch: {
-    'user/index': ['webpack-dev-server/client?http://192.168.0.190', // WebpackDevServer host and port
+    'user/index': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/index.js'
     ],
-    'user/login': ['webpack-dev-server/client?http://192.168.0.190', // WebpackDevServer host and port
+    'user/login': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/login.js'
     ],
-    'user/signIn': ['webpack-dev-server/client?http://192.168.0.190', // WebpackDevServer host and port
+    'user/signIn': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/signIn.js'
     ],
-    'user/account/index': ['webpack-dev-server/client?http://192.168.0.190', // WebpackDevServer host and port
+    'user/account/index': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/account/index.js'
     ],
-    'user/account/evaluateInfo': ['webpack-dev-server/client?http://192.168.0.190', // WebpackDevServer host and port
+    'user/account/evaluateInfo': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/user/account/assessment.js'
     ],
     //admin
-    'admin/login': ['webpack-dev-server/client?http://192.168.0.190', // WebpackDevServer host and port
+    'admin/login': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
     'webpack/hot/only-dev-server',
     './js/user/adminLogin.js'
     ],
-    'admin/index': ['webpack-dev-server/client?http://192.168.0.190', // WebpackDevServer host and port
+    'admin/index': ['webpack-dev-server/client?http://192.168.0.188:8088', // WebpackDevServer host and port
       'webpack/hot/only-dev-server',
       './js/admin/index.js'
     ]