增加按钮逻辑

This commit is contained in:
BianLzhaoMin 2025-07-24 10:42:33 +08:00
parent aed438d65f
commit 73f20adcdf
2 changed files with 87 additions and 3 deletions

View File

@ -75,6 +75,16 @@ function initTable(type, bidCode) {
},
done: function (res, curr, count, origin) {
// console.log(res);
$(".layui-table-body table.layui-table tbody tr #exportBtn").on(
"click",
function () {
// 获取当前行的数据
var index = $(this).index();
var rowData = res.rows[index]; // 获取对应行的数据
console.log(rowData, "rowData导出");
}
);
},
});

View File

@ -26,7 +26,16 @@ function setCols(type) {
{ field: "processDiff", title: "进度偏差", align: "center" },
{ field: "completeEffort", title: "已完成工程量", align: "center" },
{ field: "totalEffort", title: "总工程量", align: "center" },
{ field: "delayActor", title: "延误因素分析", align: "center" },
{
title: "延误因素分析",
align: "center",
templet: (d) => {
let text = "";
text +=
'<a id="viewBtn" style="color: #007bff;cursor: pointer;font-size: 16px">查看</a>';
return text;
},
},
{
field: "resourceMatchStatus",
title: "资源匹配状态",
@ -114,6 +123,64 @@ function initTable(type, bidCode) {
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 () {
// 获取当前行的数据
var index = $(this).index();
var rowData = res.rows[index]; // 获取对应行的数据
// 弹框配置
layer.open({
type: 1,
title: "分析查看",
content:
"<div id='oneEcharts' style='width:100%;height:100%;padding: 10px;'>" +
"<div style='font-size: 16px; padding: 10px;'>延误原因:" +
rowData.delayActor +
"</div>" +
"<div style='font-size: 16px; padding: 10px;'>其他原因:" +
rowData.delayActor +
"</div>" +
"<div style='font-size: 16px; padding: 10px;'>分析结果:" +
rowData.delayActor +
"</div>" +
"<div style='font-size: 16px; padding: 10px;'>分析结论:" +
rowData.delayActor +
"</div>" +
"</div>",
area: ["600px", "auto"],
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", // 边框颜色(如果按钮有边框)
});
},
});
}
);
},
error: function () {
layer.msg("数据加载失败", { icon: 2 });
@ -121,6 +188,8 @@ function initTable(type, bidCode) {
});
}
$(".chart-box").hide();
$(".list-view").click(function () {
if ($(this).hasClass("active")) return;
@ -255,6 +324,11 @@ function initPieChart() {
top: "center", // 垂直居中
textStyle: {
color: "#fff", // 图例文字颜色设为白色
borderWidth: 0,
borderColor: "transparent",
},
itemStyle: {
borderWidth: 0, // 关键点:去除 legend 图例项(小色块)的边框
},
data: ["大气影响", "设备判断延迟", "人员不足", "设计变更", "其他"],
},
@ -273,8 +347,8 @@ function initPieChart() {
},
itemStyle: {
borderRadius: 5, // 每块扇形圆角效果
borderColor: "#000", // 边框颜色(用于间隙)
borderWidth: 1, // 边框宽度1px 每边,形成 2px 间隙)
borderColor: "#333", // 边框颜色(用于间隙)
borderWidth: 2, // 边框宽度1px 每边,形成 2px 间隙)
},
data: [
{