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

View File

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

View File

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

View File

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

View File

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