修改table

master
夜笙歌 2 years ago
parent 8244ed5da6
commit afe47a2297

@ -45,29 +45,26 @@ $(() => {
energyConsumption(result, document.getElementById("energyConsumption"));
});
const tableRes = {}
//生产计划
const getTable = () => {
$.ajax({
url: '/storage/getProductionPlan',
url: '/tankShellDevice/getDeviceParameterValue',
type: 'GET',
dataType: 'JSON',
success: function (res) {
console.log('update');
let Res = res
Res.data.forEach(val => {
val[0] = 'SHEBEI452736'
val[1] = 'AGYM45HH23'
val[2] = Math.random() * 30
val[3] = '2021.01.01 10:00:00'
delete val[4]
});
Res.header = ['设备名称', '参数名称', '当前值', '时间',]
console.log(Res);
if (res.length === tableRes.data?.length) return
console.log(res.map(val => [val.prameterValue]) == tableRes.data);
$('#productionPlan').remove()
$('.scrollTable').html('<div class="productionPlan" id="productionPlan"></div>')
tableRes.data = res.map(val => [val.deviceId,val.prameterName,val.prameterValue,val.createTime,])
tableRes.header = ['设备名称', '参数名称', '当前值', '时间',]
dynamicTable({
el: '#productionPlan',
rowNum: 5,
timeout: 0,
header: Res.header,
data: Res.data,
header: tableRes.header,
data: tableRes.data,
index: false,
fontColor: '#B4B7BF ',
indexBGC: '#86F3FF',
@ -81,6 +78,11 @@ $(() => {
console.log(e)
}
});
}
getTable()
setInterval(() => {
getTable()
}, 10000);
tableAnimation('#productionPlan')
/*数据信息*/
$.getJSON('/tankShellDevice/getDataInformation', function (result) {

@ -217,24 +217,6 @@ let dynamicTable = resource => {
}
}
//奇偶校验 --> 处理最后一行是奇数的问题
let oddORevenCheck = $(`${ele}>.table>.tbody>.tr`).length % 2 == 0 ? 'even' : 'odd';
//滚动动画
var animation = () => setInterval(function() {
$(ele + '>.table>.tbody>.tr:eq(0)').slideToggle(100, function() {
switch (oddORevenCheck) {
case 'even':
$(this).clone().css(trEvenCSS).appendTo(ele + '>.table>.tbody');
oddORevenCheck = 'odd';
break;
case 'odd':
$(this).clone().css(trOddCSS).appendTo(ele + '>.table>.tbody');
oddORevenCheck = 'even';
break;
}
$(this).remove();
});
}, timeout);
// 组件销毁钩子
$(`${ele}`).bind('DOMNodeRemoved', (e) => {

@ -45,29 +45,26 @@ $(() => {
energyConsumption(result, document.getElementById("energyConsumption"));
});
const tableRes = {}
//生产计划
const getTable = () => {
$.ajax({
url: '/storage/getProductionPlan',
url: '/tankShellDevice/getDeviceParameterValue',
type: 'GET',
dataType: 'JSON',
success: function (res) {
console.log('update');
let Res = res
Res.data.forEach(val => {
val[0] = 'SHEBEI452736'
val[1] = 'AGYM45HH23'
val[2] = Math.random() * 30
val[3] = '2021.01.01 10:00:00'
delete val[4]
});
Res.header = ['设备名称', '参数名称', '当前值', '时间',]
console.log(Res);
if (res.length === tableRes.data?.length) return
console.log(res.map(val => [val.prameterValue]) == tableRes.data);
$('#productionPlan').remove()
$('.scrollTable').html('<div class="productionPlan" id="productionPlan"></div>')
tableRes.data = res.map(val => [val.deviceId,val.prameterName,val.prameterValue,val.createTime,])
tableRes.header = ['设备名称', '参数名称', '当前值', '时间',]
dynamicTable({
el: '#productionPlan',
rowNum: 5,
timeout: 0,
header: Res.header,
data: Res.data,
header: tableRes.header,
data: tableRes.data,
index: false,
fontColor: '#B4B7BF ',
indexBGC: '#86F3FF',
@ -81,6 +78,11 @@ $(() => {
console.log(e)
}
});
}
getTable()
setInterval(() => {
getTable()
}, 10000);
tableAnimation('#productionPlan')
/*数据信息*/
$.getJSON('/tankShellDevice/getDataInformation', function (result) {

Loading…
Cancel
Save