2024-12-06 18:32:24 +08:00
|
|
|
|
let table, form, layer, util,laydate
|
|
|
|
|
|
let pageNum = 1, limitSize = 30; // 默认第一页,分页数量为10
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
layui.config({
|
|
|
|
|
|
base: "../../js/layui/", //此处路径请自行处理, 可以使用绝对路径
|
|
|
|
|
|
}).use(['layer', 'form', 'table', 'util','laydate'], function () {
|
|
|
|
|
|
layer = layui.layer;
|
|
|
|
|
|
form = layui.form;
|
|
|
|
|
|
// laydate = layui.laydate;
|
|
|
|
|
|
table = layui.table;
|
|
|
|
|
|
util = layui.util;
|
|
|
|
|
|
laydate = layui.laydate;
|
|
|
|
|
|
form.render();
|
|
|
|
|
|
util.event('lay-active', {
|
|
|
|
|
|
query: function () {
|
|
|
|
|
|
pages(1, limitSize);
|
|
|
|
|
|
},
|
|
|
|
|
|
reset: function () {
|
|
|
|
|
|
$('#keyWord').val('');
|
|
|
|
|
|
$('#betweenTimeCreate').val('');
|
|
|
|
|
|
$('#betweenTimeUpdate').val('');
|
|
|
|
|
|
form.render();
|
|
|
|
|
|
pages(1, limitSize);
|
|
|
|
|
|
},
|
|
|
|
|
|
export: function () {
|
|
|
|
|
|
exportData();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
laydate.render({
|
|
|
|
|
|
elem: '#betweenTimeCreate',//指定元素 元素选择器
|
|
|
|
|
|
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
|
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
|
range: true,
|
|
|
|
|
|
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
|
|
|
|
|
|
// btns: ['now', 'confirm'], //选择框右下角显示的按钮 清除-现在-确定
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
laydate.render({
|
|
|
|
|
|
elem: '#betweenTimeUpdate',//指定元素 元素选择器
|
|
|
|
|
|
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
|
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
|
range: true,
|
|
|
|
|
|
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
|
|
|
|
|
|
// btns: ['now', 'confirm'], //选择框右下角显示的按钮 清除-现在-确定
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
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/getSingleProjectInforList" + '?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: "singleProjectId",title: "单项工程id",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "singleProjectName",title: "单项工程名称",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "singleProjectCode",title: "单项工程编码",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "safetyCode",title: "安全编码",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "safetyProjectStatus",title: "安全工程状态",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "prjLocal",title: "工程地点",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "provinceCode",title: "省公司编码",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "buildUnitCode",title: "建设管理单位编码",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "buildUnitConPerson",title: "建设管理人名",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "buildUnitMobile",title: "建设管理单位联系人电话",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "acrossArea",title: "流经区域",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "towerNo",title: "线路基础数",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "actualCommencementDate",title: "安全实际开工时间",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "actualFinishTime",title: "安全实际开工时间",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "currentDrpRate",title: "当前压降率",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "currentWorkStage",title: "前作业阶段",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "towerFoundComNum",title: "工程基础完工数",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "towerAssemNum",title: "工程组塔完工数",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "lineComNum",title: "架线完成数",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "remark",title: "备注",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "lastSuspendTime",title: "最近停工时间",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "lastResumeTime",title: "最近复工时间",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "huvFlag",title: "工程类型",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field:"createrId",title:"创建人id",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
{field:"createTime",title:"创建时间",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
{field:"updaterId",title:"修改人id",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
{field:"updateTime",title:"修改时间",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
{field:"deleteFlag",title:"删除状态",unresize:false,minWidth:120,sort:true,align:"center"},
|
|
|
|
|
|
{field: "prjType",title: "工程类型",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "singleProjectType",title: "单项工程类型",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "prjCode",title: "项目编码",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
{field: "prjName",title: "项目名称",unresize: false,minWidth: 120,sort: true,align: "center"},
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
],
|
|
|
|
|
|
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(),
|
|
|
|
|
|
betweenTimeCreate:$("#betweenTimeCreate").val(),
|
|
|
|
|
|
betweenTimeUpdate:$("#betweenTimeUpdate").val(),
|
|
|
|
|
|
};
|
|
|
|
|
|
return obj;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//导出
|
|
|
|
|
|
function exportData() {
|
|
|
|
|
|
let loadingMsg = layer.msg("数据导出中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
|
|
|
|
|
let url = dataUrl + "proteam/query/queryManage/exportSingleProjectInfor?" + 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)
|
|
|
|
|
|
)));
|
2024-12-13 18:24:28 +08:00
|
|
|
|
xhr.setRequestHeader('encryption','encryption');
|
|
|
|
|
|
xhr.setRequestHeader('token',token);
|
2024-12-06 18:32:24 +08:00
|
|
|
|
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();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|