user5 пре 4 година
родитељ
комит
6e70abafb8

+ 10 - 5
src/main/java/com/jeeplus/modules/workclientinfo/web/WorkClientInfoController.java

@@ -343,15 +343,20 @@ public class WorkClientInfoController extends BaseController {
 	 */
 	@RequiresPermissions("workclientinfo:workClientInfo:del")
 	@RequestMapping(value = "delete")
-	public String delete(WorkClientInfo workClientInfo, RedirectAttributes redirectAttributes) {
-
+	@ResponseBody
+	public Map delete(WorkClientInfo workClientInfo, RedirectAttributes redirectAttributes) {
+		Map map = new HashMap();
 		if(!workClientInfoService.getUsedCount(workClientInfo)){
 			workClientInfoService.delete(workClientInfo);
-			addMessage(redirectAttributes, "删除客户成功");
+			map.put("result",1);
+			map.put("msg","删除客户成功");
+			//addMessage(redirectAttributes, "删除客户成功");
 		}else{
-			addMessage(redirectAttributes,"该客户已经被其他模块引用,删除失败");
+			map.put("result",0);
+			map.put("msg","该客户已经被其他模块引用,删除失败");
+			//addMessage(redirectAttributes,"该客户已经被其他模块引用,删除失败");
 		}
-		return "redirect:"+Global.getAdminPath()+"/workclientinfo/workClientInfo/?repage";
+		return map;
 	}
 	
 	/**

+ 47 - 16
src/main/webapp/webpage/modules/workclientinfo/workClientInfoList.jsp

@@ -5,6 +5,18 @@
 <head>
 	<title>客户管理管理</title>
 	<meta name="decorator" content="default"/>
+	<style>
+		/*body{
+			background-color:transparent;
+			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
+			color:#ffffff;
+			background-color:rgba(255,255,255,0);
+			height:100%;
+		}*/
+		.layui-layer-btn1:hover{
+			color: #c2c2c2;
+		}
+	</style>
 	<script type="text/javascript">
 		$(document).ready(function() {
             $("#cus_name").show();
@@ -54,23 +66,42 @@
                 }
             });
         }
-	</script>
-	<script type="text/javascript">
-        $(function () {
-            function openNewWindowTab(url) {
-                alert(url);
+
+
+        //打开对话框(查看)
+        function deleteFun(url){
+            if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+                width='auto';
+                height='auto';
+            }else{//如果是PC端,根据用户设置的width和height显示。
+
             }
-        })
-	</script>
-	<style>
-		body{
-			background-color:transparent;
-			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
-			color:#ffffff;
-			background-color:rgba(255,255,255,0);
-			height:100%;
+
+			layer.confirm('确定要删除该客户信息吗?', {
+				title: "删除",
+				btn: ['确定','关闭'] //可以无限个按钮
+			},function(index, layero){
+				$.ajax({
+					type: 'post',
+					url:url,
+					dataType: "json",
+					cache: false,
+					processData: false,
+					contentType: false,
+				}).success(function (result) {
+					if(result.result == "1"){
+						top.layer.msg(result.msg, {icon: 1});
+						window.location.reload();
+					}else{
+						top.layer.msg(result.msg, {icon: 2});
+						window.location.reload();
+					}
+				});
+			}, function(index){
+				layer.close(index);
+			});
 		}
-	</style>
+	</script>
 </head>
 <body class="gray-bg">
 <div class="wrapper wrapper-content">
@@ -229,7 +260,7 @@
                             xml +="<a href=\"javascript:void(0)\" onclick=\"openDialog('修改客户信息', '${ctx}/workclientinfo/workClientInfo/form?id=" + d.id + "&param=1','95%','95%')\" class=\"op-btn op-btn-edit\" ><i class=\"fa fa-edit\"></i>修改</a>"
 
                         if(d.candelete != undefined && d.candelete == "1")
-                            xml +="<a href=\"${ctx}/workclientinfo/workClientInfo/delete?id=" + d.id + "\" onclick=\"return confirmx('确认要删除该客户信息吗?', this.href)\"   class=\"op-btn op-btn-delete\"><i class=\"fa fa-trash\"></i> 删除</a>";
+                            xml +="<a href=\"javascript:void(0)\" onclick=\"deleteFun('${ctx}/workclientinfo/workClientInfo/delete?id=" + d.id + "')\"   class=\"op-btn op-btn-delete\"><i class=\"fa fa-trash\"></i> 删除</a>";
                         return xml;
                     }}
             ]]