dataLock.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799
  1. <template>
  2. <view>
  3. <u-navbar :title="title" :backIconColor="'#ffffff'" title-color="#ffffff"
  4. :background="backgroundObj"></u-navbar>
  5. <view class="gradient-header">
  6. <view class="jpback">
  7. </view>
  8. </view>
  9. <u-picker title="日期选择" :maskCloseAble="true" v-model="body0data.tabsFrom.show" :defaultTime="body0data.tabsFrom.showIndex+'-1'"
  10. mode="time" :params="body0data.tabsFrom.params" @confirm="selector2confirm" @cancel="selector2cancel"
  11. >
  12. </u-picker>
  13. <view class="main">
  14. <view class="statistics ">
  15. <view class="data1">
  16. <view class="item">
  17. <view class="line">
  18. <view class="name">
  19. {{info.name}}
  20. </view>
  21. <view class="item-tags">
  22. <view class="tag tag1" :class="'typeN typeN'+info.type">
  23. {{info.typeN}}
  24. </view>
  25. <!-- <view class="tag" :class="'statusN statusN'+info.status">
  26. {{info.statusN}}
  27. </view>
  28. <view class="tag" :class="'lockStatusN lockStatusN'+info.lockStatus">
  29. {{info.lockStatusN}}
  30. </view> -->
  31. </view>
  32. </view>
  33. <view class="line">
  34. 编号:{{info.lockNo}}
  35. </view>
  36. <view class="line" style=" color: #909399;">
  37. 更新时间:{{info.lastOnlineTime}}
  38. </view>
  39. </view>
  40. <view class="value" v-if="0">
  41. <u-button type="primary" size="mini" shape="circle">
  42. <img class="img" src="@/assets/img/button/lock.svg" alt="">
  43. 降锁
  44. </u-button>
  45. </view>
  46. </view>
  47. <view class="top-span">
  48. <view class="item-span">
  49. <img src="@/assets/img/topspan/span1.png">
  50. <span>车位</span>
  51. <span v-if="info.parkingStatus==1" style="color: #1677FF;" >有车</span>
  52. <span v-else-if="info.parkingStatus==0" style="color: #00B962;" >无车</span>
  53. </view>
  54. <view class="item-span">
  55. <img src="@/assets/img/topspan/span2.png">
  56. <span>地锁</span>
  57. <span style="color: red;"
  58. v-if="info.lockStatus==4||info.lockStatus==0">
  59. 错误</span>
  60. <span v-else-if="info.lockStatus==1" style="color: #1677FF;" >升起</span>
  61. <span v-else-if="info.lockStatus==2" style="color: #00B962;" >降落</span>
  62. <span v-else >其他</span>
  63. </view>
  64. <view class="item-span">
  65. <img src="@/assets/img/topspan/span3.png">
  66. <span>电压</span>
  67. <span v-if="info.batteryLevel">{{info.batteryLevel}}V</span>
  68. <span v-else>未知</span>
  69. </view>
  70. <view class="item-span">
  71. <img src="@/assets/img/topspan/span4.png">
  72. <span>网络</span>
  73. <span v-if="info.status==1" style="color: #00B962;" >在线</span>
  74. <span v-else-if="info.status==0" style="color: red" >离线</span>
  75. </view>
  76. <view class="item-span">
  77. <img src="@/assets/img/topspan/span5.png">
  78. <span>雷达</span>
  79. <span v-if="info.radarStatus==0" style="color: #00B962;" >正常</span>
  80. <span v-else-if="info.radarStatus==1" style="color: red" >故障</span>
  81. </view>
  82. </view>
  83. </view>
  84. <view class=" no_statistics">
  85. <view class="data2">
  86. <view class="top">
  87. <view class="item">
  88. <view class="name">
  89. 停车时长
  90. </view>
  91. <view class="value">
  92. {{durationShow()}}
  93. </view>
  94. </view>
  95. <view class="item">
  96. <view class="name">
  97. 使用率
  98. </view>
  99. <view class="value" v-if="lockUsageRateData&&lockUsageRateData.usageRate">
  100. {{lockUsageRateData.usageRate=='∞'?'/':lockUsageRateData.usageRate+'%'}}
  101. </view>
  102. </view>
  103. <view class="item">
  104. <view class="name">
  105. 异常次数
  106. </view>
  107. <view class="value">
  108. 0
  109. </view>
  110. </view>
  111. </view>
  112. <view class="body">
  113. <u-radio-group v-model="radiovalue" @change="radioGroupChange">
  114. <u-radio @change="radioChange" v-for="(item, index) in radiolist" :key="index"
  115. :name="item.value">
  116. {{item.name}}
  117. </u-radio>
  118. </u-radio-group>
  119. </view>
  120. </view>
  121. </view>
  122. <u-picker v-model="body2data.vue.show" :params="body2data.vue.params" :default-time="body2data.query.startTime"
  123. @confirm="body2dataconfirm" mode="time"></u-picker>
  124. <view class="statistics ">
  125. <view class="title">
  126. <view class="icon">
  127. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  128. </view>
  129. <view class="text">
  130. <view>车位平均占用率(%)</view>
  131. <view class="tag" @click="body2data.vue.show=true">{{body2data.vue.queryN}}<u-icon
  132. name="arrow-down"></u-icon></view>
  133. </view>
  134. </view>
  135. <view class="contentBody">
  136. <jpContent :status="jpContentMap.body2">
  137. <view class="body2lineChart">
  138. <view id="body2line1" class="body2line">
  139. </view>
  140. </view>
  141. </jpContent>
  142. </view>
  143. </view>
  144. <view class="statistics " v-if="0">
  145. <view class="title">
  146. <view class="icon">
  147. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  148. </view>
  149. <view class="text">
  150. <view>地锁历史异常状态</view>
  151. </view>
  152. </view>
  153. <view class="contentBody">
  154. <jpContent :status="jpContentMap.body1">
  155. <view class="body1pieChart">
  156. <view id="body1pie1" class="body1pie">
  157. </view>
  158. </view>
  159. </jpContent>
  160. </view>
  161. </view>
  162. <view class="statistics ">
  163. <view class="title">
  164. <view class="icon">
  165. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  166. </view>
  167. <view class="text">
  168. <view>高频使用时段分布</view>
  169. </view>
  170. </view>
  171. <view class="contentBody">
  172. <jpContent :status="jpContentMap.body3">
  173. <view class="body3barChart">
  174. <view id="body3bar1" class="body3bar">
  175. </view>
  176. </view>
  177. </jpContent>
  178. </view>
  179. </view>
  180. <view class="statistics ">
  181. <view class="title">
  182. <view class="icon">
  183. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  184. </view>
  185. <view class="text">
  186. <view>用户停留时长分群特征</view>
  187. </view>
  188. </view>
  189. <view class="contentBody">
  190. <jpContent :status="jpContentMap.body4">
  191. <view class="body4pieChart">
  192. <view id="body4pie1" class="body4pie">
  193. </view>
  194. </view>
  195. </jpContent>
  196. </view>
  197. </view>
  198. <view class="statistics " v-if="0">
  199. <view class="title">
  200. <view class="icon">
  201. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  202. </view>
  203. <view class="text">
  204. <view>高频使用用户TOP</view>
  205. </view>
  206. </view>
  207. <view class="contentBody">
  208. <jpContent :status="jpContentMap.body5">
  209. <view class="body5data">
  210. <view class="line">
  211. <view class="data">
  212. <view class="item">
  213. 王二
  214. </view>
  215. <view class="value">
  216. 鄂DDT1268
  217. </view>
  218. <view class="value">
  219. 28次
  220. </view>
  221. </view>
  222. <view class="goto">
  223. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  224. </view>
  225. </view>
  226. <view class="line">
  227. <view class="data">
  228. <view class="item">
  229. 王三
  230. </view>
  231. <view class="value">
  232. 鄂DDT1268
  233. </view>
  234. <view class="value">
  235. 8次
  236. </view>
  237. </view>
  238. <view class="goto">
  239. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  240. </view>
  241. </view>
  242. </view>
  243. </jpContent>
  244. </view>
  245. </view>
  246. <!-- end-->
  247. <view class="statistics " v-if="0">
  248. <view class="title">
  249. <view class="icon">
  250. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  251. </view>
  252. <view class="text">
  253. <view>白名单用户清单</view>
  254. <view class="check-all">查看全部<u-icon name="arrow-right"></u-icon></view>
  255. </view>
  256. </view>
  257. <view class="contentBody">
  258. <jpContent :status="jpContentMap.body7">
  259. <view class="body7data">
  260. <view class="line">
  261. <view class="value">
  262. 用户姓名
  263. </view>
  264. <view class="value">
  265. 车主身份
  266. </view>
  267. <view class="value">
  268. 使用次数
  269. </view>
  270. </view>
  271. <view class="line">
  272. <view class="value">
  273. 孙培军
  274. </view>
  275. <view class="value">
  276. 车位所有人
  277. </view>
  278. <view class="value">
  279. 22
  280. </view>
  281. </view>
  282. <view class="line">
  283. <view class="value">
  284. 刘洋
  285. </view>
  286. <view class="value">
  287. 白名单用户
  288. </view>
  289. <view class="value">
  290. 11
  291. </view>
  292. </view>
  293. </view>
  294. </jpContent>
  295. </view>
  296. </view>
  297. <!-- end-->
  298. <view class="statistics " v-if="0" >
  299. <view class="title">
  300. <view class="icon">
  301. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  302. </view>
  303. <view class="text">
  304. <view>车位异常记录</view>
  305. <view class="check-all">查看全部<u-icon name="arrow-right"></u-icon></view>
  306. </view>
  307. </view>
  308. <view class="contentBody" >
  309. <jpContent :status="jpContentMap.body6">
  310. <view class="body6main">
  311. <view class="line" v-for="(item,index) in abnormalRecordsList" :key="index">
  312. <view class="abnormal-item">
  313. <!-- @click="gotoUrl('/pages/abnormal/abnormalAlarmDetails?id='+item.id)"
  314. -->
  315. <view class="item-title">
  316. <view class="name">
  317. <span v-if="item.level==1" class="level level1 ">一级</span>
  318. <span v-if="item.level==2" class="level level2">二级</span>
  319. {{item.content}}
  320. </view>
  321. <view class="date"
  322. style="display: flex; justify-content: space-between;margin-top: 4rpx;">
  323. <view>{{item.title}}</view>
  324. <view>{{item.createTime}}</view>
  325. </view>
  326. </view>
  327. </view>
  328. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  329. </view>
  330. </view>
  331. </jpContent>
  332. </view>
  333. </view>
  334. <!-- end-->
  335. <view class="body8data-popup">
  336. <u-popup v-model="body8data.popup" mode="bottom" height="80%" border-radius="12">
  337. <view class="content">
  338. <view class="headline">
  339. 地锁信息
  340. </view>
  341. <view class="infos">
  342. <view class="item">
  343. <view class="item-title">
  344. 地锁名称
  345. </view>
  346. <view class="item-value">
  347. {{info.name}}
  348. </view>
  349. </view>
  350. <view class="item">
  351. <view class="item-title">
  352. 地锁管理者
  353. </view>
  354. <view class="item-value">
  355. {{info.administrator}}
  356. </view>
  357. </view>
  358. <view class="item">
  359. <view class="item-title">
  360. 车位类型
  361. </view>
  362. <view class="item-value">
  363. {{info.typeN}}
  364. </view>
  365. </view>
  366. <view class="item">
  367. <view class="item-title">
  368. 地锁状态
  369. </view>
  370. <view class="item-value">
  371. {{info.lockStatusN}}
  372. </view>
  373. </view>
  374. <view class="item">
  375. <view class="item-title">
  376. 地锁型号
  377. </view>
  378. <view class="item-value">
  379. {{info.model}}
  380. </view>
  381. </view>
  382. <view class="item">
  383. <view class="item-title">
  384. 出厂编号
  385. </view>
  386. <view class="item-value">
  387. <span>{{info.factoryNumber}}</span>
  388. </view>
  389. </view>
  390. <view class="item">
  391. <view class="item-title">
  392. 固件版号
  393. </view>
  394. <view class="item-value">
  395. {{info.solidVersion}}
  396. </view>
  397. </view>
  398. <view class="item">
  399. <view class="item-title">
  400. 防护等级
  401. </view>
  402. <view class="item-value">
  403. {{info.protectionGrade}}
  404. </view>
  405. </view>
  406. <view class="item">
  407. <view class="item-title">
  408. 生产日期
  409. </view>
  410. <view class="item-value">
  411. {{info.manufactureDate}}
  412. </view>
  413. </view>
  414. <view class="item">
  415. <view class="item-title">
  416. 标准依据
  417. </view>
  418. <view class="item-value">
  419. {{info.enablingTime}}
  420. </view>
  421. </view>
  422. <view class="item">
  423. <view class="item-title">
  424. 联网卡号
  425. </view>
  426. <view class="item-value">
  427. {{info.standardBasis}}
  428. </view>
  429. </view>
  430. <view class="item" v-if="info.tariffStandard">
  431. <view class="item-title">
  432. 资费标准
  433. </view>
  434. <view class="item-value">
  435. {{info.tariffStandard}}元/月
  436. </view>
  437. </view>
  438. <view class="item">
  439. <view class="item-title">
  440. 地锁启动时间
  441. </view>
  442. <view class="item-value">
  443. {{info.activationTime}}
  444. </view>
  445. </view>
  446. <view class="item">
  447. <view class="item-title">
  448. 地锁质保期
  449. </view>
  450. <view class="item-value">
  451. {{info.shelfLife}}年
  452. </view>
  453. </view>
  454. </view>
  455. <button class="get" @click="body8data.popup=false">知道了</button>
  456. </view>
  457. </u-popup>
  458. </view>
  459. <view class="statistics ">
  460. <view class="title">
  461. <view class="icon">
  462. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  463. </view>
  464. <view class="text">
  465. <view>地锁信息</view>
  466. <view class="check-all" @click="body8data.popup=true" >查看全部<u-icon name="arrow-right"></u-icon></view>
  467. </view>
  468. </view>
  469. <view class="contentBody">
  470. <jpContent :status="jpContentMap.body8">
  471. <view class="body8main">
  472. <view class="line">
  473. <view class="value">
  474. 地锁型号
  475. </view>
  476. <view class="value">
  477. 出厂编号
  478. </view>
  479. <view class="value">
  480. 固件版号
  481. </view>
  482. </view>
  483. <view class="line">
  484. <view class="value">
  485. {{info.model}}
  486. </view>
  487. <view class="value">
  488. {{info.factoryNumber}}
  489. </view>
  490. <view class="value">
  491. {{info.solidVersion}}
  492. </view>
  493. </view>
  494. </view>
  495. </jpContent>
  496. </view>
  497. </view>
  498. <!-- end-->
  499. <u-divider border-color="#CFD2D5">已经到底了</u-divider>
  500. </view>
  501. </view>
  502. </template>
  503. <script>
  504. import jpContent from '@/components/JPcontent.vue'
  505. import * as echarts from 'echarts';
  506. import * as API from '@/apis/pagejs/deviceTab.js'
  507. import * as API_index from '@/apis/pagejs/index.js'
  508. import {
  509. parseUnixTime,
  510. beforeTimeStamp,
  511. newDate
  512. } from '@/apis/utils'
  513. export default {
  514. components: {
  515. jpContent
  516. },
  517. data() {
  518. return {
  519. id:"",
  520. info:{},
  521. echartsList: {},
  522. lockUsageRateData:{},
  523. body2data: {
  524. query: {},
  525. vue: {
  526. queryN: "",
  527. show: false,
  528. params: {
  529. year: true,
  530. month: true,
  531. day: false,
  532. hour: false,
  533. minute: false,
  534. second: false
  535. }
  536. },
  537. data: {}
  538. },
  539. body0data: {
  540. query: {},
  541. data: {},
  542. tabsFrom:{
  543. show:false,
  544. showIndex:"",
  545. params:{
  546. year: true,
  547. month: true,
  548. day: false,
  549. hour: false,
  550. minute: false,
  551. second: false
  552. }
  553. }
  554. },
  555. body4data: {
  556. query: {},
  557. data: {}
  558. },
  559. body8data: {
  560. query: {},
  561. data: {},
  562. popup:false,
  563. },
  564. body3data: {
  565. query: {},
  566. data: {}
  567. },
  568. jpContentMap: {
  569. body1: 2,
  570. body2: 2,
  571. body3: 2,
  572. body4: 2,
  573. body5: 2,
  574. body6: 2,
  575. body7: 2,
  576. body8: 2,
  577. body9: 2,
  578. body10: 2,
  579. },
  580. title: "",
  581. backgroundObj: {
  582. background: '#307AF6'
  583. },
  584. radiovalue: "1",
  585. radiolist: [{
  586. name: '上月',
  587. value: "3"
  588. },
  589. {
  590. name: '当月',
  591. value: "1"
  592. },
  593. {
  594. name: '今日',
  595. value: "2"
  596. }, {
  597. name: '当年',
  598. value: "4"
  599. }, {
  600. name: '合计',
  601. value: "5"
  602. },
  603. {
  604. name: '指定月份',
  605. value: "0"
  606. }
  607. ],
  608. abnormalRecordsList: [{
  609. level: 1,
  610. content: "1111111",
  611. title: "11",
  612. createTime: "123:123"
  613. },
  614. {
  615. level: 2,
  616. content: "1111111",
  617. title: "11",
  618. createTime: "123:123"
  619. }
  620. ],
  621. };
  622. },
  623. onLoad(op) {
  624. if(op.id){
  625. this.id=op.id
  626. this.init();
  627. }
  628. this.body0data.tabsFrom.showIndex=new Date().getFullYear()+'-'+(new Date().getMonth()+1)
  629. },
  630. onReady() {
  631. // if(this.id){
  632. // }
  633. },
  634. methods: {
  635. durationShow(){
  636. if(this.lockUsageRateData.duration){
  637. var m=this.lockUsageRateData.duration%60
  638. var h=parseInt(this.lockUsageRateData.duration/60)
  639. if(h>0){
  640. return `${h}h${m}m`
  641. }else{
  642. return `${m}m`
  643. }
  644. }else{
  645. return '0m'
  646. }
  647. },
  648. radioChange(e) {
  649. // console.log(e);
  650. },
  651. // 选中任一radio时,由radio-group触发
  652. selector2confirm(e){
  653. var time=e.year + "-" + e.month
  654. this.radiolist[5].name=e.year + "年" + e.month+"月"
  655. this.body0data.tabsFrom.showIndex=time
  656. this.getLockUsageRate()
  657. },
  658. selector2cancel(){
  659. this.radiovalue= "1"
  660. this.radiolist[5].name="指定月份"
  661. this.getLockUsageRate()
  662. },
  663. radioGroupChange(e) {
  664. console.log(e);
  665. if(e==0){
  666. this.body0data.tabsFrom.show=true
  667. }else{
  668. this.radiolist[5].name="指定月份"
  669. this.getLockUsageRate()
  670. }
  671. },
  672. init() {
  673. this.getInfo()
  674. this.getLockUsageRate()
  675. this.occupancyByTime(1)
  676. //this.getbody1()
  677. //this.getbody2()
  678. this.occupancyByTimeBar(1);
  679. //this.getbody3()
  680. //this.getbody4()
  681. this.durationDistribution()
  682. },
  683. occupancyByTime(init) {
  684. if (init) {
  685. var date = new Date();
  686. this.body2data.vue.queryN = date.getFullYear() + "年" + (date.getMonth() + 1) + '月';
  687. this.body2data.query.startTime = date.getFullYear() + "-" + (date.getMonth() + 1) + "-1"
  688. var endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0)
  689. this.body2data.query.endTime = parseUnixTime(endOfMonth, '{y}-{m}-{d}')
  690. }
  691. this.jpContentMap.body2 = 0
  692. this.body2data.query.floorId = this.id
  693. API_index.occupancyByTime(
  694. this.body2data.query
  695. ).then((response) => {
  696. this.body2data.data = [
  697. ...response.data.locksTimeList,
  698. // ...response.data.locksTimeList,
  699. ];
  700. if (this.body2data.data.length == 0) {
  701. this.jpContentMap.body2 = 1
  702. } else {
  703. this.jpContentMap.body2 = 2
  704. this.getbody2()
  705. }
  706. }).catch(error => {
  707. uni.showToast({
  708. title: error,
  709. icon: "none"
  710. })
  711. })
  712. },
  713. body2dataconfirm(e) {
  714. var date = new Date(e.year + "-" + e.month + "-1");
  715. this.body2data.vue.queryN = date.getFullYear() + "年" + (date.getMonth() + 1) + '月';
  716. this.body2data.query.startTime = date.getFullYear() + "-" + (date.getMonth() + 1) + "-1"
  717. var endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0)
  718. this.body2data.query.endTime = parseUnixTime(endOfMonth, '{y}-{m}-{d}')
  719. this.occupancyByTime()
  720. },
  721. getLockUsageRate(){
  722. var obj = {
  723. floorId: this.id,
  724. queryType:this.radiovalue
  725. }
  726. if(this.radiovalue==0){
  727. obj.queryMonth=this.body0data.tabsFrom.showIndex
  728. }
  729. API.lockUsageRate(obj).then((res) => {
  730. this.lockUsageRateData=res.data
  731. }).catch(error => {
  732. uni.hideLoading();
  733. uni.showToast({
  734. title: error,
  735. icon: "none"
  736. })
  737. })
  738. },
  739. durationDistribution() {
  740. this.jpContentMap.body4 = 0
  741. var date = new Date();
  742. //test
  743. //this.body4data.query.startTime = date.getFullYear() + "-" + (date.getMonth() + 1) + "-1"
  744. var endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0)
  745. // this.body4data.query.endTime = parseUnixTime(endOfMonth, '{y}-{m}-{d}')
  746. this.body4data.query.floorId = this.id
  747. API_index.durationDistribution(
  748. this.body4data.query
  749. ).then((response) => {
  750. this.body4data.data = response.data.distribution;
  751. if (this.body4data.data.length == 0) {
  752. this.jpContentMap.body4 = 1
  753. } else {
  754. this.jpContentMap.body4 = 2
  755. //this.getbody3()
  756. this.getbody4()
  757. }
  758. }).catch(error => {
  759. uni.showToast({
  760. title: error,
  761. icon: "none"
  762. })
  763. })
  764. },
  765. getInfo(){
  766. uni.showLoading({
  767. title: "加载中",
  768. mask: true,
  769. })
  770. var obj = {
  771. id: this.id
  772. }
  773. this.jpContentMap.body8 =0
  774. API.lockDetails(obj).then((res) => {
  775. this.info = res.data.floorlockInfo
  776. this.title =this.info.parkingName
  777. uni.hideLoading();
  778. this.jpContentMap.body8 =2
  779. //this.getWhiteList()
  780. }).catch(error => {
  781. uni.hideLoading();
  782. uni.showToast({
  783. title: error,
  784. icon: "none"
  785. })
  786. })
  787. },
  788. getbody1() {
  789. var key = "body1pie1"
  790. var myChart = this.echartsList[key];
  791. if (!myChart) {
  792. myChart = echarts.init(document.getElementById(key), null, {
  793. width: uni.upx2px(300 * 2),
  794. height: uni.upx2px(170 * 2)
  795. })
  796. }
  797. myChart.clear()
  798. var option = {
  799. grid: {
  800. top: 20,
  801. left: 0,
  802. right: 0,
  803. bottom: 0,
  804. containLabel: true
  805. },
  806. series: [{
  807. type: 'pie',
  808. radius: ['80%', '50%'],
  809. radius: [35, 50],
  810. data: [{
  811. itemStyle: {
  812. color: "#EB3C31"
  813. },
  814. value: 1048,
  815. name: '0.5小时\n20%',
  816. },
  817. {
  818. itemStyle: {
  819. color: "#EF8132"
  820. },
  821. value: 735,
  822. name: '2小时\n10%'
  823. },
  824. {
  825. itemStyle: {
  826. color: "#929292"
  827. },
  828. value: 580,
  829. name: '2-6小时\n30%'
  830. },
  831. ]
  832. }]
  833. };
  834. myChart.setOption(option);
  835. this.echartsList[key] = myChart;
  836. },
  837. getbody4() {
  838. var key = "body4pie1"
  839. var myChart = this.echartsList[key];
  840. if (!myChart) {
  841. myChart = echarts.init(document.getElementById(key), null, {
  842. width: uni.upx2px(300 * 2),
  843. height: uni.upx2px(170 * 2)
  844. })
  845. }
  846. myChart.clear()
  847. var dataApi = this.body4data.data;
  848. var data = []
  849. var num = 0
  850. var sum = 0
  851. Object.keys(dataApi).forEach(key1 => {
  852. num += dataApi[key1]
  853. });
  854. var i = 0
  855. Object.keys(dataApi).forEach(key1 => {
  856. var value = dataApi[key1]
  857. if(value!=0){
  858. var obj = {
  859. value: value,
  860. name: key1
  861. }
  862. if (num != 0) {
  863. var valueInt = parseInt(value / num * 100)
  864. if (valueInt == 0 && value != 0) {
  865. valueInt = 1
  866. }
  867. sum += valueInt;
  868. if (i == Object.keys(dataApi).length - 1) {
  869. if (sum != 100) {
  870. valueInt += (100 - sum)
  871. }
  872. }
  873. obj.name += '\n' + (valueInt) + '%'
  874. }
  875. data.push(obj)
  876. }
  877. i++;
  878. });
  879. var option = {
  880. grid: {
  881. top: 20,
  882. left: 0,
  883. right: 0,
  884. bottom: 0,
  885. containLabel: true
  886. },
  887. series: [{
  888. type: 'pie',
  889. radius: ['80%', '50%'],
  890. radius: [45, 60],
  891. data: data
  892. }]
  893. };
  894. myChart.setOption(option);
  895. this.echartsList[key] = myChart;
  896. },
  897. occupancyByTimeBar(init) {
  898. if (init) {
  899. var date = new Date();
  900. //test
  901. //this.body3data.query.startTime = date.getFullYear() + "-" + (date.getMonth() + 1) + "-1"
  902. var endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0)
  903. //this.body3data.query.endTime = parseUnixTime(endOfMonth, '{y}-{m}-{d}')
  904. }
  905. this.jpContentMap.body3 = 0
  906. this.body3data.query.floorId = this.id
  907. API_index.occupancyByTimeBar(
  908. this.body3data.query
  909. ).then((response) => {
  910. this.body3data.data = [
  911. ...response.data.locksTimeList,
  912. // ...response.data.locksTimeList,
  913. ];
  914. if (this.body3data.data.length == 0) {
  915. this.jpContentMap.body3 = 1
  916. } else {
  917. this.jpContentMap.body3 = 2
  918. this.getbody3()
  919. }
  920. }).catch(error => {
  921. uni.showToast({
  922. title: error,
  923. icon: "none"
  924. })
  925. })
  926. },
  927. getbody3() {
  928. var key = "body3bar1"
  929. var myChart = this.echartsList[key];
  930. if (!myChart) {
  931. myChart = echarts.init(document.getElementById(key), null, {
  932. width: uni.upx2px(300 * 2),
  933. height: uni.upx2px(170 * 2)
  934. })
  935. }
  936. var dataApi = this.body3data.data;
  937. myChart.clear()
  938. var data1 = []
  939. var data2 = [] //useDays
  940. var i = 0
  941. dataApi[0].timeUseList.forEach(item => {
  942. Object.keys(item).forEach(key1 => {
  943. data1.push(key1 + '点')
  944. var num = 0
  945. dataApi.forEach(item2 => {
  946. num += item2.timeUseList[i][key1].useDays
  947. })
  948. data2.push(num)
  949. });
  950. i += 1
  951. })
  952. var axisLabel = {
  953. rotate: 40,
  954. interval: 0,
  955. textStyle: {
  956. color: "#333"
  957. }
  958. }
  959. if (data1.length < 7) {
  960. axisLabel = {
  961. interval: 0,
  962. textStyle: {
  963. color: "#333"
  964. },
  965. }
  966. } else {
  967. axisLabel.interval = 0;
  968. }
  969. var option = {
  970. xAxis: {
  971. type: 'category',
  972. data: data1,
  973. axisLabel: axisLabel,
  974. },
  975. tooltip: {
  976. trigger: 'axis',
  977. axisPointer: {
  978. type: 'shadow'
  979. },
  980. formatter: function(params) {
  981. var result = params[0].name + '<br/>';
  982. for (var i = 0; i < params.length; i++) {
  983. result += params[i].marker+ ' ' + params[i].value + '次<br/>';
  984. }
  985. return result;
  986. }
  987. },
  988. yAxis: {
  989. type: 'value'
  990. },
  991. grid: {
  992. top: 20,
  993. left: 0,
  994. right: 0,
  995. bottom: 0,
  996. containLabel: true
  997. },
  998. series: [{
  999. itemStyle: {
  1000. color: "#5A88E5"
  1001. },
  1002. data: data2,
  1003. type: 'bar'
  1004. }]
  1005. };
  1006. myChart.setOption(option);
  1007. this.echartsList[key] = myChart;
  1008. },
  1009. getbody2() {
  1010. var key = "body2line1"
  1011. var myChart = this.echartsList[key];
  1012. var dataApi = this.body2data.data;
  1013. var head = 20 * (parseInt(dataApi.length / 4)) + 20
  1014. if (!myChart) {
  1015. myChart = echarts.init(document.getElementById(key), null, {
  1016. width: uni.upx2px(300 * 2),
  1017. height: uni.upx2px((170 + head) * 2)
  1018. })
  1019. }
  1020. myChart.clear()
  1021. var data1 = []
  1022. var series = [];
  1023. dataApi.forEach(item => {
  1024. var obj = {
  1025. name: item.lockName,
  1026. areaStyle: {},
  1027. itemStyle: {
  1028. color: "#BBD4FB"
  1029. },
  1030. label: {
  1031. show: true,
  1032. position: 'top',
  1033. color: "#307AF6"
  1034. },
  1035. data: [],
  1036. type: 'line'
  1037. }
  1038. if (dataApi.length == 1) {
  1039. obj.label.color = "#307AF6"
  1040. obj.areaStyle = {}
  1041. obj.itemStyle = {
  1042. color: "#BBD4FB"
  1043. }
  1044. }
  1045. item.timeUseList.forEach(item2 => {
  1046. Object.keys(item2).forEach(key1 => {
  1047. obj.data.push(item2[key1].useRate)
  1048. });
  1049. })
  1050. series.push(obj)
  1051. })
  1052. dataApi[0].timeUseList.forEach(item => {
  1053. Object.keys(item).forEach(key1 => {
  1054. data1.push(key1)
  1055. });
  1056. })
  1057. var axisLabel = {
  1058. rotate: 40,
  1059. interval: 0,
  1060. textStyle: {
  1061. color: "#333"
  1062. }
  1063. }
  1064. if (data1.length < 7) {
  1065. axisLabel = {
  1066. interval: 0,
  1067. textStyle: {
  1068. color: "#333"
  1069. },
  1070. }
  1071. } else {
  1072. axisLabel.interval = 0;
  1073. }
  1074. var option = {
  1075. xAxis: {
  1076. type: 'category',
  1077. data: data1,
  1078. axisLabel: axisLabel,
  1079. },
  1080. tooltip: {
  1081. trigger: 'axis',
  1082. axisPointer: {
  1083. type: 'shadow'
  1084. },
  1085. formatter: function(params) {
  1086. var result = params[0].name + '点<br/>';
  1087. for (var i = 0; i < params.length; i++) {
  1088. result += params[i].marker+params[i].seriesName + ': ' + params[i].value + '%<br/>';
  1089. }
  1090. return result;
  1091. }
  1092. },
  1093. yAxis: {
  1094. type: 'value'
  1095. },
  1096. grid: {
  1097. top: (20 + head),
  1098. left: 0,
  1099. right: 0,
  1100. bottom: 0,
  1101. containLabel: true
  1102. },
  1103. series: series,
  1104. };
  1105. myChart.setOption(option);
  1106. this.echartsList[key] = myChart;
  1107. },
  1108. }
  1109. }
  1110. </script>
  1111. <style lang="scss">
  1112. .gradient-header {
  1113. height: 0px;
  1114. }
  1115. .jpback {
  1116. height: 268rpx;
  1117. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 20%, rgba(121, 177, 255, 1) 100%);
  1118. }
  1119. .main {
  1120. padding: 32rpx;
  1121. .no_statistics {
  1122. margin-bottom: 24rpx;
  1123. }
  1124. .statistics {
  1125. border-radius: 8px;
  1126. background-color: rgba(255, 255, 255, 1);
  1127. box-shadow: 0px 1px 6px 0px rgba(0, 59, 142, 0.05);
  1128. margin-bottom: 24rpx;
  1129. padding: 40rpx;
  1130. .title {
  1131. display: flex;
  1132. align-items: center;
  1133. margin-bottom: 32rpx;
  1134. font-weight: bold;
  1135. .img {
  1136. width: 36rpx;
  1137. height: 36rpx;
  1138. vertical-align: middle;
  1139. border-radius: 999px;
  1140. }
  1141. .change {
  1142. display: flex;
  1143. align-items: center;
  1144. .change-img {
  1145. width: 32rpx;
  1146. height: 32rpx;
  1147. vertical-align: middle;
  1148. }
  1149. text {
  1150. margin-left: 8rpx;
  1151. }
  1152. }
  1153. .text {
  1154. color: rgba(16, 16, 16, 1);
  1155. font-size: 36rpx;
  1156. margin-left: 16rpx;
  1157. display: flex;
  1158. justify-content: space-between;
  1159. align-items: center;
  1160. width: 100%;
  1161. .tag {
  1162. border-radius: 4px;
  1163. border: 1px solid rgba(187, 187, 187, 1);
  1164. color: rgba(51, 51, 51, 1);
  1165. font-size: 24rpx;
  1166. padding: 1px 8rpx;
  1167. margin-left: 8rpx;
  1168. }
  1169. }
  1170. .change {
  1171. margin-left: 16rpx;
  1172. font-size: 24rpx;
  1173. color: #838383;
  1174. }
  1175. .check-all {
  1176. margin-left: auto;
  1177. color: rgba(131, 131, 131, 1);
  1178. font-size: 24rpx;
  1179. }
  1180. }
  1181. }
  1182. }
  1183. .data1 {
  1184. display: flex;
  1185. align-items: center;
  1186. justify-content: space-between;
  1187. .item {
  1188. .line{
  1189. display: flex;
  1190. align-items: center;
  1191. }
  1192. .name {
  1193. color: rgba(51, 51, 51, 1);
  1194. font-size: 36rpx;
  1195. font-weight: bold;
  1196. margin-right: 8rpx;
  1197. }
  1198. .item-tags {
  1199. display: flex;
  1200. .tag {
  1201. border-radius: 4px;
  1202. background-color: rgba(39, 177, 72, 1);
  1203. color: rgba(255, 255, 255, 1);
  1204. font-size: 24rpx;
  1205. padding: 2rpx 8rpx;
  1206. margin-right: 8rpx;
  1207. }
  1208. .typeN1 {
  1209. background-color: rgba(22, 119, 255, 1);
  1210. }
  1211. .typeN2{
  1212. background-color: #8161ff;
  1213. background-color: #8161ff;
  1214. }
  1215. .statusN{
  1216. background-color:#838383
  1217. }
  1218. .lockStatusN {
  1219. background-color: rgba(153, 153, 153, 1);
  1220. }
  1221. .lockStatusN2 {
  1222. background-color: #03A9F4
  1223. }
  1224. }
  1225. }
  1226. .value {
  1227. .img {
  1228. margin-right: 8rpx;
  1229. width: 32rpx;
  1230. height: 32rpx;
  1231. }
  1232. }
  1233. }
  1234. .data2 {
  1235. height: 336rpx;
  1236. padding: 32rpx;
  1237. border-radius: 12px;
  1238. background: linear-gradient(180deg, rgba(222, 222, 222, 1) 3%, rgba(255, 255, 255, 1) 5%, rgba(232, 232, 232, 1) 56%, rgba(255, 255, 255, 1) 59%, rgba(236, 236, 236, 1) 95%, rgba(215, 215, 215, 1) 98%);
  1239. .top {
  1240. background-repeat: round;
  1241. background-image: url('@/assets/img/deviceTab/index3-2.png');
  1242. display: flex;
  1243. justify-content: space-around;
  1244. text-align: center;
  1245. height: 152rpx;
  1246. align-items: center;
  1247. .item {
  1248. .name {
  1249. color: rgba(16, 16, 16, 1);
  1250. font-size: 32rpx;
  1251. }
  1252. .value {
  1253. color: rgba(16, 16, 16, 1);
  1254. font-size: 48rpx;
  1255. font-weight: bold;
  1256. }
  1257. }
  1258. }
  1259. .body {
  1260. padding: 16rpx;
  1261. }
  1262. }
  1263. .body5data {
  1264. .line {
  1265. display: flex;
  1266. align-items: center;
  1267. justify-content: space-between;
  1268. .data {
  1269. display: flex;
  1270. width: 80%;
  1271. justify-content: space-between;
  1272. .item {
  1273. color: rgba(51, 51, 51, 1);
  1274. font-size: 16px;
  1275. }
  1276. .value {
  1277. color: rgba(119, 119, 119, 1);
  1278. font-size: 16px;
  1279. }
  1280. }
  1281. }
  1282. }
  1283. .body7data {
  1284. .line {
  1285. display: flex;
  1286. align-items: center;
  1287. justify-content: space-between;
  1288. .value {
  1289. width: 33%;
  1290. padding: 16rpx;
  1291. color: rgba(51, 51, 51, 1);
  1292. }
  1293. .value:nth-child(3) {
  1294. text-align: center;
  1295. }
  1296. }
  1297. /* 隔行变色: 偶数行设置背景色 */
  1298. .line:nth-child(odd) {
  1299. background-color: #F2F2F2;
  1300. /* 偶数行 */
  1301. }
  1302. .line:nth-child(even) {
  1303. background-color: #FFFFFF
  1304. /* 奇数行 */
  1305. }
  1306. }
  1307. .body8main {
  1308. .line {
  1309. display: flex;
  1310. align-items: center;
  1311. justify-content: space-between;
  1312. .value {
  1313. width: 33%;
  1314. padding: 16rpx;
  1315. text-align: center;
  1316. overflow: hidden;
  1317. white-space: nowrap;
  1318. text-overflow: ellipsis;
  1319. }
  1320. }
  1321. /* 隔行变色: 偶数行设置背景色 */
  1322. .line:nth-child(odd) {
  1323. color: rgba(119, 119, 119, 1);
  1324. font-size: 14px;
  1325. /* 偶数行 */
  1326. }
  1327. .line:nth-child(even) {
  1328. color: rgba(16, 16, 16, 1);
  1329. font-size: 16px;
  1330. /* 奇数行 */
  1331. }
  1332. }
  1333. .body6main {
  1334. .line {
  1335. display: flex;
  1336. justify-content: space-between;
  1337. }
  1338. .abnormal-item:last-of-type {
  1339. border-bottom: none !important;
  1340. padding-bottom: 0;
  1341. }
  1342. .abnormal-item {
  1343. width: 100%;
  1344. display: flex;
  1345. justify-content: space-between;
  1346. align-items: center;
  1347. padding: 16rpx;
  1348. border-bottom: 1px solid rgba(245, 245, 245, 1);
  1349. .item-title {
  1350. .level {
  1351. color: #fff;
  1352. border-radius: 8rpx;
  1353. font-weight: 400;
  1354. padding: 4rpx 8rpx;
  1355. font-size: 22rpx;
  1356. margin-right: 2px;
  1357. }
  1358. .level1 {
  1359. background: red;
  1360. }
  1361. .level2 {
  1362. background-color: rgba(255, 123, 0, 1);
  1363. }
  1364. color: rgba(51, 51, 51, 1);
  1365. width: 100%;
  1366. .img {
  1367. width: 32rpx;
  1368. height: 32rpx;
  1369. margin-right: 8rpx;
  1370. }
  1371. .name {
  1372. color: rgba(51, 51, 51, 1);
  1373. font-weight: bold;
  1374. overflow: hidden;
  1375. white-space: nowrap;
  1376. text-overflow: ellipsis;
  1377. }
  1378. .date {
  1379. color: rgba(119, 119, 119, 1);
  1380. font-size: 24rpx;
  1381. }
  1382. }
  1383. .item-value {
  1384. text-align: right;
  1385. display: flex;
  1386. align-items: center;
  1387. .more {
  1388. margin-left: 8rpx;
  1389. }
  1390. .value1 {
  1391. font-weight: bold;
  1392. color: rgba(51, 51, 51, 1);
  1393. }
  1394. .value2 {
  1395. color: rgba(119, 119, 119, 1);
  1396. font-size: 24rpx;
  1397. }
  1398. }
  1399. }
  1400. }
  1401. // 地锁信息弹窗
  1402. .body8data-popup {
  1403. .content {
  1404. padding: 32rpx;
  1405. .headline {
  1406. color: rgba(16, 16, 16, 1);
  1407. font-size: 36rpx;
  1408. text-align: center;
  1409. font-weight: bold;
  1410. margin-bottom: 24rpx;
  1411. }
  1412. .infos {
  1413. //padding-bottom: 100rpx;
  1414. .item:last-of-type {
  1415. border: none;
  1416. }
  1417. .item {
  1418. display: flex;
  1419. align-items: center;
  1420. //line-height: 48rpx;
  1421. padding: 20rpx 0;
  1422. border-bottom: 1px solid #cccccc;
  1423. .item-title {
  1424. color: rgba(51, 51, 51, 1);
  1425. width: 200rpx;
  1426. }
  1427. .item-value {
  1428. color: #666666;
  1429. flex: 1;
  1430. margin-left: 16rpx;
  1431. display: flex;
  1432. align-items: center;
  1433. justify-content: space-between;
  1434. .img{
  1435. width: 32rpx;
  1436. height: 32rpx;
  1437. transform: rotate(90deg);
  1438. margin-left: 96rpx;
  1439. }
  1440. }
  1441. }
  1442. }
  1443. .get {
  1444. height: 80rpx;
  1445. line-height: 80rpx;
  1446. border-radius: 4px;
  1447. background-color: rgba(22, 119, 255, 1);
  1448. color: rgba(255, 255, 255, 1);
  1449. font-size: 32rpx;
  1450. }
  1451. }
  1452. }
  1453. .top-span{
  1454. border-top: 1px solid rgba(245, 245, 245, 1);
  1455. display: flex;
  1456. flex-wrap: wrap;
  1457. justify-content: space-between;
  1458. padding-top: 16rpx;
  1459. margin-top: 16rpx;
  1460. .item-span{
  1461. white-space: pre;
  1462. display: flex;
  1463. align-items: center;
  1464. margin-top: 4rpx;
  1465. width: 30%;
  1466. font-size: 28rpx;
  1467. span{
  1468. margin: 0 8rpx;
  1469. }
  1470. img{
  1471. width: 28rpx;
  1472. height: 28rpx;
  1473. }
  1474. }
  1475. .lockStatusX1{
  1476. color: #00B962;
  1477. }
  1478. .lockStatusX2{
  1479. color: #1677FF;
  1480. }
  1481. .statusX1{
  1482. color: #00B962;
  1483. }
  1484. .statusX2{
  1485. color: #1677FF;
  1486. }
  1487. }
  1488. </style>