大屏泥处理

This commit is contained in:
Rue Ji
2026-03-12 00:30:18 +08:00
parent 7fbf63ed66
commit a187b11c33

View File

@ -664,6 +664,14 @@
val3: 0, // 泥处理指标3 val3: 0, // 泥处理指标3
}, },
// 泥处理点位编码配置
nclMPointKeys: {
val1: "D_NiCL", // 泥处理指标1点位编码
val2: "D_NiCL", // 泥处理指标2点位编码
val3: "D_NiCL", // 泥处理指标3点位编码
chart: "D_NiCL", // 泥处理图表点位编码
},
// 药耗数据 (yaohao) // 药耗数据 (yaohao)
yaohao: { yaohao: {
D_PACDSYH: 0, D_PACDSYH: 0,
@ -880,44 +888,6 @@
}); });
} }
// 从接口获取数据并更新页面(示例方法,供后期调用)
function fetchDataFromApi(apiUrl) {
$.ajax({
url: apiUrl,
type: "GET",
dataType: "json",
success: function (response) {
// 假设接口返回的数据格式如下:
// {
// slqs: { todayTotal: xxx, yesterdayTotal: xxx, monthTotal: xxx },
// ncl: { val1: xxx, val2: xxx, val3: xxx },
// yaohao: { val1: xxx, val2: xxx, val3: xxx },
// qualityTable: [...],
// sevenDaysChart: { xAxis: [...], data: [...] },
// nclChart: { xAxis: [...], data: [...] },
// qualityChart: { xAxis: [...], data: [...] }
// }
if (response) {
if (response.slqs) pageData.slqs = response.slqs;
if (response.ncl) pageData.ncl = response.ncl;
if (response.yaohao) pageData.yaohao = response.yaohao;
if (response.qualityTable)
pageData.qualityTable = response.qualityTable;
if (response.sevenDaysChart)
pageData.sevenDaysChart = response.sevenDaysChart;
if (response.nclChart) pageData.nclChart = response.nclChart;
if (response.qualityChart)
pageData.qualityChart = response.qualityChart;
refreshPage();
}
},
error: function (xhr, status, error) {
console.error("获取数据失败:", error);
},
});
}
// 刷新页面所有数据 // 刷新页面所有数据
function refreshPage() { function refreshPage() {
updateSlqs(); updateSlqs();
@ -929,6 +899,14 @@
initQualityChart(); initQualityChart();
} }
// 格式化日期为 YYYY-MM-DD 格式
function formatDate(date) {
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString().padStart(2, "0");
var day = date.getDate().toString().padStart(2, "0");
return year + "-" + month + "-" + day;
}
// 进入全屏函数 // 进入全屏函数
function enterFullscreen() { function enterFullscreen() {
var elem = document.documentElement; var elem = document.documentElement;
@ -1077,51 +1055,46 @@
}); });
} }
// 获取点位信息数据 // 获取泥处理数据(每日汇总)
// mpcode: 点位编码 function fetchNclData() {
// sdt: 开始时间 (可选默认7天前) var mPointKey = pageData.nclMPointKeys.chart;
// edt: 结束时间 (可选,默认当前时间)
// 返回: Promise对象
function fetchPointData(mpcode, sdt, edt) {
// 默认时间范围近7天
if (!edt) {
var now = new Date(); var now = new Date();
edt = formatDate(now); var endTime = formatDate(now) + " 23:59:59";
} var startTime = formatDate(new Date(now.getTime() - 10 * 24 * 60 * 60 * 1000)) + " 00:00:00"; // 最近10天
if (!sdt) {
var sevenDaysAgo = new Date();
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
sdt = formatDate(sevenDaysAgo);
}
return new Promise(function(resolve, reject) {
$.ajax({ $.ajax({
url: '<%=request.getContextPath()%>/data/getDetailData.do', url: "<%=request.getContextPath()%>/mpoint/data/getDailyAggregation.do",
type: 'GET', type: "GET",
data: { data: {
mpcode: mpcode, mPointKey: mPointKey,
sdt: sdt, startTime: startTime,
edt: edt endTime: endTime
}, },
dataType: 'json', dataType: "json",
success: function (response) { success: function (response) {
console.log('点位数据[' + mpcode + ']:', response); console.log("泥处理数据:", response);
resolve(response); if (response && response.success && response.dailyData) {
var xAxis = [];
var data = [];
response.dailyData.forEach(function (item) {
// 日期格式: "2026-03-07" -> "03-07"
var dateStr = item.dateStr || "";
if (dateStr.length >= 10) {
xAxis.push(dateStr.substring(5)); // 取 "MM-DD" 部分
} else {
xAxis.push(dateStr);
}
data.push(parseFloat(item.totalValue) || 0);
});
pageData.nclChart.xAxis = xAxis;
pageData.nclChart.data = data;
initNclChart(); // 重新渲染图表
}
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
console.error('获取点位数据失败:', mpcode, error); console.error("获取泥处理数据失败:", error);
reject(error);
} }
}); });
});
}
// 格式化日期为 YYYY-MM-DD 格式
function formatDate(date) {
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString().padStart(2, "0");
var day = date.getDate().toString().padStart(2, "0");
return year + "-" + month + "-" + day;
} }
$(function () { $(function () {
@ -1145,6 +1118,9 @@
// 获取质量指标表格数据 // 获取质量指标表格数据
fetchQualityTableData(); fetchQualityTableData();
// 获取泥处理数据
fetchNclData();
// 批量获取点位数据并更新显示 // 批量获取点位数据并更新显示
var pointList = getAllPointIds(); var pointList = getAllPointIds();
pointList.forEach(function (mpcode) { pointList.forEach(function (mpcode) {
@ -1156,6 +1132,7 @@
console.log('定时刷新数据...'); console.log('定时刷新数据...');
fetchSlqsData(); fetchSlqsData();
fetchQualityTableData(); fetchQualityTableData();
fetchNclData();
// 批量刷新点位数据 // 批量刷新点位数据
pointList.forEach(function (mpcode) { pointList.forEach(function (mpcode) {
getValue('0533JS', mpcode, mpcode, `${mpcode}_name`, '<%=request.getContextPath()%>'); getValue('0533JS', mpcode, mpcode, `${mpcode}_name`, '<%=request.getContextPath()%>');