rabin 1 year ago
parent
commit
23a7ec5eda
1 changed files with 65 additions and 0 deletions
  1. 65 0
      assets/lib/manage/main.js

+ 65 - 0
assets/lib/manage/main.js

@@ -793,6 +793,46 @@ function loadShow()
 			}
 		})
 	}
+
+	if($(".control_url").length)
+	{
+		$(".control_url input:radio").each(function()
+		{
+			if ($(this).attr('checked'))
+			{
+				inputShowUrl($(this), $(this).attr('control_url'), $(this).attr('data-id'));
+			}
+
+			var filter = $(this).attr('lay-filter');
+			if (filter) {
+				form.on('radio('+filter+')', function(data) {
+					inputShowUrl($(this), $(this).attr('control_url'), $(this).attr('data-id'));
+				})
+			}
+		})
+
+		$(".control_url input:checkbox").each(function()
+		{
+			if ($(this).attr('checked'))
+			{
+				inputShowUrl($(this), $(this).attr('control_url'), $(this).attr('data-id'));
+			}
+			var filter = $(this).attr('lay-filter');
+			if (filter) {
+				form.on('checkbox('+filter+')', function(data) {
+					inputShowUrl($(this), $(this).attr('control_url'), $(this).attr('data-id'));
+				})
+			}
+		})
+
+		$(".control_url select").each(function()
+		{
+			if($(this).find('option:selected').text())
+			{
+				inputShowUrl($(this), $(this).attr('control_url'), $(this).attr('data-id'));
+			}
+		})
+	}
 }
 function menuGroup(id, e)
 {
@@ -2611,6 +2651,31 @@ function addChangeAction(url, id, self)
 	});
 }
 
+function inputShowUrl(e, url, id)
+{
+	if (e.attr('v')) {
+		var val = e.attr('v');
+	} else {
+		var val = e.val();
+	}
+	var send = {};
+	send['json'] = 1;
+	send['id'] = id;
+	send['value'] = val;
+	$.getJSON(url, send, function(t)
+	{
+		if (t.status == 1) {
+			for (var i in t.data) {
+				var e1 = $('#update_' + i).parent().parent();
+				e1.html(t.data[i]);
+			}
+		}
+		layui.use(['form'], function(){
+			layui.form.render();
+	  	});
+		checkbox();
+	});
+}
 function loadChange(e, load)
 {
 	if (e.attr('v')) {