初步支持峰谷

This commit is contained in:
qiaomu 2025-04-21 14:26:22 +08:00
parent 14b0692c13
commit 31290a776e
4 changed files with 760 additions and 159 deletions

View File

@ -10,25 +10,46 @@ import Card from './components/Card';
import Unit from './components/Unit'; import Unit from './components/Unit';
import { outputWithPrecision } from '@u/funcs'; import { outputWithPrecision } from '@u/funcs';
import html2pdf from "html2pdf.js"; import html2pdf from "html2pdf.js";
import ReactToPrint from 'react-to-print';
import dayjs from "dayjs"; import dayjs from "dayjs";
import TopTitle from './components/TopTitle'; import TopTitle from './components/TopTitle';
import TopContent from './components/TopContent'; import TopContent from './components/TopContent';
// 核心代码 // 核心代码
import { useSearchParams } from 'react-router-dom' import { useSearchParams } from 'react-router-dom'
import {getRoundNumber} from "@/utils";
function getAmount(amount: string, loss: string, refund: string, price: string): string {
return `${
getRoundNumber(
Number(
getRoundNumber(
Number(
(Number(
(Number(amount) + Number(loss)
)
) -
Number(refund)
)
)
)
) * Number(price)
)}`
}
export const UserReport: FC = () => { export const UserReport: FC = () => {
const [searchParams] = useSearchParams() const [searchParams] = useSearchParams()
const tid = searchParams.get("tenement"); const tid = searchParams.get("tenement");
const rid = searchParams.get("report"); const rid = searchParams.get("report");
const amount = useRef<string>();
const { data } = useQuery( const { data } = useQuery(
['report-tenement-detail', rid, tid], ['report-tenement-detail', rid, tid],
() => reportTenementDetail(rid, tid), () => reportTenementDetail(rid, tid),
{ {
select: res => { select: res => {
if (isCorrectResult(res)) return res.detail; if (isCorrectResult(res)) {
amount.current = res.amount;
return res.detail
}
message.error(res.message || '获取商户电费详情失败'); message.error(res.message || '获取商户电费详情失败');
return null; return null;
} }
@ -81,10 +102,10 @@ export const UserReport: FC = () => {
}, [data?.meters]) }, [data?.meters])
return ( return (
<> <>
<style> <style>
{ {
` `
td { td {
padding: 0.2cm padding: 0.2cm
} }
@ -104,148 +125,443 @@ export const UserReport: FC = () => {
font-size: 0.34cm; font-size: 0.34cm;
} }
` `
} }
</style> </style>
<div style={{position: 'fixed',width: '100%', height: '100%', left: 0, right: 0, top: 0, bottom: 0, margin: 'auto', zIndex: 99, background: '#fff', display: 'flex', justifyContent: 'center', alignItems: "center" }}> <div style={{
position: 'fixed',
<Button loading={downloadLoading} type='primary' tw='' onClick={() => handlePrint()}> </Button> width: '100%',
height: '100%',
left: 0,
right: 0,
top: 0,
bottom: 0,
margin: 'auto',
zIndex: 99,
background: '#fff',
display: 'flex',
justifyContent: 'center',
alignItems: "center"
}}>
<Button loading={downloadLoading} type='primary' tw='' onClick={() => handlePrint()}> </Button>
</div>
<div ref={printRef}>
<ContentArea> </div>
<div id="content"> <div ref={printRef}>
<div> <ContentArea>
<img src={Logo} alt="" width={60} height={60}/> <div id="content">
</div> <div>
<div tw='mt-4' style={{fontSize: "18px", fontWeight: 600}}> <img src={Logo} alt="" width={60} height={60}/>
{data?.tenement?.fullName} &nbsp; </div>
{dayjs(data?.comprehensive?.startDate).format("MM")} <div tw='mt-4' style={{fontSize: "18px", fontWeight: 600}}>
</div> {data?.tenement?.fullName} &nbsp;
<div tw='flex mt-6 flex-row' style={{backgroundColor: "#f0f0f0", padding: '18px 20px'}}> {dayjs(data?.comprehensive?.startDate).format("MM")}
<div tw='flex flex-1 flex-col'> </div>
<Row gutter={16}> <div tw='flex mt-6 flex-row' style={{backgroundColor: "#f0f0f0", padding: '18px 20px'}}>
<Col span={5} style={{display: "flex", flexDirection: "column"}}> <div tw='flex flex-1 flex-col'>
<div></div> <Row gutter={16}>
<div style={{fontSize: "20px", fontWeight: 600, flex: 1, display: "flex", alignItems: "center"}}> <Col span={5} style={{display: "flex", flexDirection: "column"}}>
{data?.comprehensive?.startDate ? dayjs(data?.comprehensive?.startDate).format("YYYY年MM月") : null} <div></div>
</div> <div style={{
{/* <div> {data?.comprehensive?.startDate} - {data?.comprehensive?.endDate} </div> */} fontSize: "20px",
</Col> fontWeight: 600,
<Col span={19}> flex: 1,
<Row gutter={16}> display: "flex",
<Col span={6}> <TopTitle> </TopTitle> <TopContent> {data?.tenement?.id} </TopContent> </Col> alignItems: "center"
<Col span={6}> <TopTitle></TopTitle><TopContent>{data?.tenement?.fullName}</TopContent> </Col> }}>
<Col span={6}> <TopTitle></TopTitle><TopContent></TopContent> </Col> {data?.comprehensive?.startDate ? dayjs(data?.comprehensive?.startDate).format("YYYY年MM月") : null}
<Col span={6}> <TopTitle></TopTitle><TopContent>0.4kv</TopContent> </Col> </div>
</Row> {/* <div> {data?.comprehensive?.startDate} - {data?.comprehensive?.endDate} </div> */}
<Divider dashed tw='mt-2 mb-2 flex flex-col w-full' /> </Col>
<Row gutter={16}> <Col span={19}>
<div tw='mt-3 flex-1 flex flex-row'> <Row gutter={16}>
<Col span={6}> <TopTitle></TopTitle> <TopContent> {data?.park?.name} </TopContent> </Col> <Col span={6}> <TopTitle> </TopTitle>
<Col span={6}> <TopTitle></TopTitle> <TopContent> {data?.tenement?.address} </TopContent> </Col> <TopContent> {data?.tenement?.id} </TopContent> </Col>
<Col span={6}> <TopTitle></TopTitle><TopContent>{data?.comprehensive?.endDate}</TopContent> </Col> <Col span={6}>
<Col span={6}> <TopTitle></TopTitle><TopContent></TopContent> </Col> <TopTitle></TopTitle><TopContent>{data?.tenement?.fullName}</TopContent>
</div> </Col>
</Row> <Col span={6}> <TopTitle></TopTitle><TopContent></TopContent>
</Col> </Col>
</Row> <Col span={6}> <TopTitle></TopTitle><TopContent>0.4kv</TopContent>
</div> </Col>
</div> </Row>
<div> <Divider dashed tw='mt-2 mb-2 flex flex-col w-full'/>
<div tw='mt-6'> <Row gutter={16}>
<div tw='mt-3 flex-1 flex flex-row'>
<Divider tw='mt-2 mb-2 flex flex-col w-full' /> <Col span={6}> <TopTitle></TopTitle>
</div> <TopContent> {data?.park?.name} </TopContent> </Col>
<div tw='mt-2'> <Col span={6}> <TopTitle></TopTitle>
<div tw='flex flex-row'> <TopContent> {data?.tenement?.address} </TopContent> </Col>
<Card> <Col span={6}>
<h4 tw='mt-1 mb-1'> </h4> <TopTitle></TopTitle><TopContent>{data?.comprehensive?.endDate}</TopContent>
<div> {outputWithPrecision(data?.comprehensive?.consumption, 2, '-')} &nbsp;&nbsp; </div> </Col>
</Card> <Col span={6}>
</div> <TopTitle></TopTitle><TopContent></TopContent>
<div tw='mt-3'> </Col>
</div>
<Divider tw='mt-2 mb-4 flex flex-col w-full' /> </Row>
</div> </Col>
<div tw='flex flex-row items-center' style={{height: 'fit-content', alignItems: "stretch", flexGrow: "stratch" }}> </Row>
<div tw='flex flex-row items-center flex-wrap'> </div>
<Unit> </Unit> </div>
<Card> <div>
<h4 tw='mt-1 mb-1'> </h4> <div tw='mt-6'>
<div> {outputWithPrecision(data?.comprehensive?.consumption, 2, '-')} &nbsp;&nbsp; </div>
</Card> <Divider tw='mt-2 mb-2 flex flex-col w-full'/>
<Unit> + </Unit> </div>
<Card> <div tw='mt-2'>
<h4 tw='mt-1 mb-1'> 线 </h4> <div tw='flex flex-row'>
<div> {outputWithPrecision(data?.comprehensive?.lossAmount, 2, '-')} &nbsp;&nbsp; </div> <Card>
</Card> <h4 tw='mt-1 mb-1'> </h4>
<Unit> + </Unit> <div> {
<Card> outputWithPrecision(
<h4 tw='mt-1 mb-1'> </h4> `${Number(amount.current || 0)}`, 2, '-')} &nbsp;&nbsp;
<div> {outputWithPrecision(data?.comprehensive?.publicAmount, 2, '-')} &nbsp;&nbsp; </div> </div>
</Card> </Card>
<Unit> </Unit><Unit> * </Unit> </div>
<Card> <div tw='mt-3'>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.price, 6, '-')} &nbsp;&nbsp;/ </div> <Divider tw='mt-2 mb-4 flex flex-col w-full'/>
</Card> </div>
<Unit> + </Unit> {
<Card> data?.park?.meter04kvType === 0 ? (
<h4 tw='mt-1 mb-1'> </h4> <div tw='flex flex-row items-center' style={{
<div> {outputWithPrecision(data?.comprehensive?.basicPooled, 2, '-')} </div> height: 'fit-content',
</Card> alignItems: "stretch",
<Unit> + </Unit> flexGrow: "stratch"
<Card> }}>
<h4 tw='mt-1 mb-1'> </h4> <div tw='flex flex-row items-center flex-wrap'>
<div> {outputWithPrecision(data?.comprehensive?.adjustPooled, 2, '-')} </div> <Unit> </Unit>
</Card> <Card>
</div> <h4 tw='mt-1 mb-1'> </h4>
<div tw='flex flex-row items-center' style={{height: '100%', flex: 1}}> <div> {outputWithPrecision(data?.comprehensive?.consumption, 2, '-')} &nbsp;&nbsp;</div>
<Unit> = </Unit> </Card>
<Card style={{height: 200}}> {
<h4 tw='mt-1 mb-1'> </h4> data?.tenement?.feeType === 3 ? null : (
<div> {outputWithPrecision(data?.comprehensive?.total, 2, '-')} </div> <>
</Card> <Unit> + </Unit>
</div> <Card>
</div> <h4 tw='mt-1 mb-1'> 线 </h4>
</div> <div> {outputWithPrecision(data?.comprehensive?.lossAmount, 2, '-')} &nbsp;&nbsp;</div>
<div> </Card>
<div tw='mt-4'> </>
)
<Divider tw='mt-2 mb-4 flex flex-col w-full' /> }
</div>
<div tw="mt-3" style={{fontSize: 12}}> <Unit> + </Unit>
<table border={1} width={"100%"} cellSpacing="0" > <Card>
<thead> <h4 tw='mt-1 mb-1'> </h4>
<tr> <div> {outputWithPrecision(data?.comprehensive?.publicAmount, 2, '-')} &nbsp;&nbsp;</div>
<td></td> </Card>
<td></td> <Unit> - </Unit>
<td></td> <Card>
<td></td> <h4 tw='mt-1 mb-1'> 退 </h4>
<td></td> <div> {outputWithPrecision(data?.comprehensive?.publicAmount, 2, '-')} &nbsp;&nbsp;</div>
<td></td> </Card>
{/* <td>线损占比</td> */} <Unit> </Unit><Unit> * </Unit>
<td>线</td> <Card>
<td></td> <h4 tw='mt-1 mb-1'> </h4>
<td></td> <div> {outputWithPrecision(data?.comprehensive?.price, 6, '-')} &nbsp;&nbsp;/</div>
</tr> </Card>
</thead> <Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.basicPooled, 2, '-')} </div>
</Card>
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.adjustPooled, 2, '-')} </div>
</Card>
</div>
<div tw='flex flex-row items-center' style={{height: '100%', flex: 1}}>
<Unit> = </Unit>
<Card style={{height: 200}}>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.total, 2, '-')} </div>
</Card>
</div>
</div>
) : (
<div tw='' style={{
height: 'fit-content',
alignItems: "stretch",
flexGrow: "stratch"
}}>
<div tw='flex flex-row items-center flex-wrap'>
<Unit> </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.sharpAmount, 2, '-')} &nbsp;&nbsp;</div>
</Card>
{
data?.tenement?.feeType === 3 ? null : (
<>
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> 线 </h4>
<div> {outputWithPrecision(data?.comprehensive?.lossSharp, 2, '-')} &nbsp;&nbsp;</div>
</Card>
</>
)
}
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.poolSharp || '0', 2, '-')} &nbsp;&nbsp;</div>
</Card>
<Unit> - </Unit>
<Card>
<h4 tw='mt-1 mb-1'> 退 </h4>
<div> {outputWithPrecision(data?.comprehensive?.refundSharp, 2, '-')} &nbsp;&nbsp;</div>
</Card>
<Unit> </Unit><Unit> * </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.priceSharp, 6, '-')} &nbsp;&nbsp;/</div>
</Card>
<Unit> = </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(getAmount(
data?.comprehensive?.sharpAmount || "0",
data?.tenement?.feeType === 3 ? "0" : (data?.comprehensive?.lossSharp || "0"),
data?.comprehensive?.refundSharp || "0",
data?.comprehensive?.priceSharp || "0",
), 2, '-')} &nbsp;&nbsp;</div>
</Card>
</div>
<div tw='flex flex-row items-center flex-wrap'>
<Unit> </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.peakAmount, 2, '-')} &nbsp;&nbsp;</div>
</Card>
{
data?.tenement?.feeType === 3 ? null : (
<>
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> 线 </h4>
<div> {outputWithPrecision(data?.comprehensive?.lossPeak, 2, '-')} &nbsp;&nbsp;</div>
</Card>
</>
)
}
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.poolPeak, 2, '-')} &nbsp;&nbsp;</div>
</Card>
<Unit> - </Unit>
<Card>
<h4 tw='mt-1 mb-1'> 退 </h4>
<div> {outputWithPrecision(data?.comprehensive?.refundPeak, 2, '-')} &nbsp;&nbsp;</div>
</Card>
<Unit> </Unit><Unit> * </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.pricePeak, 6, '-')} &nbsp;&nbsp;/</div>
</Card>
<Unit> = </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(getAmount(
data?.comprehensive?.peakAmount || "0",
data?.tenement?.feeType === 3 ? "0" : (data?.comprehensive?.lossPeak || "0"),
data?.comprehensive?.refundPeak || "0",
data?.comprehensive?.pricePeak || "0",
), 2, '-')} &nbsp;&nbsp;</div>
</Card>
</div>
<div tw='flex flex-row items-center flex-wrap'>
<Unit> </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.flatAmount, 2, '-')} &nbsp;&nbsp;</div>
</Card>
{
data?.tenement?.feeType === 3 ? null : (
<>
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> 线 </h4>
<div> {outputWithPrecision(data?.comprehensive?.lossFlat, 2, '-')} &nbsp;&nbsp;</div>
</Card>
</>
)
}
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.poolFlat, 2, '-')} &nbsp;&nbsp;</div>
</Card>
<Unit> - </Unit>
<Card>
<h4 tw='mt-1 mb-1'> 退 </h4>
<div> {outputWithPrecision(data?.comprehensive?.refundFlat, 2, '-')} &nbsp;&nbsp;</div>
</Card>
<Unit> </Unit><Unit> * </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.priceFlat, 6, '-')} &nbsp;&nbsp;/</div>
</Card>
<Unit> = </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(getAmount(
data?.comprehensive?.flatAmount || "0",
data?.tenement?.feeType === 3 ? "0" : (data?.comprehensive?.lossFlat || "0"),
data?.comprehensive?.refundFlat || "0",
data?.comprehensive?.priceFlat || "0",
), 2, '-')} &nbsp;&nbsp;</div>
</Card>
</div>
<div tw='flex flex-row items-center flex-wrap'>
<Unit> </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.valleyAmount, 2, '-')} &nbsp;&nbsp;</div>
</Card>
{
data?.tenement?.feeType === 3 ? null : (
<>
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> 线 </h4>
<div> {outputWithPrecision(data?.comprehensive?.lossValley, 2, '-')} &nbsp;&nbsp;</div>
</Card>
</>
)
}
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.poolValley, 2, '-')} &nbsp;&nbsp;</div>
</Card>
<Unit> - </Unit>
<Card>
<h4 tw='mt-1 mb-1'> 退 </h4>
<div> {outputWithPrecision(data?.comprehensive?.refundValley, 2, '-')} &nbsp;&nbsp;</div>
</Card>
<Unit> </Unit><Unit> * </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.priceValley, 6, '-')} &nbsp;&nbsp;/</div>
</Card>
<Unit> = </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(getAmount(
data?.comprehensive?.valleyAmount || "0",
data?.tenement?.feeType === 3 ? "0" : (data?.comprehensive?.lossValley || "0"),
data?.comprehensive?.refundValley || "0",
data?.comprehensive?.priceValley || "0",
), 2, '-')} &nbsp;&nbsp;</div>
</Card>
</div>
<div tw='flex flex-row items-center flex-wrap'>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(getAmount(
data?.comprehensive?.sharpAmount || "0",
data?.tenement?.feeType === 3 ? "0" : (data?.comprehensive?.lossSharp || "0"),
data?.comprehensive?.refundSharp || "0",
data?.comprehensive?.priceSharp || "0",
), 2, '-')} </div>
</Card>
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(getAmount(
data?.comprehensive?.peakAmount || "0",
data?.tenement?.feeType === 3 ? "0" : (data?.comprehensive?.lossPeak || "0"),
data?.comprehensive?.refundPeak || "0",
data?.comprehensive?.pricePeak || "0",
), 2, '-')} </div>
</Card>
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(getAmount(
data?.comprehensive?.flatAmount || "0",
data?.tenement?.feeType === 3 ? "0" : (data?.comprehensive?.lossFlat || "0"),
data?.comprehensive?.refundFlat || "0",
data?.comprehensive?.priceFlat || "0",
), 2, '-')}</div>
</Card>
<Unit> + </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(getAmount(
data?.comprehensive?.valleyAmount || "0",
data?.tenement?.feeType === 3 ? "0" : (data?.comprehensive?.lossValley || "0"),
data?.comprehensive?.refundValley || "0",
data?.comprehensive?.priceValley || "0",
), 2, '-')}</div>
</Card>
<Unit> = </Unit>
<Card>
<h4 tw='mt-1 mb-1'> </h4>
<div> {outputWithPrecision(data?.comprehensive?.total, 2, '-')} &nbsp;&nbsp;</div>
</Card>
</div>
{/*<div tw='flex flex-row items-center' style={{height: '100%', flex: 1}}>*/}
{/* <Unit> = </Unit>*/}
{/* <Card style={{height: 200}}>*/}
{/* <h4 tw='mt-1 mb-1'> 本期总电费(元): </h4>*/}
{/* <div> {outputWithPrecision(data?.comprehensive?.total, 2, '-')} </div>*/}
{/* </Card>*/}
{/*</div>*/}
</div>
)
}
</div>
<div>
<div tw='mt-4'>
<Divider tw='mt-2 mb-4 flex flex-col w-full'/>
</div>
<div tw="mt-3" style={{fontSize: 12}}>
<table border={1} width={"100%"} cellSpacing="0">
<thead>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
{/* <td>线损占比</td> */}
{
data?.tenement?.feeType === 3 ? null : (
<td>线</td>
)
}
<td>退</td>
<td></td>
<td></td>
</tr>
</thead>
<tbody> <tbody>
{renderTable()} {renderTable()}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</ContentArea> </ContentArea>
</div> </div>
</> </>
); );
}; };

View File

@ -304,6 +304,10 @@ export interface TenementInfo {
phone: null | string; phone: null | string;
/** 简称 */ /** 简称 */
shortName: null | string; shortName: null | string;
/** 收费类型 */
feeType: number;
/** 限电状态 */
exceptionalCase: number;
} }
export interface MeterByTenement { export interface MeterByTenement {

View File

@ -170,6 +170,174 @@ export interface ReportTenement extends TenementInfo {
consumptionAmount: string consumptionAmount: string
} }
export interface ReportTenementMeters extends Meter04KvInfo, PooledSumDetail, ReportMeterUnit{
finalAmount: string,
/**
*
*/
address: null | string;
/**
*
*/
adjustPooled: string;
/**
*
*/
attachedAt: string;
/**
*
*/
basicPooled: string;
/**
*
*/
buildingName: null | string;
/**
*
*/
code: string;
/**
*
*/
currentTermReadings: string;
/**
*
*/
detachedAt: null | string;
/**
*
*/
displayRatio: string;
/**
*
*/
enabled: boolean;
/**
* 2312
*/
endNumber: number;
/**
*
*/
finalTotal: string;
/**
* id
*/
id: string;
/**
*
*/
lastTermReadings: string;
/**
* 线
*/
lossFlat: string;
/**
* 线
*/
lossFlatFee: string;
/**
* 线
*/
lossPeak: string;
/**
* 线
*/
lossPeakFee: string;
/**
* 线
*/
lossPooled: string;
/**
* 线
*/
lossSharp: string;
/**
* 线
*/
lossSharpFee: string;
/**
* 线
*/
lossValley: string;
/**
* 线
*/
lossValleyFee: string;
/**
*
*/
meterNo: string;
/**
*
*/
nestMeter: ReportTenementMeters[];
/**
*
*/
nestOverall: string;
/**
*
*/
onFloor: null | string;
/**
* ID
*/
parkId: string;
/**
*
*/
peak: Consumption;
/**
*
*/
publicAmount: string;
/**
*
*/
publicPooled: string;
/**
*
*/
ratio: string;
/**
* 退
*/
refundAmount: string;
/**
*
*/
refundFlat: string;
/**
*
*/
refundPeak: string;
/**
*
*/
refundSharp: string;
/**
*
*/
refundValley: string;
/**
*
*/
seq: number;
/**
* 2312
*/
startNumber: number;
/**
* 012
*/
type: number;
[property: string]: any;
}
/** /**
* *
*/ */
@ -177,22 +345,7 @@ export interface ReportTenementDetail {
park: SimpleParkInfo; park: SimpleParkInfo;
tenement: TenementInfo; tenement: TenementInfo;
comprehensive: TenementComprehensiveDetail; comprehensive: TenementComprehensiveDetail;
meters: (Meter04KvInfo & meters: ReportTenementMeters[];
PooledSumDetail &
ReportMeterUnit & { /** 合计电费 */ finalTotal: string; loss: Consumption } & {
/** 首次抄表时间 */
currentTermReadings: string,
/** 最近抄表时间 */
lastTermReadings: string,
}
& {
startNumber: number,
endNumber: number,
displayRatio: number,
publicAmount: string,
refundAmount: string,
}
)[];
pooled: (Meter04KvInfo & ReportMeterUnit)[]; pooled: (Meter04KvInfo & ReportMeterUnit)[];
@ -226,6 +379,126 @@ export type TenementComprehensiveDetail = PooledSumDetail & {
endDate: string; endDate: string;
/** 本期公摊电量 */ /** 本期公摊电量 */
publicAmount: number publicAmount: number
/**
*/
sharpAmount: string;
/** 峰电量 */
peakAmount: string;
/** 平电量 */
flatAmount: string;
/** 谷电量 */
valleyAmount: string;
/**
* 线
*/
lossFlat: string;
/**
* 线
*/
lossFlatFee: string;
/**
* 线
*/
lossPeak: string;
/**
* 线
*/
lossPeakFee: string;
/**
* 线
*/
lossPooled: string;
/**
* 线
*/
lossSharp: string;
/**
* 线
*/
lossSharpFee: string;
/**
* 线
*/
lossValley: string;
/**
* 退
*/
refundSharp: string;
/**
* 退
*/
refundPeak: string;
/**
* 退
*/
refundFlat: string;
/**
* 退
*/
refundValley: string;
/**
*
*/
priceSharp: string;
/**
*
*/
pricePeak: string;
/**
*
*/
priceFlat: string;
/**
*
*/
priceValley: string;
refundOverall?: string
poolSharp?: string
poolValley?: string
poolPeak?: string
poolFlat?: string
/**
*
*/
finalFlatFee: string;
/**
*
*/
finalPeakFee: string;
/**
*
*/
finalSharpFee: string;
/**
*
*/
finalValleyFee: string;
/**
*
*/
flatFee: string;
/**
* 线
*/
lossValleyFee: string;
/**
*
*/
peakFee: string;
/**
*
*/
sharpFee: string;
/**
*
*/
valleyFee: string;
/**
*
*/
finalAmount: string;
finalLossFee: string;
}; };
/** /**

View File

@ -35,8 +35,8 @@ export function throttle(fn: Function, delay: number) {
} }
// 获取列表中序号 // 获取列表中序号
export function getIndex(page: number, index: number) : string { export function getIndex(page: number, size: number, index: number) : string {
return `${(page - 1) * 20 + Number(index) + 1}` return `${(page - 1) * size + Number(index) + 1}`
} }
interface Response { interface Response {
@ -75,4 +75,12 @@ export function getFetchFileList(files: FileList[]) : string[] {
return files.filter(item => item.status === "done").map(item => { return files.filter(item => item.status === "done").map(item => {
return item?.response?.data return item?.response?.data
}) })
}
export function getRoundNumber(number: number) : string {
return (Math.round(number * 100) / 100).toFixed(2)
}
export function getFileName(url: string) : string {
return url.substring(url.lastIndexOf('/') + 1);
} }