|
@@ -2476,13 +2476,37 @@ function addChange(e)
|
|
|
var url = o.attr('data-url');
|
|
|
var p = e.parent();
|
|
|
if (p.find('.addchange').length < 1) {
|
|
|
- p.html(p.html() + '<div class="addchange"></div>');
|
|
|
+ p.html(p.html() + '<div class="addchange" style="display: inline-block;margin-left: 10px;"></div>');
|
|
|
}
|
|
|
- p.find('.addchange').html('<input type="text" class="update_value form-control layui-input " name="update_pic" id="update_pic_pic" value="" autocomplete="off" style="width:25%">');
|
|
|
+ var id = e.attr('id');
|
|
|
+ p.find('.addchange').html('<input type="text" class="update_value form-control layui-input " id="add_'+id+'" value="" autocomplete="off" style="width:60%;display: inline;" autofocus="autofocus" /><button class="btn btn-default layui-btn layuiadmin-btn-list" type="button" style="vertical-align: middle;margin-bottom: 2px;margin-left: 10px;" onclick="addChangeAction(\''+url+'\',\''+id+'\', $(this))">创建</button>');
|
|
|
}
|
|
|
+ e.val('0');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+function addChangeAction(url, id, self)
|
|
|
+{
|
|
|
+ var send = {};
|
|
|
+ var e = $('#' + id);
|
|
|
+ send.value = $('#add_' + id).val();
|
|
|
+ if (!send.value) {
|
|
|
+ layer.alert('没有填写内容');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ send.json = 1;
|
|
|
+ $.getJSON(url, send, function(t)
|
|
|
+ {
|
|
|
+ if (t.status == 1) {
|
|
|
+ e.append('<option value="'+t.data.id+'">'+send.value+'</option>');
|
|
|
+ e.val(t.data.id);
|
|
|
+ self.parent().remove();
|
|
|
+ } else {
|
|
|
+ layer.alert(t.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
function loadChange(e, load)
|
|
|
{
|
|
|
var val = e.val();
|
|
@@ -2517,7 +2541,7 @@ function showLoad(id, value)
|
|
|
}
|
|
|
} else {
|
|
|
e.html(t.data);
|
|
|
- form.render('checkbox');
|
|
|
+ form.render();
|
|
|
}
|
|
|
} else {
|
|
|
e.html('');
|