2023-08-11 16:04:39 +08:00
|
|
|
|
@{
|
|
|
|
|
ViewBag.Title = "Index";
|
|
|
|
|
Layout = "~/Views/Shared/_Index.cshtml";
|
|
|
|
|
}
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
|
|
|
<title>
|
|
|
|
|
表单设计器代码
|
|
|
|
|
</title>
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
.mytable .layui-table-cell {
|
|
|
|
|
height: auto;
|
|
|
|
|
overflow: visible;
|
|
|
|
|
text-overflow: inherit;
|
|
|
|
|
white-space: normal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
<style>
|
|
|
|
|
.layui-table-cell {
|
|
|
|
|
font-size:14px;
|
|
|
|
|
padding:0 5px;
|
|
|
|
|
height:auto;
|
|
|
|
|
overflow:visible;
|
|
|
|
|
text-overflow:inherit;
|
|
|
|
|
white-space:normal;
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<link rel="stylesheet" href="~/lib/layui/css/layui.css" />
|
|
|
|
|
<link rel="stylesheet" href="~/js/lay-module/formDesigner/formDesigner.css" />
|
|
|
|
|
<link rel="stylesheet" href="~/js/lay-module/cron/cron.css" />
|
|
|
|
|
<link rel="stylesheet" href="~/js/lay-module/labelGeneration/labelGeneration.css" />
|
|
|
|
|
<link rel="stylesheet" href="~/js/lay-module/formDesigner/formPreview.css" />
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
<div id="workerdiv" style="margin: 10px 5px;">
|
|
|
|
|
<form class="layui-form" style="height:30px;" id="formPreviewForm">
|
|
|
|
|
<div id="grid_2" class="layui-form-item layui-row grid active" data-id="grid_2"
|
|
|
|
|
data-tag="grid" data-index="0" style="height:100%">
|
|
|
|
|
@*<div class="layui-col-md2 widget-col-list column2" data-index="3" data-parentindex="0">
|
|
|
|
|
<div id="select_Group" class="layui-form-item active" data-id="select_4" data-tag="select"
|
|
|
|
|
data-index="0">
|
|
|
|
|
<label class="layui-form-label layui-form-required" style="width: 100px;">
|
|
|
|
|
选择系统:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-block layui-form" lay-filter="select_4" style="margin-left: 110px">
|
|
|
|
|
<select name="selectGroup" lay-verify="required" id="selectGroup">
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>*@
|
|
|
|
|
<div class="layui-col-md3 widget-col-list column0" data-index="0" data-parentindex="0">
|
|
|
|
|
<div id="ReStartTime" class="layui-form-item active" data-id="ReStartTime"
|
|
|
|
|
data-tag="date" data-index="0">
|
|
|
|
|
<label class="layui-form-label layui-form-required" style="width: 110px;">
|
|
|
|
|
开始时间:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-block" style="width:calc(100% - 150px);margin-left: 110px;">
|
|
|
|
|
<input id="dateReStartTime" name="ndateReStartTime" lay-verify="required"
|
|
|
|
|
class="layui-input icon-date widget-date " style="line-height: 40px;">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-col-md3 widget-col-list column1" data-index="1" data-parentindex="0">
|
|
|
|
|
<div id="ReEndTime" class="layui-form-item active" data-id="ReEndTime"
|
|
|
|
|
data-tag="date" data-index="0">
|
|
|
|
|
<label class="layui-form-label layui-form-required" style="width: 110px;">
|
2023-11-06 21:26:55 +08:00
|
|
|
|
结束时间:
|
2023-08-11 16:04:39 +08:00
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-block" style="width:calc(100% - 150px);margin-left: 110px;">
|
|
|
|
|
<input id="dateReEndTime" name="ndateReEndTime" lay-verify="required" class="layui-input icon-date widget-date "
|
|
|
|
|
style="line-height: 40px;">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-col-md2 widget-col-list column2" data-index="2" data-parentindex="0">
|
|
|
|
|
<div id="select_10" class="layui-form-item active" data-id="select_4" data-tag="select"
|
|
|
|
|
data-index="0">
|
|
|
|
|
<label class="layui-form-label layui-form-required" style="width: 110px;">
|
|
|
|
|
快捷节点:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-block layui-form" lay-filter="select_4" style="margin-left: 110px">
|
|
|
|
|
|
|
|
|
|
<select name="selectquick" lay-filter="quickTime" lay-verify="required" id="selectQuick">
|
|
|
|
|
<option value="def" selected="">
|
|
|
|
|
快速选择周期
|
|
|
|
|
</option>
|
|
|
|
|
<option value="toDay">
|
|
|
|
|
今日
|
|
|
|
|
</option>
|
|
|
|
|
<option value="yesterDay">
|
|
|
|
|
昨日
|
|
|
|
|
</option>
|
|
|
|
|
<option value="thisWeek">
|
|
|
|
|
本周
|
|
|
|
|
</option>
|
|
|
|
|
<option value="lastWeek">
|
|
|
|
|
上周
|
|
|
|
|
</option>
|
|
|
|
|
<option value="thisMonth">
|
|
|
|
|
本月
|
|
|
|
|
</option>
|
|
|
|
|
<option value="lastMonth">
|
|
|
|
|
上月
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-col-md2 widget-col-list column2" data-index="3" data-parentindex="0">
|
|
|
|
|
<div id="select_4" class="layui-form-item active" data-id="select_4" data-tag="select"
|
|
|
|
|
data-index="0">
|
|
|
|
|
<label class="layui-form-label layui-form-required" style="width: 110px;">
|
|
|
|
|
时间间隔:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-block layui-form" lay-filter="select_4" style="margin-left: 110px">
|
|
|
|
|
<select name="selectint" lay-verify="required" id="selectIntervalt">
|
|
|
|
|
<option value="onesec">
|
|
|
|
|
1秒钟
|
|
|
|
|
</option>
|
|
|
|
|
<option value="tensec">
|
|
|
|
|
10秒钟
|
|
|
|
|
</option>
|
|
|
|
|
<option value="thirtysec">
|
|
|
|
|
30秒钟
|
|
|
|
|
</option>
|
|
|
|
|
<option value="onemin" selected="">
|
|
|
|
|
1分钟
|
|
|
|
|
</option>
|
|
|
|
|
<option value="fivemin">
|
|
|
|
|
5分钟
|
|
|
|
|
</option>
|
|
|
|
|
<option value="tenmin">
|
|
|
|
|
10分钟
|
|
|
|
|
</option>
|
|
|
|
|
<option value="thirtymin">
|
|
|
|
|
30分钟
|
|
|
|
|
</option>
|
|
|
|
|
<option value="onehour">
|
|
|
|
|
1小时
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-col-md1 widget-col-list column3" data-index="4" data-parentindex="0">
|
|
|
|
|
<div id="bottom_5" class="layui-form-item active" data-id="bottom_5" data-tag="bottom"
|
|
|
|
|
data-index="0">
|
|
|
|
|
<div class="layui-input-block" style="margin-left: 0px;">
|
|
|
|
|
<button id="btn_search" type="button" class="layui-btn custom-zc" ; onclick="GetReportViewNew()">
|
|
|
|
|
<i class="layui-icon ">
|
|
|
|
|
</i>
|
|
|
|
|
确定
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-col-md1 widget-col-list column4" data-index="5" data-parentindex="0">
|
|
|
|
|
<div id="btn_download" class="layui-form-item active" data-id="bottom_6" data-tag="bottom"
|
|
|
|
|
data-index="0">
|
|
|
|
|
|
|
|
|
|
<div class="layui-input-block" style="margin-left: 0px;">
|
|
|
|
|
<button id="bottom_6bottom" type="button" class="layui-btn custom-zc" ; onclick="exports()">
|
|
|
|
|
<i class="layui-icon ">
|
|
|
|
|
</i>
|
|
|
|
|
下载
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
@*<form class="layui-form" style="height:100%;width:100%;" id="tablepanel">*@
|
|
|
|
|
@*<div class="layui-panel" id="gridpanel" style="height:100%;width:100%;overflow:scroll;">
|
|
|
|
|
<div id="result" style="height:100%;width:100%;"></div>
|
|
|
|
|
</div>*@
|
|
|
|
|
<div id="result" style="height:100%;width:100%;overflow:scroll;">
|
|
|
|
|
</div>
|
|
|
|
|
@*</form>*@
|
|
|
|
|
</div>
|
|
|
|
|
@*<script type="text/javascript" src="~/lib/layui/layui.js">
|
|
|
|
|
</script>*@
|
|
|
|
|
<script type="text/javascript" src="~/js/Sortable/Sortable.js">
|
|
|
|
|
</script>
|
|
|
|
|
@* <script type="text/javascript" src="~/js/lay-module/iceEditor/iceEditor.js">
|
|
|
|
|
</script>
|
|
|
|
|
<script type="text/javascript" src="~/js/config.js?v=100">
|
|
|
|
|
</script>*@
|
|
|
|
|
<script type="text/javascript" src="~/lib/xlsx/dist/xlsx.full.min.js">
|
|
|
|
|
</script>
|
|
|
|
|
<script type="text/javascript" src="~/lib/notify/notify_stand.js">
|
|
|
|
|
</script>
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
layui.use(["table", "layer", "laytpl", "element", "form", "slider", "laydate", "rate", "colorpicker", "carousel", "upload", "formField", "numberInput", "iconPicker", "cron", "labelGeneration"],
|
|
|
|
|
function () {
|
|
|
|
|
var $ = layui.jquery,
|
|
|
|
|
table = layui.table,
|
|
|
|
|
layer = layui.layer,
|
|
|
|
|
laytpl = layui.laytpl,
|
|
|
|
|
setter = layui.cache,
|
|
|
|
|
element = layui.element,
|
|
|
|
|
slider = layui.slider,
|
|
|
|
|
laydate = layui.laydate,
|
|
|
|
|
rate = layui.rate,
|
|
|
|
|
colorpicker = layui.colorpicker,
|
|
|
|
|
carousel = layui.carousel,
|
|
|
|
|
form = layui.form,
|
|
|
|
|
upload = layui.upload,
|
|
|
|
|
formField = layui.formField,
|
|
|
|
|
hint = layui.hint,
|
|
|
|
|
numberInput = layui.numberInput,
|
|
|
|
|
iconPicker = layui.iconPicker,
|
|
|
|
|
cron = layui.cron,
|
|
|
|
|
labelGeneration = layui.labelGeneration;
|
|
|
|
|
form.on('select(quickTime)', function (data) {
|
|
|
|
|
var selectValue = data.value;
|
|
|
|
|
|
|
|
|
|
function getFormatDate(date) {
|
|
|
|
|
let year = date.getFullYear();
|
|
|
|
|
let month = date.getMonth() + 1;
|
|
|
|
|
let day = date.getDate();
|
|
|
|
|
let hour = date.getHours();
|
|
|
|
|
let minutes = date.getMinutes();
|
|
|
|
|
let seconds = date.getSeconds();
|
|
|
|
|
month = (month < 10) ? '0' + month : month;
|
|
|
|
|
day = (day < 10) ? '0' + day : day;
|
|
|
|
|
hour = (hour < 10) ? '0' + hour : hour;
|
|
|
|
|
minutes = (minutes < 10) ? '0' + minutes : minutes;
|
|
|
|
|
seconds = (seconds < 10) ? '0' + seconds : seconds;
|
|
|
|
|
let currentDate = year + "-" + month + "-" + day
|
|
|
|
|
+ " " + hour + ":" + minutes + ":" + seconds;
|
|
|
|
|
return currentDate;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取今日零点时间戳
|
|
|
|
|
* returns {number}
|
|
|
|
|
*/
|
|
|
|
|
function todayStartTimestamp() {
|
|
|
|
|
const timestamp = Math.floor(new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000)
|
|
|
|
|
return timestamp
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取昨日开始、结束时间戳
|
|
|
|
|
* param num
|
|
|
|
|
* returns {number[昨日开始时间戳, 昨日结束时间戳]}
|
|
|
|
|
*/
|
|
|
|
|
function yesterdayTimestamp(num = 1) {
|
|
|
|
|
const MillisecondsADay = 24 * 60 * 60 * num
|
|
|
|
|
// 今日零点时间戳
|
|
|
|
|
const timestamp = Math.floor(new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000)
|
|
|
|
|
// 昨日开始时间戳
|
|
|
|
|
const yesterdayStartTime = timestamp - MillisecondsADay
|
|
|
|
|
// 昨日结束时间戳
|
|
|
|
|
const yesterdayEndTime = timestamp - 1
|
|
|
|
|
return [yesterdayStartTime, yesterdayEndTime]
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 本周开始时间戳
|
|
|
|
|
* returns {number}
|
|
|
|
|
*/
|
|
|
|
|
function weekStartTimestamp() {
|
|
|
|
|
// 一天的秒数
|
|
|
|
|
const MillisecondsADay = 24 * 60 * 60
|
|
|
|
|
// 今日零点时间戳
|
|
|
|
|
const timestamp = Math.floor(new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000)
|
|
|
|
|
const weekDay = new Date().getDay() === 0 ? (7 - 1) : (new Date().getDay() - 1)
|
|
|
|
|
const weekTimeStamp = timestamp - MillisecondsADay * weekDay
|
|
|
|
|
return weekTimeStamp
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 上周开始、结束时间戳
|
|
|
|
|
* returns {number[上周开始时间戳, 上周结束时间戳]}
|
|
|
|
|
*/
|
|
|
|
|
function lastWeekTimetamp() {
|
|
|
|
|
// 一天的秒数
|
|
|
|
|
const MillisecondsADay = 24 * 60 * 60
|
|
|
|
|
// 今日零点时间戳
|
|
|
|
|
const timestamp = Math.floor(new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000)
|
|
|
|
|
const weekDay = new Date().getDay() === 0 ? (7 - 1) : (new Date().getDay() - 1)
|
|
|
|
|
// 本周开始时间戳
|
|
|
|
|
const weekTimeStamp = timestamp - MillisecondsADay * weekDay
|
|
|
|
|
// 上周开始时间戳
|
|
|
|
|
const lastWeekStart = weekTimeStamp - MillisecondsADay * 7
|
|
|
|
|
// 上周结束时间戳
|
|
|
|
|
const lastWeekEnd = weekTimeStamp - 1
|
|
|
|
|
return [lastWeekStart, lastWeekEnd]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当月开始时间戳
|
|
|
|
|
* returns {number}
|
|
|
|
|
*/
|
|
|
|
|
function monthStartTimestamp() {
|
|
|
|
|
const date = new Date()
|
|
|
|
|
date.setDate(1)
|
|
|
|
|
date.setHours(0, 0, 0, 0)
|
|
|
|
|
const timeStamp = date.getTime() / 1000
|
|
|
|
|
return timeStamp
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取上月开始、结束时间戳
|
|
|
|
|
* returns {number[上月开始时间戳,上月结束时间戳]}
|
|
|
|
|
*/
|
|
|
|
|
function lastMonthTimetamp() {
|
|
|
|
|
// 一天的秒数
|
|
|
|
|
const MillisecondsADay = 24 * 60 * 60
|
|
|
|
|
|
|
|
|
|
const date = new Date()
|
|
|
|
|
date.setDate(1)
|
|
|
|
|
date.setHours(0, 0, 0, 0)
|
|
|
|
|
// 当月开始时间戳
|
|
|
|
|
const timeStamp = date.getTime() / 1000
|
|
|
|
|
// 上个月的天数
|
|
|
|
|
const days = lastMonthDats()
|
|
|
|
|
// 上月开始时间戳
|
|
|
|
|
const lastMonthStart = timeStamp - (MillisecondsADay * days)
|
|
|
|
|
// 上月结束时间戳
|
|
|
|
|
const lastMonthEnd = timeStamp - 1
|
|
|
|
|
return [lastMonthStart, lastMonthEnd]
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 上月天数
|
|
|
|
|
* returns {number}
|
|
|
|
|
*/
|
|
|
|
|
function lastMonthDats() {
|
|
|
|
|
const date = new Date()
|
|
|
|
|
const year = date.getFullYear()
|
|
|
|
|
// 上个月月份
|
|
|
|
|
let month = (date.getMonth() + 1) - 1 // 0-11 表示 1月-12月
|
|
|
|
|
// 0 表示12月
|
|
|
|
|
month = month || 12
|
|
|
|
|
// 30天的月份
|
|
|
|
|
const arr30 = [4, 6, 9, 11]
|
|
|
|
|
// 31天的月份
|
|
|
|
|
const arr31 = [1, 3, 5, 7, 8, 10, 12]
|
|
|
|
|
if (arr30.indexOf(month) !== -1) {
|
|
|
|
|
// 上个月是 30 天
|
|
|
|
|
return 30
|
|
|
|
|
} else if (arr31.indexOf(month) !== -1) {
|
|
|
|
|
// 上个月是 31 天
|
|
|
|
|
return 31
|
|
|
|
|
} else {
|
|
|
|
|
// 2月
|
|
|
|
|
if (isRunYear(year)) {
|
|
|
|
|
return 29
|
|
|
|
|
} else {
|
|
|
|
|
return 28
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 是否为闰年
|
|
|
|
|
* param year
|
|
|
|
|
* returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
function isRunYear(year) {
|
|
|
|
|
// 条件:能被4整除并且不能被100整除,或者被400整除的
|
|
|
|
|
let flag = false
|
|
|
|
|
if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
|
|
|
|
|
flag = true
|
|
|
|
|
}
|
|
|
|
|
return flag
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var laydate = layui.laydate;
|
|
|
|
|
if(selectValue == "toDay"){
|
|
|
|
|
var toDayStartDate = todayStartTimestamp();
|
|
|
|
|
var timef1 = getFormatDate(new Date(toDayStartDate * 1000));
|
|
|
|
|
lay('#dateReStartTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef1,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
var timef2 = getFormatDate(new Date(Date.now()));
|
|
|
|
|
lay('#dateReEndTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef2,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}else if(selectValue == "yesterDay"){
|
|
|
|
|
var yesterDayDate = yesterdayTimestamp(1);
|
|
|
|
|
var timef1 = getFormatDate(new Date(yesterDayDate[0] * 1000));
|
|
|
|
|
lay('#dateReStartTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef1,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
var timef2 = getFormatDate(new Date(yesterDayDate[1] * 1000));
|
|
|
|
|
lay('#dateReEndTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef2,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}else if (selectValue == "thisWeek"){
|
|
|
|
|
var weekStartDate = weekStartTimestamp();
|
|
|
|
|
var timef1 = getFormatDate(new Date(weekStartDate*1000));
|
|
|
|
|
lay('#dateReStartTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef1,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
var timef2 = getFormatDate(new Date(Date.now()));
|
|
|
|
|
lay('#dateReEndTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef2,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}else if(selectValue == "lastWeek"){
|
|
|
|
|
var lastWeekDate = lastWeekTimetamp();
|
|
|
|
|
var timef1 = getFormatDate(new Date(lastWeekDate[0] * 1000));
|
|
|
|
|
lay('#dateReStartTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef1,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
var timef2 = getFormatDate(new Date(lastWeekDate[1] * 1000));
|
|
|
|
|
lay('#dateReEndTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef2,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}else if(selectValue == "thisMonth"){
|
|
|
|
|
var monthStartDate = monthStartTimestamp();
|
|
|
|
|
var timef = getFormatDate(new Date(monthStartDate * 1000));
|
|
|
|
|
lay('#dateReStartTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
var timef2 = getFormatDate(new Date(Date.now()));
|
|
|
|
|
lay('#dateReEndTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef2,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}else if(selectValue == "lastMonth"){
|
|
|
|
|
//lastMonthTimetamp()
|
|
|
|
|
var lastMonthDate = lastMonthTimetamp();
|
|
|
|
|
var timef1 = getFormatDate(new Date(lastMonthDate[0] * 1000));
|
|
|
|
|
lay('#dateReStartTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef1,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
var timef2 = getFormatDate(new Date(lastMonthDate[1] * 1000));
|
|
|
|
|
lay('#dateReEndTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: timef2,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}else {}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
wcLoading.close();
|
|
|
|
|
//$.ajax({
|
|
|
|
|
// url: "/PenMeiReportManage/PenMeiHistoryReport/GetDriverGroupList",
|
|
|
|
|
// type: "GET",
|
|
|
|
|
// success: function (redata) {
|
|
|
|
|
// debugger;
|
|
|
|
|
// var groupResult = JSON.parse(redata);
|
|
|
|
|
// debugger;
|
|
|
|
|
// $.each(groupResult,function(index,item){
|
|
|
|
|
// $('#selectGroup').append(new Option(item.GroupDescription,item.GroupName));
|
|
|
|
|
// });
|
|
|
|
|
// debugger;
|
|
|
|
|
// }
|
|
|
|
|
//});
|
|
|
|
|
//debugger;
|
|
|
|
|
var starttime = new Date(new Date().setHours(0, 0, 0, 0));
|
|
|
|
|
var starttimeString = starttime.getFullYear() + "-" + parseInt(starttime.getMonth() + 1) + "-" + starttime.getDate() + " " + (starttime.getHours()) + ":" + starttime.getMinutes() + ":" + starttime.getSeconds();
|
|
|
|
|
var endtime = new Date();
|
|
|
|
|
endtime.setDate(endtime.getDate())
|
|
|
|
|
var endtimeString = endtime.getFullYear() + "-" + parseInt(endtime.getMonth() + 1) + "-" + endtime.getDate() + " " + (endtime.getHours()) + ":" + endtime.getMinutes() + ":" + endtime.getSeconds();
|
|
|
|
|
function getFormatDateone(date) {
|
|
|
|
|
let year = date.getFullYear();
|
|
|
|
|
let month = date.getMonth() + 1;
|
|
|
|
|
let day = date.getDate();
|
|
|
|
|
let hour = date.getHours();
|
|
|
|
|
let minutes = date.getMinutes();
|
|
|
|
|
let seconds = date.getSeconds();
|
|
|
|
|
month = (month < 10) ? '0' + month : month;
|
|
|
|
|
day = (day < 10) ? '0' + day : day;
|
|
|
|
|
hour = (hour < 10) ? '0' + hour : hour;
|
|
|
|
|
minutes = (minutes < 10) ? '0' + minutes : minutes;
|
|
|
|
|
seconds = (seconds < 10) ? '0' + seconds : seconds;
|
|
|
|
|
let currentDate = year + "-" + month + "-" + day
|
|
|
|
|
+ " " + hour + ":" + minutes + ":" + seconds;
|
|
|
|
|
return currentDate;
|
|
|
|
|
}
|
|
|
|
|
layui.use('laydate', function () {
|
|
|
|
|
var laydate = layui.laydate;
|
|
|
|
|
lay('#dateReStartTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: getFormatDateone(starttime),
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
lay('#dateReEndTime').each(function () {
|
|
|
|
|
laydate.render({
|
|
|
|
|
elem: this,
|
|
|
|
|
trigger: 'click',
|
|
|
|
|
format: "yyyy-MM-dd HH:mm:ss",
|
|
|
|
|
//value: "2023-02-23 13:56:25",
|
|
|
|
|
value: getFormatDateone(endtime),
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
//layui.form.on('select(quickTime)',function(data1){
|
|
|
|
|
// var selectQuick = data1.value;
|
|
|
|
|
// debugger;
|
|
|
|
|
//});
|
|
|
|
|
var starttime = new Date(new Date().setHours(0, 0, 0, 0));
|
|
|
|
|
var starttimeString = starttime.getFullYear() + "-" + parseInt(starttime.getMonth() + 1) + "-" + starttime.getDate() + " " + (starttime.getHours()) + ":" + starttime.getMinutes() + ":" + starttime.getSeconds();
|
|
|
|
|
var endtime = new Date();
|
|
|
|
|
endtime.setDate(endtime.getDate())
|
|
|
|
|
var endtimeString = endtime.getFullYear() + "-" + parseInt(endtime.getMonth() + 1) + "-" + endtime.getDate() + " " + (endtime.getHours()) + ":" + endtime.getMinutes() + ":" + endtime.getSeconds();
|
|
|
|
|
|
|
|
|
|
debugger;
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getFormatDate(date) {
|
|
|
|
|
let year = date.getFullYear();
|
|
|
|
|
let month = date.getMonth() + 1;
|
|
|
|
|
let day = date.getDate();
|
|
|
|
|
let hour = date.getHours();
|
|
|
|
|
let minutes = date.getMinutes();
|
|
|
|
|
let seconds = date.getSeconds();
|
|
|
|
|
month = (month < 10) ? '0' + month : month;
|
|
|
|
|
day = (day < 10) ? '0' + day : day;
|
|
|
|
|
hour = (hour < 10) ? '0' + hour : hour;
|
|
|
|
|
minutes = (minutes < 10) ? '0' + minutes : minutes;
|
|
|
|
|
seconds = (seconds < 10) ? '0' + seconds : seconds;
|
|
|
|
|
let currentDate = year + "-" + month + "-" + day
|
|
|
|
|
+ " " + hour + ":" + minutes + ":" + seconds;
|
|
|
|
|
return currentDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//loadinghelper
|
|
|
|
|
|
|
|
|
|
var filepath = "";
|
|
|
|
|
// 文件普通操作
|
|
|
|
|
var handler = {};
|
|
|
|
|
//right_content
|
|
|
|
|
var rootpath = window.location.host;
|
|
|
|
|
//在页面未加载完毕之前显示的loading Html自定义内容
|
|
|
|
|
var _LoadingHtml = '<div id="loadingDiv" style="display: none; "><div id="over" style=" position: absolute;top: 0;left: 0; width: 100%;height: 100%; background-color: #f5f5f5;opacity:0.5;z-index: 1000;"></div><div id="layout" style="position: absolute;top: 40%; left: 40%;width: 20%; height: 20%; z-index: 1001;text-align:center;"><img src="//'+ rootpath +'/images/loading.gif" /></div></div>';
|
|
|
|
|
//呈现loading效果
|
|
|
|
|
document.getElementById("workerdiv").innerHTML += _LoadingHtml;
|
|
|
|
|
//移除loading效果
|
|
|
|
|
function completeLoading() {
|
|
|
|
|
document.getElementById("loadingDiv").style.display = "none";
|
|
|
|
|
}
|
|
|
|
|
//展示loading效果
|
|
|
|
|
function showLoading() {
|
|
|
|
|
document.getElementById("loadingDiv").style.display = "block";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function del() {
|
|
|
|
|
var delDiv = document.getElementById("_layer_"); delDiv.parentNode.removeChild(delDiv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function downloadreport() {
|
|
|
|
|
window.open(filepath);
|
|
|
|
|
}
|
|
|
|
|
async function GetReportViewNewGZIP() {
|
|
|
|
|
debugger;
|
|
|
|
|
showLoading();
|
|
|
|
|
var datetimestart = $('#dateReStartTime')[0].value;
|
|
|
|
|
var datetimeend = $('#dateReEndTime')[0].value;
|
|
|
|
|
var timeInterval = 0;
|
|
|
|
|
switch ($('[name="selectint"]')[0].value) {
|
|
|
|
|
case "onesec":
|
|
|
|
|
timeInterval = 1
|
|
|
|
|
break
|
|
|
|
|
case "tensec":
|
|
|
|
|
timeInterval = 10
|
|
|
|
|
break
|
|
|
|
|
case "thirtysec":
|
|
|
|
|
timeInterval = 30
|
|
|
|
|
break
|
|
|
|
|
case "onemin":
|
|
|
|
|
timeInterval = 60
|
|
|
|
|
break
|
|
|
|
|
case "fivemin":
|
|
|
|
|
timeInterval = 300
|
|
|
|
|
break
|
|
|
|
|
case "tenmin":
|
|
|
|
|
timeInterval = 600
|
|
|
|
|
break
|
|
|
|
|
case "thirtymin":
|
|
|
|
|
timeInterval = 1800
|
|
|
|
|
break
|
|
|
|
|
case "onehour":
|
|
|
|
|
timeInterval = 3600
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
timeInterval = 3600
|
|
|
|
|
};
|
|
|
|
|
debugger;
|
|
|
|
|
//showLoading();
|
|
|
|
|
var datapa = {
|
|
|
|
|
"StartTime": Date.parse(new Date(datetimestart)), "EndTime": Date.parse(new Date(datetimeend)), "Interval": timeInterval
|
|
|
|
|
};
|
|
|
|
|
//var datapa = { "StartTime": datetimestart, "EndTime": datetimeend, "Interval": timeInterval };
|
|
|
|
|
debugger;
|
|
|
|
|
let result = "";
|
|
|
|
|
let first = "";
|
|
|
|
|
let second = "";
|
|
|
|
|
var start1 = Date.now();
|
|
|
|
|
await $.ajax({
|
|
|
|
|
url: "/PenMeiReportManage/PenMeiHistoryReport/GetReportNew",
|
|
|
|
|
type: "POST",
|
|
|
|
|
//dataType: "json",
|
|
|
|
|
//async: false,
|
|
|
|
|
data: datapa,
|
|
|
|
|
dataType: "text",
|
|
|
|
|
//contentType:"text/html",
|
|
|
|
|
beforeSend: function (XMLHttpRequest) {
|
|
|
|
|
XMLHttpRequest.setRequestHeader("accept-encoding", "gzip");
|
|
|
|
|
XMLHttpRequest.setRequestHeader("accept", "text/html; charset=utf-8");
|
|
|
|
|
},
|
|
|
|
|
success: function (redata) {
|
|
|
|
|
|
|
|
|
|
var start = Date.now();
|
|
|
|
|
result = JSON.parse(redata);
|
|
|
|
|
var end = Date.now();
|
|
|
|
|
console.log(end - start);
|
|
|
|
|
debugger;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
var end1 = Date.now();
|
|
|
|
|
console.log(end1 - start1);
|
|
|
|
|
await $.ajax({
|
|
|
|
|
url: "/PenMeiReportManage/PenMeiHistoryReport/GetReportFirstHead",
|
|
|
|
|
type: "GET",
|
|
|
|
|
//dataType: "json",
|
|
|
|
|
//async: false,
|
|
|
|
|
//data: datapa,
|
|
|
|
|
success: function (refirst) {
|
|
|
|
|
first = JSON.parse(refirst);
|
|
|
|
|
debugger;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await $.ajax({
|
|
|
|
|
url: "/PenMeiReportManage/PenMeiHistoryReport/GetReportSecondHead",
|
|
|
|
|
type: "GET",
|
|
|
|
|
//dataType: "json",
|
|
|
|
|
//async: false,
|
|
|
|
|
//data: datapa,
|
|
|
|
|
success: function (resecond) {
|
|
|
|
|
second = JSON.parse(resecond);
|
|
|
|
|
debugger;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let firstHead = new Array();
|
|
|
|
|
let secondHead = new Array();
|
|
|
|
|
let timeHead = {
|
|
|
|
|
field: 'HDATETIME',
|
|
|
|
|
title: '时间',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 200,
|
|
|
|
|
rowspan: 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
firstHead.push(timeHead);
|
|
|
|
|
for (var si = 0; si < second.length; si++) {
|
|
|
|
|
let head = {
|
|
|
|
|
align: 'center',
|
|
|
|
|
title: second[si].HSYS,
|
|
|
|
|
colspan: second[si].Head.length,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
firstHead.push(head);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(var hi = 0; hi < second[si].Head.length;hi++){
|
|
|
|
|
let shead = {
|
|
|
|
|
field: second[si].Title[hi],
|
|
|
|
|
title: second[si].Head[hi],
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 80,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
secondHead.push(shead);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
debugger;
|
|
|
|
|
var ingd =0;
|
|
|
|
|
var table = layui.table;
|
|
|
|
|
table.render({
|
|
|
|
|
elem: '#result',
|
|
|
|
|
height: 'full-160',
|
|
|
|
|
data: result,
|
|
|
|
|
//editTrigger:'dblclick',
|
|
|
|
|
cols: [
|
|
|
|
|
firstHead,
|
|
|
|
|
secondHead,
|
|
|
|
|
],
|
|
|
|
|
page:true,
|
|
|
|
|
limit:15,
|
|
|
|
|
//toolbar: 'default',
|
|
|
|
|
//defaultToolbar: ['filter', 'print', 'exports'],
|
|
|
|
|
done: function (res, curr, count) {
|
|
|
|
|
debugger;
|
|
|
|
|
// console.log(res)
|
|
|
|
|
//var donestyle = "<style>.layui - table - cell { height: auto;overflow: visible;text - overflow: inherit;white - space: normal;word -break: break-all;}.layui - table - cell a {text- decoration: underline;}.layui - table - cell div {white - space: nowrap;overflow: hidden;text - overflow: ellipsis;min - height: 30px;line - height: 30px;}</style>"
|
|
|
|
|
//var oDiv = document.querySelector("#tdemo");
|
|
|
|
|
//oDiv.style.cssText = donestyle;
|
|
|
|
|
//layui-table-cell laytable-cell-group
|
|
|
|
|
//layui-table-cell laytable-cell-1-1-0
|
|
|
|
|
//$(".layui-table-cell"). [800].style
|
|
|
|
|
////解决表头宽度不够自动换行问题
|
|
|
|
|
//$(".layui-table-cell").each(function (index, val) {
|
|
|
|
|
// $(".layui-table-cell")[index].style.lineHeight = "20px !importanr";
|
|
|
|
|
// $(".layui-table-cell")[index].style.verticalAlign = "middle";
|
|
|
|
|
// $(".layui-table-cell")[index].style.height = "auto";
|
|
|
|
|
// $(".layui-table-cell")[index].style.overflow = "visible";
|
|
|
|
|
// $(".layui-table-cell")[index].style.textOverflow = "inherit";
|
|
|
|
|
// $(".layui-table-cell")[index].style.whiteSpace = "normal";
|
|
|
|
|
//});
|
|
|
|
|
////解决操作栏因为内容过多换行问题
|
|
|
|
|
//$(".layui-table-main tr").each(function (index, val) {
|
|
|
|
|
// $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
|
|
|
|
// $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
|
|
|
|
//});
|
|
|
|
|
////解决fixed固定,而导致的th高度不一致
|
|
|
|
|
//$(".layui-table-header tr").each(function (index, val) {
|
|
|
|
|
// $(".layui-table-fixed").each(function () {
|
|
|
|
|
// $($(this).find(".layui-table-header thead th")[index]).height($(val).height());
|
|
|
|
|
// });
|
|
|
|
|
//});
|
|
|
|
|
//$(".layui-table-header tr").each(function (index, val) {
|
|
|
|
|
// $(".layui-table-fixed").each(function () {
|
|
|
|
|
// $($(this).find(".layui-table-header thead tr")[index]).height($(val).height());
|
|
|
|
|
// });
|
|
|
|
|
//});
|
|
|
|
|
//$(".layui-table-main tr").each(function (index, val) {
|
|
|
|
|
// $(".layui-table-fixed").each(function () {
|
|
|
|
|
// $($(this).find(".layui-table-body tbody tr")[index]).height($(val).height());
|
|
|
|
|
// });
|
|
|
|
|
//});
|
|
|
|
|
//$(".layui-table-main tr").each(function (index, val) {
|
|
|
|
|
// $(".layui-table-fixed").each(function () {
|
|
|
|
|
// $($(this).find(".layui-table-body tbody th")[index]).height($(val).height());
|
|
|
|
|
// });
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
$('.layui-laypage-limits').hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
debugger;
|
|
|
|
|
completeLoading();
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
var DownLaodPara;
|
|
|
|
|
async function GetReportViewNew() {
|
|
|
|
|
debugger;
|
|
|
|
|
showLoading();
|
|
|
|
|
var datetimestart = $('#dateReStartTime')[0].value;
|
|
|
|
|
var datetimeend = $('#dateReEndTime')[0].value;
|
|
|
|
|
//var groupname = $('[name="selectGroup"]')[0].value;
|
|
|
|
|
var timeInterval = 0;
|
|
|
|
|
switch ($('[name="selectint"]')[0].value) {
|
|
|
|
|
case "onesec":
|
|
|
|
|
timeInterval = 1
|
|
|
|
|
break
|
|
|
|
|
case "tensec":
|
|
|
|
|
timeInterval = 10
|
|
|
|
|
break
|
|
|
|
|
case "thirtysec":
|
|
|
|
|
timeInterval = 30
|
|
|
|
|
break
|
|
|
|
|
case "onemin":
|
|
|
|
|
timeInterval = 60
|
|
|
|
|
break
|
|
|
|
|
case "fivemin":
|
|
|
|
|
timeInterval = 300
|
|
|
|
|
break
|
|
|
|
|
case "tenmin":
|
|
|
|
|
timeInterval = 600
|
|
|
|
|
break
|
|
|
|
|
case "thirtymin":
|
|
|
|
|
timeInterval = 1800
|
|
|
|
|
break
|
|
|
|
|
case "onehour":
|
|
|
|
|
timeInterval = 3600
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
timeInterval = 3600
|
|
|
|
|
};
|
|
|
|
|
debugger;
|
|
|
|
|
//showLoading();
|
|
|
|
|
var datapa = {
|
|
|
|
|
"StartTime": Date.parse(new Date(datetimestart)), "EndTime": Date.parse(new Date(datetimeend)), "Interval": timeInterval
|
|
|
|
|
};
|
|
|
|
|
DownLaodPara = datapa;
|
|
|
|
|
//var datapa = { "StartTime": datetimestart, "EndTime": datetimeend, "Interval": timeInterval };
|
|
|
|
|
debugger;
|
|
|
|
|
let rescounts = 0;
|
|
|
|
|
let first = "";
|
|
|
|
|
let second = "";
|
|
|
|
|
var start1 = Date.now();
|
|
|
|
|
await $.ajax({
|
|
|
|
|
url: "/PenMeiReportManage/PenMeiHistoryReport/GetReportNewInitPara",
|
|
|
|
|
type: "POST",
|
|
|
|
|
//dataType: "json",
|
|
|
|
|
//async: false,
|
|
|
|
|
data: datapa,
|
|
|
|
|
|
|
|
|
|
success: function (redata) {
|
|
|
|
|
debugger;
|
|
|
|
|
var start = Date.now();
|
|
|
|
|
rescounts = parseInt(redata);
|
|
|
|
|
debugger;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
var end1 = Date.now();
|
|
|
|
|
console.log(end1 - start1);
|
|
|
|
|
await $.ajax({
|
|
|
|
|
url: "/PenMeiReportManage/PenMeiHistoryReport/GetReportFirstHead",
|
|
|
|
|
type: "GET",
|
|
|
|
|
//dataType: "json",
|
|
|
|
|
//async: false,
|
|
|
|
|
//data: datapa,
|
|
|
|
|
success: function (refirst) {
|
|
|
|
|
first = JSON.parse(refirst);
|
|
|
|
|
debugger;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await $.ajax({
|
|
|
|
|
url: "/PenMeiReportManage/PenMeiHistoryReport/GetReportSecondHead",
|
|
|
|
|
type: "GET",
|
|
|
|
|
//dataType: "json",
|
|
|
|
|
//async: false,
|
|
|
|
|
//data: datapa,
|
|
|
|
|
success: function (resecond) {
|
|
|
|
|
second = JSON.parse(resecond);
|
|
|
|
|
debugger;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let firstHead = new Array();
|
|
|
|
|
let secondHead = new Array();
|
|
|
|
|
let timeHead = {
|
|
|
|
|
field: 'HDATETIME',
|
|
|
|
|
title: '时间',
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 200,
|
|
|
|
|
rowspan: 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
firstHead.push(timeHead);
|
|
|
|
|
for (var si = 0; si < second.length; si++) {
|
|
|
|
|
let head = {
|
|
|
|
|
align: 'center',
|
|
|
|
|
title: second[si].HSYS,
|
|
|
|
|
colspan: second[si].Head.length,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
firstHead.push(head);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var hi = 0; hi < second[si].Head.length; hi++) {
|
|
|
|
|
let shead = {
|
|
|
|
|
field: second[si].Title[hi],
|
|
|
|
|
title: second[si].Head[hi],
|
|
|
|
|
align: 'center',
|
|
|
|
|
width: 90,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
secondHead.push(shead);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var autoCounts = firstHead.length + secondHead.length;
|
|
|
|
|
debugger;
|
|
|
|
|
var ingd = 0;
|
|
|
|
|
var table = layui.table;
|
|
|
|
|
table.render({
|
|
|
|
|
elem: '#result',
|
|
|
|
|
id: 'result',
|
|
|
|
|
height: 'full-140',
|
|
|
|
|
url: '/PenMeiReportManage/PenMeiHistoryReport/GetReportNewPage',
|
|
|
|
|
where: { "StartTime": Date.parse(new Date(datetimestart)), "EndTime": Date.parse(new Date(datetimeend)), "Interval": timeInterval/*, "GroupName": groupname */},
|
|
|
|
|
page: true,
|
|
|
|
|
limit: 13,
|
|
|
|
|
//even: true,
|
|
|
|
|
|
|
|
|
|
//data: result,
|
|
|
|
|
//editTrigger:'dblclick',
|
|
|
|
|
cols: [
|
|
|
|
|
firstHead,
|
|
|
|
|
secondHead,
|
|
|
|
|
],
|
|
|
|
|
parseData: function (res) { //res 即为原始返回的数据
|
|
|
|
|
return {
|
|
|
|
|
"code": res.code, //解析接口状态
|
|
|
|
|
"msg": res.mag, //解析提示文本
|
|
|
|
|
"count": rescounts, //解析数据长度
|
|
|
|
|
"data": JSON.parse(res.data) //解析数据列表
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
//toolbar: 'default',
|
|
|
|
|
//defaultToolbar: ['filter', 'print', 'exports'],
|
|
|
|
|
done: function (res, curr, count) {
|
|
|
|
|
debugger;
|
|
|
|
|
//console.log(res);
|
|
|
|
|
////得到当前页码
|
|
|
|
|
//console.log(curr);
|
|
|
|
|
////得到数据总量
|
|
|
|
|
//console.log(count);
|
|
|
|
|
// console.log(res)
|
|
|
|
|
//var donestyle = "<style>.layui - table - cell { height: auto;overflow: visible;text - overflow: inherit;white - space: normal;word -break: break-all;}.layui - table - cell a {text- decoration: underline;}.layui - table - cell div {white - space: nowrap;overflow: hidden;text - overflow: ellipsis;min - height: 30px;line - height: 30px;}</style>"
|
|
|
|
|
//var oDiv = document.querySelector("#tdemo");
|
|
|
|
|
//oDiv.style.cssText = donestyle;
|
|
|
|
|
//layui-table-cell laytable-cell-group
|
|
|
|
|
//layui-table-cell laytable-cell-1-1-0
|
|
|
|
|
//$(".layui-table-cell"). [800].style
|
|
|
|
|
//解决表头宽度不够自动换行问题
|
|
|
|
|
$(".layui-table-cell").each(function (index, val) {
|
|
|
|
|
if (index > autoCounts) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
debugger;
|
|
|
|
|
$(".layui-table-cell")[index].style.lineHeight = "20px !importanr";
|
|
|
|
|
$(".layui-table-cell")[index].style.verticalAlign = "middle";
|
|
|
|
|
$(".layui-table-cell")[index].style.height = "auto";
|
|
|
|
|
$(".layui-table-cell")[index].style.overflow = "visible";
|
|
|
|
|
$(".layui-table-cell")[index].style.textOverflow = "inherit";
|
|
|
|
|
$(".layui-table-cell")[index].style.whiteSpace = "normal";
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
////test
|
|
|
|
|
//$(".layui-table-cell")[3].style.lineHeight = "20px !importanr";
|
|
|
|
|
//$(".layui-table-cell")[3].style.verticalAlign = "middle";
|
|
|
|
|
//$(".layui-table-cell")[3].style.height = "auto";
|
|
|
|
|
//$(".layui-table-cell")[3].style.overflow = "visible";
|
|
|
|
|
//$(".layui-table-cell")[3].style.textOverflow = "inherit";
|
|
|
|
|
//$(".layui-table-cell")[3].style.whiteSpace = "normal";
|
|
|
|
|
////解决操作栏因为内容过多换行问题
|
|
|
|
|
//$(".layui-table-main tr").each(function (index, val) {
|
|
|
|
|
// $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
|
|
|
|
// $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
|
|
|
|
//});
|
|
|
|
|
////解决fixed固定,而导致的th高度不一致
|
|
|
|
|
//$(".layui-table-header tr").each(function (index, val) {
|
|
|
|
|
// $(".layui-table-fixed").each(function () {
|
|
|
|
|
// $($(this).find(".layui-table-header thead th")[index]).height($(val).height());
|
|
|
|
|
// });
|
|
|
|
|
//});
|
|
|
|
|
//$(".layui-table-header tr").each(function (index, val) {
|
|
|
|
|
// $(".layui-table-fixed").each(function () {
|
|
|
|
|
// $($(this).find(".layui-table-header thead tr")[index]).height($(val).height());
|
|
|
|
|
// });
|
|
|
|
|
//});
|
|
|
|
|
//$(".layui-table-main tr").each(function (index, val) {
|
|
|
|
|
// $(".layui-table-fixed").each(function () {
|
|
|
|
|
// $($(this).find(".layui-table-body tbody tr")[index]).height($(val).height());
|
|
|
|
|
// });
|
|
|
|
|
//});
|
|
|
|
|
//$(".layui-table-main tr").each(function (index, val) {
|
|
|
|
|
// $(".layui-table-fixed").each(function () {
|
|
|
|
|
// $($(this).find(".layui-table-body tbody th")[index]).height($(val).height());
|
|
|
|
|
// });
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
$('.layui-laypage-limits').hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
debugger;
|
|
|
|
|
completeLoading();
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
async function exports() {
|
|
|
|
|
notify.info("服务器导出数据,稍后弹出下载文件,可先浏览报表", "vcenter");
|
|
|
|
|
await $.ajax({
|
|
|
|
|
url: "/PenMeiReportManage/PenMeiHistoryReport/GetReportDownLoad",
|
|
|
|
|
type: "POST",
|
|
|
|
|
//dataType: "json",
|
|
|
|
|
//async: false,
|
|
|
|
|
data: DownLaodPara,
|
|
|
|
|
success:function (downRes) {
|
|
|
|
|
var ddfileName = JSON.parse(downRes);
|
|
|
|
|
|
|
|
|
|
var fileNewDownloadUrl = "/report/" + ddfileName;
|
|
|
|
|
//location.origin = fileNewDownloadUrl;
|
|
|
|
|
//filepath = location.origin + fileNewDownloadUrl;
|
|
|
|
|
|
|
|
|
|
window.open(location.origin + fileNewDownloadUrl);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function GetReportView() {
|
|
|
|
|
debugger;
|
|
|
|
|
showLoading();
|
|
|
|
|
var datetimestart = $('#dateReStartTime')[0].value;
|
|
|
|
|
var datetimeend = $('#dateReEndTime')[0].value;
|
|
|
|
|
var timeInterval = 0;
|
|
|
|
|
switch ($('[name="selectint"]')[0].value) {
|
|
|
|
|
case "tensec":
|
|
|
|
|
timeInterval = 10
|
|
|
|
|
break
|
|
|
|
|
case "twentysec":
|
|
|
|
|
timeInterval = 20
|
|
|
|
|
break
|
|
|
|
|
case "thirtysec":
|
|
|
|
|
timeInterval = 30
|
|
|
|
|
break
|
|
|
|
|
case "onemin":
|
|
|
|
|
timeInterval = 60
|
|
|
|
|
break
|
|
|
|
|
case "fivemin":
|
|
|
|
|
timeInterval = 300
|
|
|
|
|
break
|
|
|
|
|
case "tenmin":
|
|
|
|
|
timeInterval = 600
|
|
|
|
|
break
|
|
|
|
|
case "thirtymin":
|
|
|
|
|
timeInterval = 1800
|
|
|
|
|
break
|
|
|
|
|
case "onehour":
|
|
|
|
|
timeInterval = 3600
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
timeInterval = 3600
|
|
|
|
|
};
|
|
|
|
|
debugger;
|
|
|
|
|
//showLoading();
|
|
|
|
|
var datapa = {
|
|
|
|
|
"StartTime": Date.parse(new Date(datetimestart)), "EndTime": Date.parse(new Date(datetimeend)), "Interval": timeInterval
|
|
|
|
|
};
|
|
|
|
|
//var datapa = { "StartTime": datetimestart, "EndTime": datetimeend, "Interval": timeInterval };
|
|
|
|
|
debugger;
|
|
|
|
|
var result = "";
|
|
|
|
|
await $.ajax({
|
|
|
|
|
url: "/PenMeiReportManage/PenMeiHistoryReport/GetReport",
|
|
|
|
|
type: "POST",
|
|
|
|
|
//dataType: "json",
|
|
|
|
|
//async: false,
|
|
|
|
|
data:datapa,
|
|
|
|
|
success: function (redata) {
|
|
|
|
|
result = redata;
|
|
|
|
|
debugger;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
debugger;
|
|
|
|
|
//var result = await Call(api.Report.GetReport, datapa);
|
|
|
|
|
const fileDownloadUrl = "/report/" + result;
|
|
|
|
|
location.origin = fileDownloadUrl;
|
|
|
|
|
filepath = location.origin + fileDownloadUrl;
|
|
|
|
|
|
|
|
|
|
var data = xhrequest(filepath,
|
|
|
|
|
function (blob, type) {
|
|
|
|
|
ShowExcelReport(blob, "test" + '.' + type)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
async function xhrequest(url, callback) {
|
|
|
|
|
let DownUrl = url;
|
|
|
|
|
let data = await fetch(DownUrl)
|
|
|
|
|
.then((response) => response.blob())
|
|
|
|
|
.then((res) => {
|
|
|
|
|
//获取文件格式
|
|
|
|
|
var index = DownUrl.lastIndexOf(".");
|
|
|
|
|
//获取文件后缀判断文件格式
|
|
|
|
|
var fileType = DownUrl.substr(index + 1);
|
|
|
|
|
let blod = new Blob([res]);
|
|
|
|
|
if (typeof callback == "function") {
|
|
|
|
|
callback(blod, fileType)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let ShowExcelReport = (blob, fileName) => {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
let file = new File([blob], fileName, { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!/\.xlsx$/g.test(file.name)) {
|
|
|
|
|
alert("报表生成出错");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
handler.readWorkbookFromLocalFile(file, function (workbook) {
|
|
|
|
|
handler.readWorkbook(workbook);
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log("表格转换失败");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handler = {
|
|
|
|
|
// 处理本地加载的文件
|
|
|
|
|
readWorkbookFromLocalFile(file, callback) {
|
|
|
|
|
var reader = new FileReader();
|
|
|
|
|
reader.onload = function (e) {
|
|
|
|
|
var data = e.target.result;
|
|
|
|
|
var workbook = XLSX.read(data, { type: "binary" });
|
|
|
|
|
if (callback) callback(workbook);
|
|
|
|
|
};
|
|
|
|
|
reader.readAsBinaryString(file);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
readWorkbook(workbook) {
|
|
|
|
|
var sheetNames = workbook.SheetNames; // 工作表名称集合
|
|
|
|
|
var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
|
|
|
|
|
var csv = XLSX.utils.sheet_to_csv(worksheet);
|
|
|
|
|
document.getElementById("result").innerHTML = handler.csv2table(
|
|
|
|
|
csv,
|
|
|
|
|
true
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 合并单元格
|
|
|
|
|
//handler.mergeTable(workbook, true);
|
|
|
|
|
staticToLayTable();
|
|
|
|
|
completeLoading();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// csv 数据转换为 table
|
|
|
|
|
csv2table(csv, showTab = false) {
|
|
|
|
|
var html = "<table lay-filter=\"tdemo\" border=\"1\" >";// class=\"layui-table\" lay-data=\"{报表数据}\"
|
|
|
|
|
var rows = csv.split("\n");
|
|
|
|
|
debugger;
|
|
|
|
|
rows.pop(); // 最后一行没用的
|
|
|
|
|
|
|
|
|
|
var oneheadarray = rows[0].split(",");
|
|
|
|
|
var onehead = new Array();
|
|
|
|
|
var oneheadlength = new Array();
|
|
|
|
|
var marge = 0;
|
|
|
|
|
oneheadarray.forEach(function (onestring,oneid){
|
|
|
|
|
if(onestring!=""){
|
|
|
|
|
if(oneid == 0){
|
|
|
|
|
onehead.push(onestring);
|
|
|
|
|
}else{
|
|
|
|
|
oneheadlength.push(marge+1);
|
|
|
|
|
marge = 0;
|
|
|
|
|
onehead.push(onestring);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
marge++;
|
|
|
|
|
if(oneid == (oneheadarray.length-1)){
|
|
|
|
|
oneheadlength.push(marge + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var twoheadarray = rows[1].split(",");
|
|
|
|
|
|
|
|
|
|
html +="<thead>";
|
|
|
|
|
html+="<tr>";
|
|
|
|
|
onehead.forEach(function(head,hid){
|
|
|
|
|
let colspan = oneheadlength[hid];
|
|
|
|
|
if(colspan == 1){
|
|
|
|
|
html += "<th lay-data=\"{ align:'center'} \" colspan=" + colspan + ",colGroup:true>" + head + "</th>";
|
|
|
|
|
}else{
|
|
|
|
|
html += "<th lay-data=\"{ align:'center' } \" colspan="+colspan+">"+head+"</th>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
html+="</tr>";
|
|
|
|
|
|
|
|
|
|
html += "<tr>";//
|
|
|
|
|
twoheadarray.forEach(function (dhead, did) {
|
|
|
|
|
if(did == 0){
|
|
|
|
|
html += "<th lay-data=\"{ field: 'a" + did + "', width:200 ,fixed:\'left\'} \">" + dhead + "</th>";//
|
|
|
|
|
}else{
|
|
|
|
|
html += "<th lay-data=\"{ field: 'a" + did + "', width:80} \">" + dhead + "</th>";//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
html += "</tr>";
|
|
|
|
|
html+="</thead>";
|
|
|
|
|
|
|
|
|
|
rows.shift();
|
|
|
|
|
rows.shift();
|
|
|
|
|
|
|
|
|
|
html += "<tbody>";
|
|
|
|
|
rows.forEach(function (row, idx) {
|
|
|
|
|
var columns = row.split(",");
|
|
|
|
|
//if (showTab) {
|
|
|
|
|
// columns.unshift(idx + 1); // 添加行索引
|
|
|
|
|
// if (idx == 0) {
|
|
|
|
|
// // 添加列索引
|
|
|
|
|
// html += "<tr>";
|
|
|
|
|
// for (var i = 1; i < columns.length; i++) {
|
|
|
|
|
// html +=
|
|
|
|
|
// "<th>" +
|
|
|
|
|
// //(i == 0 ? "" : String.fromCharCode(65 + i - 1)) +
|
|
|
|
|
// (i == 0 ? "" : i.toString()) +
|
|
|
|
|
// "</th>";
|
|
|
|
|
// }
|
|
|
|
|
// html += "</tr>";
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
html += "<tr>";
|
|
|
|
|
columns.forEach(function (column) {
|
|
|
|
|
html += "<td align=center>" + column + "</td>";
|
|
|
|
|
});
|
|
|
|
|
html += "</tr>";
|
|
|
|
|
});
|
|
|
|
|
html += "</tbody>";
|
|
|
|
|
html += "</table>";
|
|
|
|
|
return html;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 合并单元格
|
|
|
|
|
mergeTable(workbook, hasTab = false) {
|
|
|
|
|
let SheetNames = workbook.SheetNames[0];
|
|
|
|
|
let mergeInfo = workbook.Sheets[SheetNames]["!merges"];
|
|
|
|
|
console.log(mergeInfo);
|
|
|
|
|
|
|
|
|
|
let result = document.getElementById("result");
|
|
|
|
|
|
|
|
|
|
// 是否显示了tab
|
|
|
|
|
let baiseAdd = hasTab ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
mergeInfo.forEach((item) => {
|
|
|
|
|
let start_r = item.s.r + baiseAdd-1;
|
|
|
|
|
let end_r = item.e.r + baiseAdd-1;
|
|
|
|
|
|
|
|
|
|
let start_c = item.s.c + baiseAdd-1;
|
|
|
|
|
let end_c = item.e.c + baiseAdd-1;
|
|
|
|
|
|
|
|
|
|
for (let i = start_r; i <= end_r; i++) {
|
|
|
|
|
let row = document.querySelectorAll("#result tr")[i];
|
|
|
|
|
for (let child = start_c; child <= end_c; child++) {
|
|
|
|
|
if (child === start_c && i === start_r) {
|
|
|
|
|
// 循环到就是第一个单元格,以这个单元格为开始进行合并
|
|
|
|
|
row.children[child].classList.add("will_span");
|
|
|
|
|
row.children[child].setAttribute("row", end_r - start_r + 1);
|
|
|
|
|
row.children[child].setAttribute("col", end_c - start_c + 1);
|
|
|
|
|
} else {
|
|
|
|
|
// 只做标记,不在这里删除
|
|
|
|
|
row.children[child].classList.add("remove");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 移除对应的td
|
|
|
|
|
document.querySelectorAll(".remove").forEach((item) => {
|
|
|
|
|
item.parentNode.removeChild(item);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 为大的td设置跨单元格合并
|
|
|
|
|
document.querySelectorAll(".will_span").forEach((item) => {
|
|
|
|
|
item.classList.remove("will_span");
|
|
|
|
|
item.rowSpan = item.getAttribute("row");
|
|
|
|
|
item.colSpan = item.getAttribute("col");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function staticToLayTable()
|
|
|
|
|
{
|
|
|
|
|
var table = layui.table;
|
|
|
|
|
|
|
|
|
|
//转换静态表格
|
|
|
|
|
table.init('tdemo', {
|
|
|
|
|
page:true,
|
|
|
|
|
limit:15,
|
|
|
|
|
//height: 315 //设置高度
|
|
|
|
|
//limit: 10 //注意:请务必确保 limit 参数(默认:10)是与你服务端限定的数据条数一致
|
|
|
|
|
//支持所有基础参数
|
|
|
|
|
|
|
|
|
|
done:function(res,curr,count){
|
|
|
|
|
// console.log(res)
|
|
|
|
|
//var donestyle = "<style>.layui - table - cell { height: auto;overflow: visible;text - overflow: inherit;white - space: normal;word -break: break-all;}.layui - table - cell a {text- decoration: underline;}.layui - table - cell div {white - space: nowrap;overflow: hidden;text - overflow: ellipsis;min - height: 30px;line - height: 30px;}</style>"
|
|
|
|
|
//var oDiv = document.querySelector("#tdemo");
|
|
|
|
|
//oDiv.style.cssText = donestyle;
|
|
|
|
|
//layui-table-cell laytable-cell-group
|
|
|
|
|
//layui-table-cell laytable-cell-1-1-0
|
|
|
|
|
//$(".layui-table-cell"). [800].style
|
|
|
|
|
//解决表头宽度不够自动换行问题
|
|
|
|
|
$(".layui-table-cell").each(function(index,val){
|
|
|
|
|
$(".layui-table-cell")[index].style.lineHeight = "20px !importanr";
|
|
|
|
|
$(".layui-table-cell")[index].style.verticalAlign = "middle";
|
|
|
|
|
$(".layui-table-cell")[index].style.height = "auto";
|
|
|
|
|
$(".layui-table-cell")[index].style.overflow = "visible";
|
|
|
|
|
$(".layui-table-cell")[index].style.textOverflow = "inherit";
|
|
|
|
|
$(".layui-table-cell")[index].style.whiteSpace = "normal";
|
|
|
|
|
});
|
|
|
|
|
//解决操作栏因为内容过多换行问题
|
|
|
|
|
$(".layui-table-main tr").each(function (index, val) {
|
|
|
|
|
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
|
|
|
|
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
|
|
|
|
});
|
|
|
|
|
//解决fixed固定,而导致的th高度不一致
|
|
|
|
|
$(".layui-table-header tr").each(function (index, val) {
|
|
|
|
|
$(".layui-table-fixed").each(function () {
|
|
|
|
|
$($(this).find(".layui-table-header thead th")[index]).height($(val).height());
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
$(".layui-table-header tr").each(function (index, val) {
|
|
|
|
|
$(".layui-table-fixed").each(function () {
|
|
|
|
|
$($(this).find(".layui-table-header thead tr")[index]).height($(val).height());
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
$(".layui-table-main tr").each(function (index, val) {
|
|
|
|
|
$(".layui-table-fixed").each(function () {
|
|
|
|
|
$($(this).find(".layui-table-body tbody tr")[index]).height($(val).height());
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
$(".layui-table-main tr").each(function (index, val) {
|
|
|
|
|
$(".layui-table-fixed").each(function () {
|
|
|
|
|
$($(this).find(".layui-table-body tbody th")[index]).height($(val).height());
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.layui-laypage-limits').hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function dataURLToFile(dataUrl, fileName) {
|
|
|
|
|
const dataArr = dataUrl.split(',');
|
|
|
|
|
const mime = "xlsx";
|
|
|
|
|
const originStr = atob(dataArr[0]);
|
|
|
|
|
return new File([originStr], fileName, { type: mime });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getFileFromUrl(url, fileName) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
var blob = null;
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.open("GET", url);
|
|
|
|
|
xhr.setRequestHeader('Accept', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
|
|
|
xhr.responseType = "blob";
|
|
|
|
|
// 加载时处理
|
|
|
|
|
xhr.onload = () => {
|
|
|
|
|
// 获取返回结果
|
|
|
|
|
blob = xhr.response;
|
|
|
|
|
let file = new File([blob], fileName, { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
|
|
// 返回结果
|
|
|
|
|
resolve(file);
|
|
|
|
|
};
|
|
|
|
|
xhr.onerror = (e) => {
|
|
|
|
|
reject(e)
|
|
|
|
|
};
|
|
|
|
|
// 发送
|
|
|
|
|
xhr.send();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 本周开始时间戳
|
|
|
|
|
* returns {number}
|
|
|
|
|
*/
|
|
|
|
|
function weekStartTimestamp() {
|
|
|
|
|
// 一天的秒数
|
|
|
|
|
const MillisecondsADay = 24 * 60 * 60
|
|
|
|
|
// 今日零点时间戳
|
|
|
|
|
const timestamp = Math.floor(new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000)
|
|
|
|
|
const weekDay = new Date().getDay() === 0 ? (7 - 1) : (new Date().getDay() - 1)
|
|
|
|
|
const weekTimeStamp = timestamp - MillisecondsADay * weekDay
|
|
|
|
|
return weekTimeStamp
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 上周开始、结束时间戳
|
|
|
|
|
* returns {number[上周开始时间戳, 上周结束时间戳]}
|
|
|
|
|
*/
|
|
|
|
|
function lastWeekTimetamp() {
|
|
|
|
|
// 一天的秒数
|
|
|
|
|
const MillisecondsADay = 24 * 60 * 60
|
|
|
|
|
// 今日零点时间戳
|
|
|
|
|
const timestamp = Math.floor(new Date(new Date().setHours(0, 0, 0, 0)).getTime() / 1000)
|
|
|
|
|
const weekDay = new Date().getDay() === 0 ? (7 - 1) : (new Date().getDay() - 1)
|
|
|
|
|
// 本周开始时间戳
|
|
|
|
|
const weekTimeStamp = timestamp - MillisecondsADay * weekDay
|
|
|
|
|
// 上周开始时间戳
|
|
|
|
|
const lastWeekStart = weekTimeStamp - MillisecondsADay * 7
|
|
|
|
|
// 上周结束时间戳
|
|
|
|
|
const lastWeekEnd = weekTimeStamp - 1
|
|
|
|
|
return [lastWeekStart, lastWeekEnd]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当月开始时间戳
|
|
|
|
|
* returns {number}
|
|
|
|
|
*/
|
|
|
|
|
function monthStartTimestamp() {
|
|
|
|
|
const date = new Date()
|
|
|
|
|
date.setDate(1)
|
|
|
|
|
date.setHours(0, 0, 0, 0)
|
|
|
|
|
const timeStamp = date.getTime() / 1000
|
|
|
|
|
return timeStamp
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取上月开始、结束时间戳
|
|
|
|
|
* returns {number[上月开始时间戳,上月结束时间戳]}
|
|
|
|
|
*/
|
|
|
|
|
function lastMonthTimetamp() {
|
|
|
|
|
// 一天的秒数
|
|
|
|
|
const MillisecondsADay = 24 * 60 * 60
|
|
|
|
|
|
|
|
|
|
const date = new Date()
|
|
|
|
|
date.setDate(1)
|
|
|
|
|
date.setHours(0, 0, 0, 0)
|
|
|
|
|
// 当月开始时间戳
|
|
|
|
|
const timeStamp = date.getTime() / 1000
|
|
|
|
|
// 上个月的天数
|
|
|
|
|
const days = lastMonthDats()
|
|
|
|
|
// 上月开始时间戳
|
|
|
|
|
const lastMonthStart = timeStamp - (MillisecondsADay * days)
|
|
|
|
|
// 上月结束时间戳
|
|
|
|
|
const lastMonthEnd = timeStamp - 1
|
|
|
|
|
return [lastMonthStart, lastMonthEnd]
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 上月天数
|
|
|
|
|
* returns {number}
|
|
|
|
|
*/
|
|
|
|
|
function lastMonthDats() {
|
|
|
|
|
const date = new Date()
|
|
|
|
|
const year = date.getFullYear()
|
|
|
|
|
// 上个月月份
|
|
|
|
|
let month = (date.getMonth() + 1) - 1 // 0-11 表示 1月-12月
|
|
|
|
|
// 0 表示12月
|
|
|
|
|
month = month || 12
|
|
|
|
|
// 30天的月份
|
|
|
|
|
const arr30 = [4, 6, 9, 11]
|
|
|
|
|
// 31天的月份
|
|
|
|
|
const arr31 = [1, 3, 5, 7, 8, 10, 12]
|
|
|
|
|
if (arr30.indexOf(month) !== -1) {
|
|
|
|
|
// 上个月是 30 天
|
|
|
|
|
return 30
|
|
|
|
|
} else if (arr31.indexOf(month) !== -1) {
|
|
|
|
|
// 上个月是 31 天
|
|
|
|
|
return 31
|
|
|
|
|
} else {
|
|
|
|
|
// 2月
|
|
|
|
|
if (isRunYear(year)) {
|
|
|
|
|
return 29
|
|
|
|
|
} else {
|
|
|
|
|
return 28
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 是否为闰年
|
|
|
|
|
* param year
|
|
|
|
|
* returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
function isRunYear(year) {
|
|
|
|
|
// 条件:能被4整除并且不能被100整除,或者被400整除的
|
|
|
|
|
let flag = false
|
|
|
|
|
if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
|
|
|
|
|
flag = true
|
|
|
|
|
}
|
|
|
|
|
return flag
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
</html>
|