You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
5.9 KiB
JavaScript

$(() => {
//设备OEE统计
$.getJSON('/tankShellDevice/getOeeStatistics', function (result) {
OEEStatistics(result, document.getElementById("OEEStatistics"));
});
setInterval(() => {
let result = [
{
"createTime": 1654729200000,
"yValue": "07",
"xValue": Math.random() * 3
},
{
"createTime": 1654732800000,
"yValue": "08",
"xValue": Math.random() * 3
},
{
"createTime": 1654736400000,
"yValue": "09",
"xValue": Math.random() * 3
},
{
"createTime": 1654740000000,
"yValue": "10",
"xValue": Math.random() * 3
}
]
OEEStatistics(result, document.getElementById("OEEStatistics"));
}, 1000);
//设备故障排名
$.getJSON('/tankShell/getStatisticalOutputByModel', function (result) {
equipmentFailure(result, document.getElementById("equipmentFailure"));
});
//loss
$.getJSON('/tankShell/getInventoryStatistics', function (result) {
loss(result, document.getElementById("loss"));
});
//设备产量能耗对比
$.getJSON('/tankShellDevice/getEnergyConsumption', function (result) {
energyConsumption(result, document.getElementById("energyConsumption"));
});
const tableRes = {}
//生产计划
const getTable = () => {
$.ajax({
url: '/tankShellDevice/getDeviceParameterValue',
type: 'GET',
dataType: 'JSON',
success: function (res) {
if (res.length === tableRes.data?.length) return
console.log(res.length +'+'+ tableRes.data?.length);
$('#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: tableRes.header,
data: tableRes.data,
index: false,
fontColor: '#B4B7BF ',
indexBGC: '#86F3FF',
headerBGC: 'rgba(8,36,75,0.2)',
oddRowBGC: 'rgba(8,36,75,0.2)',
evenRowBGC: 'rgba(6,25,57,0.2)',
colWidth: ['100%', '100%', '40%', '160%',]
});
},
error: function (e) {
console.log(e)
}
});
}
getTable()
setInterval(() => {
getTable()
}, 10000);
tableAnimation('#productionPlan')
/*数据信息*/
$.getJSON('/tankShellDevice/getDataInformation', function (result) {
dataInformationFunction(result)
});
$.getJSON('/tankShellDevice/getRunParameters', function (result) {
console.log(result);
energyProductionStatisticsFunction(result)
runParamStatisticsFunction(result)
$("#lossParam").text(result[8]);
$("#meterParam").text(result[9]);
});
$.getJSON('/tankShellDevice/getRunParameters', function (result) {
runParamStatisticsFunction(result)
});
})
/*数据信息*/
const dataInformationFunction = (statusArray) => {
let res = statusArray[0]
console.log(res);
let info = `<table style="position: absolute;top: 8%;width: 100%;height:100%;">
<tr style="width: 100%; height: 50%;">
<td style="border:0px solid red;text-align:center;width: 50%;"><i ${res.deviceStatus == 1 ? 'style="color:rgb(107, 253, 110);"' : 'style="color: rgb(255, 105, 106);"'} class="fa-regular ${res.deviceStatus == 1 ? "fa-circle-check" : "fa-circle-xmark"}"></i>${res.deviceStatus == 1 ? `<span style="color:rgb(107, 253, 110);margin-left: 10px">运行正常</span>` : `<span style="color:rgb(255, 105, 106);margin-left: 10px">运行异常</span>`}</td>
<td style="border:0px solid red;text-align:center;width: 50%;color: #FFEF76;"> ${res.devicePower}kW</td>
</tr>
<tr style="width: 100%; height: 50%;">
<td style="border:0px solid red;text-align:center;width: 50%;color: #CEEFFE;"> ${res.deviceEnergy}kW·h</td>
<td style="border:0px solid red;text-align:center;width: 50%;color: #red;">2</td>
</tr>
</table>`;
$("#dataInformation").append(info);
}
/*能耗产量统计*/
const energyProductionStatisticsFunction = (statusArray) => {
let info = `<table style="position: absolute;top: 8%;width: 100%;height:100%;">
<tr style="width: 100%; height: 100%;">
<td style="font-size:175%;border:0px solid red;width: 25%;text-align:center;color: #59B2F6;">${statusArray[0]}</td>
<td style="font-size:175%;border:0px solid red;width: 25%;text-align:center;color: #63F659;">${statusArray[1]}</td>
<td style="font-size:175%;border:0px solid red;width: 25%;text-align:center;color: #59B2F6;">${statusArray[2]}</td>
<td style="font-size:175%;border:0px solid red;width: 25%;text-align:center;color: #FF696A;">${statusArray[3]}</td>
</tr>
</table>`;
$("#energyProductionStatistics").append(info);
}
const runParamStatisticsFunction = (statusArray) => {
let info = `
<div style="font-size:175%;left: 9%;color:#59B2F6">${statusArray[4]}</div>
<div style="font-size:175%;left: 35%;color:#FF696A">${statusArray[5]}</div>
<div style="font-size:175%;left: 61%;color:#63F659">${statusArray[6]}</div>
<div style="font-size:175%;left: 87%;color:#FF696A">${statusArray[7]}</div>
`;
$("#runParamStatistics").append(info);
}