hn_cloud_web/smz-screen/js/proInfo/proInfo.js

236 lines
6.1 KiB
JavaScript
Raw Normal View History

2025-11-27 16:55:35 +08:00
var type = localStorage.getItem('type');
$(function() {
findCompany();
findPro();
initTable();
})
function responseHandler(res) {
console.log(res);
var datas=[];
console.log(res.total);
datas.push({total:res.total,rows:res.list});
return datas[0];
}
function initTable() {
//初始化Table
$("#table").bootstrapTable({
classes: 'table table-hover',
2025-12-09 18:44:29 +08:00
url: smz_web_url + 'proInfo/getProInfo',
2025-11-27 16:55:35 +08:00
method: 'post',
responseHandler: responseHandler, //处理服务器返回的数据格式
height: $(window).height() - ($(window).height() * 0.13),
undefinedText: '', //当数据为 undefined 时显示的字符
queryParams: function(param) {
param = {
orgId:$("#orgId").val(),
id:$("#proId").val(),
status:$("#status").val(),
keyWord:$("#keyWord").val(),
companyId:companyId,
pageSize: param.limit,
pageNum: param.offset / param.limit + 1,
sort: param.sort, //排序列名
sortOrder: param.order //排位命令descasc
}
return param;
},
sortable: true, //是否启用排序
sortOrder: "asc", //排序方式
cache: false, //是否使用缓存默认为true所以一般情况下需要设置一下这个属性*
pagination: true,
pageNumber: 1,
pageSize: 50,
pageList: [50, 100, 200, 300],
smartDisplay: false,
showColumns: false,
sidePagination: "server", //分页方式client客户端分页server服务端分页*
contentType: "application/x-www-form-urlencoded",
minimumCountColumns: 2, //最少允许的列数
uniqueId: "no", //每一行的唯一标识,一般为主键列
columns: [
{
title: '序号',
formatter: function(value, row, index) {
return index + 1;
},
rowspan: 1,
align: 'center',
valign: 'middle',
width: '5%'
},
{
title: '公司',
field: 'orgName',
rowspan: 1,
align: 'center',
valign: 'middle',
sortable: true,
width: '12%'
},
{
title: '工程名称',
field: 'name',
rowspan: 1,
align: 'center',
valign: 'middle',
sortable: true,
width: '30%'
},
{
title: '工程类型',
field: 'proType',
rowspan: 1,
align: 'center',
valign: 'middle',
sortable: true,
width: '10%'
},
{
title: '电压等级',
field: 'voltageLevel',
rowspan: 1,
align: 'center',
valign: 'middle',
sortable: true,
width: '10%'
},
{
title: '工程地址',
field: 'origin',
rowspan: 1,
align: 'center',
valign: 'middle',
sortable: true,
width: '10%'
},
{
title: '所属电网',
field: 'powerGrid',
rowspan: 1,
align: 'center',
valign: 'middle',
sortable: true,
width: '10%'
},
{
title: '工程状态',
field: 'status',
rowspan: 1,
align: 'center',
valign: 'middle',
sortable: true,
width: '10%'
},
{
title: '操作',
field: '',
formatter: function(value, row, index) {
if(row.isPush=="1"){
var content = "<a title='人社厅跳转' style='cursor:pointer;' class='layui-btn layui-btn-xs' onclick='showRst(\"" + row.id +
"\")'>人社厅跳转</a>";
return content;
}else{
return null;
}
},
rowspan: 1,
align: 'center',
valign: 'middle',
sortable: true,
width: 100
}
],
onLoadSuccess: function(data) {
top.layer.close(index);
$("#dataCount").html("工程数量:" + data.total);
},
onLoadError: function() {
$("#dataCount").html("工程数量:0");
$("#table").bootstrapTable('removeAll');
top.layer.close(index);
},
});
}
var index;
// 模糊查询数据、重置查询
function query(type) {
index = top.layer.load(0, {
shade: false
}); // 0代表加载的风格支持0-2
var keyWord = $("#keyWord").val();
var orgId = $("#orgId").val();
var proId = $("#proId").val();
var status = $("#status").val();
$("#query").css("background-image", "url(../../img/info/queryClick.png)");
$("#reset").css("background-image", "url(../../img/info/resetQuery.png)");
$("#export").css("background-image", "url(../../img/info/export.png)");
var opt = {
2025-12-09 18:44:29 +08:00
url: smz_web_url + 'proInfo/getProInfo',
2025-11-27 16:55:35 +08:00
silent: true,
query: {
orgId: orgId,
id: proId,
companyId:companyId,
status: status,
keyWord: keyWord
}
};
if (type == 2) {
$("#query").css("background-image", "url(../../img/info/query.png)");
$("#reset").css("background-image", "url(../../img/info/resetQueryClick.png)");
$("#export").css("background-image", "url(../../img/info/export.png)");
$("#keyWord").val("");
// $("#orgId option:first").attr("selected", true).trigger("change");
// $("#proId option:first").attr("selected", true).trigger("change");
$("#orgId").val("").trigger("change");
$("#proId").val("").trigger("change");
$("#status").val("");
initTable();
opt = {
2025-12-09 18:44:29 +08:00
url: smz_web_url + 'proInfo/getProInfo',
2025-11-27 16:55:35 +08:00
silent: true,
};
}
$("#table").bootstrapTable('refresh', opt);
}
function exportBtn() {
$("#query").css("background-image", "url(../../img/info/query.png)");
$("#reset").css("background-image", "url(../../img/info/resetQuery.png)");
$("#export").css("background-image", "url(../../img/info/exportClick.png)");
var orgId = $("#orgId").val();
var proId = $("#proId").val();
var status = $("#status").val();
var keyWord = $("#keyWord").val();
2025-12-09 18:44:29 +08:00
window.location.href = smz_web_url + "proInfo/expProData?keyWord=" + keyWord + "&orgId=" + orgId + "&id=" + proId + "&status=" + status+"&companyId="+companyId + "&x-auth-token=" + token;
2025-11-27 16:55:35 +08:00
}
function showRst(id){
$.ajax({
type: 'POST',
2025-12-09 18:44:29 +08:00
url: smz_web_url + 'proInfo/showRst',
2025-11-27 16:55:35 +08:00
data:{id: id},
dataType: "json",
success: function(data) {
if(data.res=="1"){
var height = '900px';
var width = '1800px';
var index = top.layer.open({
title: false,
type: 2,
content: data.obj,
area: [width, height],
maxmin: false
});
}
},
error: function(e) {
console.log("e", e);
}
});
}