2025-07-23 19:27:27 +08:00
|
|
|
|
let table, layer, form;
|
|
|
|
|
|
layui.use(["layer", "table", "form"], function () {
|
|
|
|
|
|
layer = layui.layer;
|
|
|
|
|
|
table = layui.table;
|
|
|
|
|
|
form = layui.form;
|
|
|
|
|
|
// 响应成功后的拦截器
|
|
|
|
|
|
$.ajaxSetup({
|
|
|
|
|
|
beforeSend: function (xhr, options) {
|
|
|
|
|
|
var originalSuccess = options.success;
|
|
|
|
|
|
options.success = function (data, textStatus, jqXhr) {
|
|
|
|
|
|
data = modifyResponseData(data);
|
|
|
|
|
|
// success(data,textStatus, jqXhr);
|
|
|
|
|
|
originalSuccess.apply(this, arguments);
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
initTable(1, parent.$("#bidPro").val());
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/* 切换数据 */
|
|
|
|
|
|
function changeData(that, type) {
|
|
|
|
|
|
const bidCode = parent.$("#bidPro").val();
|
|
|
|
|
|
$(".ul-box li").each(function () {
|
|
|
|
|
|
if ($(this).hasClass("check")) {
|
|
|
|
|
|
$(this).removeClass("check").addClass("nocheck");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
var tableElem = $("#demo2").parents(".layui-table-view");
|
|
|
|
|
|
tableElem.remove();
|
|
|
|
|
|
$(that).removeClass("nocheck").addClass("check");
|
|
|
|
|
|
if (type === 1 || type === 2 || type === 3 || type === 6 || type === 12) {
|
|
|
|
|
|
initTable(type, bidCode);
|
|
|
|
|
|
$("#right-table-box").removeAttr("style");
|
|
|
|
|
|
$("#no-data-box").css({ display: "none" });
|
|
|
|
|
|
$("#right-box").css({ display: "none" });
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function initTable(type, bidCode) {
|
2025-07-23 20:39:10 +08:00
|
|
|
|
const url = commonUrl + "screen/largeScreen/tb_project_new/list";
|
2025-07-23 19:27:27 +08:00
|
|
|
|
table.render({
|
|
|
|
|
|
elem: "#demo2",
|
|
|
|
|
|
url: url,
|
|
|
|
|
|
skin: "line",
|
|
|
|
|
|
page: true,
|
|
|
|
|
|
height: "full-100",
|
|
|
|
|
|
headers: {
|
|
|
|
|
|
decrypt: "decrypt",
|
|
|
|
|
|
Authorization: token,
|
|
|
|
|
|
},
|
|
|
|
|
|
where: {
|
|
|
|
|
|
bidCode: bidCode,
|
|
|
|
|
|
type: type,
|
|
|
|
|
|
},
|
2025-07-23 20:39:10 +08:00
|
|
|
|
response: {
|
|
|
|
|
|
statusName: "code", // 规定数据状态的字段名称,默认:code
|
|
|
|
|
|
statusCode: 200, // 规定成功的状态码,默认:0
|
|
|
|
|
|
countName: "count", // 规定数据总数的字段名称,默认:count
|
|
|
|
|
|
dataName: "rows", // 规定数据列表的字段名称,默认:data
|
|
|
|
|
|
},
|
2025-07-23 19:27:27 +08:00
|
|
|
|
cols: [setCols(type)],
|
|
|
|
|
|
initComplete: function () {
|
|
|
|
|
|
// 在表格渲染完成后,重新渲染序号列
|
|
|
|
|
|
var that = this.elem.next();
|
|
|
|
|
|
var tool = that
|
|
|
|
|
|
.children(".layui-table-box")
|
|
|
|
|
|
.children(".layui-table-fixed")
|
|
|
|
|
|
.children(".layui-table-body")
|
|
|
|
|
|
.children(".layui-table");
|
|
|
|
|
|
tool.find("tr").each(function (index, item) {
|
|
|
|
|
|
$(this)
|
|
|
|
|
|
.find('td[data-field="LAY_TABLE_INDEX"]')
|
|
|
|
|
|
.text(index + 1);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
done: function (res, curr, count, origin) {
|
2025-07-24 10:42:33 +08:00
|
|
|
|
$(".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导出");
|
2025-07-24 14:00:05 +08:00
|
|
|
|
|
|
|
|
|
|
const url =
|
|
|
|
|
|
commonUrl +
|
|
|
|
|
|
"screen/largeScreen/tb_project_new/export?proName=" +
|
|
|
|
|
|
rowData.taskName +
|
|
|
|
|
|
"&token=" +
|
|
|
|
|
|
sessionStorage.getItem("zhgd_token");
|
|
|
|
|
|
|
|
|
|
|
|
// window.location.href = url;
|
|
|
|
|
|
window.open(url, "_blank");
|
|
|
|
|
|
// $.ajax({
|
|
|
|
|
|
// url: url,
|
|
|
|
|
|
// type: "get",
|
|
|
|
|
|
|
|
|
|
|
|
// headers: {
|
|
|
|
|
|
// authorization: sessionStorage.getItem("zhgd_token"),
|
|
|
|
|
|
// },
|
|
|
|
|
|
// success: function (data) {
|
|
|
|
|
|
// console.log(data, "导出的数据结果");
|
|
|
|
|
|
// },
|
|
|
|
|
|
// });
|
2025-07-24 10:42:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
);
|
2025-07-23 19:27:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function setCols(type) {
|
|
|
|
|
|
if (type === 1) {
|
|
|
|
|
|
return [
|
|
|
|
|
|
{ type: "numbers", title: "序号", width: "10%" }, // 添加序号列
|
|
|
|
|
|
{
|
2025-07-23 20:39:10 +08:00
|
|
|
|
field: "taskName",
|
2025-07-23 19:27:27 +08:00
|
|
|
|
title: "工程名称",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "projectNumber",
|
2025-07-23 20:39:10 +08:00
|
|
|
|
title: "任务名称",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "planStartTime",
|
|
|
|
|
|
title: "计划开始时间",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "planEndTime",
|
|
|
|
|
|
title: "实际开始时间",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "diffDay",
|
|
|
|
|
|
title: "偏差天数",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
field: "planCost",
|
|
|
|
|
|
title: "成本预算",
|
2025-07-23 19:27:27 +08:00
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-07-23 20:39:10 +08:00
|
|
|
|
field: "actualCost",
|
|
|
|
|
|
title: "实际成本",
|
2025-07-23 19:27:27 +08:00
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-07-23 20:39:10 +08:00
|
|
|
|
field: "riskLevel",
|
|
|
|
|
|
title: "风险等级",
|
2025-07-23 19:27:27 +08:00
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-07-23 20:39:10 +08:00
|
|
|
|
field: "suggestion",
|
|
|
|
|
|
title: "建议策略",
|
2025-07-23 19:27:27 +08:00
|
|
|
|
align: "center",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-07-23 20:39:10 +08:00
|
|
|
|
title: "操作",
|
2025-07-23 19:27:27 +08:00
|
|
|
|
align: "center",
|
2025-07-23 20:39:10 +08:00
|
|
|
|
templet: (d) => {
|
|
|
|
|
|
let text = "";
|
|
|
|
|
|
text +=
|
2025-07-24 14:00:05 +08:00
|
|
|
|
'<a id="exportBtn" style="color: #007bff;cursor: pointer;font-size: 16px">分析报告</a>';
|
2025-07-23 20:39:10 +08:00
|
|
|
|
return text;
|
|
|
|
|
|
},
|
2025-07-23 19:27:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|