This commit is contained in:
fl 2025-07-24 18:25:57 +08:00
commit 8f890c079a
6 changed files with 413 additions and 110 deletions

View File

@ -66,3 +66,12 @@
overflow: hidden;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.layui-table[lay-even] tbody tr:nth-child(even) {
background-color: transparent !important;
}
/* 如果需要同时去除鼠标悬停效果 */
.layui-table tbody tr:hover {
background-color: transparent !important;
}

View File

@ -192,7 +192,7 @@ function initEchartsOne(data) {
},
{
type: 'value',
name: '风速',
name: '风速 m/s',
nameTextStyle: {
color: "#fff", // Y轴名称白色
},
@ -400,7 +400,7 @@ function hiddenDanger() {
function handlDetails(analysisReason){
// 分离原因分析和改进措施
const [reason, measure] = analysisReason.match(/原因分析(.*)。改进措施:(.*)/).slice(1);
const [reason, measure] = analysisReason.match(/分析原因:(.*)。改进措施:(.*)/).slice(1);
// 创建一个包含分析原因及改进措施的HTML结构
const content = `
@ -409,7 +409,7 @@ function handlDetails(analysisReason){
<h3 style="margin-bottom: 10px; color: #fff;">分析原因及改进措施</h3>
<div style="display: flex; flex-direction: column;">
<div style="margin-bottom: 10px;">
<span style="font-weight: bold; color: #CFD3D4;">原因分析</span>
<span style="font-weight: bold; color: #CFD3D4;">分析原因</span>
<span style="color: #fff;">${reason}</span>
</div>
<div>

View File

@ -182,6 +182,7 @@ let pieData_1 = [];
let tableData = [];
let barData = [];
let barData_1 = [];
let barData_2 = [];
// 将setCols函数提取到外部使其可以被全局访问
function setCols(type) {
@ -224,9 +225,29 @@ function setCols(type) {
align: "center",
},
{
field: "riskLevel",
title: "风险等级",
align: "center",
templet: (d) => {
let text = "";
text +=
'<a style="color:rgb(226, 154, 11);font-size: 16px">' +
d.riskLevel +
"级" +
"</a>";
return text;
},
},
{
title: "风险数量",
align: "center",
templet: (d) => {
let text = "";
text +=
'<a id="riskLevel" style="color: #007bff;cursor: pointer;font-size: 16px">' +
d.riskSize +
"</a>";
return text;
},
},
{
field: "suggestion",
@ -249,6 +270,24 @@ function setCols(type) {
return []; // 默认返回空数组
}
function setCols2(type) {
if (type === 1) {
return [
{ type: "numbers", title: "序号", width: "10%" }, // 添加序号列
{
field: "proPart",
title: "工程部位",
align: "center",
},
{
field: "riskDesc",
title: "风险描述",
align: "center",
},
];
}
}
layui.use(["layer", "table", "form"], function () {
layer = layui.layer;
table = layui.table;
@ -342,64 +381,148 @@ function initTable(type, bidCode) {
return item.actualCost;
});
barData_2 = tableData.map((item) => {
return item.riskLevel;
});
if (res.code !== 200 || !res.rows || res.rows.length === 0) {
layer.msg("暂无数据", { icon: 2 });
}
// 查看按钮点击
// $(".layui-table-body table.layui-table tbody tr #viewBtn").on(
// "click",
// function () {
// const index = $(this).closest("tr").data("index");
// console.log(index, "index");
// var rowData = res.rows[index]; // 获取对应行的数据
// 查看按钮点击;
$(".layui-table-body table.layui-table tbody tr #riskLevel").on(
"click",
function () {
const index = $(this).closest("tr").data("index");
console.log(index, "index");
var rowData = res.rows[index]; // 获取对应行的数据
// // 弹框配置
// layer.open({
// type: 1,
// title: "分析查看",
// content:
// "<div id='oneEcharts' style='width:100%;height:100%;display: flex;flex-direction: column;justify-content: space-around;'>" +
// "<div style='font-size: 16px; padding: 20px;'>延误原因:" +
// rowData.delayActor +
// "</div>" +
// "<div style='font-size: 16px; padding: 20px;'>其他原因:" +
// data1[index] +
// "</div>" +
// "<div style='font-size: 16px; padding: 20px;'>分析结果:" +
// data2[index] +
// "</div>" +
// "</div>",
// area: ["600px", "300px"],
// shade: 0.3, // 遮罩透明度
// skin: "custom-layer-style", // 自定义皮肤
// success: function (layero, index) {
// // 修改弹框背景颜色
// $(layero).css(
// "background",
// "rgba(13, 34, 37, 0.9)"
// ); // 半透明黑色背景
// $(layero).find(".layui-layer-title").css({
// fontSize: "18px",
// color: "#fff", // 标题文字颜色
// background: "transparent", // 标题背景透明
// "border-bottom":
// "1px solid rgba(255, 255, 255, 0.2)", // 标题底部边框
// });
// $(layero).find(".layui-layer-content").css({
// background: "transparent", // 内容区域透明
// });
// 弹框配置
layer.open({
type: 1,
title: "风险详情",
content: "<div id='risk-detail-table'></div>",
area: ["800px", "400px"],
shade: 0.3, // 遮罩透明度
skin: "custom-layer-style", // 自定义皮肤
success: function (layero, index) {
// 修改弹框背景颜色
$(layero).css(
"background",
"rgba(13, 34, 37, 0.9)"
); // 半透明黑色背景
$(layero).find(".layui-layer-title").css({
fontSize: "18px",
color: "#fff", // 标题文字颜色
background: "transparent", // 标题背景透明
"border-bottom":
"1px solid rgba(255, 255, 255, 0.2)", // 标题底部边框
});
$(layero).find(".layui-layer-content").css({
background: "transparent", // 内容区域透明
});
// $(layero)
// .find(".layui-layer-setwin .layui-layer-close")
// .css({
// color: "#fff", // 文字颜色
// "border-color": "#fff", // 边框颜色(如果按钮有边框)
// });
// },
// });
// }
// );
$(layero)
.find(".layui-layer-setwin .layui-layer-close")
.css({
color: "#fff", // 文字颜色
"border-color": "#fff", // 边框颜色(如果按钮有边框)
});
// table.render({
// elem: "#table-box",
// url:
// commonUrl +
// "screen/largeScreen/tb_project_new/listRiskDetail",
// skin: "line",
// page: true,
// height: "full-100",
// headers: {
// decrypt: "decrypt",
// Authorization: token,
// },
// where: {
// bidCode: bidCode,
// type: type,
// proId: rowData.proId,
// },
// response: {
// statusName: "code",
// statusCode: 200,
// countName: "count",
// dataName: "rows",
// },
// cols: [setCols2(type)],
// });
$.ajax({
url:
commonUrl +
"screen/largeScreen/tb_project_new/listRiskDetail",
type: "GET",
headers: {
decrypt: "decrypt",
Authorization: token,
},
data: {
bidCode: bidCode,
type: type,
proId: rowData.proId,
},
success: function (res) {
console.log(res, "res");
if (res.code === 200 && res.rows) {
// 渲染表格
table.render({
elem: "#risk-detail-table",
data: res.rows,
skin: "line",
even: true,
page: false,
cols: [
[
{
field: "number",
title: "序号",
width: 100,
},
{
field: "proPart",
title: "工程部位",
align: "center",
},
{
field: "riskDesc",
title: "风险描述",
align: "center",
},
],
],
done: function () {
// 确保表格渲染后可见
this.elem.next().show();
$(this.elem).removeAttr(
"lay-even"
);
},
});
} else {
$("#risk-detail-table").html(
'<div class="layui-nodata">暂无风险详情数据</div>'
);
}
},
error: function () {
$("#risk-detail-table").html(
'<div class="layui-nodata">数据加载失败,请稍后重试</div>'
);
},
});
},
});
}
);
$(".layui-table-body table.layui-table tbody tr #exportBtn").on(
"click",
@ -465,12 +588,13 @@ $(".chart-view").click(function () {
initLineChart();
initPieChart();
initBottomPieChart();
});
// 初始化左侧双折线图
function initLineChart() {
const leftChart = echarts.init(document.getElementById("left-chart"));
const bottomChart = echarts.init(document.getElementById("bottom-chart"));
//
const option = {
textStyle: {
@ -547,7 +671,7 @@ function initLineChart() {
};
leftChart.setOption(option);
bottomChart.setOption(option);
// bottomChart.setOption(option);
// 响应式调整
window.addEventListener("resize", function () {
@ -653,6 +777,150 @@ function initPieChart() {
});
}
// 初始化底部饼图
function initBottomPieChart() {
const bottomChart = echarts.init(document.getElementById("bottom-chart"));
// 定义一组更现代化的颜色方案
const colorPalette = [
"#4E79A7",
"#F28E2B",
"#E15759",
"#76B7B2",
"#59A14F",
"#EDC948",
"#B07AA1",
"#FF9DA7",
];
const option = {
title: {
text: "项目风险等级分布", // 修改标题以反映显示的是等级
left: "center",
textStyle: {
color: "#fff",
fontSize: 18,
fontWeight: "bold",
},
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
formatter: "项目: {b}<br/>风险等级: {c}",
},
grid: {
left: "12%",
right: "12%",
bottom: "15%",
top: "25%",
containLabel: true,
},
xAxis: {
type: "category",
data: barData, // ['项目A','项目B']
axisLabel: {
color: "#fff",
fontSize: 12,
interval: 0, // 强制显示所有标签
rotate: barData.length > 5 ? 30 : 0, // 如果项目多就旋转标签
},
axisLine: {
lineStyle: {
color: "rgba(255, 255, 255, 0.8)",
width: 2,
},
},
axisTick: {
alignWithLabel: true,
lineStyle: {
color: "rgba(255, 255, 255, 0.6)",
},
},
},
yAxis: {
type: "value",
name: "风险等级",
nameTextStyle: {
color: "#fff",
fontSize: 14,
padding: [0, 0, 0, 40], // 调整名称位置
},
min: 0,
max: 10, // 假设风险等级最高为10
interval: 1, // 固定间隔为1
axisLabel: {
color: "#fff",
fontSize: 12,
formatter: function (value) {
return value + "级"; // 显示为1级、2级等
},
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(255, 255, 255, 0.8)",
width: 2,
},
},
splitLine: {
lineStyle: {
color: "rgba(255, 255, 255, 0.15)",
type: "dashed",
},
},
},
series: [
{
name: "风险等级",
type: "bar",
barWidth: "60%", // 加宽柱子
data: barData_2, // [3,6]
itemStyle: {
color: function (params) {
// 根据风险等级设置颜色,等级越高颜色越深
const riskLevel = barData_2[params.dataIndex];
if (riskLevel <= 3) return "#5B8FF9"; // 低风险
if (riskLevel <= 6) return "#F6BD16"; // 中风险
return "#E86452"; // 高风险
},
borderRadius: [6, 6, 0, 0],
shadowColor: "rgba(0, 0, 0, 0.3)",
shadowBlur: 5,
shadowOffsetY: 3,
},
label: {
show: true,
position: "top",
color: "#fff",
fontWeight: "bold",
formatter: function (params) {
return params.value + "级"; // 显示为3级、6级等
},
},
// 添加渐变色效果
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
// 添加背景色
backgroundColor: "rgba(10, 20, 40, 0.7)",
};
bottomChart.setOption(option);
// 响应式调整
window.addEventListener("resize", function () {
bottomChart.resize();
});
}
// 获取图表数据
function getChartData() {
const url = commonUrl + "screen/largeScreen/tb_project_new/list4progress";

View File

@ -7,6 +7,16 @@ const tipsArr = [
'持续强化技能培训与考核,同时确保施工工具按时检查,保障作业安全。',
'定期组织技能培训和考试,并做好施工工具的维护与定期检查工作。',
];
// let
const inefficiencyArr = [
{
'gxName':'',
nameList:['专业技能不足', '工具故障','人员异常','设备维保','环境变化'],
valueList:[{ name: '专业技能不足', value: 4 }, { name: '工具故障', value: 1 }]
}
];
layui.use(['layer', 'table', 'form'], function () {
layer = layui.layer;
table = layui.table;
@ -49,45 +59,47 @@ function initTable() {
},
cols: [[
{ type: 'numbers', title: '序号', width: '10%' }, // 添加序号列
{ field: 'userName', title: '姓名', align: 'center', width: '10%' },
{ field: 'teamName', title: '班组', align: 'center', width: '10%' },
{ field: 'postName', title: '工种', align: 'center', width: '10%' },
{ field: 'attDay', title: '出勤天数', align: 'center', width: '10%' },
{ field: 'userName', title: '班组长', align: 'center', width: '10%' },
{ field: 'teamName', title: '班组', align: 'center', width: '15%' },
{
field: 'sgType', title: '施工类型', align: 'center', width: '10%',
field: 'gxName', title: '工序', align: 'center', width: '20%',
},
{
field: 'completeWorkload', title: '完成工作量', align: 'center', width: '10%',
templet: function (d) {
return d.completeWorkload + d.unitTimeOutputUnit;
}
field: 'planDay', title: '计划完成天数', align: 'center', width: '10%',
},
{
field: 'unitTimeOutput', title: '单位时间产量', align: 'center', width: '10%',
templet: function (d) {
return d.unitTimeOutput + d.unit;
}
field: 'actualDay', title: '实际完成天数', align: 'center', width: '10%',
},
{
field: 'standardTimeOutput', title: '单位时间标准产量', align: 'center', width: '10%',
field: 'workStandard', title: '作业内容', align: 'center', width: '15%',
templet: function (d) {
return d.standardTimeOutput + d.unit;
if (d.workStandard) {
if (d.workStandard.length > 60) {
return '<span title="' + d.workStandard + '">' + d.workStandard.substring(0, 60) + '...</span>'
} else {
return '<span title="' + d.workStandard + '">' + d.workStandard + '</span>'
}
} else {
return '';
}
}
},
{
title: '效率评级', align: 'center', width: '10%',
templet: function (d) {
let color = '', title = '';
let min = parseFloat(d.standardTimeOutput.split('~')[0]) || 0;
let max = parseFloat(d.standardTimeOutput.split('~')[1]) || 0;
let unitTimeOutput = parseFloat(d.unitTimeOutput) || 0;
if (unitTimeOutput > max) {
let planDay = d.planDay;
let actualDay = d.actualDay;
if (planDay > actualDay ) {
color = 'green',
title = '高效';
} else if (unitTimeOutput >= min && unitTimeOutput <= max) {
} else if (planDay === actualDay) {
color = 'yellow',
title = '达标';
} else if (unitTimeOutput < min) {
} else if (planDay < actualDay) {
color = 'red',
title = '低效';
}
@ -143,10 +155,9 @@ function initEcharts(data) {
myChart2 = echarts.init(document.getElementById("twoEcharts"));
$('#suggestion').empty();
initEchartsOne(data);
let min = parseFloat(data.standardTimeOutput.split('~')[0]) || 0;
let max = parseFloat(data.standardTimeOutput.split('~')[1]) || 0;
let unitTimeOutput = parseFloat(data.unitTimeOutput) || 0;
if (unitTimeOutput < min) {
let planDay = data.planDay;
let actualDay = data.actualDay;
if (planDay < actualDay) {
initEchartsTwo(data);
const randomIndex = Math.floor(Math.random() * tipsArr.length); // 生成 0~4 的随机整数
const randomItem = tipsArr[randomIndex];
@ -160,10 +171,8 @@ function average(a, b) {
}
function initEchartsOne(obj) {
let min = parseFloat(obj.standardTimeOutput.split('~')[0]) || 0;
let max = parseFloat(obj.standardTimeOutput.split('~')[1]) || 0;
const data = [obj.unitTimeOutput];
const data2 = [average(min,max)];
const data = [obj.actualDay];
const data2 = [obj.planDay];
const colorArr1 = ["rgba(11, 83, 128)", "rgba(2, 143, 224)", "#2a7fcc"];
const colorArr2 = ["rgb(12, 109, 122)", "rgba(1, 241, 228)", "#5ce1d6"];
var color1 = {
@ -231,13 +240,10 @@ function initEchartsOne(obj) {
trigger: 'axis',
formatter: function (params) {
var str = params[0].name + ":";
str += "<br/>" + "工序:" + obj.gxName;
params.filter(function (item) {
if (item.componentSubType == "bar") {
if(item.seriesName === '单位时间产量'){
str += "<br/>" + item.seriesName + "" + item.value + obj.unit;
}else if(item.seriesName === '单位时间标准产量'){
str += "<br/>" + item.seriesName + "" + obj.standardTimeOutput + obj.unit;
}
str += "<br/>" + item.seriesName + "" + item.value;
}
});
@ -324,7 +330,7 @@ function initEchartsOne(obj) {
series: [
{
z: 1,
name: '单位时间产量',
name: '实际天数',
type: "bar",
barWidth: barWidth,
barGap: "0%",
@ -337,7 +343,7 @@ function initEchartsOne(obj) {
},
{
z: 3,
name: '单位时间产量',
name: '实际天数',
type: "pictorialBar",
symbolPosition: "end",
data: data,
@ -353,7 +359,7 @@ function initEchartsOne(obj) {
},
{
z: 1,
name: '单位时间标准产量',
name: '计划天数',
type: "bar",
barWidth: barWidth,
barGap: "50%",
@ -366,7 +372,7 @@ function initEchartsOne(obj) {
},
{
z: 3,
name: '单位时间标准产量',
name: '计划天数',
type: "pictorialBar",
symbolPosition: "end",
data: data2,
@ -393,7 +399,7 @@ function initEchartsOne(obj) {
/* 变化趋势 */
function initEchartsTwo(data) {
let nameList = ['专业技能不足', '工具故障'];
let nameList = ['专业技能不足', '工具故障','人员异常','设备维保','环境变化'];
let valueList = [{ name: '专业技能不足', value: 4 }, { name: '工具故障', value: 1 }];
const option = {
grid: {

View File

@ -85,6 +85,10 @@
border-bottom: 1px solid #008781;
}
.layui-laydate-preview {
color: #FFFFFF !important;
}
#alarm-container {
overflow-x: auto; /* 或 overflow-y: auto根据需要 */
@ -181,8 +185,10 @@
table = layui.table;
form = layui.form;
laydate = layui.laydate;
let range = getDateRangeOneMonth();
let range = getDateRangeOneWeek();
range.startDate = "2024-09-17"
range.endDate = "2024-09-24"
laydate.render({
elem: '#ID-laydate-range',
range: ['#ID-laydate-start-date', '#ID-laydate-end-date'],
@ -190,11 +196,23 @@
value: range.startDate + ' - ' + range.endDate,
done: function (value) {
// value 是选择的字符串,比如 '2025-06-23 - 2025-07-23'
console.log('选择的日期范围:', value);
const [startDate, endDate] = value.split(" - ");
const [startDateStr, endDateStr] = value.split(" - ");
const startDate = new Date(startDateStr);
const endDate = new Date(endDateStr);
// 计算两个日期相差的天数
const diffDays = (endDate - startDate) / (1000 * 60 * 60 * 24);
if (diffDays > 7) {
layer.msg('起止时间不能超过7天', {icon: 0});
// 重置日期为上一次合法范围(或你预设的默认值)
this.elem.val(range.startDate + ' - ' + range.endDate);
return;
}
let data = {
"startDate": startDate,
"endDate": endDate,
"startDate": startDateStr,
"endDate": endDateStr,
"proId": parent.parent.$('#bidPro').val()
}
selectEnergyStatsByDateRange(data)
@ -217,13 +235,12 @@
});
// 获取今天和一个月前日期,格式 yyyy-MM-dd
function getDateRangeOneMonth() {
function getDateRangeOneWeek() {
let today = new Date();
let year = today.getFullYear();
let month = today.getMonth();
let day = today.getDate();
let oneMonthAgo = new Date(year, month - 1, day);
// 复制一个日期减去7天
let oneWeekAgo = new Date(today);
oneWeekAgo.setDate(today.getDate() - 7);
function formatDate(d) {
let m = d.getMonth() + 1;
@ -232,11 +249,12 @@
}
return {
startDate: formatDate(oneMonthAgo),
startDate: formatDate(oneWeekAgo),
endDate: formatDate(today)
};
}
/* 加载数据分析应用 */
function selectEnergyStatsByDateRange(data) {
const url = commonUrl + 'screen/largeScreen/deviceEnergyAnalysis/selectEnergyStatsByDateRange';
@ -421,10 +439,12 @@
},
yAxis: [{
type: 'value',
name: '能源消耗量(kWh)'
name: '能源消耗量(kWh)',
}, {
type: 'value',
name: '节能减排量(kgCO₂)',
splitLine: {
show: false
}

View File

@ -28,7 +28,7 @@
<form class="layui-form basic-form layout" onclick="return false;" onsubmit="return false;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 80px;">姓名:</label>
<label class="layui-form-label" style="width: 80px;">班组长:</label>
<div class="layui-input-inline">
<input type="text" id="userName" class="layui-input" autocomplete="off">
</div>