[Frontend]報表固定欄寬度修正

This commit is contained in:
Celeste 2023-09-08 12:59:42 +08:00
parent 40fcbb3f8d
commit 3a8d5fb81c

View File

@ -806,12 +806,12 @@
switch (tableType) {
case "day":
columns = getDayByMonth($("#elecMonthDate").val()).map((dc) => {
return { title: dc, data: dc, sWidth: columnWidth };
return { title: dc, data: dc, width: columnWidth };
});
break;
case "month":
columns = getMonthByYear($("#elecYearDate").val()).map((dc) => {
return { title: dc, data: dc, sWidth: columnWidth };
return { title: dc, data: dc, width: columnWidth };
});
break;
case "year":
@ -819,7 +819,7 @@
$("#elecSYearDate").val(),
$("#elecEYearDate").val()
).map((dc) => {
return { title: dc, data: dc, sWidth: columnWidth };
return { title: dc, data: dc, width: columnWidth };
});
break;
case "compare":
@ -859,10 +859,10 @@
title: dc.value,
data: dc.value,
sClass: "compare",
sWidth: columnWidth,
width: columnWidth,
};
}
return { title: dc, data: dc, sWidth: columnWidth };
return { title: dc, data: dc, width: columnWidth };
});
break;
@ -909,7 +909,7 @@
value: "last year different",
},
].map((dc) => {
return { title: dc.label, data: dc.value, sWidth: "120px" };
return { title: dc.label, data: dc.value, width: "120px" };
});
} else {
datesColumns = setTableColumns();
@ -929,12 +929,14 @@
{
title: "小計",
data: "total",
sWidth: "70px",
width: "70px",
className: "text-nowrap",
},
{
title: "單價",
data: "price",
sWidth: "45px",
width: "45px",
className: "text-nowrap",
render: function (data) {
return parseInt(data) === 0 ? "" : data;
},
@ -942,7 +944,8 @@
{
title: "金額總計",
data: "total_price",
sWidth: "70px",
width: "70px",
className: "text-nowrap",
render: function (data) {
return parseInt(data) === 0 ? "" : data;
},
@ -966,11 +969,12 @@
totalColumns.splice(i + 1, 0, {
title: com2Time + c.title,
data: "_compare_" + c.data,
sWidth: "70px",
sClass: "compare",
width: "70px",
sClass: "compare text-nowrap",
});
c.title = com1Time + c.title;
c.sWidth = "70px";
c.width = "70px";
c.className = "text-nowrap";
}
}
}
@ -979,10 +983,13 @@
data: datas,
destroy: true,
sDom: '<"toolbar">tipl',
fixedColumns: { left: 3, right: tableType == "compare" ? 2 : 3 },
fixedColumns: {
leftColumns: 3,
rightColumns: tableType == "compare" ? 2 : 3,
},
scrollX: "auto",
scrollCollapse: true,
autoWidth: true,
autoWidth: false,
language: { url: "/file/BajascriptTest/js/dataTables/zh-HANT.json" },
aaSorting: [],
columns: [
@ -990,18 +997,19 @@
title: "棟別",
data: "building_name",
className: "text-nowrap",
sWidth: "100px",
width: "100px",
},
{
title: "樓層",
data: "floor_tag",
sWidth: "8%",
width: "8%",
className: "text-nowrap",
},
{
title: "設備",
data: "device_full_name",
sWidth: "100px",
width: "300px",
className: "text-nowrap",
},
...datesColumns,
...(ElecEachTotal ? [] : totalColumns),