diff --git a/src/pages/report/index.tsx b/src/pages/report/index.tsx
index 11bb94d..ea789f8 100644
--- a/src/pages/report/index.tsx
+++ b/src/pages/report/index.tsx
@@ -51,14 +51,17 @@ export const UserReport: FC = () => {
const [downloadLoading, setDownloadLoading] = useState(false);
const printRef = useRef()
-
const handlePrint = async () => {
const opt = {
margin: 0,
- filename: `${data?.comprehensive?.startDate ? dayjs(data?.comprehensive?.startDate).format("YYYY年MM月") : null}${data?.tenement?.fullName || '报表'}.pdf`,
- image: { type: "jpeg", quality: 0.98, },
+ filename: `${data?.tenement?.fullName + '-' + dayjs(data?.comprehensive?.startDate).format("YYYY年MM月") || '报表-' + dayjs(data?.comprehensive?.startDate).format("YYYY年MM月")}.pdf`,
+ image: {type: "jpeg", quality: 0.98,},
enableLinks: true,
- html2canvas: { scale: 3, useCORS: true, allowTaint: false, },
+ html2canvas: {scale: 3, useCORS: true, allowTaint: false,},
+ pagebreak: {
+ // mode: ['avoid-all', 'css'], // 优先使用CSS分页规则
+ before: '.page-break' // 在指定元素前分页(可添加class到需要分页的位置)
+ },
jsPDF: {
unit: 'pt', // pt、mm、cm、in
format: 'a4',
@@ -146,16 +149,16 @@ export const UserReport: FC = () => {
)
}
- {
- data?.park?.meter04kvType === Meter04KvType.DisableValley ?
-
{outputWithPrecision(item?.publicAmount, 2, '-')} | :
-
- 尖:{item?.poolSharp || 0}
- 峰:{item?.poolPeak || 0}
- 平:{item?.poolFlat || 0}
- 谷:{item?.poolValley || 0}
- |
- }
+ {/*{*/}
+ {/* data?.park?.meter04kvType === Meter04KvType.DisableValley ?*/}
+ {/* {outputWithPrecision(item?.publicAmount, 2, '-')} | :*/}
+ {/* */}
+ {/* 尖:{item?.poolSharp || 0} */}
+ {/* 峰:{item?.poolPeak || 0} */}
+ {/* 平:{item?.poolFlat || 0} */}
+ {/* 谷:{item?.poolValley || 0} */}
+ {/* | */}
+ {/*}*/}
{outputWithPrecision(item?.finalAmount, 2, '-')} |
@@ -164,15 +167,212 @@ export const UserReport: FC = () => {
})
}, [data?.meters, data?.park?.meter04kvType])
+
+ const renderFee = useCallback(() => {
+ return
+
+
+ |
+ 电度电量 |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ 线损电量 |
+ 合计电量 |
+ >
+ }
+
+ {/*退补电量 | */}
+
+ 单价 |
+ 电度电费 |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ 线损电费 |
+ 合计电费 |
+ >
+ }
+
+
+
+
+
+
+ 尖 |
+ {data?.comprehensive?.sharpAmount} |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {data?.comprehensive?.lossSharp} |
+ {getRoundNumber(
+ Number(data?.comprehensive?.finalSharpAmount || 0)
+ )} |
+ >
+ }
+
+ {/* {data?.comprehensive?.refundSharp} | */}
+
+ {data?.comprehensive?.priceSharp} |
+ {getRoundNumber(
+ Number(data?.comprehensive?.sharpFee || 0)
+ )} |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {getRoundNumber(
+ Number(data?.comprehensive?.lossSharpFee || 0)
+ )} |
+ {getRoundNumber(
+ Number(
+ data?.comprehensive?.finalSharpFee || 0
+ )
+ )} |
+ >
+ }
+
+
+
+
+ 峰 |
+ {data?.comprehensive?.peakAmount} |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {data?.comprehensive?.lossPeak} |
+ {getRoundNumber(
+ Number(data?.comprehensive?.finalPeakAmount || 0)
+ )} |
+ >
+ }
+
+ {/* {data?.comprehensive?.refundPeak} | */}
+
+ {data?.comprehensive?.pricePeak} |
+ {getRoundNumber(
+ Number(data?.comprehensive?.peakFee || 0)
+ )} |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {getRoundNumber(
+ Number(data?.comprehensive?.lossPeakFee || 0)
+ )} |
+ {getRoundNumber(
+ Number(
+ data?.comprehensive?.finalPeakFee || 0
+ )
+ )} |
+ >
+ }
+
+
+
+
+ 平 |
+ {data?.comprehensive?.flatAmount} |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {data?.comprehensive?.lossFlat} |
+ {getRoundNumber(
+ Number(data?.comprehensive?.finalFlatAmount || 0)
+ )} |
+ >
+ }
+ {/* {data?.comprehensive?.refundFlat} | */}
+
+ {data?.comprehensive?.priceFlat} |
+ {getRoundNumber(
+ Number(data?.comprehensive?.flatFee || 0)
+ )} |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {getRoundNumber(
+ Number(data?.comprehensive?.lossFlatFee || 0)
+ )} |
+ {getRoundNumber(
+ Number(
+ data?.comprehensive?.finalFlatFee || 0
+ )
+ )} |
+ >
+ }
+
+
+
+
+ 谷 |
+ {data?.comprehensive?.valleyAmount} |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {data?.comprehensive?.lossValley} |
+ {getRoundNumber(
+ Number(data?.comprehensive?.finalValleyAmount || 0)
+ )} |
+ >
+ }
+
+ {/* {data?.comprehensive?.refundValley} | */}
+
+ {data?.comprehensive?.priceValley} |
+ {getRoundNumber(
+ Number(data?.comprehensive?.valleyFee || 0)
+ )} |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {getRoundNumber(
+ Number(data?.comprehensive?.lossValleyFee || 0)
+ )} |
+ {getRoundNumber(
+ Number(
+ data?.comprehensive?.finalValleyFee || 0
+ )
+ )} |
+ >
+ }
+
+
+
+
+ 总 |
+ {data?.comprehensive?.consumption} |
+
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {data?.comprehensive?.loss?.amount} |
+ {getRoundNumber(
+ Number(data?.comprehensive?.finalAmount || 0)
+ )} |
+ >
+ }
+ {/* {data?.comprehensive?.refundOverall} | */}
+
+ - |
+ {getRoundNumber(
+ Number(data?.comprehensive?.fee || 0)
+ )} |
+ {
+ data?.tenement?.feeType === 3 ? null : <>
+ {getRoundNumber(
+ Number(data?.comprehensive?.finalLossFee || 0)
+ )} |
+ {getRoundNumber(
+ Number(
+ data?.comprehensive?.total || 0
+ )
+ )} |
+ >
+ }
+
+
+
+
+
+ }, [data])
+
const renderTableSum = useCallback(() => {
if (data?.meters?.length < 2) {
return null;
}
return
- 总计 |
- - |
- - |
- - |
+ 总计 |
+ - |
+ - |
+ - |
{
data?.park?.meter04kvType === Meter04KvType.DisableValley ?
{data?.comprehensive?.refundOverall} | :
@@ -218,29 +418,29 @@ export const UserReport: FC = () => {
)
}
- {
- data?.park?.meter04kvType === Meter04KvType.DisableValley ?
- {outputWithPrecision(data?.comprehensive?.publicAmount, 2, '-')} | :
-
- 尖:{data?.comprehensive?.poolSharp || 0}
- 峰:{data?.comprehensive?.poolPeak || 0}
- 平:{data?.comprehensive?.poolFlat || 0}
- 谷:{data?.comprehensive?.poolValley || 0}
- |
- }
+ {/*{*/}
+ {/* data?.park?.meter04kvType === Meter04KvType.DisableValley ?*/}
+ {/* {outputWithPrecision(data?.comprehensive?.publicAmount, 2, '-')} | :*/}
+ {/* */}
+ {/* 尖:{data?.comprehensive?.poolSharp || 0} */}
+ {/* 峰:{data?.comprehensive?.poolPeak || 0} */}
+ {/* 平:{data?.comprehensive?.poolFlat || 0} */}
+ {/* 谷:{data?.comprehensive?.poolValley || 0} */}
+ {/* | */}
+ {/*}*/}
{outputWithPrecision(
`${(data?.park?.meter04kvType === 0 ? amount?.current : data?.comprehensive?.finalAmount) || 0}`, 2, '-')} |
}, [data?.meters, data?.park?.meter04kvType, data?.comprehensive])
-
+ const totalFee = data?.tenement?.feeType === 3 ? data?.comprehensive?.fee : data?.comprehensive?.total
return (
<>
@@ -358,283 +569,299 @@ export const UserReport: FC = () => {
合计电费:
- {outputWithPrecision(data?.comprehensive?.total, 2, '-')} 元
+ {outputWithPrecision(totalFee, 2, '-')} 元
+
电费构成
+ {
+ data?.tenement?.feeType === 3 ?
+ (
+ 电费=电度电量*单价
+ )
+ :
+ (
+ 电费=(电度电量+线损电量)*单价
+ )
+
+ }
+
{
data?.park?.meter04kvType === 0 ? (
-
-
-
(
-
- 电度电量:
- {outputWithPrecision(data?.comprehensive?.consumption, 2, '-')} 千瓦时
-
- {
- data?.tenement?.feeType === 3 ? null : (
- <>
-
+
-
- 线损电量:
- {outputWithPrecision(data?.comprehensive?.lossAmount, 2, '-')} 千瓦时
-
- >
- )
- }
+
+
+
(
+
+ 电度电量:
+ {outputWithPrecision(data?.comprehensive?.consumption, 2, '-')} 千瓦时
+
+ {
+ data?.tenement?.feeType === 3 ? null : (
+ <>
+
+
+
+ 线损电量:
+ {outputWithPrecision(data?.comprehensive?.lossAmount, 2, '-')} 千瓦时
+
+ >
+ )
+ }
-
+
-
- 公摊电量:
- {outputWithPrecision(data?.comprehensive?.publicAmount, 2, '-')} 千瓦时
-
- {/*
- */}
- {/*
*/}
- {/* 退补电量:
*/}
- {/* {outputWithPrecision(data?.comprehensive?.publicAmount, 2, '-')} 千瓦时
*/}
- {/**/}
-
) *
-
- 电度单价:
- {outputWithPrecision(data?.comprehensive?.price, 6, '-')} 千瓦时/元
-
-
+
-
- 基本电费:
- {outputWithPrecision(data?.comprehensive?.basicPooled, 2, '-')} 元
-
- {/*
+ */}
- {/*
*/}
- {/* 调整电费:
*/}
- {/* {outputWithPrecision(data?.comprehensive?.adjustPooled, 2, '-')} 元
*/}
- {/**/}
+
+
+
+ 公摊电量:
+ {outputWithPrecision(data?.comprehensive?.publicAmount, 2, '-')} 千瓦时
+
+ {/*
- */}
+ {/*
*/}
+ {/* 退补电量:
*/}
+ {/* {outputWithPrecision(data?.comprehensive?.publicAmount, 2, '-')} 千瓦时
*/}
+ {/**/}
+
) *
+
+ 电度单价:
+ {outputWithPrecision(data?.comprehensive?.price, 6, '-')} 千瓦时/元
+
+
+
+
+ 基本电费:
+ {outputWithPrecision(data?.comprehensive?.basicPooled, 2, '-')} 元
+
+ {/*
+ */}
+ {/*
*/}
+ {/* 调整电费:
*/}
+ {/* {outputWithPrecision(data?.comprehensive?.adjustPooled, 2, '-')} 元
*/}
+ {/**/}
+
+
+
=
+
+ 本期总电费:
+ {outputWithPrecision(totalFee, 2, '-')} 元
+
+
-
-
=
-
- 本期总电费:
- {outputWithPrecision(data?.comprehensive?.total, 2, '-')} 元
-
-
-
- ) : (
-
-
-
(
-
- 电度电量(尖):
- {outputWithPrecision(data?.comprehensive?.sharpAmount, 2, '-')} 千瓦时
-
- {
- data?.tenement?.feeType === 3 ? null : (
- <>
-
+
-
- 线损电量(尖):
- {outputWithPrecision(data?.comprehensive?.lossSharp, 2, '-')} 千瓦时
-
- >
- )
- }
-
-
+
-
- 公摊电量(尖):
- {outputWithPrecision(data?.comprehensive?.poolSharp || '0', 2, '-')} 千瓦时
-
- {/*
- */}
- {/*
*/}
- {/* 退补电量(尖):
*/}
- {/* {outputWithPrecision(data?.comprehensive?.refundSharp, 2, '-')} 千瓦时
*/}
- {/**/}
-
) *
-
- 电度单价(尖):
- {outputWithPrecision(data?.comprehensive?.priceSharp, 6, '-')} 千瓦时/元
-
-
=
-
- 电费(尖):
- {outputWithPrecision(data?.comprehensive?.finalSharpFee, 2, '-')} 元
-
-
-
-
(
-
- 电度电量(峰):
- {outputWithPrecision(data?.comprehensive?.peakAmount, 2, '-')} 千瓦时
-
- {
- data?.tenement?.feeType === 3 ? null : (
- <>
-
+
-
- 线损电量(峰):
- {outputWithPrecision(data?.comprehensive?.lossPeak, 2, '-')} 千瓦时
-
- >
- )
- }
-
-
+
-
- 公摊电量(峰):
- {outputWithPrecision(data?.comprehensive?.poolPeak, 2, '-')} 千瓦时
-
- {/*
- */}
- {/*
*/}
- {/* 退补电量(峰):
*/}
- {/* {outputWithPrecision(data?.comprehensive?.refundPeak, 2, '-')} 千瓦时
*/}
- {/**/}
-
) *
-
- 用电单价(峰):
- {outputWithPrecision(data?.comprehensive?.pricePeak, 6, '-')} 千瓦时/元
-
-
=
-
- 电费(峰):
- {outputWithPrecision(data?.comprehensive?.finalPeakFee, 2, '-')} 元
-
-
-
-
(
-
- 电度电量(平):
- {outputWithPrecision(data?.comprehensive?.flatAmount, 2, '-')} 千瓦时
-
- {
- data?.tenement?.feeType === 3 ? null : (
- <>
-
+
-
- 线损电量(平):
- {outputWithPrecision(data?.comprehensive?.lossFlat, 2, '-')} 千瓦时
-
- >
- )
- }
-
-
+
-
- 公摊电量(平):
- {outputWithPrecision(data?.comprehensive?.poolFlat, 2, '-')} 千瓦时
-
- {/*
- */}
- {/*
*/}
- {/* 退补电量(平):
*/}
- {/* {outputWithPrecision(data?.comprehensive?.refundFlat, 2, '-')} 千瓦时
*/}
- {/**/}
-
) *
-
- 用电单价(平):
- {outputWithPrecision(data?.comprehensive?.priceFlat, 6, '-')} 千瓦时/元
-
-
=
-
- 电费(平):
- {outputWithPrecision(data?.comprehensive?.finalFlatFee, 2, '-')} 元
-
-
-
-
(
-
- 电度电量(谷):
- {outputWithPrecision(data?.comprehensive?.valleyAmount, 2, '-')} 千瓦时
-
- {
- data?.tenement?.feeType === 3 ? null : (
- <>
-
+
-
- 线损电量(谷):
- {outputWithPrecision(data?.comprehensive?.lossValley, 2, '-')} 千瓦时
-
- >
- )
- }
-
-
+
-
- 公摊电量(谷):
- {outputWithPrecision(data?.comprehensive?.poolValley, 2, '-')} 千瓦时
-
- {/*
- */}
- {/*
*/}
- {/* 退补电量(谷):
*/}
- {/* {outputWithPrecision(data?.comprehensive?.refundValley, 2, '-')} 千瓦时
*/}
- {/**/}
-
) *
-
- 用电单价(谷):
- {outputWithPrecision(data?.comprehensive?.priceValley, 6, '-')} 千瓦时/元
-
-
=
-
- 电费(谷):
- {outputWithPrecision(data?.comprehensive?.finalValleyFee, 2, '-')} 元
-
-
-
-
- 电费(尖):
- {outputWithPrecision(data?.comprehensive?.finalSharpFee, 2, '-')} 元
-
-
-
+
-
- 电费(峰):
- {outputWithPrecision(data?.comprehensive?.finalPeakFee, 2, '-')} 元
-
-
-
+
-
- 电费(平):
- {outputWithPrecision(data?.comprehensive?.finalFlatFee, 2, '-')} 元
-
-
-
+
-
- 电费(谷):
- {outputWithPrecision(data?.comprehensive?.finalValleyFee, 2, '-')} 元
-
-
-
=
-
- 本期总电费:
- {outputWithPrecision(data?.comprehensive?.total, 2, '-')} 元
-
-
- {/*
*/}
- {/*
= */}
- {/*
*/}
- {/* 本期总电费(元):
*/}
- {/* {outputWithPrecision(data?.comprehensive?.total, 2, '-')}
*/}
- {/* */}
- {/*
*/}
-
- )
+ ) :
+ renderFee()
+ // (
+ //
+ //
+ //
(
+ //
+ // 电度电量(尖):
+ // {outputWithPrecision(data?.comprehensive?.sharpAmount, 2, '-')} 千瓦时
+ //
+ // {
+ // data?.tenement?.feeType === 3 ? null : (
+ // <>
+ //
+
+ //
+ // 线损电量(尖):
+ // {outputWithPrecision(data?.comprehensive?.lossSharp, 2, '-')} 千瓦时
+ //
+ // >
+ // )
+ // }
+ //
+ //
+
+ //
+ // 公摊电量(尖):
+ // {outputWithPrecision(data?.comprehensive?.poolSharp || '0', 2, '-')} 千瓦时
+ //
+ // {/*
- */}
+ // {/*
*/}
+ // {/* 退补电量(尖):
*/}
+ // {/* {outputWithPrecision(data?.comprehensive?.refundSharp, 2, '-')} 千瓦时
*/}
+ // {/**/}
+ //
) *
+ //
+ // 电度单价(尖):
+ // {outputWithPrecision(data?.comprehensive?.priceSharp, 6, '-')} 千瓦时/元
+ //
+ //
=
+ //
+ // 电费(尖):
+ // {outputWithPrecision(data?.comprehensive?.finalSharpFee, 2, '-')} 元
+ //
+ //
+ //
+ //
(
+ //
+ // 电度电量(峰):
+ // {outputWithPrecision(data?.comprehensive?.peakAmount, 2, '-')} 千瓦时
+ //
+ // {
+ // data?.tenement?.feeType === 3 ? null : (
+ // <>
+ //
+
+ //
+ // 线损电量(峰):
+ // {outputWithPrecision(data?.comprehensive?.lossPeak, 2, '-')} 千瓦时
+ //
+ // >
+ // )
+ // }
+ //
+ //
+
+ //
+ // 公摊电量(峰):
+ // {outputWithPrecision(data?.comprehensive?.poolPeak, 2, '-')} 千瓦时
+ //
+ // {/*
- */}
+ // {/*
*/}
+ // {/* 退补电量(峰):
*/}
+ // {/* {outputWithPrecision(data?.comprehensive?.refundPeak, 2, '-')} 千瓦时
*/}
+ // {/**/}
+ //
) *
+ //
+ // 用电单价(峰):
+ // {outputWithPrecision(data?.comprehensive?.pricePeak, 6, '-')} 千瓦时/元
+ //
+ //
=
+ //
+ // 电费(峰):
+ // {outputWithPrecision(data?.comprehensive?.finalPeakFee, 2, '-')} 元
+ //
+ //
+ //
+ //
(
+ //
+ // 电度电量(平):
+ // {outputWithPrecision(data?.comprehensive?.flatAmount, 2, '-')} 千瓦时
+ //
+ // {
+ // data?.tenement?.feeType === 3 ? null : (
+ // <>
+ //
+
+ //
+ // 线损电量(平):
+ // {outputWithPrecision(data?.comprehensive?.lossFlat, 2, '-')} 千瓦时
+ //
+ // >
+ // )
+ // }
+ //
+ //
+
+ //
+ // 公摊电量(平):
+ // {outputWithPrecision(data?.comprehensive?.poolFlat, 2, '-')} 千瓦时
+ //
+ // {/*
- */}
+ // {/*
*/}
+ // {/* 退补电量(平):
*/}
+ // {/* {outputWithPrecision(data?.comprehensive?.refundFlat, 2, '-')} 千瓦时
*/}
+ // {/**/}
+ //
) *
+ //
+ // 用电单价(平):
+ // {outputWithPrecision(data?.comprehensive?.priceFlat, 6, '-')} 千瓦时/元
+ //
+ //
=
+ //
+ // 电费(平):
+ // {outputWithPrecision(data?.comprehensive?.finalFlatFee, 2, '-')} 元
+ //
+ //
+ //
+ //
(
+ //
+ // 电度电量(谷):
+ // {outputWithPrecision(data?.comprehensive?.valleyAmount, 2, '-')} 千瓦时
+ //
+ // {
+ // data?.tenement?.feeType === 3 ? null : (
+ // <>
+ //
+
+ //
+ // 线损电量(谷):
+ // {outputWithPrecision(data?.comprehensive?.lossValley, 2, '-')} 千瓦时
+ //
+ // >
+ // )
+ // }
+ //
+ //
+
+ //
+ // 公摊电量(谷):
+ // {outputWithPrecision(data?.comprehensive?.poolValley, 2, '-')} 千瓦时
+ //
+ // {/*
- */}
+ // {/*
*/}
+ // {/* 退补电量(谷):
*/}
+ // {/* {outputWithPrecision(data?.comprehensive?.refundValley, 2, '-')} 千瓦时
*/}
+ // {/**/}
+ //
) *
+ //
+ // 用电单价(谷):
+ // {outputWithPrecision(data?.comprehensive?.priceValley, 6, '-')} 千瓦时/元
+ //
+ //
=
+ //
+ // 电费(谷):
+ // {outputWithPrecision(data?.comprehensive?.finalValleyFee, 2, '-')} 元
+ //
+ //
+ //
+ //
+ // 电费(尖):
+ // {outputWithPrecision(data?.comprehensive?.finalSharpFee, 2, '-')} 元
+ //
+ //
+ //
+
+ //
+ // 电费(峰):
+ // {outputWithPrecision(data?.comprehensive?.finalPeakFee, 2, '-')} 元
+ //
+ //
+ //
+
+ //
+ // 电费(平):
+ // {outputWithPrecision(data?.comprehensive?.finalFlatFee, 2, '-')} 元
+ //
+ //
+ //
+
+ //
+ // 电费(谷):
+ // {outputWithPrecision(data?.comprehensive?.finalValleyFee, 2, '-')} 元
+ //
+ //
+ //
=
+ //
+ // 本期总电费:
+ // {outputWithPrecision(data?.comprehensive?.total, 2, '-')} 元
+ //
+ //
+ // {/*
*/}
+ // {/*
= */}
+ // {/*
*/}
+ // {/* 本期总电费(元):
*/}
+ // {/* {outputWithPrecision(data?.comprehensive?.total, 2, '-')}
*/}
+ // {/* */}
+ // {/*
*/}
+ //
+ // )
}
-
-
+
+
用电明细
(
电度电量=(止码-起码)*倍率-退补电量-从表电量,
- 合计电量=电度电量+线损电量+公摊电量
- )
+ 合计电量=电度电量+线损电量
+ {/*+公摊电量*/}
+ )
@@ -655,7 +882,7 @@ export const UserReport: FC = () => {
线损电量 |
)
}
-
公摊电量 |
+ {/*
公摊电量 | */}
合计电量 |
diff --git a/src/shared/model-publicity.ts b/src/shared/model-publicity.ts
index 10294be..f6c710d 100644
--- a/src/shared/model-publicity.ts
+++ b/src/shared/model-publicity.ts
@@ -499,6 +499,10 @@ export type TenementComprehensiveDetail = PooledSumDetail & {
*/
finalAmount: string;
finalLossFee: string;
+ finalSharpAmount: string,
+ finalPeakAmount: string,
+ finalFlatAmount: string,
+ finalValleyAmount: string,
};
/**