From b78198b3c16512e4af8b90a62054936d4b29bce4 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Tue, 27 Jan 2026 18:06:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engineeringSafetyAnalysis.js | 173 ++++++++++++------ .../dataAnalysisOctober/proQualityAnalysis.js | 10 +- .../dataAnalysisOctober/projectProgress.js | 12 +- .../resourceRateAnalysis.js | 24 ++- .../workerEfficiencyAnalysis.js | 18 +- .../engineeringSafetyAnalysis.html | 7 +- .../proQualityAnalysis.html | 4 +- .../workerEfficiencyAnalysis.html | 4 +- 8 files changed, 157 insertions(+), 95 deletions(-) diff --git a/js/pages/dataAnalysisOctober/engineeringSafetyAnalysis.js b/js/pages/dataAnalysisOctober/engineeringSafetyAnalysis.js index 4f12dcd..aa73d43 100644 --- a/js/pages/dataAnalysisOctober/engineeringSafetyAnalysis.js +++ b/js/pages/dataAnalysisOctober/engineeringSafetyAnalysis.js @@ -60,8 +60,10 @@ layui.use(["layer", "table", "form", "laydate"], function () { // 初始化页面 initPage(); - // 初始化日期范围选择器 - initDateRangePicker(); + // 初始化顶部单个日期选择器 + initDatePicker(); + // 初始化质量监测记录模块的日期范围选择器 + initRecordDateRangePicker(); }); // 初始化页面 @@ -76,78 +78,91 @@ function initPage() { } -// 初始化日期范围选择器(逻辑与工程质量分析模块保持一致) -function initDateRangePicker() { - // 设置初始显示值为当天范围 - const initialValue = queryParams.startTestDay + ' ~ ' + queryParams.endTestDay; +// 初始化顶部单个日期选择器 +function initDatePicker() { + // 设置初始显示值为当天 + const initialValue = queryParams.startTestDay; $('#dateRange').val(initialValue); - // 使用范围选择器,单个输入框显示日期范围 + // 使用单个日期选择器 laydate.render({ elem: '#dateRange', type: 'date', - range: true, // 启用范围选择 format: 'yyyy-MM-dd', theme: 'dark', - // 默认值使用当天范围 - value: queryParams.startTestDay + ' - ' + queryParams.endTestDay, - done: function (value, date, endDate) { - // 重置为当天日期的函数 - const resetToToday = function () { + // 默认值使用当天 + value: queryParams.startTestDay, + done: function (value, date) { + if (value && value.trim() !== '') { + // 更新查询参数,startTestDay和endTestDay传相同的值 + queryParams.startTestDay = value.trim(); + queryParams.endTestDay = value.trim(); + $('#dateRange').val(value.trim()); + + // 日期变化后,重新调用所有模块接口(不包括质量监测记录表格) + refreshAllModules(); + } else { + // 清空时,重置为当天日期 const today = getTodayDate(); queryParams.startTestDay = today; queryParams.endTestDay = today; - $('#dateRange').val(today + ' ~ ' + today); + $('#dateRange').val(today); refreshAllModules(); - }; - - if (value && value.trim() !== '') { - const dates = value.split(' - '); - if (dates.length === 2) { - const startDate = dates[0].trim(); - const endDateStr = dates[1].trim(); - - // 在单个输入框中显示日期范围(格式:2026-01-15 ~ 2026-01-15) - $('#dateRange').val(startDate + ' ~ ' + endDateStr); - - // 更新查询参数 - queryParams.startTestDay = startDate; - queryParams.endTestDay = endDateStr; - - // 日期变化后,重新调用所有模块接口 - refreshAllModules(); - } else { - // 如果格式不正确,重置为当天日期 - resetToToday(); - } - } else { - // 清空时,重置为当天日期 - resetToToday(); } } }); } -// 刷新所有模块数据 +// 初始化质量监测记录模块的日期范围选择器 +function initRecordDateRangePicker() { + const today = getTodayDate(); + // 设置初始显示值为当天范围 + const initialValue = today + ' ~ ' + today; + $('#recordDateRange').val(initialValue); + + // 使用范围选择器 + laydate.render({ + elem: '#recordDateRange', + type: 'date', + range: true, // 启用范围选择 + format: 'yyyy-MM-dd', + theme: 'dark', + // 默认值使用当天范围 + value: today + ' - ' + today, + done: function (value, date, endDate) { + console.log('日期范围选择器回调:', { value, date, endDate }); + if (value && value.trim() !== '') { + // laydate返回的格式是 "2026-01-14 - 2026-01-31" + const dates = value.split(' - '); + if (dates.length === 2) { + const startDate = dates[0].trim(); + const endDateStr = dates[1].trim(); + // 在输入框中显示日期范围(使用 ~ 分隔符) + const displayValue = startDate + ' ~ ' + endDateStr; + // 使用setTimeout确保DOM更新完成 + setTimeout(function () { + $('#recordDateRange').val(displayValue); + console.log('设置日期范围值:', displayValue, '当前输入框值:', $('#recordDateRange').val()); + }, 0); + } else { + // 如果格式不正确,重置为当天日期范围 + $('#recordDateRange').val(today + ' ~ ' + today); + } + } else { + // 清空时,重置为当天日期范围 + $('#recordDateRange').val(today + ' ~ ' + today); + } + } + }); +} + +// 刷新所有模块数据(不包括质量监测记录表格,它使用自己的日期范围) function refreshAllModules() { - // 重新调用接口获取数据 + // 重新调用接口获取数据(使用顶部单个日期,startTestDay和endTestDay相同) getTemperatureHumidityData(); getQualityDetectionRecord(); - // 重新加载表格 - if (table) { - table.reload('environmentRecordTable', { - where: { - projectId: bidCode, - startTestDay: queryParams.startTestDay, - endTestDay: queryParams.endTestDay, - monitoringPointName: keyword || '' - }, - page: { - curr: 1 - } - }); - } + // 注意:质量监测记录表格不在这里刷新,它使用自己的日期范围筛选 } // 查询数据(统一刷新所有模块) @@ -584,6 +599,8 @@ function initAirQualityChart() { // 初始化环境监测记录表格 function initEnvironmentRecordTable() { + // 初始化时使用当天日期范围 + const today = getTodayDate(); table.render({ elem: '#environmentRecordTable', url: commonUrl + 'screen/project/projectSafety/list', @@ -594,8 +611,8 @@ function initEnvironmentRecordTable() { method: 'GET', where: { projectId: bidCode, - startTestDay: queryParams.startTestDay, - endTestDay: queryParams.endTestDay, + startTestDay: today, + endTestDay: today, monitoringPointName: keyword || '' }, skin: 'line', @@ -658,12 +675,50 @@ function initEnvironmentRecordTable() { function queryRecords() { keyword = $('#keywordInput').val() || ''; - // 重新加载表格 + // 获取质量监测记录模块的日期范围 + const recordDateRangeInput = document.getElementById('recordDateRange'); + const recordDateRange = recordDateRangeInput ? recordDateRangeInput.value || '' : ''; + let recordStartDate = ''; + let recordEndDate = ''; + + console.log('查询时获取的日期范围输入框值:', recordDateRange); + + // 解析日期范围,支持两种格式:"2026-01-14 ~ 2026-01-31" 或 "2026-01-14 - 2026-01-31" + if (recordDateRange && recordDateRange.trim() !== '') { + let dates = []; + if (recordDateRange.includes(' ~ ')) { + dates = recordDateRange.split(' ~ '); + } else if (recordDateRange.includes(' - ')) { + dates = recordDateRange.split(' - '); + } + + if (dates.length === 2) { + recordStartDate = dates[0].trim(); + recordEndDate = dates[1].trim(); + } + } + + // 如果没有选择日期范围,使用当天 + if (!recordStartDate || !recordEndDate) { + const today = getTodayDate(); + recordStartDate = today; + recordEndDate = today; + console.log('未获取到日期范围,使用默认当天:', today); + } + + console.log('查询参数:', { + keyword: keyword, + recordDateRange: recordDateRange, + recordStartDate: recordStartDate, + recordEndDate: recordEndDate + }); + + // 重新加载表格,使用质量监测记录模块的日期范围 table.reload('environmentRecordTable', { where: { projectId: bidCode, - startTestDay: queryParams.startTestDay, - endTestDay: queryParams.endTestDay, + startTestDay: recordStartDate, + endTestDay: recordEndDate, monitorName: keyword }, page: { diff --git a/js/pages/dataAnalysisOctober/proQualityAnalysis.js b/js/pages/dataAnalysisOctober/proQualityAnalysis.js index 38efff8..86ec277 100644 --- a/js/pages/dataAnalysisOctober/proQualityAnalysis.js +++ b/js/pages/dataAnalysisOctober/proQualityAnalysis.js @@ -288,7 +288,7 @@ function initTeamQualityChart() { // 请求数据 const url = commonUrl + - "screen/project/quality/teamRate?projectId=" + bidCode + "&startTestDay=" + queryParams.startTestDay + "&endTestDay=" + queryParams.endTestDay; + "screen/project/quality/teamRate?projectId=" + bidCode + "&startTestDay=" + '' + "&endTestDay=" + ''; ajaxRequestGet( url, "GET", @@ -523,7 +523,7 @@ function initQualityRatioChart() { // 请求数据 const url = commonUrl + - "screen/project/quality/resultCount?projectId=" + bidCode + "&startTestDay=" + queryParams.startTestDay + "&endTestDay=" + queryParams.endTestDay; + "screen/project/quality/resultCount?projectId=" + bidCode + "&startTestDay=" + '' + "&endTestDay=" + ''; ajaxRequestGet( url, "GET", @@ -616,8 +616,8 @@ function initQualityRecordTable() { method: 'GET', where: { projectId: bidCode, - startTestDay: queryParams.startTestDay, - endTestDay: queryParams.endTestDay, + startTestDay: '', + endTestDay: '', teamName: keyword || '' }, skin: 'line', @@ -754,7 +754,7 @@ function initWarningList() { const url = commonUrl + - "screen/project/quality/warnlist?projectId=" + bidCode + "&startTestDay=" + queryParams.startTestDay + "&endTestDay=" + queryParams.endTestDay; + "screen/project/quality/warnlist?projectId=" + bidCode + "&startTestDay=" + '' + "&endTestDay=" + ''; ajaxRequestGet( url, "GET", diff --git a/js/pages/dataAnalysisOctober/projectProgress.js b/js/pages/dataAnalysisOctober/projectProgress.js index 44812bd..1dcc281 100644 --- a/js/pages/dataAnalysisOctober/projectProgress.js +++ b/js/pages/dataAnalysisOctober/projectProgress.js @@ -84,8 +84,8 @@ function getFirstRowProgress() { // 土建专业(gxType=1) const civilUrl = baseUrl + "?projectId=" + (bidCode || '') - + "&startTestDay=" + (queryParams.startTestDay || '') - + "&endTestDay=" + (queryParams.endTestDay || '') + + "&startTestDay=" + '' + + "&endTestDay=" + '' + "&gxType=1"; ajaxRequestGet( @@ -131,8 +131,8 @@ function getThirdRowProgressDeviation() { commonUrl + "screen/project/constructionProgress/list" + "?projectId=" + (bidCode || '') - + "&startTestDay=" + (queryParams.startTestDay || '') - + "&endTestDay=" + (queryParams.endTestDay || '') + + "&startTestDay=" + '' + + "&endTestDay=" + '' + "&pageNum=1&pageSize=9999"; ajaxRequestGet( url, @@ -1483,8 +1483,8 @@ function initModalProcessDetailTable() { method: 'GET', where: { projectId: bidCode, - startTestDay: queryParams.startTestDay, - endTestDay: queryParams.endTestDay, + startTestDay: '', + endTestDay: '', gxType: currentGxType, keyword: modalProcessKeyword || '' }, diff --git a/js/pages/dataAnalysisOctober/resourceRateAnalysis.js b/js/pages/dataAnalysisOctober/resourceRateAnalysis.js index 4fd209e..fc278e5 100644 --- a/js/pages/dataAnalysisOctober/resourceRateAnalysis.js +++ b/js/pages/dataAnalysisOctober/resourceRateAnalysis.js @@ -364,16 +364,20 @@ function updateTeamTable(data) { } // 映射数据字段(尝试多个可能的字段名) - const tableData = data.map(item => ({ - workType: item.workType || '', - teamName: item.teamName || '', - teamLeader: item.teamLeader || '', - // 尝试多个可能的字段名:peopleNum, totalPeople, teamPeople - teamPeople: item.peopleNum || item.totalPeople || item.teamPeople || 0, - // dutyNum 应该是正确的字段名 - dutyPeople: item.dutyNum || 0, - utilizationRate: item.userRate || '0.00%' - })); + const tableData = data.map(item => ( + + { + workType: item.workType || '', + teamName: item.teamName || '', + teamLeader: item.teamLeader || '', + // 尝试多个可能的字段名:peopleNum, totalPeople, teamPeople + teamPeople: item.teamPeople || item.peopleNum || item.totalPeople || 0, + // dutyNum 应该是正确的字段名 + dutyPeople: item.dutyPeople || 0, + utilizationRate: item.userRate || '0.00%' + })); + + console.log(tableData, 'tableData'); // 重新加载表格数据 table.reload('teamTable', { diff --git a/js/pages/dataAnalysisOctober/workerEfficiencyAnalysis.js b/js/pages/dataAnalysisOctober/workerEfficiencyAnalysis.js index 76f664f..cf8d071 100644 --- a/js/pages/dataAnalysisOctober/workerEfficiencyAnalysis.js +++ b/js/pages/dataAnalysisOctober/workerEfficiencyAnalysis.js @@ -68,7 +68,7 @@ layui.use(["layer", "table", "form", "laydate"], function () { // 获取左上角近七天用电趋势 function getElectricTrend() { - const url = commonUrl + "screen/worker/analysis/summary?projectId=" + bidCode + "&startTestDay=" + queryParams.startTestDay + "&endTestDay=" + queryParams.endTestDay; + const url = commonUrl + "screen/worker/analysis/summary?projectId=" + bidCode + "&startTestDay=" + '' + "&endTestDay=" + ''; ajaxRequestGet(url, "GET", true, function () { }, function (result) { @@ -112,7 +112,7 @@ function updateElectricTrendData(data) { // 获取右上角月工种任务分布 function getTaskDistribution() { - const url = commonUrl + "screen/worker/analysis/gzsummary?projectId=" + bidCode + "&startTestDay=" + queryParams.startTestDay + "&endTestDay=" + queryParams.endTestDay; + const url = commonUrl + "screen/worker/analysis/gzsummary?projectId=" + bidCode + "&startTestDay=" + '' + "&endTestDay=" + ''; ajaxRequestGet(url, "GET", true, function () { }, function (result) { @@ -143,7 +143,7 @@ function getTaskDistribution() { // 获取左下角月任务延期排名top5 function getTaskDelayRanking() { - const url = commonUrl + "screen/worker/analysis/delay/person?projectId=" + bidCode + "&startTestDay=" + queryParams.startTestDay + "&endTestDay=" + queryParams.endTestDay; + const url = commonUrl + "screen/worker/analysis/delay/person?projectId=" + bidCode + "&startTestDay=" + '' + "&endTestDay=" + ''; ajaxRequestGet(url, "GET", true, function () { }, function (result) { @@ -169,7 +169,7 @@ function getTaskDelayRanking() { // 获取下方中间的月任务延期分布 function getTaskDelayDistribution() { - const url = commonUrl + "screen/worker/analysis/delay/workType?projectId=" + bidCode + "&startTestDay=" + queryParams.startTestDay + "&endTestDay=" + queryParams.endTestDay; + const url = commonUrl + "screen/worker/analysis/delay/workType?projectId=" + bidCode + "&startTestDay=" + '' + "&endTestDay=" + ''; ajaxRequestGet(url, "GET", true, function () { }, function (result) { @@ -200,7 +200,7 @@ function getTaskDelayDistribution() { // 获取右下方分析预警 function getAnalysisWarning() { - const url = commonUrl + "screen/worker/analysis/yujingdetail?projectId=" + bidCode + "&startTestDay=" + queryParams.startTestDay + "&endTestDay=" + queryParams.endTestDay; + const url = commonUrl + "screen/worker/analysis/yujingdetail?projectId=" + bidCode + "&startTestDay=" + '' + "&endTestDay=" + ''; ajaxRequestGet(url, "GET", true, function () { }, function (result) { @@ -704,8 +704,8 @@ function initModalTaskDetailTable() { method: 'GET', where: { projectId: bidCode, - startTestDay: modalQueryParams.startTestDay, - endTestDay: modalQueryParams.endTestDay, + startTestDay: '', + endTestDay: '', taskStatus: modalTaskStatus || '', keyword: modalKeyword || '' }, @@ -879,8 +879,8 @@ function initModalTaskDetailTable() { method: 'GET', where: { projectId: bidCode, - startTestDay: modalQueryParams.startTestDay, - endTestDay: modalQueryParams.endTestDay, + startTestDay: '', + endTestDay: '', taskStatus: modalTaskStatus || '', keyword: modalKeyword || '' }, diff --git a/pages/dataAnalysisOctober/engineeringSafetyAnalysis.html b/pages/dataAnalysisOctober/engineeringSafetyAnalysis.html index 4f3ad3f..0d1a480 100644 --- a/pages/dataAnalysisOctober/engineeringSafetyAnalysis.html +++ b/pages/dataAnalysisOctober/engineeringSafetyAnalysis.html @@ -27,9 +27,9 @@
-
日期范围:
+
日期:
- +
@@ -86,6 +86,9 @@
diff --git a/pages/dataAnalysisOctober/proQualityAnalysis.html b/pages/dataAnalysisOctober/proQualityAnalysis.html index cac98d8..8b73d6e 100644 --- a/pages/dataAnalysisOctober/proQualityAnalysis.html +++ b/pages/dataAnalysisOctober/proQualityAnalysis.html @@ -26,12 +26,12 @@
-
+
diff --git a/pages/dataAnalysisOctober/workerEfficiencyAnalysis.html b/pages/dataAnalysisOctober/workerEfficiencyAnalysis.html index 64dd7eb..b78411f 100644 --- a/pages/dataAnalysisOctober/workerEfficiencyAnalysis.html +++ b/pages/dataAnalysisOctober/workerEfficiencyAnalysis.html @@ -26,12 +26,12 @@
-
+