242 lines
13 KiB
JavaScript
242 lines
13 KiB
JavaScript
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/getGtList" + '?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-200",
|
||
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: "topography",title: "地形地貌",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "stentFlag",title: "是否架构",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "borrowedFlag",title: "是否借用塔",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "span",title: "档距",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerCuircuitNumber",title: "杆塔回数",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "circuitQuantity",title: "线路回数",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "longitude",title: "经度",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "latitude",title: "纬度",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "eastCoordinate",title: "东坐标",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "northCoordinate",title: "北坐标",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "singleProjectCode",title: "单项工程编码",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "centerPileElevation",title: "中心桩高程",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "rotationDegree",title: "转角度数",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "geology",title: "地质",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerLegBaseformFirst",title: "塔脚1基础形式",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerLegBaseformSecond",title: "塔脚2基础形式",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerLegBaseformThird",title: "塔脚3基础形式",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerLegBaseformFourth",title: "塔脚4基础形式",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerLegMaxDepthFirst",title: "塔脚1基础最大深度m",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerLegMaxDepthSecond",title: "塔脚2基础最大深度m",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "biddingSectionCode",title: "标段编码",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerLegMaxDepthThird",title: "塔脚3基础最大深度m",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerType",title: "杆塔型式",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "tensionTowerFlag",title: "是否耐张塔",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerStructure",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:"deleteFlag",title:"删除状态",unresize:false,minWidth:120,sort:true,align:"center"},
|
||
{field: "provinceCode",title: "省公司编码",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "generalDesignFlag",title: "是否应用通用设计",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerTypeNo",title: "塔型编号",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "upstreamTowerNo",title: "上行塔号",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "dismantleFlag",title: "是否拆旧",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "cover4gFlag",title: "4g信号是否覆盖",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerSequenceNo",title: "杆塔排列序号",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "remark",title: "备注",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "representativeSpan",title: "代表档距",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "tensionSectionLength",title: "耐张段长度",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "county",title: "区县",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "town",title: "乡镇",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerNo",title: "塔号",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "village",title: "村庄",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "runTowerCode",title: "运行塔号",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "groundThingName",title: "地上物",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "designChangeNo",title: "设计变更编号",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "sectionDividePointFlag",title: "是否区段点击杆塔",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "sectionAdjustNum",title: "区段划分调整量",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerWeight",title: "塔重",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "slope",title: "塔基坡度",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "constructionDeptId",title: "施工项目部id",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "supervisionDeptId",title: "监理项目部id",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "moduleNo",title: "模块编号",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "deviseDeptId",title: "设计项目部id",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "ownerDeptId",title: "业主项目部id",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "uhvFlag",title: "删除",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "address",title: "细地址",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "customFlag",title: "自定义标识",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "nominalHeight",title: "呼称高",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "towerFullHeight",title: "塔全高",unresize: false,minWidth: 150,sort: true,align: "center"},
|
||
{field: "majorCrossingFlag",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(),
|
||
};
|
||
return obj;
|
||
|
||
}
|
||
|
||
//导出
|
||
function exportData() {
|
||
let loadingMsg = layer.msg("数据导出中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||
let url = dataUrl + "proteam/query/queryManage/exportGt?" + 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();
|
||
}
|
||
|
||
|
||
|