yn_hxy_web/hxy-web/js/wireManager/header.js

47 lines
1.5 KiB
JavaScript

let layer,laypage,table,form,element,dropdown;
layui.use(['element', 'layer', 'form', 'element','laypage'], function(){
layer = layui.layer; //弹层
element = layui.element; //分页
laypage = layui.laypage; //分页
table = layui.table; //表格
form=layui.form;
dropdown = layui.dropdown;
init()
})
function init(){
$.ajax({
type: 'POST',
url: PATH_URL + '/homePageSelect/getLineProtectorSubComAndStandDropdown', // 请求地址
contentType: "application/json; charset=utf-8",
data: {}, //获取提交的表单字段
success: function (data) {
console.log("datadatasss:", data.data)
$("#taskSourceId").val(data.data[0].child[0].parentName + ' / ' + data.data[0].child[0].title);
$("#taskSourceId").attr("stationId", data.data[0].child[0].id);
$("#taskSourceId").attr("stationName", data.data[0].child[0].title);
dropdown.render({
elem: '#taskSourceId',
accordion: true,
data: data.data,
click: function(item){
console.log(item)
$("#taskSourceId").val(`${item.parentName + ' / ' + item.title}`);
$("#taskSourceId").attr("stationId", item.id);
$("#taskSourceId").attr("stationName", item.title);
var iframe = $("#indexFrame")[0];
var iframeWindow = iframe.contentWindow;
iframeWindow.setData();
},
});
},
error: function (XMLHttpRequest, textStatus, e) {
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
top.layer.close(addLoadingMsg); //再执行关闭
}
});
}