From e223e695d544890b1f2402bb12ebdb0295acbae3 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Wed, 23 May 2018 09:43:52 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BC=B9=E7=AA=97=E7=8A=B6?=
 =?UTF-8?q?=E6=80=81=E7=A0=81=20modal=5Fstatus?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/main/resources/static/ruoyi/js/common.js  | 45 ++++++++++---------
 src/main/resources/static/ruoyi/js/ry-ui.js   | 12 ++---
 .../resources/static/ruoyi/monitor/job/job.js |  2 +-
 .../static/ruoyi/monitor/job/jobLog.js        |  2 +-
 .../ruoyi/monitor/logininfor/logininfor.js    |  2 +-
 .../static/ruoyi/monitor/online/online.js     |  2 +-
 .../static/ruoyi/monitor/operlog/operlog.js   |  2 +-
 .../static/ruoyi/system/config/config.js      |  2 +-
 .../static/ruoyi/system/dict/data/data.js     |  2 +-
 .../static/ruoyi/system/dict/type/type.js     |  2 +-
 .../static/ruoyi/system/menu/edit.js          |  2 +-
 .../static/ruoyi/system/post/post.js          |  2 +-
 .../resources/static/ruoyi/system/role/add.js |  4 +-
 .../static/ruoyi/system/role/edit.js          |  4 +-
 .../static/ruoyi/system/role/role.js          |  2 +-
 .../resources/static/ruoyi/system/user/add.js |  4 +-
 .../static/ruoyi/system/user/edit.js          |  4 +-
 .../static/ruoyi/system/user/user.js          |  2 +-
 .../resources/static/ruoyi/tool/gen/gen.js    |  2 +-
 19 files changed, 51 insertions(+), 48 deletions(-)

diff --git a/src/main/resources/static/ruoyi/js/common.js b/src/main/resources/static/ruoyi/js/common.js
index 0ae96093..62c4a79f 100644
--- a/src/main/resources/static/ruoyi/js/common.js
+++ b/src/main/resources/static/ruoyi/js/common.js
@@ -2,13 +2,21 @@
  * 通用方法封装处理
  * Copyright (c) 2018 ruoyi 
  */
-/*
-	参数解释:
-	title	标题
-	url		请求的url
-	w		弹出层宽度(缺省调默认值)
-	h		弹出层高度(缺省调默认值)
-*/
+
+/** 消息状态码 */
+web_status = {
+    SUCCESS: 0,
+    FAIL: 500
+};
+
+/** 弹窗状态码 */
+modal_status = {
+    SUCCESS: "success",
+    FAIL: "error",
+    WARNING: "warning"
+};
+
+/** 弹出层指定宽度 */
 function layer_show(title, url, w, h) {
     if (title == null || title == '') {
         title = false;
@@ -34,23 +42,18 @@ function layer_show(title, url, w, h) {
     });
 }
 
+/** 弹出层自动宽高 */
 function layer_showAuto(title, url) {
 	layer_show(title, url, '', '');
 }
 
-/*关闭弹出框口*/
+/** 关闭弹出框口 */
 function layer_close() {
     var index = parent.layer.getFrameIndex(window.name);
     parent.layer.close(index);
 }
 
-//状态码
-web_status = {
-    SUCCESS: 0,
-    FAIL: 500
-};
-
-//对ajax的post方法再次封装
+/** 对ajax的post方法再次封装 */
 _ajax_save = function(url, data) {
     var config = {
         url: url,
@@ -64,7 +67,7 @@ _ajax_save = function(url, data) {
     $.ajax(config)
 };
 
-//对jquery的ajax方法再次封装
+/** 对jquery的ajax方法再次封装 */
 _ajax = function(url, data, type) {
     var config = {
         url: url,
@@ -81,10 +84,10 @@ _ajax = function(url, data, type) {
 /** 返回结果处理 */
 function simpleSuccess(result) {
     if (result.code == web_status.SUCCESS) {
-		$.modalMsg(result.msg, "success");
+		$.modalMsg(result.msg, modal_status.SUCCESS);
 		$.refreshTable();
     } else {
-    	$.modalAlert(result.msg, "error");
+    	$.modalAlert(result.msg, modal_status.FAIL);
     }
 }
 
@@ -95,7 +98,7 @@ function handleSuccess(result) {
 			$.parentReload();
 		});
     } else {
-    	$.modalAlert(result.msg, "error");
+    	$.modalAlert(result.msg, modal_status.FAIL);
     }
 }
 
@@ -129,7 +132,7 @@ Date.prototype.format = function(format) {
 	return format;
 }
 
-// 创建选项卡
+/** 创建选项卡 */
 function createMenuItem(dataUrl, menuName) {
     dataIndex = Math.floor(Math.random()*100),
     flag = true;
@@ -168,7 +171,7 @@ function createMenuItem(dataUrl, menuName) {
     return false;
 }
 
-//设置全局ajax超时处理
+/** 设置全局ajax超时处理 */
 $.ajaxSetup({
     complete: function(XMLHttpRequest, textStatus) {
         if (textStatus == "parsererror") {
diff --git a/src/main/resources/static/ruoyi/js/ry-ui.js b/src/main/resources/static/ruoyi/js/ry-ui.js
index a48c73e7..bb9b5e6e 100644
--- a/src/main/resources/static/ruoyi/js/ry-ui.js
+++ b/src/main/resources/static/ruoyi/js/ry-ui.js
@@ -7,13 +7,13 @@ $(function(){
 	$.modalMsg = function(content, type) {
 	    if (type != undefined) {
 	        var icon = "";
-	        if (type == 'warning') {
+	        if (type == modal_status.WARNING) {
 	            icon = 0;
 	        }
-	        else if (type == 'success') {
+	        else if (type == modal_status.SUCCESS) {
 	            icon = 1;
 	        }
-	        else if (type == 'error') {
+	        else if (type == modal_status.FAIL) {
 	            icon = 2;
 	        }
 	        layer.msg(content, { icon: icon, time: 2000, shift: 0 });
@@ -25,11 +25,11 @@ $(function(){
 	// 弹出窗体
 	$.modalAlert = function(content, type) {
 	    var icon = "";
-	    if (type == 'warning') {
+	    if (type == modal_status.WARNING) {
 	        icon = 0;
-	    } else if (type == 'success') {
+	    } else if (type == modal_status.SUCCESS) {
 	        icon = 1;
-	    } else if (type == 'error') {
+	    } else if (type == modal_status.FAIL) {
 	        icon = 2;
 	    } else {
 	        icon = 3;
diff --git a/src/main/resources/static/ruoyi/monitor/job/job.js b/src/main/resources/static/ruoyi/monitor/job/job.js
index 79ad587f..05e694eb 100644
--- a/src/main/resources/static/ruoyi/monitor/job/job.js
+++ b/src/main/resources/static/ruoyi/monitor/job/job.js
@@ -104,7 +104,7 @@ function remove(id) {
 function batchRemove() {
 	var rows = $.getSelections("jobId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/monitor/job/jobLog.js b/src/main/resources/static/ruoyi/monitor/job/jobLog.js
index 9741d983..ec53e162 100644
--- a/src/main/resources/static/ruoyi/monitor/job/jobLog.js
+++ b/src/main/resources/static/ruoyi/monitor/job/jobLog.js
@@ -68,7 +68,7 @@ function remove(jobLogId) {
 function batchRemove() {
 	var rows = $.getSelections("jobLogId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/monitor/logininfor/logininfor.js b/src/main/resources/static/ruoyi/monitor/logininfor/logininfor.js
index cceea1f3..7766cc39 100644
--- a/src/main/resources/static/ruoyi/monitor/logininfor/logininfor.js
+++ b/src/main/resources/static/ruoyi/monitor/logininfor/logininfor.js
@@ -52,7 +52,7 @@ $(function() {
 function batchRemove() {
 	var rows = $.getSelections("infoId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/monitor/online/online.js b/src/main/resources/static/ruoyi/monitor/online/online.js
index 65ed6e2e..bb00cc46 100644
--- a/src/main/resources/static/ruoyi/monitor/online/online.js
+++ b/src/main/resources/static/ruoyi/monitor/online/online.js
@@ -71,7 +71,7 @@ function forceLogout(id) {
 function batchForceLogout() {
 	var rows = $.getSelections("sessionId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/monitor/operlog/operlog.js b/src/main/resources/static/ruoyi/monitor/operlog/operlog.js
index 6ee2fcf4..b44b80d6 100644
--- a/src/main/resources/static/ruoyi/monitor/operlog/operlog.js
+++ b/src/main/resources/static/ruoyi/monitor/operlog/operlog.js
@@ -67,7 +67,7 @@ function detail(id) {
 function batchRemove() {
 	var rows = $.getSelections("operId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/system/config/config.js b/src/main/resources/static/ruoyi/system/config/config.js
index 1dcd045b..1ba1b995 100644
--- a/src/main/resources/static/ruoyi/system/config/config.js
+++ b/src/main/resources/static/ruoyi/system/config/config.js
@@ -73,7 +73,7 @@ function remove(id) {
 function batchRemove() {
 	var rows = $.getSelections("configId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/system/dict/data/data.js b/src/main/resources/static/ruoyi/system/dict/data/data.js
index 4a9798f3..107c7329 100644
--- a/src/main/resources/static/ruoyi/system/dict/data/data.js
+++ b/src/main/resources/static/ruoyi/system/dict/data/data.js
@@ -82,7 +82,7 @@ function remove(id) {
 function batchRemove() {
 	var rows = $.getSelections("dictCode");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/system/dict/type/type.js b/src/main/resources/static/ruoyi/system/dict/type/type.js
index fa91e666..4d32587a 100644
--- a/src/main/resources/static/ruoyi/system/dict/type/type.js
+++ b/src/main/resources/static/ruoyi/system/dict/type/type.js
@@ -80,7 +80,7 @@ function remove(id) {
 function batchRemove() {
 	var rows = $.getSelections("dictId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/system/menu/edit.js b/src/main/resources/static/ruoyi/system/menu/edit.js
index cf7cb1b1..051eeeb5 100644
--- a/src/main/resources/static/ruoyi/system/menu/edit.js
+++ b/src/main/resources/static/ruoyi/system/menu/edit.js
@@ -91,6 +91,6 @@ function selectMenuTree() {
 	}
 	else
 	{
-		$.modalAlert("主菜单不能选择", "error");
+		$.modalAlert("主菜单不能选择", modal_status.FAIL);
 	}
 }
\ No newline at end of file
diff --git a/src/main/resources/static/ruoyi/system/post/post.js b/src/main/resources/static/ruoyi/system/post/post.js
index 33ca666d..970fc75b 100644
--- a/src/main/resources/static/ruoyi/system/post/post.js
+++ b/src/main/resources/static/ruoyi/system/post/post.js
@@ -72,7 +72,7 @@ function remove(id) {
 function batchRemove() {
 	var rows = $.getSelections("postId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/system/role/add.js b/src/main/resources/static/ruoyi/system/role/add.js
index 24ff9b2a..c9677549 100644
--- a/src/main/resources/static/ruoyi/system/role/add.js
+++ b/src/main/resources/static/ruoyi/system/role/add.js
@@ -86,7 +86,7 @@ function add() {
 		},
 		async : false,
 		error : function(request) {
-			$.modalAlert("系统错误", "error");
+			$.modalAlert("系统错误", modal_status.FAIL);
 		},
 		success : function(data) {
 			if (data.code == 0) {
@@ -94,7 +94,7 @@ function add() {
 					$.parentReload();
 				});
 			} else {
-				$.modalAlert(data.msg, "error");
+				$.modalAlert(data.msg, modal_status.FAIL);
 			}
 
 		}
diff --git a/src/main/resources/static/ruoyi/system/role/edit.js b/src/main/resources/static/ruoyi/system/role/edit.js
index af45a296..bd15968e 100644
--- a/src/main/resources/static/ruoyi/system/role/edit.js
+++ b/src/main/resources/static/ruoyi/system/role/edit.js
@@ -91,7 +91,7 @@ function update() {
 		},
 		async : false,
 		error : function(request) {
-			$.modalAlert("系统错误", "error");
+			$.modalAlert("系统错误", modal_status.FAIL);
 		},
 		success : function(data) {
 			if (data.code == 0) {
@@ -99,7 +99,7 @@ function update() {
 					$.parentReload();
 				});
 			} else {
-				$.modalAlert(data.msg, "error");
+				$.modalAlert(data.msg, modal_status.FAIL);
 			}
 
 		}
diff --git a/src/main/resources/static/ruoyi/system/role/role.js b/src/main/resources/static/ruoyi/system/role/role.js
index 3b8e93de..dc7ecfb9 100644
--- a/src/main/resources/static/ruoyi/system/role/role.js
+++ b/src/main/resources/static/ruoyi/system/role/role.js
@@ -73,7 +73,7 @@ function remove(id) {
 function batchRemove() {
 	var rows = $.getSelections("roleId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/system/user/add.js b/src/main/resources/static/ruoyi/system/user/add.js
index 75efb877..262e31cd 100644
--- a/src/main/resources/static/ruoyi/system/user/add.js
+++ b/src/main/resources/static/ruoyi/system/user/add.js
@@ -114,7 +114,7 @@ function add() {
 		},
 		async : false,
 		error : function(request) {
-			$.modalAlert("系统错误", "error");
+			$.modalAlert("系统错误", modal_status.FAIL);
 		},
 		success : function(data) {
 			if (data.code == 0) {
@@ -122,7 +122,7 @@ function add() {
 					$.parentReload();
 				});
 			} else {
-				$.modalAlert(data.msg, "error");
+				$.modalAlert(data.msg, modal_status.FAIL);
 			}
 
 		}
diff --git a/src/main/resources/static/ruoyi/system/user/edit.js b/src/main/resources/static/ruoyi/system/user/edit.js
index 11f069f6..6c866983 100644
--- a/src/main/resources/static/ruoyi/system/user/edit.js
+++ b/src/main/resources/static/ruoyi/system/user/edit.js
@@ -89,7 +89,7 @@ function update() {
 		},
 		async : false,
 		error : function(request) {
-			$.modalAlert("系统错误", "error");
+			$.modalAlert("系统错误", modal_status.FAIL);
 		},
 		success : function(data) {
 			if (data.code == 0) {
@@ -97,7 +97,7 @@ function update() {
 					$.parentReload();
 				});
 			} else {
-				$.modalAlert(data.msg, "error");
+				$.modalAlert(data.msg, modal_status.FAIL);
 			}
 		}
 	});
diff --git a/src/main/resources/static/ruoyi/system/user/user.js b/src/main/resources/static/ruoyi/system/user/user.js
index 8bb72cb2..62e35aed 100644
--- a/src/main/resources/static/ruoyi/system/user/user.js
+++ b/src/main/resources/static/ruoyi/system/user/user.js
@@ -155,7 +155,7 @@ function resetPwd(userId) {
 function batchRemove() {
 	var rows = $.getSelections("userId");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要删除的数据", "warning");
+		$.modalMsg("请选择要删除的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
diff --git a/src/main/resources/static/ruoyi/tool/gen/gen.js b/src/main/resources/static/ruoyi/tool/gen/gen.js
index a4c5abd0..9824b833 100644
--- a/src/main/resources/static/ruoyi/tool/gen/gen.js
+++ b/src/main/resources/static/ruoyi/tool/gen/gen.js
@@ -44,7 +44,7 @@ function genCode(tableName) {
 function batchGenCode() {
 	var rows = $.getSelections("tableName");
 	if (rows.length == 0) {
-		$.modalMsg("请选择要生成的数据", "warning");
+		$.modalMsg("请选择要生成的数据", modal_status.WARNING);
 		return;
 	}
 	$.modalConfirm("确认要生成选中的" + rows.length + "条数据吗?", function() {