caipin 5 years ago
parent
commit
50da5b9aa5

+ 17 - 5
app/cloudAjaxRouter.js

@@ -9,16 +9,28 @@ router.get('/cloud/curing/ajax/curingInfo/:mobile', function(req, res, next) {
     cloudAjaxController.getCuringInfo(req, res);
 });
 
+//------------用户列表界面相关----------------
 /**
- * 
+ * 编办筛选
  */
-router.get('/cloud/curing/ajax/getCuringByCompilationId/:compilation/:latestCompilation', function(req, res, next) {
-    cloudAjaxController.getCuringByCompilationId(req, res);
-});
 router.get('/cloud/curing/ajax/getCuringByCompilationId', function(req, res, next) {
-    cloudAjaxController.getCuringByCompilationId(req, res);
+	cloudAjaxController.refreshCuringPage(req, res);
+});
+router.get('/cloud/curing/ajax/refreshCuringPage', function(req, res, next) {
+    cloudAjaxController.refreshCuringPage(req, res);
 });
 
+
+
+
+
+
+
+
+
+
+
+
 //������ҳ
 router.get('/cloud/curing/ajax/getCuringPage/:currentPage', function(req, res, next) {
     cloudAjaxController.getCuringPage(req, res);

+ 1 - 1
app/config/common.config.js

@@ -6,7 +6,7 @@ global.WEB_SITE_GLOBAL='/cloud/';
 global.CRYPTO_KEY='CLDV2_CP';
 
 global.STAFF='';
-global.curingInterfaceConfig={'sort':['latest_login','desc']};
+//global.curingInterfaceConfig={'sort':['latest_login','desc']};
 
 var d = new Date();
 global.OPERATELOGTABLE=d.getFullYear();

+ 44 - 28
app/controller/cloudEditionAjaxController.js

@@ -9,6 +9,50 @@ var models=require('../models');
 
 
 var cloudEditionAjaxController={
+		
+		//------------用户列表界面相关----------------
+		/**
+		 * 养护用户-筛选-条件已升级编办和最近使用编办----废弃
+		 */
+		getCuringByCompilationId: async function(req, res){
+//		    var compilation=req.params.compilation;
+			
+			//get获得方式
+		    var params = url.parse(req.url, true).query;
+			
+		    var curingList= await cloudService.getCuringList(params);
+
+		    res.json({ 'status': 1,'curingList':curingList.curingList,'pageData':curingList.pageData });
+		},
+
+		/**
+		 * 养护用户分页
+		 */
+		getCuringPage: async function(req, res){
+		    var currentPage=req.params.currentPage;
+		    if(!hash.isNotANumber(currentPage)){
+		        res.json({ 'status': 2,'msg':'currentPage error' });return ;
+		    }
+		    //get获得方式
+		    //var params = url.parse(req.url, true).query;
+
+		    var curingList= await cloudService.getCuringList(req,currentPage);
+
+		    res.json({ 'status': 1,'curingList':curingList.curingList,'pageData':curingList.pageData });
+		},	
+		
+		/**
+		 * 用户列表刷新
+		 */
+		refreshCuringPage: async function(req, res){
+			//var params = url.parse(req.url, true).query;
+			
+		    var curingList= await cloudService.getCuringList(req);
+
+		    res.json({ 'status': 1,'curingList':curingList.curingList,'pageData':curingList.pageData });
+		},	
+		
+
     //获得养护信息
     getCuringInfo: async function(req, res){
         if(!hash.isNotANumber(req.params.mobile)){
@@ -47,35 +91,7 @@ var cloudEditionAjaxController={
         }
     },
 
-/**
- * 养护用户-筛选-条件已升级编办和最近使用编办
- */
-getCuringByCompilationId: async function(req, res){
-//    var compilation=req.params.compilation;
-	
-	//get获得方式
-    var params = url.parse(req.url, true).query;
-	
-    var curingList= await cloudService.getCuringList(params);
 
-    res.json({ 'status': 1,'curingList':curingList.curingList,'pageData':curingList.pageData });
-},
-
-/**
- * 养护用户分页
- */
-getCuringPage: async function(req, res){
-    var currentPage=req.params.currentPage;
-    if(!hash.isNotANumber(currentPage)){
-        res.json({ 'status': 2,'msg':'currentPage error' });return ;
-    }
-    //get获得方式
-    var params = url.parse(req.url, true).query;
-
-    var curingList= await cloudService.getCuringList(params,currentPage);
-
-    res.json({ 'status': 1,'curingList':curingList.curingList,'pageData':curingList.pageData });
-},
 
 //搜索手机号,防止由于改号码导致数据不全问题
 checkMobile: async function(req, res){

+ 25 - 11
app/service/cloudEditionService.js

@@ -4,6 +4,7 @@
 var models=require('../models');
 var moment = require('moment');
 const hash=require('../class/hash');
+const url=require("url");
 
 //http://qa.smartcost.com.cn:2060/cld
 //"https://yhuat.smartcost.com.cn/cld";
@@ -23,7 +24,7 @@ var cloudService={
 	 * -compilation			已升级编办	
 	 * -latestCompilation	最近使用编办
 	 */
-    getCuringList: async function(paramsCompilation,page=1){
+    getCuringList: async function(req,page=1){
        
     	//获得远程养护用户
     	//分页数据
@@ -36,22 +37,35 @@ var cloudService={
         var compilation='';
     	var latestCompilation='';
     	
-    	//编办参数
-        if(hash.isExistence(paramsCompilation)){
-        	if(hash.isExistence(paramsCompilation.compilation)){
+    	//编办参数-排序参数
+        if(hash.isExistence(req)){
+        	var params = url.parse(req.url, true).query;
+        	
+        	if(hash.isExistence(params.compilation)){
         		compilation=paramsCompilation.compilation;
         	}
-        	if(hash.isExistence(paramsCompilation.latestCompilation)){
-        		latestCompilation=paramsCompilation.latestCompilation;
+        	if(hash.isExistence(params.latestCompilation)){
+        		latestCompilation=params.latestCompilation;
+        	}
+        	if(hash.isExistence(params.sortField)){//保存到cookie中
+        		res.cookie('sortField','create_time', {maxAge: 0});
+        		if(params.sortField=='latest_login'){
+        			res.cookie('sortField','latest_login', {maxAge: 0});
+        		}
+        	}
+        	if(hash.isExistence(params.sortField)){//保存到cookie中
+        		res.cookie('sort','desc', {maxAge: 0});
+        		if(params.sortField=='asc'){
+        			res.cookie('sort','asc', {maxAge: 0});
+        		}
         	}
         }
         
         //排序参数
-        console.log(curingInterfaceConfig.sort[0]);
-        var sortField='latest_login';
-        var sort='desc';
-//        loginTime
-//        regtime
+        console.log(req.cookies.sortField);
+        
+        //var sortField=curingInterfaceConfig.sort[0];
+        //var sort=curingInterfaceConfig.sort[1];
         
     	var url= curingUrl+'/getUserList'+
     	'?page='+page+'&pageSize='+limit+'&latestUsed='+latestCompilation+'&upGrade='+compilation;

+ 69 - 37
global/js/cloud/curing.js

@@ -148,7 +148,7 @@ function getClentList(){
 
 
 $(function() {
-
+//------用户列表界面相关----------
 	/**
      * 动态绑定养护用户列表 打开用户详情页面事件 
      * ssoid
@@ -205,8 +205,73 @@ $(function() {
 
     });
 	
+    /**
+     * 绑定分页-点击事件-刷新用户列表和分页列表
+     * parameter 传递参数
+     * currentPage
+     */
+    $('div[pageDetail]').delegate( 'a','click', function(){
+        // 只获取第一个选中的值
+        var parameter = $(this).attr('parameter');
+        var currentPage = $(this).attr('currentPage');
+
+        $.ajax({
+            cache :false,
+            type: 'get',
+            url: '/cloud/curing/ajax/getCuringPage/'+currentPage+parameter,
+            dataType: 'json',
+            success: function(data) {
+                if (data.status == 1) {
+                    fnStructureCuringUser(data.curingList);
+                    fnPage(data.pageData);
+                } else {
+                    alert(data.msg);
+                }
+            }
+        })
+    });
 	
-	
+    /**
+     * 编办下拉选择
+     */
+    $('select[curingByCompilation]').on('change', function(e){
+        var compilation=$(this).val();
+        var latestCompilation=$('select[curingByLatestCompilation]').val();
+        curingByCompilation(compilation,latestCompilation);
+    });
+    $('select[curingByLatestCompilation]').on('change', function(e){
+        var latestCompilation=$(this).val();
+        var compilation=$('select[curingByCompilation]').val();
+        curingByCompilation(compilation,latestCompilation);
+    });
+    
+    /**
+     * 用户列表排序相关 
+     */
+    $('input[type=radio][name=sortField]').on('change', function(e){
+    	var sortField=$(this).attr('data');
+    	var latestCompilation=$('select[curingByLatestCompilation]').val();
+    	var compilation=$('select[curingByCompilation]').val();
+    	console.log(sortField);
+    	$.ajax({
+            cache :false,
+            type: 'get',
+            url: '/cloud/curing/ajax/refreshCuringPage?sortField='+sortField+'&compilation='+compilation+'&latestCompilation='+latestCompilation,
+            dataType: 'json',
+            success: function(data) {
+                if (data.status == 1) {
+                	fnStructureCuringUser(data.curingList);
+                    fnPage(data.pageData);
+                } else {
+                    alert(data.msg);
+                }
+            }
+        })
+    });
+    
+    
+    
+    
     //动态绑定 移除CLD客户事件
     $('button[relieveClientDo]').on('click', function(e){
     //$('div[curinginfo]').delegate( 'a[relieveClientDo]','click', function(){
@@ -291,28 +356,7 @@ $(function() {
 
     
     
-
-    //动态绑定分页事件
-    $('div[pageDetail]').delegate( 'a','click', function(){
-        // 只获取第一个选中的值
-        var parameter = $(this).attr('parameter');
-        var currentPage = $(this).attr('currentPage');
-
-        $.ajax({
-            cache :false,
-            type: 'get',
-            url: '/cloud/curing/ajax/getCuringPage/'+currentPage+parameter,
-            dataType: 'json',
-            success: function(data) {
-                if (data.status == 1) {
-                    fnStructureCuringUser(data.curingList);
-                    fnPage(data.pageData);
-                } else {
-                    alert(data.msg);
-                }
-            }
-        })
-    });
+    
 
     //升级用户产品信息
     $('button[upCuringDo]').on('click', function(e){
@@ -406,19 +450,7 @@ $(function() {
     });
 
     
-    /**
-     * 编办下拉选择
-     */
-    $('select[curingByCompilation]').on('change', function(e){
-        var compilation=$(this).val();
-        var latestCompilation=$('select[curingByLatestCompilation]').val();
-        curingByCompilation(compilation,latestCompilation);
-    });
-    $('select[curingByLatestCompilation]').on('change', function(e){
-        var latestCompilation=$(this).val();
-        var compilation=$('select[curingByCompilation]').val();
-        curingByCompilation(compilation,latestCompilation);
-    });
+    
     
     
     

+ 10 - 17
views/cloud/curing.html

@@ -136,8 +136,8 @@
                                 
                                 
                                 <div class="col-auto ml-auto">
-                                              <button class="btn btn-sm btn-default dropdown-toggle waves-effect waves-themed" data-toggle="dropdown" aria-expanded="false">已显示5列</button>
-                                              <div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; top: 32px; left: 12px; will-change: top, left;">
+                                              <button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">已显示5列</button>
+                                              <div class="dropdown-menu">
                                                 <ul class="list-unstyled px-3 pt-2 mb-0">
                                                   <li class="mb-2">
                                                     <div class="custom-control custom-switch">
@@ -184,40 +184,33 @@
                                                 </ul>
                                               </div>
                                           </div>
-                                
-                                <div class="col-auto pl-0">
-                                            <button class="btn btn-sm btn-default waves-effect waves-themed" data-toggle="dropdown" aria-expanded="false"><i class="fal fa-sort-amount-down"></i> 排序</button>
-                                            <div class="dropdown-menu dropdown-menu-right" id="paixu" x-placement="bottom-end" style="position: absolute; will-change: top, left; top: 32px; left: 68px;">
+                                          <div class="col-auto pl-0">
+                                            <button class="btn btn-sm btn-default" data-toggle="dropdown"><i class="fal fa-sort-amount-down"></i> 排序</button>
+                                            <div class="dropdown-menu dropdown-menu-right"  id="paixu">
                                               <ul class="list-unstyled px-3 pt-2 mb-0">
                                                 <li class="mb-2">
                                                   <div class="custom-control custom-radio">
-                                                    <input type="radio" class="custom-control-input" id="pai1" name="paizhi" checked="">
+                                                    <input type="radio" class="custom-control-input" id="pai1" data="latest_login" name="sortField" checked="">
                                                     <label class="custom-control-label" for="pai1">最近登录</label>
                                                   </div>
                                                 </li>
-                                                <li class="mb-2" style="display:none">
-                                                  <div class="custom-control custom-radio">
-                                                    <input type="radio" class="custom-control-input" id="pai2" name="paizhi">
-                                                    <label class="custom-control-label" for="pai2">登录时长</label>
-                                                  </div>
-                                                </li>
                                                 <li class="mb-2">
                                                   <div class="custom-control custom-radio">
-                                                    <input type="radio" class="custom-control-input" id="pai3" name="paizhi">
+                                                    <input type="radio" class="custom-control-input" id="pai3" data="addtime" name="sortField">
                                                     <label class="custom-control-label" for="pai3">注册时间</label>
                                                   </div>
                                                 </li>
                                               </ul>
-                                              <ul class="list-unstyled px-3 pt-2 mb-0 border-top" style="display:none">
+                                              <ul class="list-unstyled px-3 pt-2 mb-0 border-top">
                                                 <li class="mb-2">
                                                   <div class="custom-control custom-radio">
-                                                    <input type="radio" class="custom-control-input" id="pdown" name="paixu" checked="">
+                                                    <input type="radio" class="custom-control-input" id="pdown" data="desc" name="sort" checked="">
                                                     <label class="custom-control-label" for="pdown">降序</label>
                                                   </div>
                                                 </li>
                                                 <li class="mb-2">
                                                   <div class="custom-control custom-radio">
-                                                    <input type="radio" class="custom-control-input" id="pup" name="paixu">
+                                                    <input type="radio" class="custom-control-input" id="pup" data="asc" name="sort">
                                                     <label class="custom-control-label" for="pup">升序</label>
                                                   </div>
                                                 </li>