储能智慧云平台web端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 38KB

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