Update loading + Combine 2 api call in paging + Add dynamic font size for gauge chart #82

Merged
dev merged 1 commits from dev-nghiantt-fix-bugs into dev 2025-08-20 19:19:41 +09:00
6 changed files with 54 additions and 30 deletions

BIN
assets/images/loading.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,18 +1,27 @@
.loading {
z-index: 99;
.loading-container {
position: fixed;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
transform: translate(-50%, -50%);
top: 0;
left: 0;
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
background-color: rgba(0, 0, 0, 0.4);
//box-shadow: rgba(68, 67, 67, 0.9) 0 0 0 9999px;
}
.v-spinner {
top: 50%;
left: 50%;
.loading-img {
width: 64px;
height: 64px;
animation: spin 3s linear infinite;
}
@keyframes spin {
100% {
transform: rotate(360deg);
}
}
::v-deep {

View File

@ -1,5 +1,6 @@
// Gauge chart options
export default function getGaugeChartOption({ title, min = 0, max = 160, unit = '%', isDarkMode = false, backgroundRadius = 97 }) {
export default function getGaugeChartOption({ title, min = 0, max = 160, unit = '%', isDarkMode = false, backgroundRadius = 97,
value = 0 }) {
const colorRanges = isDarkMode
? [
[60 / 160, '#49AA19'], // Dark Green
@ -24,6 +25,9 @@ export default function getGaugeChartOption({ title, min = 0, max = 160, unit =
// [0.8, "#f7931e"],
// [1.0, "#ed1c24"],
// ];
const valueLength = String(value).length;
const dynamicFontSize = valueLength >= 4 ? 21 : 30;
return {
grid: {
// top: '-10%',
@ -109,7 +113,7 @@ export default function getGaugeChartOption({ title, min = 0, max = 160, unit =
valueAnimation: true,
fontWeight: 500, // or "normal", "lighter", "bolder", or a number like 600
fontFamily: "Oxanium, sans-serif", // or any custom font
fontSize: 30,
fontSize: dynamicFontSize,
lineHeight: 25,
offsetCenter: [0, "60%"],
color: isDarkMode ? "#fff" : "#333333",
@ -130,7 +134,7 @@ export default function getGaugeChartOption({ title, min = 0, max = 160, unit =
},
data: [
{
value: 16,
value: value,
name: "에너지사용효율", // "Energy Usage Efficiency"
},
],

View File

@ -155,9 +155,8 @@
</v-row>
</v-container>
<div v-if="loadingStackCnt > 0" class="loading-container">
<div class="loading">
<Fade-loader />
</div>
<!-- <Fade-loader color="#717577" /> -->
<img class="loading-img" src="@/assets/images/loading.png" alt="Loading..." />
</div>
</v-main>
</fullscreen>

View File

@ -442,7 +442,7 @@ export default {
chartOption = getGaugeChartOption({
title: chartKey,
value: 75,
value: currentChartData["effcRt"],
isDarkMode: this.isDarkMode,
backgroundRadius: 89,
});

View File

@ -613,20 +613,34 @@ export default {
apiKey = "selectMonthlyEnrgUseMainIdx";
apiKey2 = "selectMonthlyEnrgUseMainIdxPageTotal";
}
var res = await this.postApiReturn({
var [res, res2] = await Promise.all([
this.postApiReturn({
apiKey: apiKey,
resKey: "eqpmIndMntrData",
sendParam: params,
});
var res2 = await this.postApiReturn({
}),
this.postApiReturn({
apiKey: apiKey2,
resKey: "eqpmIndMntrPageTotal",
sendParam: params,
});
}),
]);
// var res = await this.postApiReturn({
// apiKey: apiKey,
// resKey: "eqpmIndMntrData",
// sendParam: params,
// });
// var res2 = await this.postApiReturn({
// apiKey: apiKey2,
// resKey: "eqpmIndMntrPageTotal",
// sendParam: params,
// });
this.totalCount = res2[0].totalcount;
this.enrgUseMainIdxDesc = await this.postApiReturn({
apiKey: "selectEnrgUseMainIdxDesc",
resKey: "eqpmIndMntrData",
@ -642,14 +656,12 @@ export default {
no: i + 1,
});
}
this.setGridData({
gridKey: this.gridName,
value: newRes,
});
this.loadGrid = true;
this.makeTooltip();
},
async search() {