electronicMonitoring.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554
  1. <template>
  2. <view>
  3. <view class="background">
  4. <!-- 日期选择器 -->
  5. <u-picker-select title="日期选择" v-model="tabsFrom.show2" :defaultTime="tabsFrom.show2Index" :endYear="endYear"
  6. mode="time" :params="params" :noselect="false" @confirm="selector2confirm" @cancel="selector2cancel"
  7. @reset="selector2reset">
  8. </u-picker-select>
  9. <view class="navbar-c">
  10. <view class="back" @click="backDataMonitoringList">
  11. <u-icon name="arrow-left" color="#fff" size="36"></u-icon>
  12. </view>
  13. <view class="title" @click="titleCk">
  14. {{tabsFrom.title}}
  15. <u-icon name="arrow-down" color="#fff" size="24"></u-icon>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 设备选择器 -->
  20. <u-select title="设备选择" v-model="tabsFrom.show1" mode="mutil-column-auto" :list="tabsFrom.selector1"
  21. @confirm="selector1confirm" cancel-text="重置" @cancel="selector1cancel">
  22. </u-select>
  23. <!-- 用电量 -->
  24. <view class="electricity-consumption">
  25. <!-- <view class="title">
  26. 用电量统计 (度)
  27. </view> -->
  28. <!-- <view class="degree">
  29. <view class="item">
  30. <view class="item-text">
  31. 百万
  32. </view>
  33. <view class="item-number" v-text="showTop[0]">
  34. 0
  35. </view>
  36. </view>
  37. <view class="item">
  38. <view class="item-text">
  39. 拾万
  40. </view>
  41. <view class="item-number" v-text="showTop[1]">
  42. 0
  43. </view>
  44. </view>
  45. <view class="item">
  46. <view class="item-text">
  47. </view>
  48. <view class="item-number" v-text="showTop[2]">
  49. 0
  50. </view>
  51. </view>
  52. <view class="item">
  53. <view class="item-text">
  54. </view>
  55. <view class="item-number" v-text="showTop[3]">
  56. 0
  57. </view>
  58. </view>
  59. <view class="item">
  60. <view class="item-text">
  61. </view>
  62. <view class="item-number" v-text="showTop[4]">
  63. 0
  64. </view>
  65. </view>
  66. <view class="item">
  67. <view class="item-text">
  68. </view>
  69. <view class="item-number" v-text="showTop[5]">
  70. 7
  71. </view>
  72. </view>
  73. <view class="item">
  74. <view class="item-text">
  75. 1
  76. </view>
  77. <view class="item-number" v-text="showTop[6]">
  78. 7
  79. </view>
  80. </view>
  81. <view class="item">
  82. <view class="item-text">
  83. 0.1
  84. </view>
  85. <view class="item-number decimal" v-text="showTop[7]">
  86. 7
  87. </view>
  88. </view>
  89. </view> -->
  90. <!-- 统计 -->
  91. <view class="statistics-content">
  92. <view class="statistics-item">
  93. <view class="item-title">
  94. 电量统计(度)
  95. </view>
  96. <view class="item-value">
  97. {{electricity}}
  98. </view>
  99. </view>
  100. <view class="statistics-item">
  101. <view class="item-title">
  102. 电费统计(元)
  103. </view>
  104. <view class="item-value">
  105. {{fee}}
  106. </view>
  107. </view>
  108. </view>
  109. <view class="radio">
  110. <u-radio-group v-model="value" @change="radioGroupChange">
  111. <u-radio @change="radioChange" v-for="(item, index) in list" :key="index" :name="item.id"
  112. :disabled="item.disabled">
  113. {{item.name}}
  114. </u-radio>
  115. </u-radio-group>
  116. </view>
  117. </view>
  118. <!-- 各时段用电量 -->
  119. <view class="electricity-chart">
  120. <view class="title">
  121. <view class="icon">
  122. </view>
  123. <view class="text">
  124. 各时段用电量 (度)
  125. </view>
  126. <view class="more" @click="tabsFrom.show2=true,params.day=true">
  127. {{queryDay}}<u-icon name="arrow-down" color="#bbbbbb"></u-icon>
  128. </view>
  129. </view>
  130. <view class="chart">
  131. <view id="barEcharts" style="min-height:440rpx;">
  132. </view>
  133. </view>
  134. <view class="total" >
  135. <view class="total-item">
  136. 当日电量合计:{{sumQuantity}}度
  137. </view>
  138. <view class="total-item">
  139. 当日电费合计: 1.28元
  140. </view>
  141. </view>
  142. </view>
  143. <!-- 异常波动 -->
  144. <view class="abnormal" v-if="abnormalRecordsList.length != 0">
  145. <view class="headline">
  146. <view class="title">
  147. <view class="icon">
  148. </view>
  149. <view class="text">
  150. 异常告警
  151. </view>
  152. </view>
  153. <view class="more" @click="gotoUrl('/pages/abnormal/abnormalAlarmRecord?id='+companyId)">
  154. 查看全部
  155. <u-icon name="arrow-right" size="24" color="#d4d4d4"></u-icon>
  156. </view>
  157. </view>
  158. <view class="details">
  159. <view class="item" v-for="(item, index) in abnormalRecordsList" :key="index"
  160. @click="gotoUrl('/pages/abnormal/abnormalAlarmDetails?id='+item.id)">
  161. <view class="name">
  162. {{item.configName}}
  163. </view>
  164. <view class="time">
  165. {{item.createTime}}
  166. </view>
  167. </view>
  168. </view>
  169. </view>
  170. <!-- 能源监测 -->
  171. <view class="energy-inspection">
  172. <view class="title">
  173. <view class="icon">
  174. </view>
  175. <view class="text">
  176. 能源监测
  177. </view>
  178. </view>
  179. <view class="grid">
  180. <u-grid :col="3" :border="false">
  181. <u-grid-item @click="gotoInfo('3PhaseCurrentDetails','A','三相电流')">
  182. <view class="icon icon1">
  183. <image class="img" src="@/assets/img/Image@1.png" mode=""></image>
  184. </view>
  185. <view class="grid-text">三相电流</view>
  186. </u-grid-item>
  187. <u-grid-item @click="gotoInfo('3PhaseCurrentDetails','V','三相电压')">
  188. <view class="icon icon2">
  189. <image class="img" src="@/assets/img/Image@2.png" mode=""></image>
  190. </view>
  191. <view class="grid-text">三相电压</view>
  192. </u-grid-item>
  193. <u-grid-item @click="gotoInfo('3PhaseCurrentDetails','T','三相温度')">
  194. <view class="icon icon3">
  195. <image class="img" src="@/assets/img/Image@3.png" mode=""></image>
  196. </view>
  197. <view class="grid-text">三相温度</view>
  198. </u-grid-item>
  199. <u-grid-item @click="gotoInfo('3PhaseCurrentDetails','P','三相有功功率')">
  200. <view class="icon icon4">
  201. <image class="img" src="@/assets/img/Image@4.png" mode=""></image>
  202. </view>
  203. <view class="grid-text">三相有功功率</view>
  204. </u-grid-item>
  205. <u-grid-item @click="gotoInfo('3PhaseCurrentDetails','F','三相功率因数')">
  206. <view class="icon icon5">
  207. <image class="img" src="@/assets/img/Image@5.png" mode=""></image>
  208. </view>
  209. <view class="grid-text">三相功率因数</view>
  210. </u-grid-item>
  211. <u-grid-item @click="gotoInfo('3PhaseCurrentDetails','AF','平均功率因数')">
  212. <view class="icon icon6">
  213. <image class="img" src="@/assets/img/Image@5.png" mode=""></image>
  214. </view>
  215. <view class="grid-text">平均功率因数</view>
  216. </u-grid-item>
  217. </u-grid>
  218. </view>
  219. </view>
  220. <!-- 数据分析 -->
  221. <view class="data-analysis">
  222. <view class="title">
  223. <view class="icon">
  224. </view>
  225. <view class="text">
  226. 数据分析
  227. </view>
  228. </view>
  229. <view class="grid">
  230. <u-grid :col="3" :border="false">
  231. <u-grid-item @click="gotoInfo('chartYoY','','')">
  232. <view class="icon icon7">
  233. <image class="img" src="@/assets/img/Image@7.png" mode=""></image>
  234. </view>
  235. <view class="grid-text">同比分析</view>
  236. </u-grid-item>
  237. <u-grid-item @click="gotoInfo('chartMoM','','')">
  238. <view class="icon icon8">
  239. <image class="img" src="@/assets/img/Image@8.png" mode=""></image>
  240. </view>
  241. <view class="grid-text">环比分析</view>
  242. </u-grid-item>
  243. <u-grid-item v-if="false">
  244. <view class="icon icon9">
  245. <image class="img" src="@/assets/img/Image@9.svg" mode=""></image>
  246. </view>
  247. <view class="grid-text">用电统计</view>
  248. </u-grid-item>
  249. </u-grid>
  250. </view>
  251. </view>
  252. <!-- 设备信息 -->
  253. <view class="equipment-information">
  254. <view class="title">
  255. <view class="icon">
  256. </view>
  257. <view class="text">
  258. 设备信息
  259. </view>
  260. <view class="more" @click="equipmentInfosShow=true">
  261. 查看全部<u-icon name="arrow-right" size="24" color="#d4d4d4"></u-icon>
  262. </view>
  263. </view>
  264. <view class="infos">
  265. <view class="item">
  266. <view class="item-title">
  267. 类型
  268. </view>
  269. <view class="item-value">
  270. 变压器
  271. </view>
  272. </view>
  273. <view class="border">
  274. </view>
  275. <view class="item">
  276. <view class="item-title">
  277. 设备编号
  278. </view>
  279. <view class="item-value">
  280. SN9015001
  281. </view>
  282. </view>
  283. <view class="border">
  284. </view>
  285. <view class="item">
  286. <view class="item-title">
  287. 上次故障时间
  288. </view>
  289. <view class="item-value">
  290. 2024-02-14
  291. </view>
  292. </view>
  293. </view>
  294. </view>
  295. <!-- 设备信息弹窗 -->
  296. <view class="equipment-popup">
  297. <u-popup v-model="equipmentInfosShow" mode="bottom" border-radius="12">
  298. <view class="content">
  299. <view class="headline">
  300. 设备信息
  301. </view>
  302. <view class="infos">
  303. <view class="item">
  304. <view class="item-title">
  305. 类型
  306. </view>
  307. <view class="item-value">
  308. 变压器
  309. </view>
  310. </view>
  311. <view class="item">
  312. <view class="item-title">
  313. 编号
  314. </view>
  315. <view class="item-value">
  316. SN9015001
  317. </view>
  318. </view>
  319. <view class="item">
  320. <view class="item-title">
  321. 所属公司
  322. </view>
  323. <view class="item-value">
  324. 荆鹏集团
  325. </view>
  326. </view>
  327. <view class="item">
  328. <view class="item-title">
  329. 地址
  330. </view>
  331. <view class="item-value">
  332. 荆州市沙市区江津东路155号
  333. </view>
  334. </view>
  335. <view class="item">
  336. <view class="item-title">
  337. 上线时间
  338. </view>
  339. <view class="item-value">
  340. 2024-01-01
  341. </view>
  342. </view>
  343. <view class="item">
  344. <view class="item-title">
  345. 上次故障时间
  346. </view>
  347. <view class="item-value">
  348. 2024-02-14
  349. </view>
  350. </view>
  351. </view>
  352. <button class="get" @click="equipmentInfosShow=false">知道了</button>
  353. </view>
  354. </u-popup>
  355. </view>
  356. <!-- 故障上报 -->
  357. <view class="create-order">
  358. <view class="img-box">
  359. <image class="img" src="@/assets/img/fas fa-exclamation-triangle Copy 2@3x.png" mode=""></image>
  360. </view>
  361. <view class="text">
  362. 故障上报
  363. </view>
  364. </view>
  365. </view>
  366. </template>
  367. <script>
  368. import {
  369. parseUnixTime,
  370. beforeTimeStamp,
  371. getWeek
  372. } from '@/apis/utils'
  373. import * as echarts from 'echarts';
  374. import * as API from '@/apis/pagejs/index.js'
  375. export default {
  376. data() {
  377. return {
  378. electricity: 0, //电量统计
  379. fee: 0, //电费统计
  380. abnormalRecordsList: [], //异常list
  381. companyId: '', //企业id
  382. meterId: '', //设备id
  383. titleName: '',
  384. clickType: 0,
  385. sumQuantity: 0,
  386. equipmentInfosShow: false,
  387. kWhList: [],
  388. queryDay: '',
  389. showTop: [0, 0, 0, 0, 0, 0, 0, 0],
  390. FormData: {
  391. queryDate: '',
  392. meterId: '',
  393. type: 0
  394. },
  395. FormData2: {
  396. queryDate: '',
  397. meterId: ''
  398. },
  399. myChart: null,
  400. endYear: '',
  401. equipmentShow: false,
  402. multiSelector: [],
  403. equipmentList: [],
  404. params: {
  405. year: true,
  406. month: true,
  407. day: true,
  408. hour: false,
  409. minute: false,
  410. second: false
  411. },
  412. tabsFrom: {
  413. show1: false,
  414. show1Index: 0,
  415. show2Index: '',
  416. show2: false,
  417. show1Text: "全部类型",
  418. show2Text: "全部时间",
  419. selector1: [{
  420. label: '全部类型',
  421. value: '',
  422. },
  423. {
  424. label: '线上充值',
  425. value: '1',
  426. },
  427. {
  428. label: '线下充值',
  429. value: '2',
  430. },
  431. ]
  432. },
  433. background: {
  434. backgroundColor: '#1677FF',
  435. },
  436. list: [{
  437. id: 1,
  438. name: '当月',
  439. disabled: false
  440. }, {
  441. id: 4,
  442. name: '当日',
  443. disabled: false
  444. }, {
  445. id: 2,
  446. name: '上月',
  447. disabled: false
  448. }, {
  449. id: 3,
  450. name: '当年',
  451. disabled: false
  452. }, {
  453. id: 0,
  454. name: '合计',
  455. disabled: false
  456. }, {
  457. id: 10,
  458. name: '指定月份',
  459. disabled: false
  460. }],
  461. value: '2',
  462. intervalId: null, // 用于存储间隔ID
  463. intervalReady: true, // 用于存储间隔ID
  464. };
  465. },
  466. onLoad(op) {
  467. if (op.id) {
  468. this.FormData.meterId = op.id;
  469. this.FormData2.meterId = op.id;
  470. this.tabsFrom.title = op.name;
  471. this.meterId = op.id;
  472. this.titleName = op.name;
  473. this.companyId = op.companyId;
  474. }
  475. this.endYear = new Date().getFullYear();
  476. this.FormData.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  477. this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  478. this.FormData.type = 2;
  479. this.getElectricityStatistics();
  480. this.getTimeSlotStatistics();
  481. this.getCompanyInfoList();
  482. this.getAbnormalAlarmRecord();
  483. },
  484. beforeDestroy() {
  485. this.clearTimer(); // 组件销毁前清除定时器
  486. this.intervalReady = false;
  487. console.log("组件销毁前清除定时器")
  488. },
  489. methods: {
  490. clearTimer() {
  491. if (this.intervalId) {
  492. clearInterval(this.intervalId); // 清除定时器
  493. this.intervalId = null; // 重置定时器ID
  494. }
  495. },
  496. startInterval() {
  497. this.clearTimer(); // 组件销毁前清除定时器
  498. this.intervalId = setInterval(() => {
  499. // 每隔5秒运行的代码
  500. // console.log('这段代码每隔5秒运行一次');
  501. this.getElectricityStatistics(true)
  502. this.getTimeSlotStatistics(true)
  503. }, 60000);
  504. },
  505. gotoInfo(path, type, name) {
  506. if (!this.FormData.meterId) {
  507. uni.showToast({
  508. title: "未查询到电表",
  509. icon: "none"
  510. })
  511. return
  512. }
  513. uni.navigateTo({
  514. url: "/pages/equipmentDataMonitoring/" + path + "?id=" + this.FormData.meterId + "&type=" + type +
  515. "&typeName=" + name
  516. })
  517. },
  518. // 异常告警记录
  519. getAbnormalAlarmRecord() {
  520. var queryDate = parseUnixTime(new Date(), '{y}-{m}');
  521. uni.showLoading({
  522. title: "加载中",
  523. mask: true,
  524. })
  525. API.alarmRecord({
  526. queryDate: queryDate,
  527. configId: '',
  528. pageIndex: 1,
  529. pageSize: 2,
  530. companyId: this.companyId,
  531. meterId: this.meterId
  532. }).then((res) => {
  533. uni.hideLoading();
  534. this.abnormalRecordsList = res.data.data;
  535. }).catch(error => {
  536. uni.showToast({
  537. title: error,
  538. icon: "none"
  539. })
  540. })
  541. },
  542. titleCk() {
  543. if (this.tabsFrom.selector1.length > 1) {
  544. this.tabsFrom.show1 = true
  545. }
  546. },
  547. selector1confirm(e) {
  548. console.log(e)
  549. // var index = e[2];
  550. // this.tabsFrom.show1Index = index;
  551. if (e[2].value != null) {
  552. this.tabsFrom.show1Text = e[2].label;
  553. this.tabsFrom.title = e[2].label;
  554. this.FormData.meterId = e[2].value;
  555. this.FormData.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  556. this.FormData2.meterId = e[2].value;
  557. this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  558. //this.meterId =e[2].value;
  559. this.FormData.type = 2;
  560. this.value = '2';
  561. this.getTimeSlotStatistics();
  562. this.getElectricityStatistics();
  563. }
  564. },
  565. selector1cancel() {
  566. this.tabsFrom.show1Text = this.titleName;
  567. this.tabsFrom.title = this.titleName;
  568. this.FormData.meterId = this.meterId;
  569. this.FormData.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  570. this.FormData2.meterId = this.meterId;
  571. this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  572. this.FormData.type = 2;
  573. this.value = '2';
  574. this.getTimeSlotStatistics();
  575. this.getElectricityStatistics();
  576. },
  577. queryDate(queryTime, day) {
  578. if (day) {
  579. this.FormData2.queryDate = queryTime;
  580. //this.FormData2.type =day?"9":"10"
  581. //this.value="-1"
  582. this.getTimeSlotStatistics();
  583. } else {
  584. this.FormData.queryDate = queryTime + "-01";
  585. this.FormData.type = 10;
  586. this.value = "10";
  587. this.list[5].name = queryTime;
  588. this.getElectricityStatistics();
  589. }
  590. },
  591. getCompanyInfoList() {
  592. uni.showLoading({
  593. title: "加载中",
  594. mask: true,
  595. })
  596. API.deviceCompanyList().then((response) => {
  597. uni.hideLoading();
  598. var list = response.data.companyInfoList;
  599. this.tabsFrom.selector1 = [];
  600. this.tabsFrom.selector1 = list.map(item => {
  601. if (item.remoteReadingMeterList.length != 0 && item.remoteMonitorMeterList.length != 0) {
  602. return {
  603. label: item.fullName,
  604. value: item.id,
  605. children: [{
  606. label: '抄表',
  607. value: '1',
  608. children: item.remoteReadingMeterList.map(item => {
  609. return {
  610. label: item.name,
  611. value: item.id,
  612. }
  613. })
  614. },
  615. {
  616. label: '监控表',
  617. value: '1',
  618. children: item.remoteMonitorMeterList.map(item => {
  619. return {
  620. label: item.name,
  621. value: item.id,
  622. }
  623. })
  624. }
  625. ]
  626. }
  627. } else if (item.remoteReadingMeterList.length != 0 && item.remoteMonitorMeterList.length == 0) {
  628. return {
  629. label: item.fullName,
  630. value: item.id,
  631. children: [{
  632. label: '抄表',
  633. value: '1',
  634. children: item.remoteReadingMeterList.map(item => {
  635. return {
  636. label: item.name,
  637. value: item.id,
  638. }
  639. })
  640. }]
  641. }
  642. } else if (item.remoteReadingMeterList.length == 0 && item.remoteMonitorMeterList.length != 0) {
  643. return {
  644. label: item.fullName,
  645. value: item.id,
  646. children: [{
  647. label: '监控表',
  648. value: '1',
  649. children: item.remoteMonitorMeterList.map(item => {
  650. return {
  651. label: item.name,
  652. value: item.id,
  653. }
  654. })
  655. }]
  656. }
  657. } else {
  658. }
  659. })
  660. }).catch(error => {
  661. uni.showToast({
  662. title: error,
  663. icon: "none"
  664. })
  665. })
  666. },
  667. getTimeSlotStatistics(interval) {
  668. if (!interval) {
  669. uni.showLoading({
  670. title: "加载中",
  671. mask: true,
  672. })
  673. }
  674. this.queryDay = parseUnixTime(new Date(this.FormData2.queryDate), '{y}年{m}月{d}日');
  675. API.timeSlotStatistics(this.FormData2).then((response) => {
  676. if (!interval) {
  677. uni.hideLoading();
  678. }
  679. this.hourMap = response.data.hourMap;
  680. this.sumQuantity = response.data.kwhMap.kwh;
  681. this.getBarCharts(this.hourMap, interval);
  682. if (!interval) {
  683. this.startInterval(); // 组件挂载后开始间隔
  684. }
  685. }).catch(error => {
  686. uni.showToast({
  687. title: error,
  688. icon: "none"
  689. })
  690. })
  691. },
  692. getElectricityStatistics(interval) {
  693. if (!interval) {
  694. uni.showLoading({
  695. title: "加载中",
  696. mask: true,
  697. })
  698. }
  699. var obj = {
  700. ...this.FormData
  701. }
  702. // if(obj.type==10){
  703. // obj.queryDate+="-01"
  704. // }
  705. API.electricityStatistics(obj).then((response) => {
  706. if (!interval) {
  707. uni.hideLoading();
  708. }
  709. this.showTop = [0, 0, 0, 0, 0, 0, 0, 0]
  710. var electricity = response.data.kwhMap.kwh + "";
  711. this.electricity = response.data.kwhMap.kwh;
  712. this.fee = response.data.kwhMap.fee;
  713. if (electricity) {
  714. var sz = electricity.split(".")
  715. var str1 = sz[0];
  716. var str2 = [];
  717. if (sz.length > 1) {
  718. str2 = sz[1];
  719. this.showTop[7] = str2[0];
  720. }
  721. var j = 0;
  722. for (var i in str1) {
  723. if (i != undefined) {
  724. this.showTop[6 - str1.length + j + 1] = str1[i]
  725. }
  726. j++;
  727. }
  728. this.$forceUpdate()
  729. }
  730. if (!interval) {
  731. this.startInterval(); // 组件挂载后开始间隔
  732. }
  733. }).catch(error => {
  734. uni.showToast({
  735. title: error,
  736. icon: "none"
  737. })
  738. })
  739. },
  740. getBarCharts(list, interval) {
  741. if (!this.myChart) {
  742. this.myChart = echarts.init(document.getElementById('barEcharts'), null, {
  743. width: uni.upx2px(700),
  744. height: uni.upx2px(480)
  745. });
  746. }
  747. if (!interval) {
  748. this.myChart.clear();
  749. }
  750. var data1 = [];
  751. var data2 = [];
  752. // var sumQuantity=0
  753. for (var i in list) {
  754. data1.push(i)
  755. data2.push(list[i].kwh)
  756. // sumQuantity+=list[i]
  757. }
  758. var axisLabel = {
  759. rotate: 40,
  760. interval: 0,
  761. textStyle: {
  762. color: "#333"
  763. }
  764. }
  765. if (data1.length < 4) {
  766. axisLabel = {
  767. interval: 0,
  768. textStyle: {
  769. color: "#333"
  770. },
  771. }
  772. }
  773. // this.sumQuantity = sumQuantity.toFixed(2);
  774. var headitemby = "";
  775. var showkey = "";
  776. var option = {
  777. tooltip: {
  778. trigger: 'axis',
  779. axisPointer: {
  780. type: 'shadow'
  781. },
  782. formatter: (value) => {
  783. var name = value[0].name;
  784. var obj=list[name]
  785. var text= `<p>${name}</p>`
  786. if (obj.electricityPrice != undefined) {
  787. text += `<p>电价:${obj.electricityPrice}元/度</p>`
  788. }
  789. if (obj.kwh != undefined) {
  790. text += `用电量:${obj.kwh}度`
  791. }
  792. if (obj.amount != undefined) {
  793. text += ` <p>电费:${obj.amount}元</p>`
  794. }
  795. return text
  796. }
  797. },
  798. grid: {
  799. top: '10%',
  800. left: '3%',
  801. right: '8%',
  802. bottom: '8%',
  803. containLabel: true
  804. },
  805. xAxis: {
  806. type: 'category',
  807. data: data1,
  808. axisLabel: axisLabel,
  809. },
  810. yAxis: {
  811. type: 'value',
  812. },
  813. series: [{
  814. name: '合计',
  815. data: data2,
  816. type: 'bar',
  817. label: {
  818. show: true,
  819. position: 'top',
  820. color: '#5C7BD9'
  821. }
  822. }]
  823. }
  824. console.log(option)
  825. this.myChart.setOption(option);
  826. },
  827. selector2confirm(e) {
  828. this.tabsFrom.show2Text = e.year + "年" + e.month + "月"
  829. this.tabsFrom.show2Index = e.year + "-" + e.month
  830. if (e.day) {
  831. this.tabsFrom.show2Text += e.day + "日"
  832. this.tabsFrom.show2Index += '-' + e.day
  833. this.queryDate(this.tabsFrom.show2Index, true)
  834. } else {
  835. this.queryDate(this.tabsFrom.show2Index, false)
  836. }
  837. },
  838. selector2cancel() {
  839. this.value = this.clickType;
  840. },
  841. selector2reset(e) {
  842. console.log(e)
  843. this.tabsFrom.show2Text = '全部时间'
  844. this.tabsFrom.show2Index = '';
  845. if (e.day) {
  846. this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  847. this.queryDay = parseUnixTime(new Date(this.FormData2.queryDate), '{y}年{m}月{d}日');
  848. this.getTimeSlotStatistics();
  849. } else {
  850. this.FormData.type = this.clickType;
  851. this.value = this.clickType;
  852. if (this.value != 10) {
  853. this.list[5].name = '指定月份';
  854. }
  855. this.getElectricityStatistics();
  856. }
  857. },
  858. // 选中某个单选框时,由radio时触发
  859. radioChange(e) {
  860. console.log(`选择前的值: ${this.value}`);
  861. this.clickType = this.value;
  862. },
  863. // 选中任一radio时,由radio-group触发
  864. radioGroupChange(e) {
  865. console.log(e)
  866. this.FormData.type = e;
  867. if (e == 10) {
  868. this.tabsFrom.show2 = true;
  869. this.params.day = false;
  870. } else {
  871. this.list[5].name = '指定月份'
  872. this.getElectricityStatistics();
  873. }
  874. },
  875. backDataMonitoringList() {
  876. uni.navigateBack()
  877. },
  878. }
  879. };
  880. </script>
  881. <style lang="scss" scoped>
  882. page {
  883. padding-bottom: 184rpx;
  884. }
  885. /deep/.u-select__header__title {
  886. font-size: 36rpx;
  887. font-weight: bold;
  888. }
  889. .navbar-c {
  890. background-color: rgba(22, 119, 255, 1);
  891. position: fixed;
  892. top: 0;
  893. left: 0;
  894. right: 0;
  895. z-index: 999;
  896. .back {
  897. z-index: 999;
  898. width: 200rpx;
  899. }
  900. .title {
  901. color: #fff;
  902. display: flex;
  903. align-items: center;
  904. justify-content: center;
  905. }
  906. .right {
  907. .img {
  908. width: 48rpx;
  909. height: 48rpx;
  910. }
  911. }
  912. }
  913. /deep/.uicon-nav-back {
  914. color: #fff !important;
  915. }
  916. .background {
  917. background-color: rgba(22, 119, 255, 1);
  918. padding-top: 88rpx;
  919. padding-bottom: 100rpx;
  920. /deep/.u-border-bottom:after {
  921. border: none;
  922. }
  923. .u-nav-slot {
  924. margin-right: 32rpx;
  925. .img {
  926. width: 48rpx;
  927. height: 48rpx;
  928. vertical-align: middle;
  929. }
  930. }
  931. }
  932. .background::after {
  933. content: '';
  934. position: absolute;
  935. width: 160%;
  936. height: 80px;
  937. background-color: rgba(22, 119, 255, 1);
  938. left: -30%;
  939. border-radius: 0 0 50% 50%;
  940. }
  941. // // 日期
  942. .date-box {
  943. display: flex;
  944. align-items: center;
  945. justify-content: space-between;
  946. margin: 24rpx 32rpx;
  947. .item {
  948. border-radius: 8px;
  949. background-color: rgba(255, 255, 255, 0.1);
  950. border: 1px solid rgba(255, 255, 255, 0.15);
  951. width: 120rpx;
  952. height: 120rpx;
  953. color: #fff;
  954. text-align: center;
  955. display: flex;
  956. flex-direction: column;
  957. justify-content: center;
  958. .date {
  959. font-size: 40rpx;
  960. }
  961. }
  962. .item-today {
  963. background-color: rgba(255, 255, 255, 1);
  964. position: relative;
  965. .date {
  966. color: rgba(22, 119, 255, 1);
  967. }
  968. .week {
  969. color: rgba(16, 16, 16, 1);
  970. }
  971. .dot {
  972. width: 10rpx;
  973. height: 10rpx;
  974. background-color: rgba(255, 150, 0, 1);
  975. border-radius: 999px;
  976. position: absolute;
  977. bottom: -5rpx;
  978. left: 50%;
  979. transform: translateX(-50%);
  980. }
  981. }
  982. }
  983. // 用电量
  984. .electricity-consumption {
  985. background-color: #fff;
  986. padding: 40rpx 32rpx 0rpx;
  987. border-radius: 8px;
  988. margin: -88rpx 32rpx 0;
  989. position: relative;
  990. // 统计
  991. .statistics-content{
  992. display: flex;
  993. align-items: center;
  994. justify-content: space-between;
  995. .statistics-item{
  996. width: 300rpx;
  997. padding: 24rpx;
  998. border-radius: 8px;
  999. background: linear-gradient(180deg, rgba(207,227,255,1) 0%,rgba(255,255,255,0) 100%);
  1000. box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1);
  1001. }
  1002. .item-title{
  1003. color: #333333;
  1004. }
  1005. .item-value{
  1006. color: rgba(16,16,16,1);
  1007. font-size: 48rpx;
  1008. font-weight: bold;
  1009. margin-top: 8rpx;
  1010. overflow: hidden;
  1011. white-space: nowrap;
  1012. text-overflow: ellipsis;
  1013. }
  1014. }
  1015. .title {
  1016. color: rgba(16, 16, 16, 1);
  1017. font-size: 36rpx;
  1018. }
  1019. .degree {
  1020. display: flex;
  1021. margin-top: 32rpx;
  1022. .item {
  1023. margin-right: 6rpx;
  1024. text-align: center;
  1025. .item-text {
  1026. color: rgba(16, 16, 16, 1);
  1027. }
  1028. .item-number {
  1029. margin-top: 24rpx;
  1030. width: 72rpx;
  1031. height: 96rpx;
  1032. background-color: rgba(16, 16, 16, 1);
  1033. color: #fff;
  1034. font-size: 72rpx;
  1035. }
  1036. .decimal {
  1037. background-color: #900005;
  1038. }
  1039. }
  1040. }
  1041. // .tab {
  1042. // width: 240rpx;
  1043. // height: 0;
  1044. // border-width: 0px 48rpx 72rpx 0px;
  1045. // border-radius: 8px 8px 0 0;
  1046. // border-style: none solid solid none;
  1047. // border-color: transparent transparent #fff;
  1048. // position: absolute;
  1049. // top: -72rpx;
  1050. // left: 0rpx;
  1051. // right: 0rpx;
  1052. // color: #101010;
  1053. // color: rgba(16, 16, 16, 1);
  1054. // text-align: center;
  1055. // line-height: 72rpx;
  1056. // z-index: 999;
  1057. // text-indent: 16rpx;
  1058. // }
  1059. // .tab2 {
  1060. // width: 240rpx;
  1061. // height: 0;
  1062. // border-width: 0px 48rpx 72rpx 0px;
  1063. // border-radius: 8px 8px 0 0;
  1064. // border-style: none solid solid none;
  1065. // border-color: transparent transparent #D4DBE4;
  1066. // position: absolute;
  1067. // top: -72rpx;
  1068. // left: 210rpx;
  1069. // right: 0rpx;
  1070. // color: #777777;
  1071. // text-align: center;
  1072. // line-height: 72rpx;
  1073. // text-indent: 16rpx;
  1074. // }
  1075. .radio {
  1076. margin-top: 24rpx;
  1077. /deep/.u-radio__label {
  1078. font-size: 24rpx
  1079. }
  1080. /deep/.u-radio {
  1081. margin-bottom: 16px;
  1082. // width: 160rpx !important;
  1083. margin-right: 24rpx;
  1084. }
  1085. }
  1086. }
  1087. //各时段用电量
  1088. .electricity-chart {
  1089. margin: 24rpx 32rpx;
  1090. padding: 40rpx 32rpx;
  1091. background-color: #fff;
  1092. border-radius: 8px;
  1093. .title {
  1094. display: flex;
  1095. align-items: center;
  1096. margin-bottom: 40rpx;
  1097. .icon {
  1098. width: 36rpx;
  1099. height: 36rpx;
  1100. background-color: rgba(182, 212, 255, 1);
  1101. border: 6px solid rgba(22, 119, 255, 1);
  1102. border-radius: 100px;
  1103. }
  1104. .text {
  1105. color: rgba(51, 51, 51, 1);
  1106. font-size: 36rpx;
  1107. margin-left: 16rpx;
  1108. }
  1109. .more {
  1110. margin-left: auto;
  1111. border: 1px solid rgba(187,187,187,1);
  1112. border-radius: 4px;
  1113. padding: 8rpx;
  1114. }
  1115. }
  1116. .total{
  1117. display: flex;
  1118. align-items: center;
  1119. justify-content: space-between;
  1120. color: rgba(51,51,51,1);
  1121. font-weight: bold;
  1122. }
  1123. .chart {
  1124. width: 100%;
  1125. height: 500rpx;
  1126. .img {
  1127. width: 100%;
  1128. height: 440rpx;
  1129. }
  1130. }
  1131. }
  1132. .equipment-information {
  1133. margin: 24rpx 32rpx;
  1134. padding: 40rpx 0rpx;
  1135. background-color: #fff;
  1136. border-radius: 8px;
  1137. .title {
  1138. display: flex;
  1139. align-items: center;
  1140. padding: 0 32rpx;
  1141. margin-bottom: 40rpx;
  1142. .icon {
  1143. width: 36rpx;
  1144. height: 36rpx;
  1145. background-color: rgba(182, 212, 255, 1);
  1146. border: 6px solid rgba(22, 119, 255, 1);
  1147. border-radius: 100px;
  1148. }
  1149. .text {
  1150. display: flex;
  1151. align-items: center;
  1152. color: rgba(51, 51, 51, 1);
  1153. font-size: 36rpx;
  1154. margin-left: 16rpx;
  1155. }
  1156. .date {
  1157. margin-left: auto;
  1158. }
  1159. .more {
  1160. color: #838383;
  1161. font-size: 24rpx;
  1162. margin-left: auto;
  1163. }
  1164. }
  1165. .chart {
  1166. width: 100%;
  1167. height: 440rpx;
  1168. .img {
  1169. width: 100%;
  1170. height: 440rpx;
  1171. }
  1172. }
  1173. .infos {
  1174. padding: 0 32rpx;
  1175. display: flex;
  1176. justify-content: space-between;
  1177. text-align: center;
  1178. .border {
  1179. margin: auto 0;
  1180. height: 70rpx;
  1181. width: 2rpx;
  1182. background-color: rgba(204, 204, 204, 1);
  1183. ;
  1184. }
  1185. .item-title {
  1186. color: rgba(119, 119, 119, 1);
  1187. }
  1188. .item-value {
  1189. color: rgba(16, 16, 16, 1);
  1190. font-size: 32rpx;
  1191. margin-top: 16rpx;
  1192. }
  1193. }
  1194. }
  1195. // 异常
  1196. .abnormal {
  1197. margin: 24rpx 32rpx;
  1198. padding: 40rpx 32rpx;
  1199. background-color: #fff;
  1200. border-radius: 8px;
  1201. .headline {
  1202. display: flex;
  1203. align-items: center;
  1204. justify-content: space-between;
  1205. }
  1206. .title {
  1207. display: flex;
  1208. align-items: center;
  1209. font-weight: bold;
  1210. .icon {
  1211. width: 36rpx;
  1212. height: 36rpx;
  1213. background-color: rgba(182, 212, 255, 1);
  1214. border: 6px solid rgba(22, 119, 255, 1);
  1215. border-radius: 100px;
  1216. }
  1217. .text {
  1218. color: rgba(51, 51, 51, 1);
  1219. font-size: 36rpx;
  1220. margin-left: 16rpx;
  1221. }
  1222. }
  1223. .more {
  1224. color: #838383;
  1225. font-size: 24rpx
  1226. }
  1227. .details {
  1228. margin-top: 40rpx;
  1229. .item {
  1230. display: flex;
  1231. align-items: center;
  1232. justify-content: space-between;
  1233. margin-top: 32rpx;
  1234. .name {
  1235. color: rgba(51, 51, 51, 1);
  1236. }
  1237. .time {
  1238. color: rgba(119, 119, 119, 1);
  1239. font-size: 24rpx;
  1240. }
  1241. }
  1242. }
  1243. }
  1244. // 能源监测
  1245. .energy-inspection,
  1246. .data-analysis {
  1247. margin: 24rpx 32rpx;
  1248. padding: 40rpx 32rpx;
  1249. background-color: #fff;
  1250. border-radius: 8px;
  1251. .title {
  1252. display: flex;
  1253. align-items: center;
  1254. font-weight: bold;
  1255. .icon {
  1256. width: 36rpx;
  1257. height: 36rpx;
  1258. background-color: rgba(182, 212, 255, 1);
  1259. border: 6px solid rgba(22, 119, 255, 1);
  1260. border-radius: 100px;
  1261. }
  1262. .text {
  1263. color: rgba(51, 51, 51, 1);
  1264. font-size: 36rpx;
  1265. margin-left: 16rpx;
  1266. }
  1267. }
  1268. .grid {
  1269. .icon {
  1270. width: 128rpx;
  1271. height: 128rpx;
  1272. border-radius: 12px;
  1273. background-color: rgba(35, 186, 178, 1);
  1274. display: flex;
  1275. align-items: center;
  1276. justify-content: center;
  1277. margin-bottom: 16rpx;
  1278. .img {
  1279. width: 80rpx;
  1280. height: 80rpx;
  1281. }
  1282. }
  1283. .icon2 {
  1284. background-color: rgba(42, 186, 72, 1);
  1285. }
  1286. .icon3 {
  1287. background-color: rgba(78, 96, 246, 1);
  1288. }
  1289. .icon4 {
  1290. background-color: rgba(22, 119, 255, 1);
  1291. }
  1292. .icon5 {
  1293. background-color: rgba(35, 186, 178, 1);
  1294. }
  1295. .icon6 {
  1296. background-color: rgba(42, 186, 72, 1);
  1297. }
  1298. .icon7 {
  1299. background-color: rgba(22, 119, 255, 1);
  1300. }
  1301. .icon8 {
  1302. background-color: rgba(35, 186, 178, 1);
  1303. }
  1304. .icon9 {
  1305. background-color: rgba(42, 186, 72, 1);
  1306. }
  1307. .grid-text {
  1308. color: #333333;
  1309. }
  1310. }
  1311. }
  1312. // 设备信息弹窗
  1313. .equipment-popup {
  1314. .content {
  1315. padding: 32rpx;
  1316. .headline {
  1317. color: rgba(16, 16, 16, 1);
  1318. font-size: 36rpx;
  1319. text-align: center;
  1320. font-weight: bold;
  1321. }
  1322. .infos {
  1323. padding-bottom: 100rpx;
  1324. .item:last-of-type {
  1325. border: none;
  1326. }
  1327. .item {
  1328. display: flex;
  1329. align-items: center;
  1330. height: 80rpx;
  1331. line-height: 80rpx;
  1332. border-bottom: 1px solid #cccccc;
  1333. .item-title {
  1334. color: rgba(51, 51, 51, 1);
  1335. width: 200rpx;
  1336. }
  1337. .item-value {
  1338. color: #666666;
  1339. flex: 1;
  1340. margin-left: 16rpx;
  1341. }
  1342. }
  1343. }
  1344. .get {
  1345. height: 80rpx;
  1346. line-height: 80rpx;
  1347. border-radius: 4px;
  1348. background-color: rgba(22, 119, 255, 1);
  1349. color: rgba(255, 255, 255, 1);
  1350. font-size: 32rpx;
  1351. }
  1352. }
  1353. }
  1354. // 创建工单
  1355. .create-order {
  1356. width: 120rpx;
  1357. height: 120rpx;
  1358. border-radius: 20px;
  1359. background: linear-gradient(180.29deg, rgba(255, 124, 112, 1) 0.9%, rgba(255, 79, 63, 1) 100.4%);
  1360. box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
  1361. text-align: center;
  1362. display: flex;
  1363. flex-direction: column;
  1364. justify-content: center;
  1365. align-items: center;
  1366. position: fixed;
  1367. right: 32rpx;
  1368. bottom: 64rpx;
  1369. .img {
  1370. width: 56rpx;
  1371. height: 56rpx;
  1372. vertical-align: middle;
  1373. }
  1374. .text {
  1375. color: rgba(255, 255, 255, 1);
  1376. font-size: 22rpx;
  1377. }
  1378. }
  1379. </style>