This commit is contained in:
parent
6b99b2b946
commit
b78198b3c1
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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 || ''
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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', {
|
||||
|
|
|
|||
|
|
@ -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 || ''
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@
|
|||
<div id="proQuality">
|
||||
<!-- 顶部查询栏 -->
|
||||
<div class="top-date-filter">
|
||||
<div class="date-filter-label">日期范围:</div>
|
||||
<div class="date-filter-label">日期:</div>
|
||||
<div class="date-range-wrapper">
|
||||
<input type="text" id="dateRange" class="search-input date-input" placeholder="请选择日期范围" readonly>
|
||||
<input type="text" id="dateRange" class="search-input date-input" placeholder="请选择日期" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -86,6 +86,9 @@
|
|||
<div class="search-bar">
|
||||
<span class="search-label">检测点:</span>
|
||||
<input type="text" id="keywordInput" class="search-input" placeholder="请输入关键字">
|
||||
<span class="search-label">日期范围:</span>
|
||||
<input type="text" id="recordDateRange" class="search-input date-input" placeholder="请选择日期范围"
|
||||
readonly>
|
||||
<button type="button" class="search-btn" onclick="queryRecords()">查询</button>
|
||||
</div>
|
||||
<div class="table-container">
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@
|
|||
<body>
|
||||
<div id="proQuality">
|
||||
<!-- 顶部日期筛选区域 -->
|
||||
<div class="top-date-filter">
|
||||
<!-- <div class="top-date-filter">
|
||||
<div class="date-filter-label">日期范围:</div>
|
||||
<div class="date-range-wrapper">
|
||||
<input type="text" id="dateRange" class="search-input date-input" placeholder="请选择日期范围" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- 右侧主体区域 - Grid布局 -->
|
||||
<div class="main-content">
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@
|
|||
<body>
|
||||
<div id="proQuality">
|
||||
<!-- 顶部日期筛选区域 -->
|
||||
<div class="top-date-filter">
|
||||
<!-- <div class="top-date-filter">
|
||||
<div class="date-filter-label">日期范围:</div>
|
||||
<div class="date-range-wrapper">
|
||||
<input type="text" id="dateRange" class="search-input date-input" placeholder="请选择日期范围" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- 主体区域 - Grid布局 -->
|
||||
<div class="main-content">
|
||||
|
|
|
|||
Loading…
Reference in New Issue