electronicMonitoring.vue 34 KB

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