rabin 2 vuotta sitten
vanhempi
commit
ccadc472df
1 muutettua tiedostoa jossa 185 lisäystä ja 182 poistoa
  1. 185 182
      assets/lib/manage/main.js

+ 185 - 182
assets/lib/manage/main.js

@@ -1554,52 +1554,117 @@ function checkbox()
 	var checkbox = $("." + name);
 	if(checkbox.length)
 	{
-		checkbox.each(function()
-		{
-			var self = $(this);
-	        var ele = "." + name + "-" + self.val();
-
-	        var len = $(ele).length;
-			$(ele).each(function()
+		if (checkbox.attr('title')) {
+			checkbox.each(function()
 			{
-				if(this.checked == true)
+				var self = $(this);
+		        var ele = "." + name + "-" + self.val();
+
+		        var len = $(ele).length;
+				$(ele).each(function()
 				{
-					self.get(0).checked = true;
-					if ($(this).attr('onclick') && $(this).attr('onclick').indexOf('show') > 0) {
-						inputShow($(this), 'col');
+					if(this.checked == true)
+					{
+						self.get(0).checked = true;
+						if ($(this).attr('onclick') && $(this).attr('onclick').indexOf('show') > 0) {
+							inputShow($(this), 'col');
+						}
 					}
-				}
 
-				var filter = $(this).attr('lay-filter');
-				if (filter) {
-					form.on('checkbox('+filter+')', function (data) {
-						var next = $(this).next();
-						var state = $(this).attr('data-state');
+					var filter = $(this).attr('lay-filter');
+					if (filter) {
+						form.on('checkbox('+filter+')', function (data) {
+							var next = $(this).next();
+							var state = $(this).attr('data-state');
 
-						if(data.elem.checked == true)
-						{
-							if (state == 2) {
-								self.get(0).checked = true;
-							} else {
-								if ($("." + name + "-" + self.val()+":checked").length >= len) {
+							if(data.elem.checked == true)
+							{
+								if (state == 2) {
 									self.get(0).checked = true;
+								} else {
+									if ($("." + name + "-" + self.val()+":checked").length >= len) {
+										self.get(0).checked = true;
+									}
 								}
-							}
 
-							if(self.attr('type') == 'radio')
-							{
-								//如果父选项是radio类型,做下限制
-								//alert(1);
+								if(self.attr('type') == 'radio')
+								{
+									//如果父选项是radio类型,做下限制
+									//alert(1);
+								}
+								if($("#mul_type").length)
+								{
+									$("#mul_type").val(1);
+								}
+								
+								if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
+								{
+									next.attr('disabled', false);
+								}
 							}
-							if($("#mul_type").length)
+							else
 							{
-								$("#mul_type").val(1);
+								if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
+								{
+									next.attr('disabled', true);
+								}
 							}
+
+							var num = 0;
+							$(ele).each(function()
+							{
+								if($(this).get(0).checked == true)
+								{
+									num = 1;
+								}
+							});
 							
+							var id = $(this).attr('name');
+							var hidden = id;
+							id = id.replace('[]', '');
+							if(num == 0)
+							{
+								self.get(0).checked = false;
+								
+								if($("#mul_type").length)
+								{
+									$("#mul_type").val(0);
+								}
+
+								if (state == 2) {
+
+								} else if (!$('#' + id).length) {
+									self.parent().append('<input type="hidden" value="0" id="'+id+'" name="'+hidden+'" />');
+								}
+							} else {
+								if ($('#' + id).length) {
+									$('#' + id).remove();
+								}
+							}
+
+							form.render('checkbox');
+						});
+					}
+				});
+
+				var filter = self.attr('lay-filter');
+				form.on('checkbox('+filter+')', function (data) {
+		            $("." + name + "-" + $(this).val()).each(function()
+					{
+						this.checked = data.elem.checked;
+
+						var next = $(this).next();
+					
+						if(this.checked == true)
+						{
 							if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
 							{
 								next.attr('disabled', false);
 							}
+							if($("#mul_type").length)
+							{
+								$("#mul_type").val(1);
+							}
 						}
 						else
 						{
@@ -1607,54 +1672,36 @@ function checkbox()
 							{
 								next.attr('disabled', true);
 							}
-						}
-
-						var num = 0;
-						$(ele).each(function()
-						{
-							if($(this).get(0).checked == true)
-							{
-								num = 1;
-							}
-						});
-						
-						var id = $(this).attr('name');
-						var hidden = id;
-						id = id.replace('[]', '');
-						if(num == 0)
-						{
-							self.get(0).checked = false;
-							
+								
 							if($("#mul_type").length)
 							{
 								$("#mul_type").val(0);
 							}
+						}
 
-							if (state == 2) {
-
-							} else if (!$('#' + id).length) {
-								self.parent().append('<input type="hidden" value="0" id="'+id+'" name="'+hidden+'" />');
-							}
-						} else {
-							if ($('#' + id).length) {
-								$('#' + id).remove();
-							}
+						if ($(this).attr('onclick') && $(this).attr('onclick').indexOf('show') > 0) {
+							inputShow($(this), 'col');
 						}
 
 						form.render('checkbox');
 					});
-				}
+		        });
+
+				form.render('checkbox');
 			});
+		} else {
 
-			var filter = self.attr('lay-filter');
-			form.on('checkbox('+filter+')', function (data) {
-	            $("." + name + "-" + $(this).val()).each(function()
-				{
-					this.checked = data.elem.checked;
+			checkbox.unbind('click').bind('click', function()
+			{
+				var self = $(this);
 
+				$("." + name + "-" + self.val()).each(function()
+				{
+					$(this).get(0).checked = self.get(0).checked;
+					
 					var next = $(this).next();
-				
-					if(this.checked == true)
+					
+					if($(this).get(0).checked == true)
 					{
 						if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
 						{
@@ -1681,139 +1728,94 @@ function checkbox()
 					if ($(this).attr('onclick') && $(this).attr('onclick').indexOf('show') > 0) {
 						inputShow($(this), 'col');
 					}
+				})
+			});
 
-					form.render('checkbox');
-				});
-	        });
-
-			form.render('checkbox');
-		});
-		
-		return;
-		checkbox.unbind('click').bind('click', function()
-		{
-			var self = $(this);
-
-			$("." + name + "-" + self.val()).each(function()
-			{
-				$(this).get(0).checked = self.get(0).checked;
-				
-				var next = $(this).next();
-				
-				if($(this).get(0).checked == true)
-				{
-					if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
-					{
-						next.attr('disabled', false);
-					}
-					if($("#mul_type").length)
-					{
-						$("#mul_type").val(1);
-					}
-				}
-				else
-				{
-					if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
-					{
-						next.attr('disabled', true);
-					}
-						
-					if($("#mul_type").length)
-					{
-						$("#mul_type").val(0);
-					}
-				}
-
-				if ($(this).attr('onclick') && $(this).attr('onclick').indexOf('show') > 0) {
-					inputShow($(this), 'col');
-				}
-			})
-		});
-
-		checkbox.each(function()
-		{
-			var self = $(this);
-			var len = $("." + name + "-" + self.val()).length;
-			$("." + name + "-" + self.val()).each(function()
+			checkbox.each(function()
 			{
-				$(this).unbind('click').bind('click', function()
+				var self = $(this);
+				var len = $("." + name + "-" + self.val()).length;
+				$("." + name + "-" + self.val()).each(function()
 				{
-					var next = $(this).next();
-					var state = $(this).attr('data-state');
-					if($(this).get(0).checked == true)
+					$(this).unbind('click').bind('click', function()
 					{
-						if (state == 2) {
-							self.get(0).checked = true;
-						} else {
-							if ($("." + name + "-" + self.val()+":checked").length >= len) {
+						var next = $(this).next();
+						var state = $(this).attr('data-state');
+						if($(this).get(0).checked == true)
+						{
+							if (state == 2) {
 								self.get(0).checked = true;
+							} else {
+								if ($("." + name + "-" + self.val()+":checked").length >= len) {
+									self.get(0).checked = true;
+								}
 							}
-						}
 
-						if(self.attr('type') == 'radio')
-						{
-							//如果父选项是radio类型,做下限制
-							//alert(1);
-						}
-						if($("#mul_type").length)
-						{
-							$("#mul_type").val(1);
-						}
-						
-						if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
-						{
-							next.attr('disabled', false);
+							if(self.attr('type') == 'radio')
+							{
+								//如果父选项是radio类型,做下限制
+								//alert(1);
+							}
+							if($("#mul_type").length)
+							{
+								$("#mul_type").val(1);
+							}
+							
+							if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
+							{
+								next.attr('disabled', false);
+							}
 						}
-					}
-					else
-					{
-						if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
+						else
 						{
-							next.attr('disabled', true);
+							if(next.length && next.attr('type') != 'checkbox' && next.attr('type') != 'hidden')
+							{
+								next.attr('disabled', true);
+							}
 						}
-					}
 
-					var num = 0;
-					$("." + name + "-" + self.val()).each(function()
-					{
-						if($(this).get(0).checked == true)
+						var num = 0;
+						$("." + name + "-" + self.val()).each(function()
 						{
-							num = 1;
-						}
-					});
-					
-					var id = $(this).attr('name');
-					var hidden = id;
-					id = id.replace('[]', '');
-					if(num == 0)
-					{
-						self.get(0).checked = false;
+							if($(this).get(0).checked == true)
+							{
+								num = 1;
+							}
+						});
 						
-						if($("#mul_type").length)
+						var id = $(this).attr('name');
+						var hidden = id;
+						id = id.replace('[]', '');
+						if(num == 0)
 						{
-							$("#mul_type").val(0);
-						}
+							self.get(0).checked = false;
+							
+							if($("#mul_type").length)
+							{
+								$("#mul_type").val(0);
+							}
 
-						if (state == 2) {
+							if (state == 2) {
 
-						} else if (!$('#' + id).length) {
-							self.parent().append('<input type="hidden" value="0" id="'+id+'" name="'+hidden+'" />');
+							} else if (!$('#' + id).length) {
+								self.parent().append('<input type="hidden" value="0" id="'+id+'" name="'+hidden+'" />');
+							}
+						} else {
+							if ($('#' + id).length) {
+								$('#' + id).remove();
+							}
 						}
-					} else {
-						if ($('#' + id).length) {
-							$('#' + id).remove();
+					})
+					if($(this).get(0).checked == true)
+					{
+						self.get(0).checked = true;
+						if ($(this).attr('onclick') && $(this).attr('onclick').indexOf('show') > 0) {
+							inputShow($(this), 'col');
 						}
 					}
-				})
-				if($(this).get(0).checked == true)
-				{
-					self.get(0).checked = true;
-					if ($(this).attr('onclick') && $(this).attr('onclick').indexOf('show') > 0) {
-						inputShow($(this), 'col');
-					}
-				}
-			});
-		})
+				});
+			})
+		}
 	}
 }
 
@@ -2504,12 +2506,13 @@ function showLoad(id, value)
 	$.getJSON(url, send, function(t)
 	{
 		if (t.status == 1) {
-			e.html(t.data);
+			if (t.data) {
+				e.html(t.data);
+				form.render();
+			}
 		} else {
 			e.html('');
 		}
-		form.render();
-		
 	});
 }
 var level_value = [];