使用场景:在审核一项申请时用于审核通过或驳回需要填写原因,点击确认弹出输入框,输入备注完成审核。
1,使用自带的弹出框,只能定义弹出框的大小,不能定义输入框的大小,而且是必须输入。
// layer.prompt({title: title, maxlength: 100, value:'', formType: 2}, function (remark, i) {
$.ajax({
url: base + '/rest/project/allocate/audit/' + id + '/update/status/',
dataType: 'JSON',
type: 'POST',
data: {status: status, remark: remark},
success: function (data) {
if (data.success) {
$("#grid_id").trigger("reloadGrid");
} else {
layer.alert(data.msg);
}
}
});
});
2,可以自己定义弹出框和输入框,不是必须输入。
function updateStatus(id, status, title) {
layer.open({
type: 1,
title: title,
fix: false,
shadeClose: false,
maxmin: true,
zIndex: layer.zIndex,
area: ['250px', '200px'],
content: '<textarea rows="6" cols="30" style="margin-left: 5px;" id="remarkId"></textarea>', // 自己定义一个输入框
btn:['保存','取消'],
yes:function(index,layro){
var remark = $("#remarkId").val();
$.ajax({
url: base + '/rest/project/allocate/audit/' + id + '/update/status/',
dataType: 'JSON',
type: 'POST',
data: {status: status, remark: remark},
success: function (data) {
if (data.success) {
layer.close(index);
$("#grid_id").trigger("reloadGrid");
} else {
layer.alert(data.msg);
}
}
});
}
});
}