diff --git a/haiwei-admin/src/main/resources/templates/board/board1.html b/haiwei-admin/src/main/resources/templates/board/board1.html index d6a6d30..5d2f4df 100644 --- a/haiwei-admin/src/main/resources/templates/board/board1.html +++ b/haiwei-admin/src/main/resources/templates/board/board1.html @@ -101,12 +101,12 @@ const Modal1Search = () => { let params = {} if ($('#startTime1').val()) { - params.beginTime = new Date($('#startTime1').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime1').val()), 'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime1').val()) { - params.endTime = new Date($('#endTime1').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime1').val()), 'yyyy-MM-dd HH-mm-ss'); } - params.timeInterval=$('#timeInterval1').val(); + params.timeInterval = $('#timeInterval1').val(); $.get(ctx + 'broad/home/queryParamListA', params, (e) => { let data = e.data if (data.length > 0) { @@ -145,7 +145,7 @@ ' 一体机A机头温度', ' 一体机A切刀电流', ' 一体机A切刀转速'], - data: data.map((val, i) => [i+1, val.recordTime, val['speedA'], + data: data.map((val, i) => [i + 1, val.recordTime, val['speedA'], val['currentA'], val['pressureHead'], val['tempHead'], val['currentCutter'], val['speedCutter']]), index: true, fontColor: '#03BCD4', @@ -154,18 +154,51 @@ oddRowBGC: '#092A77', evenRowBGC: '#092A77', }) + let num1 = e.total / 10 + let arr = [] + if (num1 < 6) { + arr = new Array(Math.ceil(e.total / 10)).fill(1).map((i, k) => { + return k + 1 + }) + } else { + if (pageNum <= 3) { + arr = [1, 2, 3, '...', num1 - 1, num1] + } else { + if (pageNum < num1 - 3) { + arr = ['...', pageNum - 1, pageNum, pageNum + 1, '...', num1] + } + if (pageNum === num1 - 3) { + arr = ['...', pageNum - 1, pageNum, pageNum + 1, num1 - 1, num1] + } + if (pageNum === num1 - 2) { + arr = ['...', pageNum - 2, pageNum - 1, pageNum, num1 - 1, num1] + } + if (pageNum === num1 - 1) { + arr = ['...', pageNum - 3, pageNum - 2, pageNum - 1, pageNum, pageNum + 1] + } + if (pageNum === num1) { + arr = ['...', pageNum - 4, pageNum - 3, pageNum - 2, pageNum - 1, pageNum] + } + } + + } $("#Pagination").empty() $("#Pagination").append(` +
  • + + + +
  • `) - new Array(Math.ceil(e.total / 10)).fill(1).map((i, k) => { + arr.map((i, k) => { $("#Pagination").append(` -
  • ${k + 1}
  • +
  • ${i}
  • `) }) $("#Pagination").append(` @@ -174,6 +207,11 @@ +
  • + + + +
  • `) } else { $("#chart2").html(`
    暂无数据
    `) @@ -185,27 +223,27 @@ let params = {} params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } await Modal2SearchReq(params) $($(".page")[0]).addClass('active') $($(".page")[0]).siblings().removeClass('active') } - const pageClick = (e,i) => { + const pageClick = (e, i) => { $(e).addClass('active') $(e).siblings().removeClass('active') pageNum = i let params = {} params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } Modal2SearchReq(params) } @@ -218,10 +256,10 @@ let params = {} params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } Modal2SearchReq(params) } @@ -233,10 +271,10 @@ let params = {} params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } Modal2SearchReq(params) } @@ -256,10 +294,10 @@ params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()), 'yyyy-MM-dd HH-mm-ss'); } if ($('#name').val()) { params.name = $('#name').val() diff --git a/haiwei-admin/src/main/resources/templates/board/board3.html b/haiwei-admin/src/main/resources/templates/board/board3.html index 19a6c9f..46be916 100644 --- a/haiwei-admin/src/main/resources/templates/board/board3.html +++ b/haiwei-admin/src/main/resources/templates/board/board3.html @@ -100,10 +100,10 @@ const Modal1Search = () => { let params = {} if ($('#startTime1').val()) { - params.beginTime = new Date($('#startTime1').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime1').val()),'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime1').val()) { - params.endTime = new Date($('#endTime1').val()) + params.endTime = $.common.dateFormat(new Date($('#startTime1').val()),'yyyy-MM-dd HH-mm-ss'); } params.timeInterval=$('#timeInterval1').val(); $.get(ctx + 'broad/home/queryParamListB', params, (e) => { @@ -152,15 +152,50 @@ oddRowBGC: '#092A77', evenRowBGC: '#092A77', }); + + let num1 = e.total / 10 + let arr = [] + if (num1 < 6) { + arr = new Array(Math.ceil(e.total / 10)).fill(1).map((i, k) => { + return k + 1 + }) + } else { + if (pageNum <= 3) { + arr = [1, 2, 3, '...', num1 - 1, num1] + } else { + if (pageNum < num1 - 3) { + arr = ['...', pageNum - 1, pageNum, pageNum + 1, '...', num1] + } + if (pageNum === num1 - 3) { + arr = ['...', pageNum - 1, pageNum, pageNum + 1, num1 - 1, num1] + } + if (pageNum === num1 - 2) { + arr = ['...', pageNum - 2, pageNum - 1, pageNum, num1 - 1, num1] + } + if (pageNum === num1 - 1) { + arr = ['...', pageNum - 3, pageNum - 2, pageNum - 1, pageNum, pageNum + 1] + } + if (pageNum === num1) { + arr = ['...', pageNum - 4, pageNum - 3, pageNum - 2, pageNum - 1, pageNum] + } + } + + } + $("#Pagination").empty() $("#Pagination").append(` +
  • + + + +
  • `) - new Array(Math.ceil(e.total / 10)).fill(1).map((i,k)=>{ + arr.map((i, k) => { $("#Pagination").append(`
  • ${k+1}
  • `) @@ -171,6 +206,11 @@ +
  • + + + +
  • `) } else { $("#chart2").html(`
    暂无数据
    `) @@ -182,10 +222,10 @@ let params = {} params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()),'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()),'yyyy-MM-dd HH-mm-ss'); } await Modal2SearchReq(params) $($(".page")[0]).addClass('active') @@ -199,10 +239,10 @@ let params = {} params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()),'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()),'yyyy-MM-dd HH-mm-ss'); } Modal2SearchReq(params) } @@ -214,10 +254,10 @@ let params = {} params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()),'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()),'yyyy-MM-dd HH-mm-ss'); } Modal2SearchReq(params) } @@ -229,10 +269,10 @@ let params = {} params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()),'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()),'yyyy-MM-dd HH-mm-ss'); } Modal2SearchReq(params) } @@ -252,10 +292,10 @@ params.timeInterval = $('#timeInterval').val(); if ($('#startTime2').val()) { - params.beginTime = new Date($('#startTime2').val()) + params.beginTime = $.common.dateFormat(new Date($('#startTime2').val()),'yyyy-MM-dd HH-mm-ss'); } if ($('#endTime2').val()) { - params.endTime = new Date($('#endTime2').val()) + params.endTime = $.common.dateFormat(new Date($('#endTime2').val()),'yyyy-MM-dd HH-mm-ss'); } if ($('#name').val()) { params.name = $('#name').val()