储能智慧云平台web端
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  1. <template>
  2. <div>
  3. <div class="title">
  4. <el-select
  5. v-model="Singlevalue"
  6. collapse-tags
  7. :placeholder="$t('overview.SelectPlant')"
  8. popper-class="custom-header"
  9. :max-collapse-tags="1"
  10. class="Space_content"
  11. size="large"
  12. >
  13. <el-option
  14. v-for="(item, index) in cities"
  15. :key="index"
  16. :label="item.stationName"
  17. :value="item.id"
  18. @click="onselect(item)"
  19. />
  20. <template #prefix>
  21. {{ (cities.find(s => s.id === Singlevalue) || {}).stationName }}
  22. </template>
  23. </el-select>
  24. </div>
  25. <el-row :gutter="20">
  26. <el-col :span="6">
  27. <el-card>
  28. <div class="grid-content ep-bg-purple">
  29. <div class="overview_title1">
  30. <div class="overview_title_name">{{ $t("overview.TodayEnergy") }}</div>
  31. </div>
  32. <div class="overview_title">
  33. <div class="overview_titlename">
  34. {{ formatAmountkwh(multiStation.dayImportKwh) }}
  35. <span class="overview_unit"> {{ formatCompany(multiStation.dayImportKwh) }}</span>
  36. </div>
  37. <div class="overview_img1">
  38. <img src="../../assets/images/charging.png" alt="站点" />
  39. </div>
  40. </div>
  41. <div class="overview_line" v-if="multiStation.importKwhDiffYDay > 0">
  42. {{ $t("overview.upperYesterday") }}: {{ formatAmountkwh_(multiStation.importKwhDiffYDay) }}
  43. {{ formatCompany_(multiStation.importKwhDiffYDay) }}
  44. </div>
  45. <div class="overview_line" v-else>
  46. {{ $t("overview.belowYesterday") }}: {{ formatAmountkwh_(multiStation.importKwhDiffYDay) }}
  47. {{ formatCompany_(multiStation.importKwhDiffYDay) }}
  48. </div>
  49. <el-divider />
  50. <div class="overview_line">
  51. {{ $t("overview.Charging") }}: {{ formatAmountkwh(multiStation.monthImportKwh) }}
  52. {{ formatCompany(multiStation.monthImportKwh) }} | {{ $t("overview.TotalCharging") }}:
  53. {{ formatAmountkwh(multiStation.accumulativeImportKwh) }}
  54. {{ formatCompany(multiStation.accumulativeImportKwh) }}
  55. </div>
  56. </div>
  57. </el-card>
  58. </el-col>
  59. <el-col :span="6">
  60. <el-card>
  61. <div class="grid-content ep-bg-purple">
  62. <div class="overview_title1">
  63. <div class="overview_title_name">{{ $t("overview.TodayDischarge") }}</div>
  64. </div>
  65. <div class="overview_title">
  66. <div class="overview_titlename">
  67. {{ formatAmountkwh(multiStation.dayExportKwh) }}
  68. <span class="overview_unit"> {{ formatCompany(multiStation.dayExportKwh) }}</span>
  69. </div>
  70. <div class="overview_img2">
  71. <img src="../../assets/images/discharge.png" alt="站点" />
  72. </div>
  73. </div>
  74. <div class="overview_line" v-if="multiStation.exportKwhDiffYDay > 0">
  75. {{ $t("overview.upperYesterday") }}: {{ formatAmountkwh_(multiStation.exportKwhDiffYDay) }}
  76. {{ formatCompany_(multiStation.exportKwhDiffYDay) }}
  77. </div>
  78. <div class="overview_line" v-else>
  79. {{ $t("overview.belowYesterday") }}: {{ formatAmountkwh_(multiStation.exportKwhDiffYDay) }}
  80. {{ formatCompany_(multiStation.exportKwhDiffYDay) }}
  81. </div>
  82. <el-divider />
  83. <div class="overview_line">
  84. {{ $t("overview.Discharge") }}: {{ formatAmountkwh(multiStation.monthExportKwh) }}
  85. {{ formatCompany(multiStation.monthExportKwh) }} | {{ $t("overview.discharge") }}:
  86. {{ formatAmountkwh(multiStation.accumulativeExportKwh) }}
  87. {{ formatCompany(multiStation.accumulativeExportKwh) }}
  88. </div>
  89. </div>
  90. </el-card>
  91. </el-col>
  92. <el-col :span="6">
  93. <el-card>
  94. <div class="grid-content ep-bg-purple">
  95. <div class="overview_title1">
  96. <div class="overview_title_name">{{ $t("overview.TodayRevenue") }}</div>
  97. </div>
  98. <div class="overview_title">
  99. <div class="overview_titlename">
  100. {{ formatAmount(multiStation.todayProfit) }}
  101. <span class="overview_unit">{{ formatAmounts(multiStation.todayProfit) }}</span>
  102. </div>
  103. <div class="overview_img3">
  104. <img src="../../assets/images/qian.png" alt="站点" />
  105. </div>
  106. </div>
  107. <div class="overview_line" v-if="multiStation.profitDiffYDay > 0">
  108. {{ $t("overview.upperYesterday") }}: {{ formatAmount1(multiStation.profitDiffYDay) }}
  109. {{ formatAmounts2(multiStation.profitDiffYDay) }}
  110. </div>
  111. <div class="overview_line" v-else>
  112. {{ $t("overview.belowYesterday") }}: {{ formatAmount1(multiStation.profitDiffYDay) }}
  113. {{ formatAmounts2(multiStation.profitDiffYDay) }}
  114. </div>
  115. <el-divider />
  116. <div class="overview_line">
  117. {{ $t("overview.MTDRevenue") }}: {{ formatAmount(multiStation.monthProfit) }}
  118. {{ formatAmounts(multiStation.monthProfit) }} | {{ $t("overview.TotalRevenue") }}:
  119. {{ formatAmount(multiStation.totalProfit) }}
  120. {{ formatAmounts(multiStation.totalProfit) }}
  121. </div>
  122. </div>
  123. </el-card>
  124. </el-col>
  125. <el-col :span="6">
  126. <el-card>
  127. <div class="grid-content ep-bg-purple">
  128. <div class="overview_title1">
  129. <div class="overview_title_name">{{ $t("overview.TotalDevices") }}</div>
  130. </div>
  131. <div class="overview_title">
  132. <div class="overview_titlename">
  133. {{ multiStation.stationTotalCount }} <span class="overview_unit">{{ $t("type") == "zh" ? "个" : "" }}</span>
  134. </div>
  135. <div class="overview_img">
  136. <img src="../../assets/images/gu1.png" alt="站点" />
  137. </div>
  138. </div>
  139. <div class="overview_line">
  140. {{ $t("overview.Online") }} {{ multiStation.stationOnlineCount }} {{ $t("type") == "zh" ? "个" : "" }} \
  141. {{ $t("overview.Offline") }} {{ multiStation.stationOfflineCount }} {{ $t("type") == "zh" ? "个" : "" }}
  142. </div>
  143. <el-divider />
  144. <div class="overview_line">
  145. {{ $t("overview.InstalledPower") }}: {{ formatAmountkwh(multiStation.installedPower) }}
  146. {{ formatCompany1(multiStation.installedPower) }} | {{ $t("overview.InstalledCapacity") }}:
  147. {{ formatAmountkwh(multiStation.installedCap) }}
  148. {{ formatCompany(multiStation.installedCap) }}
  149. </div>
  150. </div>
  151. </el-card>
  152. </el-col>
  153. </el-row>
  154. <el-row :gutter="20">
  155. <el-col :span="18">
  156. <el-card>
  157. <div class="grid_div grid-content ep-bg-purple">
  158. <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
  159. <el-tab-pane :label="$t('overview.RevenueAnalytics')" name="first"></el-tab-pane>
  160. <el-tab-pane :label="$t('overview.DischargeStatistics')" name="second"></el-tab-pane>
  161. <div class="grid_div1">
  162. <div ref="baroption" id="baroption"></div>
  163. </div>
  164. </el-tabs>
  165. <div class="grid_divright">
  166. <!-- <div :class="recentlytype == 7 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(7)">近7日</div>
  167. <div :class="recentlytype == 31 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(31)">近31日</div>
  168. <div :class="recentlytype == 360 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(360)">近12月</div> -->
  169. <el-date-picker
  170. v-model="value2"
  171. :type="timetype1"
  172. :shortcuts="shortcuts1"
  173. :format="format1"
  174. :value-format="format1"
  175. :start-placeholder="$t('overview.StartTime')"
  176. :end-placeholder="$t('overview.EndTime')"
  177. :default-value="value2"
  178. :disabled-date="pickerOptions"
  179. size="large"
  180. @change="onhandleClick"
  181. :default-time="defaultTime2"
  182. />
  183. <el-select
  184. v-model="daymonthyearvalue1"
  185. :placeholder="$t('overview.SelectDate')"
  186. size="large"
  187. style="width: 80px"
  188. @change="getdaymonthyear1"
  189. >
  190. <el-option v-for="item in daymonthyear1" :key="item.value" :label="item.label" :value="item.value" />
  191. </el-select>
  192. </div>
  193. </div>
  194. </el-card>
  195. </el-col>
  196. <el-col :span="6">
  197. <el-card>
  198. <div class="grid-content ep-bg-purple">
  199. <div class="grid_right">
  200. <div>{{ $t("overview.PlantInformation") }}</div>
  201. <div class="grid_right1" @click="details()">{{ $t("overview.ViewDetails") }}</div>
  202. </div>
  203. <!-- <div id="gridpiechart">-||-</div> -->
  204. <div class="gridpiechart">
  205. <img class="gridpiechartimg" :src="stationinfodata.absoluteStationPicUrl" alt="" />
  206. </div>
  207. <div class="gridpiechartname">{{ stationinfodata.stationName }}</div>
  208. <div class="gridpiechartdiv">
  209. <div class="gridpiechartnameright">{{ $t("overview.TotalInstalledCapacity") }}</div>
  210. <div class="gridpiechartnameleft">{{ stationinfodata.installedCap }} kWh</div>
  211. </div>
  212. <div class="gridpiechartdiv">
  213. <div class="gridpiechartnameright">{{ $t("overview.RatedPower") }}</div>
  214. <div class="gridpiechartnameleft">{{ stationinfodata.installedPower }} MW</div>
  215. </div>
  216. <div class="gridpiechartdiv">
  217. <div class="gridpiechartnameright">{{ $t("overview.CommissioningDate") }}</div>
  218. <div class="gridpiechartnameleft">{{ stationinfodata.operationDate }}</div>
  219. </div>
  220. <div class="gridpiechartdiv">
  221. <div class="gridpiechartnameright">{{ $t("overview.PlantLocation") }}</div>
  222. <div class="gridpiechartnameleft1">
  223. <el-icon><Location /></el-icon>&nbsp;<el-tooltip
  224. class="box-item"
  225. effect="dark"
  226. :content="stationinfodata.detailedaddress"
  227. placement="left-start"
  228. >
  229. {{ stationinfodata.detailedaddress }}
  230. </el-tooltip>
  231. </div>
  232. </div>
  233. </div>
  234. </el-card>
  235. </el-col>
  236. </el-row>
  237. <div class="middle">
  238. <el-card style="width: 100%">
  239. <div class="middleleft">
  240. <div class="middlelefttop">
  241. <div>{{ $t("overview.CompositePower") }}</div>
  242. <div class="middle_divright">
  243. <!-- <div :class="timedays == 7 ? 'middle_divright_1' : 'middle_divright_2'" @click="oncomprehen(7)">近7日</div>
  244. <div :class="timedays == 31 ? 'middle_divright_1' : 'middle_divright_2'" @click="oncomprehen(31)">近31日</div>
  245. <div :class="timedays == 360 ? 'middle_divright_1' : 'middle_divright_2'" @click="oncomprehen(360)">近12月</div> -->
  246. <el-date-picker
  247. v-model="timedayslist"
  248. :type="pickertype"
  249. :shortcuts="shortcuts"
  250. :format="format"
  251. :value-format="format"
  252. unlink-panels
  253. size="large"
  254. :start-placeholder="$t('overview.StartTime')"
  255. :end-placeholder="$t('overview.EndTime')"
  256. :default-value="timedayslist"
  257. :disabled-date="pickerOptions"
  258. @change="onpowerblur"
  259. />
  260. <!-- <el-select
  261. v-model="daymonthyearvalue"
  262. placeholder="选择日期"
  263. size="large"
  264. style="width: 80px"
  265. @change="getdaymonthyear"
  266. >
  267. <el-option v-for="item in daymonthyear" :key="item.value" :label="item.label" :value="item.value" />
  268. </el-select> -->
  269. </div>
  270. </div>
  271. <div class="middleleftchart" ref="comprehensive"></div>
  272. </div>
  273. </el-card>
  274. </div>
  275. <el-card>
  276. <template #header>
  277. <div class="card-header">
  278. <span>{{ $t("overview.DeviceList") }}</span>
  279. </div>
  280. </template>
  281. <div class="cardtable">
  282. <div>{{ $t("overview.CommunicationStatus") }}:</div>
  283. &emsp;
  284. <el-select v-model="onlineStatus" :placeholder="$t('overview.EndTime')" size="large" style="width: 240px">
  285. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  286. </el-select>
  287. &emsp;
  288. <el-input v-model="modelinput" style="width: 240px" :placeholder="$t('overview.DeviceID')" size="large" />
  289. &emsp;
  290. <el-button type="primary" size="large" color="#0052d9" @click="query(0)">{{ $t("overview.Query") }}</el-button>
  291. <el-button size="large" @click="query(1)">{{ $t("overview.Reset") }}</el-button>
  292. </div>
  293. <el-table :data="tableData.records" style="width: 100%" border :scrollbar-always-on="true">
  294. <el-table-column type="index" :label="$t('overview.SNo')" width="60" />
  295. <el-table-column prop="eid" :label="$t('overview.DeviceID')" width="160" :show-overflow-tooltip="true" />
  296. <el-table-column prop="emsDeviceId" :label="$t('overview.DeviceName')" width="160" :show-overflow-tooltip="true" />
  297. <el-table-column prop="onlineStatus" :label="$t('overview.OnlineStatus')" width="160">
  298. <template #default="scope">
  299. {{ scope.row.onlineStatus == 0 ? $t("overview.Offline") : $t("overview.Online") }}
  300. </template>
  301. </el-table-column>
  302. <el-table-column prop="dayImportKwh" :label="$t('overview.TodayCharging')" width="160" />
  303. <el-table-column prop="dayExportKwh" :label="$t('overview.TodaysDischarge')" width="160" />
  304. <el-table-column prop="accumulativeImportKwh" :label="$t('overview.TotalCharged')" width="160" />
  305. <el-table-column prop="accumulativeExportKwh" :label="$t('overview.TotalDischarged')" width="160" />
  306. <el-table-column prop="soc" label="SOC(%)" width="160" />
  307. <el-table-column prop="todayAlarmCount" :label="$t('overview.Maintenance')" align="center" width="160">
  308. <template #default="scope">
  309. {{ scope.row.todayAlarmCount == null ? "-" : scope.row.todayAlarmCount }}
  310. </template>
  311. </el-table-column>
  312. <el-table-column prop="gridActivePower" :label="$t('overview.GridActivePower')" width="160" />
  313. <el-table-column prop="storageActivePower" :label="$t('overview.ESSActivePower')" width="160" />
  314. <el-table-column prop="loadActivePower" :label="$t('overview.LoadActivePower')" width="160" />
  315. </el-table>
  316. <div class="example_block">
  317. <Pagination :pageable="pageable" :handle-size-change="handleSizeChange" :handle-current-change="handleCurrentChange" />
  318. <!-- <el-pagination layout="prev, pager, next" :total="tableData.total" @change="changemultiStationpagebase" /> -->
  319. </div>
  320. </el-card>
  321. <el-dialog v-model="dialogVisible" title="查看电站" width="800" :before-close="handleClose">
  322. <div class="dialog">
  323. <div :class="informationtype == 1 ? 'information' : 'more'" @click="oninformation">
  324. {{ $t("overview.BasicInformation") }}
  325. </div>
  326. <div :class="informationtype == 2 ? 'information' : 'more'" @click="onmoreinformation">
  327. {{ $t("overview.MoreDetails") }}
  328. </div>
  329. </div>
  330. <div v-if="informationtype == 1">
  331. <div class="more_img">
  332. <div class="more_name">{{ $t("overview.PlantPhotos") }}:</div>
  333. <img class="dialogimg" :src="stationinfodata.absoluteStationPicUrl" alt="" />
  334. </div>
  335. <div class="dialog_title">
  336. <div class="more_name">{{ $t("overview.PlantName") }}:</div>
  337. <div class="more_theme">{{ stationinfodata.stationName }}</div>
  338. </div>
  339. <div class="dialog_title">
  340. <div class="more_name">{{ $t("overview.InstalledPower") }}:</div>
  341. <div class="more_theme">{{ stationinfodata.installedPower }}MW</div>
  342. </div>
  343. <div class="dialog_title">
  344. <div class="more_name">{{ $t("overview.InstalledCapacity") }}:</div>
  345. <div class="more_theme">{{ stationinfodata.installedCap }}kWh</div>
  346. </div>
  347. <div class="dialog_title">
  348. <div class="more_name">{{ $t("overview.PlantLocation") }}:</div>
  349. <div class="more_theme">{{ stationinfodata.province }}</div>
  350. </div>
  351. <div class="dialog_title">
  352. <div class="more_name">{{ $t("overview.CommissioningDate") }}:</div>
  353. <div class="more_theme">{{ stationinfodata.operationDate }}</div>
  354. </div>
  355. <div class="dialog_title">
  356. <div class="more_name">{{ $t("overview.ContactNumber") }}:</div>
  357. <div class="more_theme">{{ stationinfodata.contactPhone }}</div>
  358. </div>
  359. </div>
  360. <div v-if="informationtype == 2">
  361. <div class="dialog_title">
  362. <div class="more_name">{{ $t("overview.InstallationPhotos") }}:</div>
  363. <div class="more_theme">-</div>
  364. </div>
  365. <div class="dialog_title">
  366. <div class="more_name">{{ $t("overview.GridConnectionInfo") }}:</div>
  367. <div class="more_theme">-</div>
  368. </div>
  369. <div class="dialog_title">
  370. <div class="more_name">{{ $t("overview.TransformerSpecifications") }}:</div>
  371. <div class="more_theme">-</div>
  372. </div>
  373. <div class="dialog_title">
  374. <div class="more_name">{{ $t("overview.TransformerCapacity") }}:</div>
  375. <div class="more_theme">-</div>
  376. </div>
  377. <div class="dialog_title">
  378. <div class="more_name">{{ $t("overview.Installer") }}:</div>
  379. <div class="more_theme">-</div>
  380. </div>
  381. <div class="dialog_title">
  382. <div class="more_name">{{ $t("overview.InstallerContact") }}:</div>
  383. <div class="more_theme">-</div>
  384. </div>
  385. </div>
  386. <div class="dialog_footer">
  387. <el-button @click="dialogVisible = false" size="large">{{ $t("overview.Close") }}</el-button>
  388. </div>
  389. </el-dialog>
  390. </div>
  391. </template>
  392. <!-- -->
  393. <script setup lang="ts">
  394. import { onMounted, Ref, ref } from "vue";
  395. import type { TabsPaneContext } from "element-plus";
  396. import * as echarts from "echarts";
  397. import Pagination from "@/components/ProTable/components/Pagination.vue";
  398. import {
  399. getmuitiStation,
  400. emsSystempage,
  401. stationstationName,
  402. postsexportKwh,
  403. singlestationday,
  404. singlestationyearMonth,
  405. singlestationchargingMonth,
  406. overallEfficiencyday,
  407. // overallEfficiencyyearMonth,
  408. Stationinfo,
  409. singlestationdayMonth,
  410. postsexportKwhMonth
  411. } from "@/api/home/Multisite";
  412. import { Station } from "@/api/interface";
  413. import { useRoute } from "vue-router";
  414. const route = useRoute();
  415. const multiStation = ref();
  416. const activeName = ref("first");
  417. const value2 = ref();
  418. const tableData = ref();
  419. const currentDate = ref();
  420. const baroption = ref();
  421. const modelinput = ref();
  422. const pageable = ref({
  423. ps: 10,
  424. pn: 1,
  425. total: 0
  426. });
  427. // 选择站点
  428. const Singlevalue = ref();
  429. const Singledata = ref([]);
  430. const onselect = (val: any) => {
  431. activeName.value = "first";
  432. Singledata.value = val.id;
  433. getStationinfo();
  434. // gatsinglestationday();
  435. postmultiStationpagebaseInfo();
  436. onhandleClick();
  437. getsite();
  438. onpowerblur();
  439. };
  440. const cities: Ref<Station.todo[]> = ref([]);
  441. const onlineStatus = ref("");
  442. // const recentlytype = ref(7);
  443. const tabpropslabel = ref("收益统计");
  444. const options = ref([
  445. {
  446. value: "",
  447. label: "全部"
  448. },
  449. {
  450. value: "1",
  451. label: "在线"
  452. },
  453. {
  454. value: "0",
  455. label: "离线"
  456. }
  457. ]);
  458. const poststationstationName = async () => {
  459. const { data } = await stationstationName({});
  460. if (route.query.powerId) {
  461. Singlevalue.value = route.query.powerId;
  462. } else {
  463. Singlevalue.value = data[0].id;
  464. }
  465. cities.value = data;
  466. getsite();
  467. getStationinfo();
  468. gatsinglestationday();
  469. postmultiStationpagebaseInfo();
  470. onpowerblur();
  471. // oncomprehen(7);
  472. };
  473. // 选择站点
  474. const getsite = async () => {
  475. console.log(Singlevalue.value);
  476. const { data } = await getmuitiStation(Singlevalue.value);
  477. multiStation.value = data;
  478. };
  479. // 站点信息 查看详细
  480. const stationinfodata = ref();
  481. const getStationinfo = async () => {
  482. const { data } = await Stationinfo({}, Singlevalue.value);
  483. stationinfodata.value = data;
  484. };
  485. const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
  486. return time.getTime(new Date()) > Date.now();
  487. };
  488. const defaultTime2: [Date, Date] = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 56, 56)]; // '00:00:00', '23:56:56'
  489. // 查询最近数据
  490. const getdaymonthyear1 = async (value: any) => {
  491. daymonthyearvalue.value = value;
  492. if (value == 1) {
  493. timetype1.value = "daterange";
  494. format1.value = "YYYY-MM-DD";
  495. shortcuts1.value = [
  496. {
  497. text: "过去7天",
  498. value: () => {
  499. const end = new Date();
  500. const start = new Date();
  501. start.setDate(start.getDate() - 7);
  502. return [start, end];
  503. }
  504. },
  505. {
  506. text: "过去1个月",
  507. value: () => {
  508. const end = new Date();
  509. const start = new Date();
  510. start.setMonth(start.getMonth() - 1);
  511. return [start, end];
  512. }
  513. },
  514. {
  515. text: "过去3个月",
  516. value: () => {
  517. const end = new Date();
  518. const start = new Date();
  519. start.setMonth(start.getMonth() - 3);
  520. return [start, end];
  521. }
  522. }
  523. ];
  524. const today = new Date();
  525. const currentDate = today.toISOString().split("T")[0];
  526. const sevenDaysAgoDate = new Date(today);
  527. sevenDaysAgoDate.setDate(today.getDate() - 7);
  528. // const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
  529. const year = sevenDaysAgoDate.getFullYear();
  530. const month = String(sevenDaysAgoDate.getMonth() + 1).padStart(2, "0"); // Months are zero-based
  531. const day = String(sevenDaysAgoDate.getDate()).padStart(2, "0");
  532. // Format the date as "YYYY-MM-DD"
  533. const formattedDate = `${year}-${month}-${day}`;
  534. value2.value = [formattedDate, currentDate];
  535. // getreportpowerday();
  536. } else if (value == 2) {
  537. const today = new Date();
  538. const currentDate = today.toISOString().split("T")[0];
  539. const currentYearMonth = currentDate.slice(0, 7);
  540. value2.value = [currentYearMonth, currentYearMonth];
  541. // getreportpoweryearMonth();
  542. timetype1.value = "monthrange";
  543. format1.value = "YYYY-MM";
  544. shortcuts1.value = [
  545. {
  546. text: "本月",
  547. value: () => {
  548. return [new Date(), new Date()];
  549. }
  550. },
  551. {
  552. text: "过去6个月",
  553. value: () => {
  554. const end = new Date();
  555. const start = new Date();
  556. start.setMonth(start.getMonth() - 6);
  557. return [start, end];
  558. }
  559. },
  560. {
  561. text: "今年",
  562. value: () => {
  563. const end = new Date();
  564. const start = new Date(new Date().getFullYear(), 0);
  565. return [start, end];
  566. }
  567. }
  568. ];
  569. } else {
  570. const today = new Date();
  571. const currentDate = today.toISOString().split("T")[0];
  572. // 获取去年同月的日期
  573. value2.value = [currentDate.substring(0, 4), currentDate.substring(0, 4)];
  574. console.log(value2.value);
  575. timetype1.value = "yearrange";
  576. format1.value = "YYYY";
  577. shortcuts1.value = [
  578. {
  579. text: "今年",
  580. value: () => {
  581. return [new Date(), new Date()];
  582. }
  583. },
  584. {
  585. text: "过去1年",
  586. value: () => {
  587. const end = new Date();
  588. const start = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
  589. return [start, end];
  590. }
  591. },
  592. {
  593. text: "过去2年",
  594. value: () => {
  595. const start = new Date();
  596. const end = new Date(new Date().setFullYear(new Date().getFullYear() - 2));
  597. return [start, end];
  598. }
  599. }
  600. ];
  601. }
  602. if (tabpropslabel.value == "收益统计") {
  603. if (daymonthyearvalue.value == 1) {
  604. gatsinglestationday();
  605. } else if (daymonthyearvalue.value == 2) {
  606. getsinglestationdayMonth();
  607. } else {
  608. gatsinglestationyearMonth();
  609. }
  610. } else {
  611. if (daymonthyearvalue.value == 1) {
  612. getmultiStatiopower();
  613. } else if (daymonthyearvalue.value == 2) {
  614. getpostsexportKwhMonth();
  615. } else {
  616. getsinglestationchargingMonth();
  617. }
  618. }
  619. };
  620. // const recently = (val: any) => {
  621. // // 获取当前日期
  622. // recentlytype.value = val;
  623. // const today = new Date();
  624. // const currentDate = today.toLocaleDateString();
  625. // // 获取过去 7 天的日期
  626. // const sevenDaysAgoDate = new Date(today);
  627. // sevenDaysAgoDate.setDate(today.getDate() - 7);
  628. // const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
  629. // // 获取过去 31 天的日期
  630. // const thirtyOneDaysAgoDate = new Date(today);
  631. // thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
  632. // const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
  633. // // 获取去年同月的日期
  634. // const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
  635. // const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
  636. // if (tabpropslabel.value == "收益统计") {
  637. // if (val == 7) {
  638. // value2.value = [sevenDaysAgo, currentDate];
  639. // gatsinglestationday();
  640. // } else if (val == 31) {
  641. // value2.value = [thirtyOneDaysAgo, currentDate];
  642. // gatsinglestationday();
  643. // } else {
  644. // value2.value = [lastYearSameMonth, currentDate];
  645. // gatsinglestationyearMonth();
  646. // }
  647. // } else {
  648. // if (val == 7) {
  649. // value2.value = [sevenDaysAgo, currentDate];
  650. // getmultiStatiopower();
  651. // } else if (val == 31) {
  652. // value2.value = [thirtyOneDaysAgo, currentDate];
  653. // getmultiStatiopower();
  654. // } else {
  655. // value2.value = [lastYearSameMonth, currentDate];
  656. // getsinglestationchargingMonth();
  657. // }
  658. // }
  659. // };
  660. // 切换收益统计与充放电统计
  661. const handleClick = (tab: TabsPaneContext) => {
  662. tabpropslabel.value = tab.props.label;
  663. if (tabpropslabel.value == "收益统计") {
  664. if (daymonthyearvalue.value == 1) {
  665. gatsinglestationday();
  666. } else if (daymonthyearvalue.value == 2) {
  667. getsinglestationdayMonth();
  668. } else {
  669. gatsinglestationyearMonth();
  670. }
  671. } else {
  672. if (daymonthyearvalue.value == 1) {
  673. getmultiStatiopower();
  674. } else if (daymonthyearvalue.value == 2) {
  675. getpostsexportKwhMonth();
  676. } else {
  677. getsinglestationchargingMonth();
  678. }
  679. }
  680. };
  681. const onhandleClick = () => {
  682. if (tabpropslabel.value == "收益统计") {
  683. if (daymonthyearvalue.value == 1) {
  684. gatsinglestationday();
  685. } else if (daymonthyearvalue.value == 2) {
  686. getsinglestationdayMonth();
  687. } else {
  688. gatsinglestationyearMonth();
  689. }
  690. } else {
  691. if (daymonthyearvalue.value == 1) {
  692. getmultiStatiopower();
  693. } else if (daymonthyearvalue.value == 2) {
  694. getpostsexportKwhMonth();
  695. } else {
  696. getsinglestationchargingMonth();
  697. }
  698. }
  699. };
  700. // 收益统计----日
  701. const listday = ref([
  702. {
  703. ymd: "2025-02-12",
  704. profit: 1
  705. },
  706. {
  707. ymd: "2025-02-13",
  708. profit: 1
  709. },
  710. {
  711. ymd: "2025-02-14",
  712. profit: 1
  713. },
  714. {
  715. ymd: "2025-02-15",
  716. profit: 1
  717. },
  718. {
  719. ymd: "2025-02-16",
  720. profit: 1
  721. },
  722. {
  723. ymd: "2025-02-17",
  724. profit: 1
  725. },
  726. {
  727. ymd: "2025-02-18",
  728. profit: 1
  729. }
  730. ]);
  731. const gatsinglestationday = async () => {
  732. const { data } = await singlestationday({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
  733. const dates = [["product", "收益"]];
  734. if (data.list.length < 1) {
  735. data.list.push(...listday.value);
  736. }
  737. for (let index = 0; index < data.list.length; index++) {
  738. dates.push([data.list[index].ymd, data.list[index].profit.toFixed()]);
  739. }
  740. const profits = [{ type: "bar" }];
  741. baroptionchart(dates, profits, "收益/元");
  742. };
  743. // 收益统计----月
  744. const getsinglestationdayMonth = async () => {
  745. const { data } = await singlestationdayMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
  746. const dates = [["product", "收益"]];
  747. if (data.list.length < 1) {
  748. data.list.push(...listday.value);
  749. }
  750. for (let index = 0; index < data.list.length; index++) {
  751. dates.push([data.list[index].ymd, data.list[index].profit.toFixed()]);
  752. }
  753. const profits = [{ type: "bar" }];
  754. baroptionchart(dates, profits, "收益/元");
  755. };
  756. // 收益统计------年份
  757. const gatsinglestationyearMonth = async () => {
  758. const { data } = await singlestationyearMonth(
  759. { startYearMonth: value2.value[0], endYearMonth: value2.value[1] },
  760. Singlevalue.value
  761. );
  762. const dates = [["product", "收益"]];
  763. if (data.list.length < 1) {
  764. data.list.push(...listday.value);
  765. }
  766. for (let index = 0; index < data.list.length; index++) {
  767. dates.push([data.list[index].ymd, data.list[index].profit.toFixed()]);
  768. }
  769. const profits = [{ type: "bar" }];
  770. baroptionchart(dates, profits, "收益/元");
  771. };
  772. // 充放电统计图
  773. const TotalKwh = ref([
  774. {
  775. ymd: "2025-02-12",
  776. chargeTotal: 1,
  777. dischargeTotal: 0.5
  778. },
  779. {
  780. ymd: "2025-02-13",
  781. chargeTotal: 1,
  782. dischargeTotal: 0.5
  783. },
  784. {
  785. ymd: "2025-02-14",
  786. chargeTotal: 1,
  787. dischargeTotal: 0.5
  788. },
  789. {
  790. ymd: "2025-02-15",
  791. chargeTotal: 1,
  792. dischargeTotal: 0.5
  793. },
  794. {
  795. ymd: "2025-02-16",
  796. chargeTotal: 1,
  797. dischargeTotal: 0.5
  798. },
  799. {
  800. ymd: "2025-02-17",
  801. chargeTotal: 1,
  802. dischargeTotal: 0.5
  803. },
  804. {
  805. ymd: "2025-02-18",
  806. chargeTotal: 1,
  807. dischargeTotal: 0.5
  808. }
  809. ]);
  810. const getmultiStatiopower = async () => {
  811. const { data } = await postsexportKwh({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
  812. const dates = [["product", "充电", "放电"]];
  813. if (data.length < 1) {
  814. data.push(...TotalKwh.value);
  815. }
  816. for (let index = 0; index < data.length; index++) {
  817. dates.push([data[index].ymd, data[index].chargeTotal.toString(), data[index].dischargeTotal.toString()]);
  818. }
  819. const profits = [{ type: "bar" }, { type: "bar" }];
  820. baroptionchart(dates, profits, "kWh");
  821. };
  822. // 充放电统计图
  823. const getpostsexportKwhMonth = async () => {
  824. const { data } = await postsexportKwhMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
  825. const dates = [["product", "充电", "放电"]];
  826. if (data.length < 1) {
  827. data.push(...TotalKwh.value);
  828. }
  829. for (let index = 0; index < data.length; index++) {
  830. dates.push([data[index].ymd, data[index].chargeTotal.toString(), data[index].dischargeTotal.toString()]);
  831. }
  832. const profits = [{ type: "bar" }, { type: "bar" }];
  833. baroptionchart(dates, profits, "kWh");
  834. };
  835. // 充放电统计图
  836. const getsinglestationchargingMonth = async () => {
  837. const { data } = await singlestationchargingMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
  838. const dates = [["product", "充电", "放电"]];
  839. if (data.length < 1) {
  840. data.push(...TotalKwh.value);
  841. }
  842. for (let index = 0; index < data.length; index++) {
  843. dates.push([data[index].ymd, data[index].chargeTotal.toString(), data[index].dischargeTotal.toString()]);
  844. }
  845. const profits = [{ type: "bar" }, { type: "bar" }];
  846. baroptionchart(dates, profits, "kWh");
  847. };
  848. // 收益统计
  849. const baroptionchart = (dates: string[][], profits: { type: string }[], subtext: string | undefined) => {
  850. const baroptionvalue = echarts.init(baroption.value);
  851. window.addEventListener(
  852. "resize",
  853. () => {
  854. baroptionvalue.resize();
  855. },
  856. false
  857. );
  858. let option = {
  859. title: {
  860. subtext: subtext
  861. },
  862. legend: {
  863. right: 30
  864. },
  865. tooltip: {
  866. trigger: "axis",
  867. axisPointer: {
  868. type: "shadow"
  869. }
  870. },
  871. grid: {
  872. left: "1%",
  873. right: "4%",
  874. bottom: "0%",
  875. containLabel: true
  876. },
  877. xAxis: {
  878. type: "category",
  879. axisLabel: {}
  880. },
  881. yAxis: {
  882. type: "value"
  883. },
  884. dataset: {
  885. source: dates
  886. },
  887. series: profits
  888. };
  889. baroptionvalue.setOption(option, true);
  890. };
  891. // 查询
  892. const query = async (val: number) => {
  893. if (val == 0) {
  894. postmultiStationpagebaseInfo();
  895. } else {
  896. pageable.value.ps = 1;
  897. onlineStatus.value = "";
  898. modelinput.value = "";
  899. postmultiStationpagebaseInfo();
  900. }
  901. };
  902. const handleSizeChange = async (e: any) => {
  903. pageable.value.ps = e;
  904. postmultiStationpagebaseInfo();
  905. };
  906. const handleCurrentChange = async (e: any) => {
  907. pageable.value.pn = e;
  908. postmultiStationpagebaseInfo();
  909. };
  910. // 电站列表
  911. const postmultiStationpagebaseInfo = async () => {
  912. const { data } = await emsSystempage(
  913. {
  914. onlineStatus: onlineStatus.value,
  915. keyword: modelinput.value,
  916. pn: pageable.value.ps,
  917. ps: pageable.value.pn
  918. },
  919. Singlevalue.value
  920. );
  921. tableData.value = data;
  922. console.log(tableData.value.total);
  923. pageable.value.total = tableData.value.total;
  924. };
  925. const dialogVisible = ref(false);
  926. // 卡片详情对话框
  927. const details = () => {
  928. dialogVisible.value = true;
  929. };
  930. const informationtype = ref(1);
  931. const oninformation = () => {
  932. informationtype.value = 1;
  933. };
  934. const onmoreinformation = () => {
  935. informationtype.value = 2;
  936. };
  937. const handleClose = () => {
  938. dialogVisible.value = false;
  939. };
  940. // 综合效率---------------------------------------------------------------
  941. const comprehensive = ref();
  942. // const timedays = ref(7);
  943. const timedayslist = ref();
  944. const pickertype: Ref<any> = ref("daterange");
  945. const daymonthyearvalue = ref(1);
  946. const daymonthyearvalue1 = ref(1);
  947. const timetype1: Ref<any> = ref("daterange");
  948. const format = ref("YYYY-MM-DD");
  949. const format1 = ref("YYYY-MM-DD");
  950. const daymonthyear1 = ref([
  951. {
  952. value: 1,
  953. label: "按日"
  954. },
  955. {
  956. value: 2,
  957. label: "按月"
  958. },
  959. {
  960. value: 3,
  961. label: "按年"
  962. }
  963. ]);
  964. const shortcuts = ref([
  965. {
  966. text: "过去7天",
  967. value: () => {
  968. const end = new Date();
  969. const start = new Date();
  970. start.setDate(start.getDate() - 7);
  971. return [start, end];
  972. }
  973. },
  974. {
  975. text: "过去1个月",
  976. value: () => {
  977. const end = new Date();
  978. const start = new Date();
  979. start.setMonth(start.getMonth() - 1);
  980. return [start, end];
  981. }
  982. },
  983. {
  984. text: "过去3个月",
  985. value: () => {
  986. const end = new Date();
  987. const start = new Date();
  988. start.setMonth(start.getMonth() - 3);
  989. return [start, end];
  990. }
  991. }
  992. ]);
  993. const shortcuts1 = ref([
  994. {
  995. text: "过去7天",
  996. value: () => {
  997. const end = new Date();
  998. const start = new Date();
  999. start.setDate(start.getDate() - 7);
  1000. return [start, end];
  1001. }
  1002. },
  1003. {
  1004. text: "过去1个月",
  1005. value: () => {
  1006. const end = new Date();
  1007. const start = new Date();
  1008. start.setMonth(start.getMonth() - 1);
  1009. return [start, end];
  1010. }
  1011. },
  1012. {
  1013. text: "过去3个月",
  1014. value: () => {
  1015. const end = new Date();
  1016. const start = new Date();
  1017. start.setMonth(start.getMonth() - 3);
  1018. return [start, end];
  1019. }
  1020. }
  1021. ]);
  1022. const onpowerblur = () => {
  1023. getdaymonthyear();
  1024. };
  1025. const getdaymonthyear = async () => {
  1026. // daymonthyearvalue.value = value;
  1027. getcomprehensiveefficiency();
  1028. // if (daymonthyearvalue.value == 1) {
  1029. // getcomprehensiveefficiency();
  1030. // } else if (daymonthyearvalue.value == 2) {
  1031. // } else {
  1032. // getoverallEfficiencyyearMonth();
  1033. // }
  1034. };
  1035. // const oncomprehen = (val: number) => {
  1036. // // 获取当前日期
  1037. // timedays.value = val;
  1038. // const today = new Date();
  1039. // const currentDate = today.toLocaleDateString();
  1040. // // 获取过去 7 天的日期
  1041. // const sevenDaysAgoDate = new Date(today);
  1042. // sevenDaysAgoDate.setDate(today.getDate() - 7);
  1043. // const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
  1044. // // 获取过去 31 天的日期
  1045. // const thirtyOneDaysAgoDate = new Date(today);
  1046. // thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
  1047. // const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
  1048. // // 获取去年同月的日期
  1049. // const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
  1050. // const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
  1051. // if (val == 7) {
  1052. // timedayslist.value = [sevenDaysAgo, currentDate];
  1053. // getcomprehensiveefficiency();
  1054. // } else if (val == 31) {
  1055. // timedayslist.value = [thirtyOneDaysAgo, currentDate];
  1056. // getcomprehensiveefficiency();
  1057. // } else {
  1058. // timedayslist.value = [lastYearSameMonth, currentDate];
  1059. // getoverallEfficiencyyearMonth();
  1060. // }
  1061. // };
  1062. const getcomprehensiveefficiency = async () => {
  1063. const { data } = await overallEfficiencyday(
  1064. { startDate: timedayslist.value[0], endDate: timedayslist.value[1] },
  1065. Singlevalue.value
  1066. );
  1067. const dates = [["profit", "综合效率"]];
  1068. for (let index = 0; index < data.list.length; index++) {
  1069. dates.push([data.list[index].ymd, data.list[index].overallEfficiency.toString()]);
  1070. }
  1071. const profits = [
  1072. {
  1073. type: "line",
  1074. showSymbol: false
  1075. }
  1076. ];
  1077. getiveefficiency(data.avgEfficiency, dates, profits);
  1078. };
  1079. // const getoverallEfficiencyyearMonth = async () => {
  1080. // const { data } = await overallEfficiencyyearMonth(
  1081. // {
  1082. // startYearMonth: timedayslist.value[0],
  1083. // endYearMonth: timedayslist.value[1]
  1084. // },
  1085. // Singlevalue.value
  1086. // );
  1087. // const dates = [["profit", "综合效率"]];
  1088. // for (let index = 0; index < data.list.length; index++) {
  1089. // dates.push([data.list[index].ymd, data.list[index].overallEfficiency.toString()]);
  1090. // }
  1091. // const profits = [
  1092. // {
  1093. // type: "line",
  1094. // showSymbol: false
  1095. // }
  1096. // ];
  1097. // getiveefficiency(data.avgEfficiency, dates, profits);
  1098. // };
  1099. const getiveefficiency = (num: any, dates: string[][], profits: { type: string }[]) => {
  1100. const comprehensivevalue = echarts.init(comprehensive.value);
  1101. window.addEventListener(
  1102. "resize",
  1103. () => {
  1104. comprehensivevalue.resize();
  1105. },
  1106. false
  1107. );
  1108. let option = {
  1109. title: {
  1110. text: `综合效率${num}%`,
  1111. subtext: "效率/%"
  1112. },
  1113. tooltip: {
  1114. trigger: "axis",
  1115. axisPointer: {
  1116. type: "shadow"
  1117. }
  1118. },
  1119. legend: {
  1120. right: 30
  1121. },
  1122. grid: {
  1123. left: "2%",
  1124. right: "4%",
  1125. bottom: "10%",
  1126. containLabel: true
  1127. },
  1128. xAxis: {
  1129. type: "category"
  1130. },
  1131. yAxis: {
  1132. type: "value"
  1133. },
  1134. dataZoom: [
  1135. {
  1136. type: "inside",
  1137. xAxisIndex: [0, 1],
  1138. start: 0,
  1139. end: 100
  1140. },
  1141. {
  1142. show: true,
  1143. xAxisIndex: [0, 1],
  1144. type: "slider",
  1145. bottom: 10,
  1146. start: 0,
  1147. end: 100
  1148. }
  1149. ],
  1150. dataset: {
  1151. source: dates
  1152. },
  1153. series: profits
  1154. };
  1155. comprehensivevalue.setOption(option, true);
  1156. };
  1157. // 综合效率---------------------------------------------------------------
  1158. // 充电量进位
  1159. const formatAmountkwh = (amount: number) => {
  1160. if (amount == undefined) {
  1161. return "1000";
  1162. }
  1163. if (amount < 1000) {
  1164. return amount.toFixed(2);
  1165. } else {
  1166. return (amount / 1000).toFixed(2);
  1167. }
  1168. };
  1169. const formatCompany1 = (amount: number) => {
  1170. if (amount == undefined) {
  1171. return "kW";
  1172. }
  1173. if (amount < 1000) {
  1174. return "kW";
  1175. } else {
  1176. return "MW";
  1177. }
  1178. };
  1179. const formatCompany = (amount: number) => {
  1180. if (amount == undefined) {
  1181. return "kWh";
  1182. }
  1183. if (amount < 1000) {
  1184. return "kWh";
  1185. } else {
  1186. return "MWh";
  1187. }
  1188. };
  1189. const formatAmountkwh_ = (amount: number) => {
  1190. if (amount == undefined) {
  1191. return "1000";
  1192. }
  1193. if (amount > 0) {
  1194. return amount.toFixed(2);
  1195. } else {
  1196. return Math.abs(amount).toFixed(2);
  1197. }
  1198. };
  1199. const formatCompany_ = (amount: number) => {
  1200. if (amount == undefined) {
  1201. return "kWh";
  1202. }
  1203. if (amount > 0) {
  1204. return "kWh";
  1205. } else {
  1206. return "kWh";
  1207. }
  1208. };
  1209. const formatAmount = (amount: number) => {
  1210. if (amount == undefined) {
  1211. return "1000";
  1212. }
  1213. if (amount < 10000) {
  1214. return amount.toFixed(2);
  1215. } else {
  1216. return (amount / 10000).toFixed(2);
  1217. }
  1218. };
  1219. const formatAmounts = (amount: number) => {
  1220. if (amount == undefined) {
  1221. return "元";
  1222. }
  1223. if (amount < 10000) {
  1224. return "元";
  1225. } else {
  1226. return "万元";
  1227. }
  1228. };
  1229. const formatAmount1 = (amount: number) => {
  1230. if (amount == undefined) {
  1231. return "1000";
  1232. }
  1233. if (amount > -10000) {
  1234. return amount.toFixed(2);
  1235. } else {
  1236. return (amount / 10000).toFixed(2);
  1237. }
  1238. };
  1239. const formatAmounts2 = (amount: number) => {
  1240. if (amount == undefined) {
  1241. return "元";
  1242. }
  1243. if (amount > -10000) {
  1244. return "元";
  1245. } else {
  1246. return "万元";
  1247. }
  1248. };
  1249. onMounted(() => {
  1250. const current = localStorage.getItem("currentDate");
  1251. if (current) {
  1252. currentDate.value = current;
  1253. }
  1254. // 获取过去 7 天的日期
  1255. const today = new Date();
  1256. const sevenDaysAgoDate = new Date(today);
  1257. sevenDaysAgoDate.setDate(today.getDate() - 7);
  1258. // const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
  1259. // Get year, month, and day components
  1260. const year = sevenDaysAgoDate.getFullYear();
  1261. const month = String(sevenDaysAgoDate.getMonth() + 1).padStart(2, "0"); // Months are zero-based
  1262. const day = String(sevenDaysAgoDate.getDate()).padStart(2, "0");
  1263. // Format the date as "YYYY-MM-DD"
  1264. const formattedDate = `${year}-${month}-${day}`;
  1265. value2.value = [formattedDate, currentDate.value];
  1266. timedayslist.value = [formattedDate, currentDate.value];
  1267. poststationstationName();
  1268. });
  1269. </script>
  1270. <style scoped lang="scss">
  1271. @import "./index.scss";
  1272. </style>