electronicMonitoring.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575
  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. <image class="img" src="@/assets/img/meterStatistics@3x.png"></image>电量统计(度)
  95. </view>
  96. <view class="item-value">
  97. {{electricity}}
  98. </view>
  99. </view>
  100. <view class="statistics-item">
  101. <view class="item-title">
  102. <image class="img" src="@/assets/img/electricityStatistics@3x.png"></image>电费统计(元)
  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. 当日电费合计: {{sumFee}}元
  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. sumFee: 0,
  387. equipmentInfosShow: false,
  388. kWhList: [],
  389. queryDay: '',
  390. showTop: [0, 0, 0, 0, 0, 0, 0, 0],
  391. FormData: {
  392. queryDate: '',
  393. meterId: '',
  394. type: 0
  395. },
  396. FormData2: {
  397. queryDate: '',
  398. meterId: ''
  399. },
  400. myChart: null,
  401. endYear: '',
  402. equipmentShow: false,
  403. multiSelector: [],
  404. equipmentList: [],
  405. params: {
  406. year: true,
  407. month: true,
  408. day: true,
  409. hour: false,
  410. minute: false,
  411. second: false
  412. },
  413. tabsFrom: {
  414. show1: false,
  415. show1Index: 0,
  416. show2Index: '',
  417. show2: false,
  418. show1Text: "全部类型",
  419. show2Text: "全部时间",
  420. selector1: [{
  421. label: '全部类型',
  422. value: '',
  423. },
  424. {
  425. label: '线上充值',
  426. value: '1',
  427. },
  428. {
  429. label: '线下充值',
  430. value: '2',
  431. },
  432. ]
  433. },
  434. background: {
  435. backgroundColor: '#1677FF',
  436. },
  437. list: [{
  438. id: 1,
  439. name: '当月',
  440. disabled: false
  441. }, {
  442. id: 4,
  443. name: '当日',
  444. disabled: false
  445. }, {
  446. id: 2,
  447. name: '上月',
  448. disabled: false
  449. }, {
  450. id: 3,
  451. name: '当年',
  452. disabled: false
  453. }, {
  454. id: 0,
  455. name: '合计',
  456. disabled: false
  457. }, {
  458. id: 10,
  459. name: '指定月份',
  460. disabled: false
  461. }],
  462. value: '2',
  463. intervalId: null, // 用于存储间隔ID
  464. intervalReady: true, // 用于存储间隔ID
  465. };
  466. },
  467. onLoad(op) {
  468. if (op.id) {
  469. this.FormData.meterId = op.id;
  470. this.FormData2.meterId = op.id;
  471. this.tabsFrom.title = op.name;
  472. this.meterId = op.id;
  473. this.titleName = op.name;
  474. this.companyId = op.companyId;
  475. }
  476. this.endYear = new Date().getFullYear();
  477. this.FormData.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  478. this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  479. this.FormData.type = 2;
  480. this.getElectricityStatistics();
  481. this.getTimeSlotStatistics();
  482. this.getCompanyInfoList();
  483. this.getAbnormalAlarmRecord();
  484. },
  485. beforeDestroy() {
  486. this.clearTimer(); // 组件销毁前清除定时器
  487. this.intervalReady = false;
  488. console.log("组件销毁前清除定时器")
  489. },
  490. methods: {
  491. clearTimer() {
  492. if (this.intervalId) {
  493. clearInterval(this.intervalId); // 清除定时器
  494. this.intervalId = null; // 重置定时器ID
  495. }
  496. },
  497. startInterval() {
  498. this.clearTimer(); // 组件销毁前清除定时器
  499. this.intervalId = setInterval(() => {
  500. // 每隔5秒运行的代码
  501. // console.log('这段代码每隔5秒运行一次');
  502. this.getElectricityStatistics(true)
  503. this.getTimeSlotStatistics(true)
  504. }, 60000);
  505. },
  506. gotoInfo(path, type, name) {
  507. if (!this.FormData.meterId) {
  508. uni.showToast({
  509. title: "未查询到电表",
  510. icon: "none"
  511. })
  512. return
  513. }
  514. uni.navigateTo({
  515. url: "/pages/equipmentDataMonitoring/" + path + "?id=" + this.FormData.meterId + "&type=" + type +
  516. "&typeName=" + name
  517. })
  518. },
  519. // 异常告警记录
  520. getAbnormalAlarmRecord() {
  521. var queryDate = parseUnixTime(new Date(), '{y}-{m}');
  522. uni.showLoading({
  523. title: "加载中",
  524. mask: true,
  525. })
  526. API.alarmRecord({
  527. queryDate: queryDate,
  528. configId: '',
  529. pageIndex: 1,
  530. pageSize: 2,
  531. companyId: this.companyId,
  532. meterId: this.meterId
  533. }).then((res) => {
  534. uni.hideLoading();
  535. this.abnormalRecordsList = res.data.data;
  536. }).catch(error => {
  537. uni.showToast({
  538. title: error,
  539. icon: "none"
  540. })
  541. })
  542. },
  543. titleCk() {
  544. if (this.tabsFrom.selector1.length > 1) {
  545. this.tabsFrom.show1 = true
  546. }
  547. },
  548. selector1confirm(e) {
  549. console.log(e)
  550. // var index = e[2];
  551. // this.tabsFrom.show1Index = index;
  552. if (e[2].value != null) {
  553. this.tabsFrom.show1Text = e[2].label;
  554. this.tabsFrom.title = e[2].label;
  555. this.FormData.meterId = e[2].value;
  556. this.FormData.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  557. this.FormData2.meterId = e[2].value;
  558. this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  559. //this.meterId =e[2].value;
  560. this.FormData.type = 2;
  561. this.value = '2';
  562. this.getTimeSlotStatistics();
  563. this.getElectricityStatistics();
  564. }
  565. },
  566. selector1cancel() {
  567. this.tabsFrom.show1Text = this.titleName;
  568. this.tabsFrom.title = this.titleName;
  569. this.FormData.meterId = this.meterId;
  570. this.FormData.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  571. this.FormData2.meterId = this.meterId;
  572. this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  573. this.FormData.type = 2;
  574. this.value = '2';
  575. this.getTimeSlotStatistics();
  576. this.getElectricityStatistics();
  577. },
  578. queryDate(queryTime, day) {
  579. if (day) {
  580. this.FormData2.queryDate = queryTime;
  581. //this.FormData2.type =day?"9":"10"
  582. //this.value="-1"
  583. this.getTimeSlotStatistics();
  584. } else {
  585. this.FormData.queryDate = queryTime + "-01";
  586. this.FormData.type = 10;
  587. this.value = "10";
  588. this.list[5].name = queryTime;
  589. this.getElectricityStatistics();
  590. }
  591. },
  592. getCompanyInfoList() {
  593. uni.showLoading({
  594. title: "加载中",
  595. mask: true,
  596. })
  597. API.deviceCompanyList().then((response) => {
  598. uni.hideLoading();
  599. var list = response.data.companyInfoList;
  600. this.tabsFrom.selector1 = [];
  601. this.tabsFrom.selector1 = list.map(item => {
  602. if (item.remoteReadingMeterList.length != 0 && item.remoteMonitorMeterList.length != 0) {
  603. return {
  604. label: item.name,
  605. value: item.id,
  606. children: [{
  607. label: '抄表',
  608. value: '1',
  609. children: item.remoteReadingMeterList.map(item => {
  610. return {
  611. label: item.name,
  612. value: item.id,
  613. }
  614. })
  615. },
  616. {
  617. label: '监控表',
  618. value: '1',
  619. children: item.remoteMonitorMeterList.map(item => {
  620. return {
  621. label: item.name,
  622. value: item.id,
  623. }
  624. })
  625. }
  626. ]
  627. }
  628. } else if (item.remoteReadingMeterList.length != 0 && item.remoteMonitorMeterList.length == 0) {
  629. return {
  630. label: item.name,
  631. value: item.id,
  632. children: [{
  633. label: '抄表',
  634. value: '1',
  635. children: item.remoteReadingMeterList.map(item => {
  636. return {
  637. label: item.name,
  638. value: item.id,
  639. }
  640. })
  641. }]
  642. }
  643. } else if (item.remoteReadingMeterList.length == 0 && item.remoteMonitorMeterList.length != 0) {
  644. return {
  645. label: item.name,
  646. value: item.id,
  647. children: [{
  648. label: '监控表',
  649. value: '1',
  650. children: item.remoteMonitorMeterList.map(item => {
  651. return {
  652. label: item.name,
  653. value: item.id,
  654. }
  655. })
  656. }]
  657. }
  658. } else {
  659. }
  660. })
  661. }).catch(error => {
  662. uni.showToast({
  663. title: error,
  664. icon: "none"
  665. })
  666. })
  667. },
  668. getTimeSlotStatistics(interval) {
  669. if (!interval) {
  670. uni.showLoading({
  671. title: "加载中",
  672. mask: true,
  673. })
  674. }
  675. this.queryDay = parseUnixTime(new Date(this.FormData2.queryDate), '{y}年{m}月{d}日');
  676. API.timeSlotStatistics(this.FormData2).then((response) => {
  677. if (!interval) {
  678. uni.hideLoading();
  679. }
  680. this.hourMap = response.data.hourMap;
  681. this.sumQuantity = response.data.kwhMap.kwh;
  682. this.sumFee = response.data.kwhMap.fee;
  683. this.getBarCharts(this.hourMap, interval);
  684. if (!interval) {
  685. this.startInterval(); // 组件挂载后开始间隔
  686. }
  687. }).catch(error => {
  688. uni.showToast({
  689. title: error,
  690. icon: "none"
  691. })
  692. })
  693. },
  694. getElectricityStatistics(interval) {
  695. if (!interval) {
  696. uni.showLoading({
  697. title: "加载中",
  698. mask: true,
  699. })
  700. }
  701. var obj = {
  702. ...this.FormData
  703. }
  704. // if(obj.type==10){
  705. // obj.queryDate+="-01"
  706. // }
  707. API.electricityStatistics(obj).then((response) => {
  708. if (!interval) {
  709. uni.hideLoading();
  710. }
  711. this.showTop = [0, 0, 0, 0, 0, 0, 0, 0]
  712. var electricity = response.data.kwhMap.kwh + "";
  713. this.electricity = response.data.kwhMap.kwh;
  714. this.fee = response.data.kwhMap.fee;
  715. if (electricity) {
  716. var sz = electricity.split(".")
  717. var str1 = sz[0];
  718. var str2 = [];
  719. if (sz.length > 1) {
  720. str2 = sz[1];
  721. this.showTop[7] = str2[0];
  722. }
  723. var j = 0;
  724. for (var i in str1) {
  725. if (i != undefined) {
  726. this.showTop[6 - str1.length + j + 1] = str1[i]
  727. }
  728. j++;
  729. }
  730. this.$forceUpdate()
  731. }
  732. if (!interval) {
  733. this.startInterval(); // 组件挂载后开始间隔
  734. }
  735. }).catch(error => {
  736. uni.showToast({
  737. title: error,
  738. icon: "none"
  739. })
  740. })
  741. },
  742. getBarCharts(list, interval) {
  743. if (!this.myChart) {
  744. this.myChart = echarts.init(document.getElementById('barEcharts'), null, {
  745. width: uni.upx2px(700),
  746. height: uni.upx2px(480)
  747. });
  748. }
  749. if (!interval) {
  750. this.myChart.clear();
  751. }
  752. var data1 = [];
  753. var data2 = [];
  754. // var sumQuantity=0
  755. for (var i in list) {
  756. data1.push(i)
  757. data2.push(list[i].kwh)
  758. // sumQuantity+=list[i]
  759. }
  760. var axisLabel = {
  761. rotate: 40,
  762. interval: 0,
  763. textStyle: {
  764. color: "#333"
  765. }
  766. }
  767. if (data1.length < 4) {
  768. axisLabel = {
  769. interval: 0,
  770. textStyle: {
  771. color: "#333"
  772. },
  773. }
  774. }
  775. // this.sumQuantity = sumQuantity.toFixed(2);
  776. var headitemby = "";
  777. var showkey = "";
  778. var option = {
  779. tooltip: {
  780. trigger: 'axis',
  781. axisPointer: {
  782. type: 'shadow'
  783. },
  784. formatter: (value) => {
  785. var name = value[0].name;
  786. var obj=list[name]
  787. var text= `<p>${name}</p>`
  788. if (obj.electricityPrice != undefined) {
  789. text += `<p>电价:${obj.electricityPrice}元/度</p>`
  790. }
  791. if (obj.kwh != undefined) {
  792. text += `电量:${obj.kwh}度`
  793. }
  794. if (obj.amount != undefined) {
  795. text += ` <p>电费:${obj.amount}元</p>`
  796. }
  797. return text
  798. }
  799. },
  800. grid: {
  801. top: '10%',
  802. left: '3%',
  803. right: '8%',
  804. bottom: '8%',
  805. containLabel: true
  806. },
  807. xAxis: {
  808. type: 'category',
  809. data: data1,
  810. axisLabel: axisLabel,
  811. },
  812. yAxis: {
  813. type: 'value',
  814. },
  815. series: [{
  816. name: '合计',
  817. data: data2,
  818. type: 'bar',
  819. label: {
  820. show: true,
  821. position: 'top',
  822. color: '#5C7BD9'
  823. }
  824. }]
  825. }
  826. console.log(option)
  827. this.myChart.setOption(option);
  828. },
  829. selector2confirm(e) {
  830. this.tabsFrom.show2Text = e.year + "年" + e.month + "月"
  831. this.tabsFrom.show2Index = e.year + "-" + e.month
  832. if (e.day) {
  833. this.tabsFrom.show2Text += e.day + "日"
  834. this.tabsFrom.show2Index += '-' + e.day
  835. this.queryDate(this.tabsFrom.show2Index, true)
  836. } else {
  837. this.queryDate(this.tabsFrom.show2Index, false)
  838. }
  839. },
  840. selector2cancel() {
  841. this.value = this.clickType;
  842. },
  843. selector2reset(e) {
  844. console.log(e)
  845. this.tabsFrom.show2Text = '全部时间'
  846. this.tabsFrom.show2Index = '';
  847. if (e.day) {
  848. this.FormData2.queryDate = parseUnixTime(new Date(), '{y}-{m}-{d}');
  849. this.queryDay = parseUnixTime(new Date(this.FormData2.queryDate), '{y}年{m}月{d}日');
  850. this.getTimeSlotStatistics();
  851. } else {
  852. this.FormData.type = this.clickType;
  853. this.value = this.clickType;
  854. if (this.value != 10) {
  855. this.list[5].name = '指定月份';
  856. }
  857. this.getElectricityStatistics();
  858. }
  859. },
  860. // 选中某个单选框时,由radio时触发
  861. radioChange(e) {
  862. console.log(`选择前的值: ${this.value}`);
  863. this.clickType = this.value;
  864. },
  865. // 选中任一radio时,由radio-group触发
  866. radioGroupChange(e) {
  867. console.log(e)
  868. this.FormData.type = e;
  869. if (e == 10) {
  870. this.tabsFrom.show2 = true;
  871. this.params.day = false;
  872. } else {
  873. this.list[5].name = '指定月份'
  874. this.getElectricityStatistics();
  875. }
  876. },
  877. backDataMonitoringList() {
  878. uni.navigateBack()
  879. },
  880. }
  881. };
  882. </script>
  883. <style lang="scss" scoped>
  884. page {
  885. padding-bottom: 184rpx;
  886. }
  887. /deep/.u-select__header__title {
  888. font-size: 36rpx;
  889. font-weight: bold;
  890. }
  891. .navbar-c {
  892. background-color: rgba(22, 119, 255, 1);
  893. position: fixed;
  894. top: 0;
  895. left: 0;
  896. right: 0;
  897. z-index: 999;
  898. .back {
  899. z-index: 999;
  900. width: 200rpx;
  901. }
  902. .title {
  903. color: #fff;
  904. display: flex;
  905. align-items: center;
  906. justify-content: center;
  907. }
  908. .right {
  909. .img {
  910. width: 48rpx;
  911. height: 48rpx;
  912. }
  913. }
  914. }
  915. /deep/.uicon-nav-back {
  916. color: #fff !important;
  917. }
  918. .background {
  919. background-color: rgba(22, 119, 255, 1);
  920. padding-top: 88rpx;
  921. padding-bottom: 100rpx;
  922. /deep/.u-border-bottom:after {
  923. border: none;
  924. }
  925. .u-nav-slot {
  926. margin-right: 32rpx;
  927. .img {
  928. width: 48rpx;
  929. height: 48rpx;
  930. vertical-align: middle;
  931. }
  932. }
  933. }
  934. .background::after {
  935. content: '';
  936. position: absolute;
  937. width: 160%;
  938. height: 150px;
  939. background-color: rgba(22, 119, 255, 1);
  940. left: -30%;
  941. border-radius: 0 0 50% 50%;
  942. }
  943. // // 日期
  944. .date-box {
  945. display: flex;
  946. align-items: center;
  947. justify-content: space-between;
  948. margin: 24rpx 32rpx;
  949. .item {
  950. border-radius: 8px;
  951. background-color: rgba(255, 255, 255, 0.1);
  952. border: 1px solid rgba(255, 255, 255, 0.15);
  953. width: 120rpx;
  954. height: 120rpx;
  955. color: #fff;
  956. text-align: center;
  957. display: flex;
  958. flex-direction: column;
  959. justify-content: center;
  960. .date {
  961. font-size: 40rpx;
  962. }
  963. }
  964. .item-today {
  965. background-color: rgba(255, 255, 255, 1);
  966. position: relative;
  967. .date {
  968. color: rgba(22, 119, 255, 1);
  969. }
  970. .week {
  971. color: rgba(16, 16, 16, 1);
  972. }
  973. .dot {
  974. width: 10rpx;
  975. height: 10rpx;
  976. background-color: rgba(255, 150, 0, 1);
  977. border-radius: 999px;
  978. position: absolute;
  979. bottom: -5rpx;
  980. left: 50%;
  981. transform: translateX(-50%);
  982. }
  983. }
  984. }
  985. // 用电量
  986. .electricity-consumption {
  987. background-color: #fff;
  988. padding: 32rpx 32rpx 0rpx;
  989. border-radius: 8px;
  990. margin: -88rpx 32rpx 0;
  991. position: relative;
  992. background: linear-gradient(180deg, rgba(187,216,255,1) 0%,rgba(255,255,255,1) 63%);
  993. // 统计
  994. .statistics-content{
  995. display: flex;
  996. align-items: center;
  997. justify-content: space-between;
  998. .statistics-item{
  999. width: 300rpx;
  1000. padding: 24rpx 0 24rpx 24rpx;
  1001. border-radius: 8px;
  1002. box-shadow: 0px 0px 8px 0px rgba(22,119,255,0.3);
  1003. background-color: #fff;
  1004. }
  1005. .item-title{
  1006. color: rgba(22,119,255,1);
  1007. font-size: 32rpx;
  1008. display: flex;
  1009. align-items: center;
  1010. font-weight: bold;
  1011. .img{
  1012. width: 32rpx;
  1013. height: 32rpx;
  1014. vertical-align: middle;
  1015. margin-right: 4rpx;
  1016. }
  1017. }
  1018. .item-value{
  1019. color: rgba(16,16,16,1);
  1020. font-size: 48rpx;
  1021. font-weight: bold;
  1022. margin-top: 8rpx;
  1023. overflow: hidden;
  1024. white-space: nowrap;
  1025. text-overflow: ellipsis;
  1026. }
  1027. }
  1028. .title {
  1029. color: rgba(16, 16, 16, 1);
  1030. font-size: 36rpx;
  1031. }
  1032. .degree {
  1033. display: flex;
  1034. margin-top: 32rpx;
  1035. .item {
  1036. margin-right: 6rpx;
  1037. text-align: center;
  1038. .item-text {
  1039. color: rgba(16, 16, 16, 1);
  1040. }
  1041. .item-number {
  1042. margin-top: 24rpx;
  1043. width: 72rpx;
  1044. height: 96rpx;
  1045. background-color: rgba(16, 16, 16, 1);
  1046. color: #fff;
  1047. font-size: 72rpx;
  1048. }
  1049. .decimal {
  1050. background-color: #900005;
  1051. }
  1052. }
  1053. }
  1054. // .tab {
  1055. // width: 240rpx;
  1056. // height: 0;
  1057. // border-width: 0px 48rpx 72rpx 0px;
  1058. // border-radius: 8px 8px 0 0;
  1059. // border-style: none solid solid none;
  1060. // border-color: transparent transparent #fff;
  1061. // position: absolute;
  1062. // top: -72rpx;
  1063. // left: 0rpx;
  1064. // right: 0rpx;
  1065. // color: #101010;
  1066. // color: rgba(16, 16, 16, 1);
  1067. // text-align: center;
  1068. // line-height: 72rpx;
  1069. // z-index: 999;
  1070. // text-indent: 16rpx;
  1071. // }
  1072. // .tab2 {
  1073. // width: 240rpx;
  1074. // height: 0;
  1075. // border-width: 0px 48rpx 72rpx 0px;
  1076. // border-radius: 8px 8px 0 0;
  1077. // border-style: none solid solid none;
  1078. // border-color: transparent transparent #D4DBE4;
  1079. // position: absolute;
  1080. // top: -72rpx;
  1081. // left: 210rpx;
  1082. // right: 0rpx;
  1083. // color: #777777;
  1084. // text-align: center;
  1085. // line-height: 72rpx;
  1086. // text-indent: 16rpx;
  1087. // }
  1088. .radio {
  1089. margin-top: 24rpx;
  1090. padding-left: 8rpx;
  1091. /deep/.u-radio {
  1092. margin-bottom: 8px;
  1093. min-width: 25% !important;
  1094. }
  1095. /deep/.u-radio__label{
  1096. margin-left: 24rpx;
  1097. font-size: 28rpx; ;
  1098. }
  1099. }
  1100. }
  1101. //各时段用电量
  1102. .electricity-chart {
  1103. margin: 24rpx 32rpx;
  1104. padding: 40rpx 32rpx;
  1105. background-color: #fff;
  1106. border-radius: 8px;
  1107. .title {
  1108. display: flex;
  1109. align-items: center;
  1110. margin-bottom: 40rpx;
  1111. .icon {
  1112. width: 36rpx;
  1113. height: 36rpx;
  1114. background-color: rgba(182, 212, 255, 1);
  1115. border: 6px solid rgba(22, 119, 255, 1);
  1116. border-radius: 100px;
  1117. }
  1118. .text {
  1119. color: rgba(51, 51, 51, 1);
  1120. font-size: 36rpx;
  1121. margin-left: 16rpx;
  1122. font-weight: bold;
  1123. }
  1124. .more {
  1125. margin-left: auto;
  1126. border: 1px solid rgba(187,187,187,1);
  1127. border-radius: 4px;
  1128. padding: 8rpx;
  1129. font-size: 24rpx;
  1130. }
  1131. }
  1132. .total{
  1133. display: flex;
  1134. align-items: center;
  1135. justify-content: space-between;
  1136. color: rgba(51,51,51,1);
  1137. font-weight: bold;
  1138. }
  1139. .chart {
  1140. width: 100%;
  1141. height: 500rpx;
  1142. .img {
  1143. width: 100%;
  1144. height: 440rpx;
  1145. }
  1146. }
  1147. }
  1148. .equipment-information {
  1149. margin: 24rpx 32rpx;
  1150. padding: 40rpx 0rpx;
  1151. background-color: #fff;
  1152. border-radius: 8px;
  1153. .title {
  1154. display: flex;
  1155. align-items: center;
  1156. padding: 0 32rpx;
  1157. margin-bottom: 40rpx;
  1158. .icon {
  1159. width: 36rpx;
  1160. height: 36rpx;
  1161. background-color: rgba(182, 212, 255, 1);
  1162. border: 6px solid rgba(22, 119, 255, 1);
  1163. border-radius: 100px;
  1164. }
  1165. .text {
  1166. display: flex;
  1167. align-items: center;
  1168. color: rgba(51, 51, 51, 1);
  1169. font-size: 36rpx;
  1170. margin-left: 16rpx;
  1171. font-weight: bold;
  1172. }
  1173. .date {
  1174. margin-left: auto;
  1175. }
  1176. .more {
  1177. color: #838383;
  1178. font-size: 24rpx;
  1179. margin-left: auto;
  1180. }
  1181. }
  1182. .chart {
  1183. width: 100%;
  1184. height: 440rpx;
  1185. .img {
  1186. width: 100%;
  1187. height: 440rpx;
  1188. }
  1189. }
  1190. .infos {
  1191. padding: 0 32rpx;
  1192. display: flex;
  1193. justify-content: space-between;
  1194. text-align: center;
  1195. .border {
  1196. margin: auto 0;
  1197. height: 70rpx;
  1198. width: 2rpx;
  1199. background-color: rgba(204, 204, 204, 1);
  1200. ;
  1201. }
  1202. .item-title {
  1203. color: rgba(119, 119, 119, 1);
  1204. }
  1205. .item-value {
  1206. color: rgba(16, 16, 16, 1);
  1207. font-size: 32rpx;
  1208. margin-top: 16rpx;
  1209. }
  1210. }
  1211. }
  1212. // 异常
  1213. .abnormal {
  1214. margin: 24rpx 32rpx;
  1215. padding: 40rpx 32rpx;
  1216. background-color: #fff;
  1217. border-radius: 8px;
  1218. .headline {
  1219. display: flex;
  1220. align-items: center;
  1221. justify-content: space-between;
  1222. }
  1223. .title {
  1224. display: flex;
  1225. align-items: center;
  1226. font-weight: bold;
  1227. .icon {
  1228. width: 36rpx;
  1229. height: 36rpx;
  1230. background-color: rgba(182, 212, 255, 1);
  1231. border: 6px solid rgba(22, 119, 255, 1);
  1232. border-radius: 100px;
  1233. }
  1234. .text {
  1235. color: rgba(51, 51, 51, 1);
  1236. font-size: 36rpx;
  1237. margin-left: 16rpx;
  1238. }
  1239. }
  1240. .more {
  1241. color: #838383;
  1242. font-size: 24rpx
  1243. }
  1244. .details {
  1245. margin-top: 40rpx;
  1246. .item {
  1247. display: flex;
  1248. align-items: center;
  1249. justify-content: space-between;
  1250. margin-top: 32rpx;
  1251. .name {
  1252. color: rgba(51, 51, 51, 1);
  1253. }
  1254. .time {
  1255. color: rgba(119, 119, 119, 1);
  1256. font-size: 24rpx;
  1257. }
  1258. }
  1259. }
  1260. }
  1261. // 能源监测
  1262. .energy-inspection,
  1263. .data-analysis {
  1264. margin: 24rpx 32rpx;
  1265. padding: 40rpx 32rpx;
  1266. background-color: #fff;
  1267. border-radius: 8px;
  1268. .title {
  1269. display: flex;
  1270. align-items: center;
  1271. font-weight: bold;
  1272. .icon {
  1273. width: 36rpx;
  1274. height: 36rpx;
  1275. background-color: rgba(182, 212, 255, 1);
  1276. border: 6px solid rgba(22, 119, 255, 1);
  1277. border-radius: 100px;
  1278. }
  1279. .text {
  1280. color: rgba(51, 51, 51, 1);
  1281. font-size: 36rpx;
  1282. margin-left: 16rpx;
  1283. }
  1284. }
  1285. .grid {
  1286. .icon {
  1287. width: 128rpx;
  1288. height: 128rpx;
  1289. border-radius: 12px;
  1290. background-color: rgba(35, 186, 178, 1);
  1291. display: flex;
  1292. align-items: center;
  1293. justify-content: center;
  1294. margin-bottom: 16rpx;
  1295. .img {
  1296. width: 80rpx;
  1297. height: 80rpx;
  1298. }
  1299. }
  1300. .icon2 {
  1301. background-color: rgba(42, 186, 72, 1);
  1302. }
  1303. .icon3 {
  1304. background-color: rgba(78, 96, 246, 1);
  1305. }
  1306. .icon4 {
  1307. background-color: rgba(22, 119, 255, 1);
  1308. }
  1309. .icon5 {
  1310. background-color: rgba(35, 186, 178, 1);
  1311. }
  1312. .icon6 {
  1313. background-color: rgba(42, 186, 72, 1);
  1314. }
  1315. .icon7 {
  1316. background-color: rgba(22, 119, 255, 1);
  1317. }
  1318. .icon8 {
  1319. background-color: rgba(35, 186, 178, 1);
  1320. }
  1321. .icon9 {
  1322. background-color: rgba(42, 186, 72, 1);
  1323. }
  1324. .grid-text {
  1325. color: #333333;
  1326. }
  1327. }
  1328. }
  1329. // 设备信息弹窗
  1330. .equipment-popup {
  1331. .content {
  1332. padding: 32rpx;
  1333. .headline {
  1334. color: rgba(16, 16, 16, 1);
  1335. font-size: 36rpx;
  1336. text-align: center;
  1337. font-weight: bold;
  1338. }
  1339. .infos {
  1340. padding-bottom: 100rpx;
  1341. .item:last-of-type {
  1342. border: none;
  1343. }
  1344. .item {
  1345. display: flex;
  1346. align-items: center;
  1347. height: 80rpx;
  1348. line-height: 80rpx;
  1349. border-bottom: 1px solid #cccccc;
  1350. .item-title {
  1351. color: rgba(51, 51, 51, 1);
  1352. width: 200rpx;
  1353. }
  1354. .item-value {
  1355. color: #666666;
  1356. flex: 1;
  1357. margin-left: 16rpx;
  1358. }
  1359. }
  1360. }
  1361. .get {
  1362. height: 80rpx;
  1363. line-height: 80rpx;
  1364. border-radius: 4px;
  1365. background-color: rgba(22, 119, 255, 1);
  1366. color: rgba(255, 255, 255, 1);
  1367. font-size: 32rpx;
  1368. }
  1369. }
  1370. }
  1371. // 创建工单
  1372. .create-order {
  1373. width: 120rpx;
  1374. height: 120rpx;
  1375. border-radius: 20px;
  1376. background: linear-gradient(180.29deg, rgba(255, 124, 112, 1) 0.9%, rgba(255, 79, 63, 1) 100.4%);
  1377. box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
  1378. text-align: center;
  1379. display: flex;
  1380. flex-direction: column;
  1381. justify-content: center;
  1382. align-items: center;
  1383. position: fixed;
  1384. right: 32rpx;
  1385. bottom: 64rpx;
  1386. .img {
  1387. width: 56rpx;
  1388. height: 56rpx;
  1389. vertical-align: middle;
  1390. }
  1391. .text {
  1392. color: rgba(255, 255, 255, 1);
  1393. font-size: 22rpx;
  1394. }
  1395. }
  1396. </style>