diff --git a/js/pages/newDataAnalysis/projectManagement.js b/js/pages/newDataAnalysis/projectManagement.js
index 5ae98f7..10477b8 100644
--- a/js/pages/newDataAnalysis/projectManagement.js
+++ b/js/pages/newDataAnalysis/projectManagement.js
@@ -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 +=
+ '
' +
+ d.riskLevel +
+ "级" +
+ "";
+ return text;
+ },
+ },
+ {
+ title: "风险数量",
+ align: "center",
+ templet: (d) => {
+ let text = "";
+ text +=
+ '
' +
+ d.riskSize +
+ "";
+ 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:
- // "
" +
- // "
延误原因:" +
- // rowData.delayActor +
- // "
" +
- // "
其他原因:" +
- // data1[index] +
- // "
" +
- // "
分析结果:" +
- // data2[index] +
- // "
" +
- // "
",
- // 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: "
",
+ 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(
+ '
暂无风险详情数据
'
+ );
+ }
+ },
+ error: function () {
+ $("#risk-detail-table").html(
+ '
数据加载失败,请稍后重试
'
+ );
+ },
+ });
+ },
+ });
+ }
+ );
$(".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}
风险等级: {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";
diff --git a/js/pages/newDataAnalysis/workerEfficiencyAnalysis.js b/js/pages/newDataAnalysis/workerEfficiencyAnalysis.js
index 0fe5eba..fe76581 100644
--- a/js/pages/newDataAnalysis/workerEfficiencyAnalysis.js
+++ b/js/pages/newDataAnalysis/workerEfficiencyAnalysis.js
@@ -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 '
' + d.workStandard.substring(0, 60) + '...'
+ } else {
+ return '
' + d.workStandard + ''
+ }
+ } 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 += "
" + "工序:" + obj.gxName;
params.filter(function (item) {
if (item.componentSubType == "bar") {
- if(item.seriesName === '单位时间产量'){
- str += "
" + item.seriesName + ":" + item.value + obj.unit;
- }else if(item.seriesName === '单位时间标准产量'){
- str += "
" + item.seriesName + ":" + obj.standardTimeOutput + obj.unit;
- }
+ str += "
" + 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: {
diff --git a/pages/newDataAnalysis/energySavingAnalysis.html b/pages/newDataAnalysis/energySavingAnalysis.html
index 3778659..f192519 100644
--- a/pages/newDataAnalysis/energySavingAnalysis.html
+++ b/pages/newDataAnalysis/energySavingAnalysis.html
@@ -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
}
diff --git a/pages/newDataAnalysis/workerEfficiencyAnalysis.html b/pages/newDataAnalysis/workerEfficiencyAnalysis.html
index ebdca8e..a83293f 100644
--- a/pages/newDataAnalysis/workerEfficiencyAnalysis.html
+++ b/pages/newDataAnalysis/workerEfficiencyAnalysis.html
@@ -28,7 +28,7 @@