jjsp_web/bns/js/queryManage/projectInfor.js

282 lines
17 KiB
JavaScript
Raw Permalink 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,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('');
$('#betweenTimePlan').val('');
$('#betweenTimeActual').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'], //选择框右下角显示的按钮 清除-现在-确定
});
laydate.render({
elem: '#betweenTimePlan',//指定元素 元素选择器
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: '#betweenTimeActual',//指定元素 元素选择器
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/getProjectInforList" + '?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: "nonConstrDepartmentImpl", title: "是否非基建部实施", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "feaLineLength", title: "可研线路长度", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "feasTransCapacity", title: "可研变电容量", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constructionLineLength", title: "建设线路长度", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrTransformerCapacity", title: "建设变电容量", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "productionLineLength", title: "投产线路长度", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "prodTransCapacity", title: "投产变电容量", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "lineQuantity", title: "线路条数", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "mainTransformerQuantity", title: "主变台数", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "feaDinvest", title: "可研动态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "prjCode", title: "项目编码", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "feaSinvest", title: "可研静态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "apprFileNo", title: "可研批复文号", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "projectApprovalDocumentNo", title: "项目核准文号", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "locationProvince", title: "项目所在省编码", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "locationProvinceName", title: "项目所在省名称", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "locationMunicipality", title: "项目所在市编码", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "locationMunicipalityName", title: "项目所在市名称", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "locationArea", title: "项目所在区/县编码", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "locationAreaName", title: "项目所在区/县名称", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrAddress", title: "详细地址", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "prjName", title: "项目名", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "prjManageMode", title: "项目管理模式", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constructionStatus", title: "在建状态", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "plannedCommencementDate", title: "计划开工日期", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "actualCommencementDate", title: "实际开工时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "plannedCommissioningDate", title: "计划投产时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "actualCommissioningDate", title: "实际投产时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "planComplDate", title: "计划竣工时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "actualComplDate", title: "实际竣工时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "prjSource", title: "项目来源", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "gdeleteFlag", title: "删除状态", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "provinceCode", title: "省公司编码", unresize: false, minWidth: 150, 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: "settlementId", title: "初设批复概算、预算、结算信息id", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "initialDesignApprovalNo", title: "初设批复文号", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "initialDesignApprovalDate", title: "初设批复时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "initialDesgEstimDynamicInv", title: "初设概算动态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "initialDesgEstimStaticInv", title: "初设概算静态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "initialDesgApprovalFilename", title: "初设批复文件名称", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "buildUnitCode", title: "建设管理单位编码", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "estimateStatus", title: "概算状态", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrInstlnBgtPrepMethod", title: "建安预算编制方式", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrInstlnBgtRevDate", title: "建安预算评审完成时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrInstlnBgtDynamicInv", title: "建安预算动态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrInstlnBgtStaticInv", title: "建安预算静态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrInstlnReviewFilename", title: "建安评审文件名称", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrAndInstlnMajChgNum", title: "建安重大变化总项数", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrAndInstlnMajChgAmt", title: "建安重大变化总金额", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "dbFlag", title: "db模式", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrInstlnBudgetStatus", title: "建安预算状态", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "voltageLevel", title: "电压等级编码", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "fullCaliberBgtPrepMethod", title: "全口径预算编制方式", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "fullCalBgtRevComplDate", title: "全口径预算评审完成时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "fullCaliberBgtDynamicInv", title: "全口径预算动态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "fullCaliberBgtStaticInv", title: "全口径预算静态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "overallReviewFilename", title: "全口径评审文件名称", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "overallMajorChangeItemNum", title: "全口径重大变化总项数", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "overallMajorChangeAmount", title: "全口径重大变化总金额", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "overallBudgetStatus", title: "全口径预算状态", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "settlementPlanComplDate", title: "结算计划完成时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "settlementActualComplDate", title: "结算实际完成时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "projectType", title: "项目类型", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "settlementDynamicInv", title: "结算动态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "settlementStaticInv", title: "结算静态投资", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "financeReceiveDate", title: "财务接收时间", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "settlApproFormFilename", title: "审批表文件名", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "settlementStatus", title: "结算状态", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "edeleteFlag", title: "删除状态", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "approveUnit", title: "批复单位", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constrNature", title: "建设性质", unresize: false, minWidth: 150, sort: true, align: "center"},
{field: "constructionCategory", title: "建设类别", unresize: false, minWidth: 150, 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(),
betweenTimePlan:$("#betweenTimePlan").val(),
betweenTimeActual:$("#betweenTimeActual").val(),
};
return obj;
}
//导出
function exportData() {
let loadingMsg = layer.msg("数据导出中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
let url = dataUrl + "proteam/query/queryManage/exportProjectInfor?" + 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.setRequestHeader('encryption','encryption');
xhr.setRequestHeader('token',token);
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();
}