electronicMonitoringWater.vue 33 KB

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