父页面:父页面: function edit(data) { layer.open({ type: 2,//0:信息框,默认1:页面层2:iframe层3:加载层4:tips层 area: ['650px', '620px'], fixed: false, //不固定 shade: 'background-color: rgba(0,0,0,.5)', shadeClose: true, //maxmin: true, content: 'edit?d_id=' + data.d_id + '' + 'a_nam
function edit(data) {
layer.open({
type: 2,//0:信息框,默认1:页面层2:iframe层3:加载层4:tips层
area: ['650px', '620px'],
fixed: false, //不固定
shade: 'background-color: rgba(0,0,0,.5)',
shadeClose: true,
//maxmin: true,
content: 'edit?d_id=' + data.d_id + '&' + 'a_name=' + data.a_name + '&' + 'a_id=' + data.a_id + '&' + 'd_name=' + data.d_name + '&' + 'd_status=' + data.d_status + '&' + 'd_parid=' + data.d_parid + '&' + 'd_level=' + data.d_level,
btn: ['提交','返回'],
yes: function (index, layero) {
var body = layer.getChildFrame('body', index);
var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
iframeWin.Buttun_Submit();//执行iframe页的方法:iframeWin.method();
window.location.reload();//直接页面刷新
//console.log(body.html()) //得到iframe页的body内容
//body.find('input').val('Hi,我是从父页来的')
},
btn2:function (index, layero) {
layer.close(index); //如果设定了yes回调,需进行手工关闭
},
});
}
function Buttun_Submit() {
var inputName = document.getElementById('selectname').value;//部门名称(判空)
var dId = d_id;//部门id
var pId = document.getElementById('selectID').value;//上级部门id
var aId = document.getElementById('AreaselectID').value;//所在地区id
if (dId == pId) {
layer.msg("上级部门选择错误!");
} else {
$.ajax({
url: "/sys_department/edit_detaile",//请求地址
dataType: "json",//数据格式
type: "POST",//请求方式
async: false,//是否异步请求
data: {
inputName: inputName,
dId: dId,
pId: pId,
aId: aId
},
success: function (data) {
layer.msg(data);
setTimeout(function () {
var index = parent.layer.getFrameIndex(window.name)
parent.layer.close(index);
}, 500);
},
});
}
}