拿掉下載預覽、夏月時間區間修改
This commit is contained in:
parent
0616a0d783
commit
60985145f7
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-loading="loading" element-loading-text="資料加載中...">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="7">
|
||||
<el-col :span="6">
|
||||
<el-descriptions class="margin-top" title="報表資訊" :column="1" border>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
@ -29,7 +29,7 @@
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-col :span="13">
|
||||
<el-descriptions
|
||||
class="margin-top"
|
||||
:title="priceTitle"
|
||||
@ -42,79 +42,115 @@
|
||||
</template>
|
||||
{{ Three_Phase }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="isSummerMonth">
|
||||
<template #label>
|
||||
<div class="cell-item">基本電費-經常契約</div>
|
||||
</template>
|
||||
{{ Regular_Contract_Summer }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="!isSummerMonth">
|
||||
<template #label>
|
||||
<div class="cell-item">基本電費-經常契約</div>
|
||||
</template>
|
||||
{{ Regular_Contract_Non_Summer }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="isSummerMonth">
|
||||
<template #label>
|
||||
<div class="cell-item">流動電價-平日尖峰單價</div>
|
||||
</template>
|
||||
{{ Summer_Peak_Prices }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">流動電價-平日半尖峰單價</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth
|
||||
? Summer_HalfPeak_Prices_Weekday
|
||||
: Non_Summer_HalfPeak_Prices_Weekday
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">流動電價-平日離峰單價</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth
|
||||
? Summer_Off_Prices_Weekday
|
||||
: Non_Summer_Off_Prices_Weekday
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">流動電價-週六半尖峰單價</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth
|
||||
? Summer_HalfPeak_Prices_Saturday
|
||||
: Non_Summer_HalfPeak_Prices_Saturday
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">流動電價-週六離峰單價</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth
|
||||
? Summer_Off_Prices_Saturday
|
||||
: Non_Summer_Off_Prices_Saturday
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">流動電價-週日離峰單價</div>
|
||||
</template>
|
||||
{{ isSummerMonth ? Summer_Off_Prices : Non_Summer_Off_Prices }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">契約容量</div>
|
||||
</template>
|
||||
{{ ContractUse }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="isSummerMonth != 'non-summer'">
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
流動電價-平日尖峰單價
|
||||
<!-- {{ isSummerMonth == "half-summer" ? "(夏月)" : "" }} -->
|
||||
</div>
|
||||
</template>
|
||||
{{ Summer_Peak_Prices }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
基本電費-經常契約
|
||||
<!-- {{ isSummerMonth == "half-summer" ? "(夏月/非夏月)" : "" }} -->
|
||||
</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth === "summer"
|
||||
? Regular_Contract_Summer
|
||||
: isSummerMonth === "non-summer"
|
||||
? Regular_Contract_Non_Summer
|
||||
: `${Regular_Contract_Summer} / ${Regular_Contract_Non_Summer}`
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
流動電價-平日半尖峰單價
|
||||
<!-- {{ isSummerMonth == "half-summer" ? "(夏月/非夏月)" : "" }} -->
|
||||
</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth === "summer"
|
||||
? Summer_HalfPeak_Prices_Weekday
|
||||
: isSummerMonth === "non-summer"
|
||||
? Non_Summer_HalfPeak_Prices_Weekday
|
||||
: `${Summer_HalfPeak_Prices_Weekday} / ${Non_Summer_HalfPeak_Prices_Weekday}`
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
流動電價-平日離峰單價
|
||||
<!-- {{ isSummerMonth == "half-summer" ? "(夏月/非夏月)" : "" }} -->
|
||||
</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth === "summer"
|
||||
? Summer_Off_Prices_Weekday
|
||||
: isSummerMonth === "non-summer"
|
||||
? Non_Summer_Off_Prices_Weekday
|
||||
: `${Summer_Off_Prices_Weekday} / ${Non_Summer_Off_Prices_Weekday}`
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
流動電價-週六半尖峰單價
|
||||
<!-- {{ isSummerMonth == "half-summer" ? "(夏月/非夏月)" : "" }} -->
|
||||
</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth === "summer"
|
||||
? Summer_HalfPeak_Prices_Saturday
|
||||
: isSummerMonth === "non-summer"
|
||||
? Non_Summer_HalfPeak_Prices_Saturday
|
||||
: `${Summer_HalfPeak_Prices_Saturday} / ${Non_Summer_HalfPeak_Prices_Saturday}`
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
流動電價-週六離峰單價
|
||||
<!-- {{ isSummerMonth == "half-summer" ? "(夏月/非夏月)" : "" }} -->
|
||||
</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth === "summer"
|
||||
? Summer_Off_Prices_Saturday
|
||||
: isSummerMonth === "non-summer"
|
||||
? Non_Summer_Off_Prices_Saturday
|
||||
: `${Summer_Off_Prices_Saturday} / ${Non_Summer_Off_Prices_Saturday}`
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
<div class="cell-item">
|
||||
流動電價-週日離峰單價
|
||||
<!-- {{ isSummerMonth == "half-summer" ? "(夏月/非夏月)" : "" }} -->
|
||||
</div>
|
||||
</template>
|
||||
{{
|
||||
isSummerMonth === "summer"
|
||||
? Summer_Off_Prices
|
||||
: isSummerMonth === "non-summer"
|
||||
? Non_Summer_Off_Prices
|
||||
: `${Summer_Off_Prices} / ${Non_Summer_Off_Prices}`
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :span="5">
|
||||
<el-descriptions class="margin-top" title="總計" :column="1" border>
|
||||
<el-descriptions-item>
|
||||
<template #label>
|
||||
@ -199,6 +235,11 @@
|
||||
<EnergyPie :chartData="elecCostData" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<p style="margin: 0; padding-top: 15px; opacity: 0.8">
|
||||
本系統所提供之時間電價計算結果,係以未超過契約容量為前提所進行之估算,僅供用電分析與管理參考之用。
|
||||
</p>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
@ -239,12 +280,26 @@ const loading = computed(() => {
|
||||
});
|
||||
|
||||
const isSummerMonth = computed(() => {
|
||||
const month = dayjs(props.form?.date).month(); // month() 返回 0-11,代表一月到十二月
|
||||
return month >= 5 && month <= 8; // 月份範圍,6月是 5,9月是 8
|
||||
const date = dayjs(props.form?.date);
|
||||
const month = date.month() + 1; // 代表一月到十二月
|
||||
|
||||
if (month > 5 && month < 10) {
|
||||
return "summer";
|
||||
} else if (month === 5 || month === 10) {
|
||||
return "half-summer";
|
||||
} else {
|
||||
return "non-summer";
|
||||
}
|
||||
});
|
||||
|
||||
const priceTitle = computed(() => {
|
||||
return isSummerMonth.value ? "單價(NTD/kWh)-夏月" : "單價(NTD/kWh)-非夏月";
|
||||
if (isSummerMonth.value === "summer") {
|
||||
return "單價(NTD/kWh)-夏月";
|
||||
} else if (isSummerMonth.value === "non-summer") {
|
||||
return "單價(NTD/kWh)-非夏月";
|
||||
} else {
|
||||
return "單價(NTD/kWh)-夏月/非夏月";
|
||||
}
|
||||
});
|
||||
|
||||
const formattedElecCostSummary = computed(() => {
|
||||
|
@ -60,7 +60,9 @@ export const CalcuEleCost = (input: Map<string, number>): ElecCostSummary => {
|
||||
|
||||
const sampleDate = entries[0].time;
|
||||
const dayOfWeek = sampleDate.getDay();
|
||||
const month = sampleDate.getMonth() + 1;
|
||||
const year = sampleDate.getFullYear();
|
||||
const summerStart = new Date(`${year}-05-16`);
|
||||
const summerEnd = new Date(`${year}-10-15`);
|
||||
|
||||
let off = 0; //離峰用電
|
||||
let half = 0; //半尖峰用電
|
||||
@ -71,7 +73,7 @@ export const CalcuEleCost = (input: Map<string, number>): ElecCostSummary => {
|
||||
let dailyFlowCost = 0; //當日電價
|
||||
let dailyEleCost = 0; //當日用電
|
||||
|
||||
const isSummer = month >= 6 && month <= 9;
|
||||
const isSummer = sampleDate >= summerStart && sampleDate <= summerEnd;
|
||||
|
||||
entries.forEach(({ time, value }) => {
|
||||
const hour = time.getHours();
|
||||
@ -191,10 +193,14 @@ export const CalcuEleStandCost = (
|
||||
|
||||
for (const [ym, entries] of monthMap.entries()) {
|
||||
if (!entries || entries.length === 0) continue;
|
||||
|
||||
|
||||
const sampleDate = entries[0].time;
|
||||
const month = sampleDate.getMonth() + 1;
|
||||
const isSummer = month >= 6 && month <= 9;
|
||||
//const month = sampleDate.getMonth() + 1;
|
||||
// 修改 isSummer 判斷方式:從月改為日期範圍 5/16 ~ 10/15
|
||||
const year = sampleDate.getFullYear();
|
||||
const summerStart = new Date(`${year}-05-16`);
|
||||
const summerEnd = new Date(`${year}-10-15`);
|
||||
const isSummer = sampleDate >= summerStart && sampleDate <= summerEnd;
|
||||
|
||||
let Phase = Three_Phase;
|
||||
let Contract = isSummer ? Summer_Regular_Use : Non_Summer_Regular_Use;
|
||||
|
@ -43,7 +43,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="6" class="">分類</td>
|
||||
<td class="">夏月<br />(6/1~9/30)</td>
|
||||
<td class="">夏月<br />(5/16~10/15)</td>
|
||||
<td class="">非夏月<br />(夏月以外的時間)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -52,7 +52,7 @@
|
||||
:show-layout="false"
|
||||
:float-layout="true"
|
||||
:enable-download="true"
|
||||
:preview-modal="true"
|
||||
:preview-modal="false"
|
||||
:filename="pdfFileName"
|
||||
:pdf-quality="2"
|
||||
:manual-pagination="false"
|
||||
@ -121,8 +121,12 @@ const handleClose = () => {
|
||||
|
||||
// 觸發 PDF 生成和下載
|
||||
const generatePDF = async () => {
|
||||
if (html2Pdf.value) {
|
||||
await html2Pdf.value.generatePdf();
|
||||
try {
|
||||
if (html2Pdf.value) {
|
||||
await html2Pdf.value.generatePdf();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("PDF生成失敗:", error);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user