caipin 5 years ago
parent
commit
31fd9e72cd

+ 7 - 4
app/cloudAjaxRouter.js

@@ -33,15 +33,18 @@ router.post('/cloud/curing/ajax/relevanceClientDo', function(req, res, next) {
 	console.log('2222');
     cloudAjaxController.relevanceClientDo(req, res);
 });
+/**
+ * 用户取消关联CLD客户
+ */
+router.post('/cloud/curing/ajax/relieveClientDo', function(req, res, next) {
+    cloudAjaxController.relieveClientDo(req, res);
+});
 //������д��CLD��������������Ʒ
 router.post('/cloud/curing/ajax/upCuringDo', function(req, res, next) {
     cloudAjaxController.upCuringDo(req, res);
 });
 
-//�����û��Ƴ�CLD�ͻ�
-router.post('/cloud/curing/ajax/relieveClientDo', function(req, res, next) {
-    cloudAjaxController.relieveClientDo(req, res);
-});
+
 
 
 

+ 47 - 41
app/controller/cloudEditionAjaxController.js

@@ -42,7 +42,27 @@ var cloudEditionAjaxController={
 		    }
 		},
 		
-		//养护绑定CLD客户
+		/**
+		 * 升级用户使用的养护 为专业版本--根据编办
+		 */
+		upCuringDo: async function(req, res){
+		    //post数据获得
+		    var ssoid=req.body.ssoid;//通行证ID
+		    var compilationId=req.body.compilationId;//编办ID
+
+		    if(hash.isExistence(ssoid)&&hash.isExistence(compilationId)) {
+		        var flag= await cloudService.upCuringDo(req.body);
+
+		        if(flag){
+		            res.json({ 'status': 1,'msg':'升级成功' });
+		        }else{
+		            res.json({ 'status': 3,'msg':'升级失败' });
+		        }
+		    }else{
+		        res.json({ 'status': 3,'msg':'数据不正确' });
+		    }
+		},
+		
 		/**
 		 * 用户关联CLD客户
 		 */
@@ -55,10 +75,6 @@ var cloudEditionAjaxController={
 		        var flag= await cloudService.relevanceClientDo(req.body);
 		        
 		        if(flag){
-		            //获得绑定的CLD客户信息
-		            //var detail= await models.CLD_client.findById(cidKey);
-		            //var operateLogList=await models.operate_log.findByCondition(1,hash.hashDecode(id));
-		            //res.json({ 'status': 1,'detail':detail,'operateLogList':operateLogList,'msg':'绑定CLD客户成功' });
 		            res.json({ 'status': 1,'msg':'绑定CLD客户成功' });
 		        }else{
 		            res.json({ 'status': 2,'msg':'绑定失败' });
@@ -68,7 +84,29 @@ var cloudEditionAjaxController={
 		    }
 		},
 		
-		
+		/**
+		 * 用户取消关联CLD客户
+		 */
+		relieveClientDo: async function(req, res){
+		    //post数据获得
+		    var ssoId=req.body.ssoId;//养护用户ID
+
+		    if(hash.isExistence(ssoId)) {
+		        var flag= await cloudService.relieveClientDo(req.body);
+		        if(flag){
+		            /*var operateLogList=await models.operate_log.findByCondition(1,hash.hashDecode(id));
+		            //获得绑定的CLD客户信息
+		            res.json({ 'status': 1,'operateLogList':operateLogList,'msg':'解绑CLD客户成功' });*/
+		            
+		            res.json({ 'status': 1,'msg':'解绑CLD客户成功' });
+		            
+		        }else{
+		            res.json({ 'status': 2,'msg':'解绑失败' });
+		        }
+		    }else{
+		        res.json({ 'status': 3,'msg':'参数不正确' });
+		    }
+		},
 		
 		/**
 		 * 养护用户分页---废弃
@@ -132,44 +170,10 @@ checkMobile: async function(req, res){
 
 
 
-upCuringDo: async function(req, res){
-    //post数据获得
-    var ssoid=req.body.ssoid;//通行证ID
-    var compilationId=req.body.compilationId;//编办ID
-
-    if(hash.isExistence(ssoid)&&hash.isExistence(compilationId)) {
-        var flag= await cloudService.upCuringDo(req.body);
 
-        if(flag){
-            res.json({ 'status': 1,'msg':'升级成功' });
-        }else{
-            res.json({ 'status': 3,'msg':'升级失败' });
-        }
-    }else{
-        res.json({ 'status': 3,'msg':'数据不正确' });
-    }
-},
 
-//养护移除CLD客户
-relieveClientDo: async function(req, res){
-    //post数据获得
-    var id=req.body.id;//养护用户ID
-
-    if(hash.isExistence(id)) {
-        var flag= await cloudService.relieveClientDo(req.body);
-        if(flag){
-            var operateLogList=await models.operate_log.findByCondition(1,hash.hashDecode(id));
-            //获得绑定的CLD客户信息
-            res.json({ 'status': 1,'operateLogList':operateLogList,'msg':'解绑CLD客户成功' });
-        }else{
-            res.json({ 'status': 2,'msg':'解绑失败' });
-        }
-    }else{
-        res.json({ 'status': 3,'msg':'参数不正确' });
-    }
-},
 
-//养护详情页 数据
+//养护详情页 数据---可能废弃
 getCuringById: async function(req, res){
 
     if(!hash.isExistence(req.params.id)){
@@ -185,5 +189,7 @@ getCuringById: async function(req, res){
     res.json({ 'status': 3,'msg':'数据不正确' });
 },
 
+
+
 }
 module.exports = cloudEditionAjaxController;

+ 33 - 31
app/service/cloudEditionService.js

@@ -352,7 +352,6 @@ var cloudService={
             return false;
         }
 
-//修改
         var curingDetail=await models.cloud_curing.getCuringBySsoid(ssoId);
         if(hash.isExistence(curingDetail)) {
 
@@ -381,7 +380,38 @@ var cloudService={
         }
     },
     
-    
+	/**
+	 * 用户取消关联CLD客户
+	 */
+    relieveClientDo: async function(data){
+
+        var ssoId=hash.hashDecode(data.ssoId);
+        if(!hash.isNotANumber(ssoId)){
+            return false;
+        }
+
+        var curingDetail=await models.cloud_curing.getCuringBySsoid(ssoId);
+        if(hash.isExistence(curingDetail)) {
+        	var id=hash.hashDecode(curingDetail['id']);
+        	//更新数量
+            var values = {
+                client_id: ''
+            }
+            var where={
+                where: {id: id}
+            };
+            await models.cloud_curing.update(values,where);
+
+            var clientDetail=await models.CLD_client.findById(curingDetail['client_id']);
+            //记录操作日志
+            var operation=STAFF.username+'移除CLD联系人'+clientDetail.clientname;
+            await models.operate_log.createOperateLog(1,id,operation);
+
+            return true;
+        }else{
+            return false;
+        }
+    },
     
     
     
@@ -423,35 +453,7 @@ var cloudService={
 
     
     
-    //移除关联CLD客户
-    relieveClientDo: async function(data){
-
-        var id=hash.hashDecode(data.id);
-        if(!hash.isNotANumber(id)){
-            return false;
-        }
-
-        var curingDetail=await models.cloud_curing.getCuringById(id);
-        if(hash.isExistence(curingDetail)) {
-            //更新数量
-            var values = {
-                client_id: ''
-            }
-            var where={
-                where: {id: curingDetail['id']}
-            };
-            await models.cloud_curing.update(values,where);
-
-            var clientDetail=await models.CLD_client.findById(curingDetail['client_id']);
-            //记录操作日志
-            var operation=STAFF.username+'移除CLD联系人'+clientDetail.clientname;
-            await models.operate_log.createOperateLog(1,id,operation);
-
-            return true;
-        }else{
-            return false;
-        }
-    },
+    
 
 }
 module.exports = cloudService;

+ 7 - 16
global/js/cloud/curing.js

@@ -225,17 +225,7 @@ $(function() {
             dataType: 'json',
             success: function(data){
                 if(data.status==1){
-                	
                 	refreshCuringPageDetail(ssoId,cidKey);
-                	
-                    //设置CLD客户信息
-//                    var clientHtml=relevanceClient(data.detail);
-//                    $('div[curingInfo] curingClient').html(clientHtml);
-//
-//                    //设置养护日志
-//                    var operateLogHtml=buildCuringOperateLog(data.operateLogList);
-//                    $('div[operateLog] curingOperate').html(operateLogHtml);
-
                     $('#linkcld').modal('hide');
                 }else{
                     alert(data.msg);
@@ -248,31 +238,32 @@ $(function() {
 
     });
     
-    
     /**
-     * 动态绑定 移除CLD客户事件
+     * 用户取消关联CLD客户--用户详情页
      */
     $('button[relieveClientDo]').on('click', function(e){
-    //$('div[curinginfo]').delegate( 'a[relieveClientDo]','click', function(){
         // 只获取第一个选中的值
         var cid = $(this).attr('data');
-        var id=$('#id').val();
+        var ssoId = $('#curingSsoid').val();
+        //var id=$('#id').val();
         $('#unlinkcld').modal('hide');
         $.ajax({
             cache :false,
             type: 'POST',
             url: '/cloud/curing/ajax/relieveClientDo',
-            data: {cid: encodeURI(cid),id:encodeURI(id)},
+            data: {cid: encodeURI(cid),ssoId:encodeURI(ssoId)},
             dataType: 'json',
             success: function(data){
                 if(data.status==1){
+                	refreshCuringPageDetail(ssoId,cid);
+                	/*
                     //设置CLD客户信息
                     var clientHtml=relevanceClient();
                     $('div[curingInfo] curingClient').html(clientHtml);
 
                     //设置养护日志
                     var operateLogHtml=buildCuringOperateLog(data.operateLogList);
-                    $('div[operateLog] curingOperate').html(operateLogHtml);
+                    $('div[operateLog] curingOperate').html(operateLogHtml);*/
 
                 }else{
                     alert(data.msg);