gs-jjsp-web/bns/js/queryManage/BidSafetyInfor.js

387 lines
11 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let table, form, layer, util
let pageNum = 1, limitSize = 30; // 默认第一页分页数量为10
$(function () {
layui.config({
base: "../../js/layui/", //此处路径请自行处理, 可以使用绝对路径
}).use(['layer', 'form', 'table', 'util'], function () {
layer = layui.layer;
form = layui.form;
// laydate = layui.laydate;
table = layui.table;
util = layui.util;
form.render();
util.event('lay-active', {
query: function () {
pages(1, limitSize);
},
reset: function () {
$('#keyWord').val('');
form.render();
pages(1, limitSize);
},
export: function () {
exportData();
}
});
pages(1, 30, 1);
table.on("rowDouble(classTable)", function (res) {
let obj = res.data;
});
});
});
function pages(pageNum, pageSize) {
let params = getReqParams(pageNum, pageSize);
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
url: dataUrl + "proteam/query/queryManage/getBidSafetyInforList" + '?token=' + token,
data: params,
type: 'POST',
async: false,
success: function (result) {
console.log(result);
if (result.code === 200) {
if (result.data) {
initTable(result.data, limitSize, pageNum)
laypages(result.count, pageNum, limitSize)
}
} else if (result.code === 500) {
layer.alert(result.msg, {icon: 2})
} else if (result.code === 401) {
logout(1);
}
}, error: function () {
}
});
}
function laypages(total, page, limit) {
layui.use(['laypage'], function () {
let laypage = layui.laypage;
laypage.render({
elem: 'voi-page',
count: total,
curr: page,
limit: limit,
limits: [30,50,100],
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
groups: 5,
jump: function (obj, first) {
if (!first) {
pageNum = obj.curr, limitSize = obj.limit;
pages(obj.curr, obj.limit, null);
}
}
});
})
}
function initTable(dataList, limit, page) {
console.log(dataList);
table.render({
elem: "#classTable",
id: "classTable",
height: "full-250",
data: dataList,
cols: [
[//表头
{
title: "序号",
width: 100,
unresize: true,
align: "center",
templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
}
},
{
field: "id",
title: "id",
unresize: false,
minWidth: 120,
sort: true,
align: "center"
},
{
field: "singleProjectCode",
title: "单项工程编码",
unresize: false,
minWidth: 180,
sort: true,
align: "center",
},
{
field: "biddingSectionId",
title: "工程标段表id",
unresize: false,
minWidth: 180,
sort: true,
align: "center"
},
{
field: "biddingSectionName",
title: "标段名称",
unresize: false,
minWidth: 180,
sort: true,
align: "center",
},
{
field: "safetyCode",
title: "安全编码",
unresize: false,
minWidth: 140,
sort: true,
align: "center",
},
{
field: "biddingSectionCode",
title: "标段编码",
unresize: false,
minWidth: 180,
sort: true,
align: "center",
},
{
field: "safetyProjectStatus",
title: "省公司编码",
unresize: false,
minWidth: 140,
sort: true,
align: "center",
},
{
field: "buildUnitCode",
title: "建设管理单位编码",
unresize: false,
minWidth: 200,
sort: true,
align: "center",
},
{
field: "buildUnitConPerson",
title: "建设管理人名",
unresize: false,
minWidth: 180,
sort: true,
align: "center",
},
{
field: "buildUnitMobile",
title: "建设管理单位联系人电话",
unresize: false,
minWidth: 260,
sort: true,
align: "center",
},
{
field: "acrossArea",
title: "流经区域",
unresize: false,
minWidth: 180,
sort: true,
align: "center",
},
{
field: "towerNo",
title: "线路基础数",
unresize: false,
minWidth: 140,
sort: true,
align: "center",
},
{
field: "actualCommencementDate",
title: "安全实际开工时间",
unresize: false,
minWidth: 200,
sort: true,
align: "center",
},
{
field: "actualFinishTime",
title: "安全实际完工时间",
unresize: false,
minWidth: 200,
sort: true,
align: "center",
},
{
field: "currentDrpRate",
title: "当前压降率",
unresize: false,
minWidth: 140,
sort: true,
align: "center",
},
{
field: "currentWorkStage",
title: "当前作业阶段",
unresize: false,
minWidth: 160,
sort: true,
align: "center",
},
{
field: "towerFoundComNum",
title: "工程基础完工数",
unresize: false,
minWidth: 180,
sort: true,
align: "center",
},
{
field: "towerAssemNum",
title: "工程组塔完工数",
unresize: false,
minWidth: 180,
sort: true,
align: "center",
},
{
field: "lineComNum",
title: "架线完成数",
unresize: false,
minWidth: 140,
sort: true,
align: "center",
},
{
field: "remark",
title: "备注",
unresize: false,
minWidth: 120,
sort: true,
align: "center",
},
{
field: "huvFlag",
title: "工程类型",
unresize: false,
minWidth: 140,
sort: true,
align: "center",
},
{
field: "prjCode",
title: "项目编码",
unresize: false,
minWidth: 140,
sort: true,
align: "center",
},
{
field: "createrId",
title: "创建人",
unresize: false,
minWidth: 140,
sort: true,
align: "center",
},
{
field: "deleteFlag",
title: "删除状态",
unresize: false,
minWidth: 140,
sort: true,
align: "center",
}
// {
// title: "状态",
// unresize: false,
// minWidth: 50,
// sort: true,
// align: "center",
// templet: function (d) {
// if (d.delFlag === '1') {
// return "<span style='color: red'>已删除</span>";
// } else {
// return "<span>" + transformNull(d.sgStatus) + "</span>";
// }
// },
// },
],
],
limit: limit,
done: function (res, curr, count) {
$(".layui-laypage-skip").css("display", "none");
}
});
}
// 获取参数
function getReqParams(page, limit) {
let obj = {};
obj = {
page: page + "",
limit: limit + "",
keyWord:$("#keyWord").val(),
};
return obj;
}
//导出
function exportData() {
let loadingMsg = layer.msg("数据导出中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
let url = dataUrl + "proteam/query/queryManage/exportBidSafetyInfor?" + setData(getReqParams(1, 1000000)) + '&token='+token;
let xhr = new XMLHttpRequest();
let a = document.createElement("a");
xhr.open("get", url, true);
xhr.responseType = "blob"; // 转换流
xhr.setRequestHeader("encrypt",
sm3(JSON.stringify(
getReqParams(pageNum, limitSize)
)));
xhr.onload = function () {
layer.close(loadingMsg);
if (this.status === 200) {
let url = window.URL.createObjectURL(new Blob([this.response]))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', "标段安全信息.xlsx")
document.body.appendChild(link)
link.click()
// 释放URL对象所占资源
window.URL.revokeObjectURL(url)
// 用完即删
document.body.removeChild(link)
} else {
layer.msg("数据发生异常,请稍后重试", {icon: 16, scrollbar: false, time: 2000});
}
};
xhr.send();
}