Lyaer 单弹出层获取数据
案例完整代码如下
var cls = layer.open({
title: "请选择被换班人",
type: 2,
area: ['700px', '500px'],
maxmin: false,
content: "/PbManagementV3/ChangeWorkV3/GetTimePeople?time=" + time + "&myTime=" + myTime + "&userId=" + userId,
btn: ["确定"],
yes: function (index, layero) {
// 先获取弹出层位置
//var test = $(layero).children().find("#test");
var body = layer.getChildFrame('body', index);
var selected = body.find("input[name='userID']:checked");
var userid = $(selected).val();
if (userid === "" || userid == undefined) {
layer.close(index);
return;
}
var startTime = selected.data("starttime");
var endTime = selected.data("endtime");
var timeStr = time + " " + startTime + "--" + endTime;
$("#BeTimeStr").val(timeStr);
$("#BeUserName").val(selected.data("username"));
$("#BeUserId").val(userid);
$("#BePositionPbMapV3Id").val(selected.data("bepositionpbmapv3id"));
$("#BePositionName").val(selected.data("positionname"));
layer.close(index);
initIsOnDuty();
},
cancel: function (index, layero) {
}
});