123 lines
3.8 KiB
JavaScript
123 lines
3.8 KiB
JavaScript
let layer,table,buildCheck;
|
|
const bidCode = parent.$('#bidPro').val();
|
|
|
|
layui.use(['layer','table'], function () {
|
|
layer = layui.layer;
|
|
table = layui.table;
|
|
//建管单位下拉选
|
|
getBuildLists();
|
|
});
|
|
|
|
function getBuildLists(){
|
|
let paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId;
|
|
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
|
|
const url = commonUrl + "system/sys/select/getBuildLists?params=" + montageParam; // url
|
|
ajaxRequestGet(url, "GET", true, function () {
|
|
}, function (result) {
|
|
if (result.code === 200) {
|
|
let html = '';
|
|
if (result.data && result.data.length > 0) {
|
|
$.each(result.data, function (index, item) {
|
|
html += '<option value="' + item.orgId + '">' + item.name + '</option>'
|
|
})
|
|
}
|
|
$('#build').empty().append(html);
|
|
layui.form.render();
|
|
|
|
//选择单位下拉选
|
|
getSelectLists();
|
|
updateSelection();
|
|
} else if (result.code === 500) {
|
|
layer.msg(result.msg, { icon: 2 });
|
|
}
|
|
}, function (xhr, status, error) {
|
|
error(xhr, status, error)
|
|
}, aqEnnable);
|
|
}
|
|
|
|
function getSelectLists(){
|
|
let paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId;
|
|
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
|
|
const url = commonUrl + "system/sys/select/getSelectLists?params=" + montageParam; // url
|
|
ajaxRequestGet(url, "GET", true, function () {
|
|
}, function (result) {
|
|
if (result.code === 200) {
|
|
getSelect(result.data)
|
|
} else if (result.code === 500) {
|
|
layer.msg(result.msg, { icon: 2 });
|
|
}
|
|
}, function (xhr, status, error) {
|
|
error(xhr, status, error)
|
|
}, aqEnnable);
|
|
}
|
|
|
|
function getSelect(data){
|
|
$("#selection").empty();
|
|
var html ="";
|
|
for (var i = 0; i < data.length; i++) {
|
|
if(i == 0){
|
|
html += '<div class="item bright" id="'+data[i].id+'">'+data[i].name+'</div>' ;
|
|
}else{
|
|
html += '<div class="item dark" id="'+data[i].id+'">'+data[i].name+'</div>' ;
|
|
}
|
|
}
|
|
buildCheck = data[0].id;
|
|
init(data[0].id);
|
|
$("#selection").append(html);
|
|
}
|
|
|
|
function updateSelection() {
|
|
$("#selection").on("click", ".item", function() {
|
|
$(".item").removeClass("bright").addClass("dark"); // 点击时将所有元素设置为 dark 类
|
|
$(this).removeClass("dark").addClass("bright"); // 点击的元素设置为 bright 类
|
|
var clickedId = $(this).attr('id'); // 获取被点击的 div 元素的 id 值
|
|
console.log("选中的值为: " + clickedId);
|
|
buildCheck = clickedId;
|
|
init(clickedId);
|
|
});
|
|
}
|
|
|
|
function init(warnType){
|
|
const url = commonUrl + "screen/largeScreen/alarmMge/getAlarmMgeList"; // 建管单位url
|
|
table.render({
|
|
elem: '#demo',
|
|
url: url,
|
|
skin: 'line',
|
|
page: true,
|
|
headers:{
|
|
decrypt:"decrypt",
|
|
"Authorization":token
|
|
},
|
|
where: {
|
|
warnType:warnType,
|
|
orgId:$('#build').val(),
|
|
proName:$('#proName').val(),
|
|
teamLeader:$('#teamLeader').val()
|
|
},
|
|
cols: [[
|
|
{type: 'numbers', title: '序号'}, // 添加序号列
|
|
{field: 'orgName', title: '建管单位',align:'center'},
|
|
{field: 'proName', title: '工程名称',align:'center'},
|
|
{field: 'warnContent', title: '告警内容',align:'center'},
|
|
{field: 'teamLeader', title: '班组长',align:'center'},
|
|
// {field: '', title: '操作',align:'center',templet:function(d){
|
|
|
|
// }},
|
|
]],
|
|
initComplete: function () {
|
|
// 在表格渲染完成后,重新渲染序号列
|
|
var that = this.elem.next();
|
|
var tool = that.children('.layui-table-box').children('.layui-table-fixed').children('.layui-table-body').children('.layui-table');
|
|
tool.find("tr").each(function (index, item) {
|
|
$(this).find('td[data-field="LAY_TABLE_INDEX"]').text(index + 1);
|
|
});
|
|
},
|
|
done:function(res, curr, count, origin){
|
|
console.log(res);
|
|
}
|
|
})
|
|
}
|
|
|
|
function getQueryList(){
|
|
init(buildCheck)
|
|
} |