stationInfo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. <template>
  2. <view>
  3. <u-navbar title="场站主页" ></u-navbar>
  4. <view class="gradient-header">
  5. <view class="jpback">
  6. </view>
  7. </view>
  8. <view class="panel main1_panel">
  9. <view class="name">
  10. <view class="p1">
  11. {{info.name}}
  12. </view>
  13. <view class="p2">
  14. 地址:{{info.address}}
  15. </view>
  16. </view>
  17. <view class="body" v-if="info.category!='电单车'">
  18. <view class="span">
  19. <image class="img" src="@/assets/img/station/item2.svg" mode=""></image>
  20. 在用
  21. <span>{{info.gunWorkNum}}</span>
  22. </view>
  23. <view class="span">
  24. <image class="img" src="@/assets/img/station/item3.svg" mode=""></image>
  25. 空闲
  26. <span>{{info.gunFreeNum}}</span>
  27. </view>
  28. <view class="span">
  29. <image class="img" src="@/assets/img/station/item1.svg" mode=""></image>
  30. 故障
  31. <span>{{info.gunFaultNum}}</span>
  32. </view>
  33. <view class="span">
  34. <image class="img" src="@/assets/img/station/item4.svg" mode=""></image>
  35. 离线
  36. <span>{{info.gunOfflineNum}}</span>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="panel main2_panel">
  41. <view class="p1" @click="gotoUrl('/pages/inspection/add?back=1&stationId='+id)" >
  42. <view class="na-img">
  43. <image class="img" src="@/assets/img/station/index2.svg" mode=""></image>
  44. </view>
  45. <view class="na-text ">
  46. 设备巡检
  47. </view>
  48. </view>
  49. <view class="p2">
  50. </view>
  51. <view class="p1" @click="gotoUrl('/pages/task/addTask?stationName='+info.name+'&stationId='+id)">
  52. <view class="na-img">
  53. <image class="img" src="@/assets/img/station/index1.svg" mode=""></image>
  54. </view>
  55. <view class="na-text ">
  56. 故障上报
  57. </view>
  58. </view>
  59. </view>
  60. <view class="panel main3_panel">
  61. <view class="title">
  62. <view class="icon">
  63. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  64. </view>
  65. <view class="text">
  66. <view>故障提醒</view>
  67. <view class="check-all" @click="gotoUrl('/pages/task/listTask')" >查看全部<u-icon name="arrow-right"></u-icon></view>
  68. </view>
  69. </view>
  70. <view class="body">
  71. <view class="line" v-for="(item,index) in errList"
  72. @click="gotoUrl('/pages/task/maintenanceTaks?id='+item.id)"
  73. :key="index">
  74. <view class="p1">
  75. <view class="name">
  76. {{item.errorCodeText}}
  77. </view>
  78. <view class="time" v-if="item.status==0">
  79. 上报时间:{{item.errorReportTime}}
  80. </view>
  81. <view class="time" v-if="item.status==1">
  82. 处理时间:{{item.repairTime}}
  83. </view>
  84. </view>
  85. <view class="p2">
  86. <view class="tag " :class="'tag'+item.status">
  87. {{item.statusN}}
  88. </view>
  89. <u-icon name="arrow-right" color="#D4D4D4" ></u-icon>
  90. </view>
  91. </view>
  92. <u-divider :isnone="errList.length==0" v-if="errListTotal==0|errListTotal>5"
  93. nonetext="没有找到相关内容" border-color="#CFD2D5">{{errListTotal>5?'最多显示5条':'已经到底了'}}</u-divider>
  94. </view>
  95. </view>
  96. <view class="panel main4_panel">
  97. <view class="title">
  98. <view class="icon">
  99. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  100. </view>
  101. <view class="text">
  102. <view>巡检记录</view>
  103. <view class="check-all" @click="gotoUrl('/pages/inspection/list')" >查看全部<u-icon name="arrow-right"></u-icon></view>
  104. </view>
  105. </view>
  106. <view class="body">
  107. <view class="line" v-for="(item,index) in recordList"
  108. @click="gotoUrl('/pages/inspection/info?id='+item.id)"
  109. :key="index" >
  110. <view class="p1">
  111. 巡检
  112. </view>
  113. <view class="p2">
  114. {{item.inspectionUserName}}
  115. </view>
  116. <view class="p3">
  117. {{lastChargeTime(item.inspectionTime)}}
  118. </view>
  119. <u-icon name="arrow-right" color="#D4D4D4" ></u-icon>
  120. </view>
  121. <u-divider :isnone="recordList.length==0" v-if="recordListTotal==0|recordListTotal>5"
  122. nonetext="没有找到相关内容" border-color="#CFD2D5">{{recordListTotal>5?'最多显示5条':'已经到底了'}}</u-divider>
  123. </view>
  124. </view>
  125. <view class="panel main5_panel">
  126. <view class="title">
  127. <view class="icon">
  128. <image class="img" src="@/assets/img/circleCopy1@1x.png" mode=""></image>
  129. </view>
  130. <view class="text">
  131. <view>设备信息</view>
  132. <view class="check-all " v-if="false" >查看全部<u-icon name="arrow-right"></u-icon></view>
  133. <template v-if="gunList.length>5">
  134. <view class="pack-up check-all" v-show="listShow" @click="listShow=false">
  135. 展开<u-icon name="arrow-down" size="32" color="#AAAAAA"></u-icon>
  136. </view>
  137. <view class="pack-up check-all" v-if="!listShow" @click="listShow=true">
  138. 收起<u-icon name="arrow-up" size="32" color="#AAAAAA"></u-icon>
  139. </view>
  140. </template>
  141. </view>
  142. </view>
  143. <u-alert-tips type="warning" v-if="showalerttips" :description="showalerttipsdescription"></u-alert-tips>
  144. <view class="body">
  145. <view class="line lineT">
  146. <view class="p1">
  147. 设备名称
  148. </view>
  149. <view class="p2">
  150. 设备型号
  151. </view>
  152. <view class="p3">
  153. 最后充电时间
  154. </view>
  155. <u-icon name="arrow-right" color="#FFF" ></u-icon>
  156. </view>
  157. <view class="line" v-for="(item,index) in gunList"
  158. @click="gotoUrl('/pages/station/stationGun?gunNo='+item.gunNo)"
  159. v-show="index<5||listShow"
  160. :key="index">
  161. <view class="p1">
  162. 充电枪
  163. </view>
  164. <view class="p2">
  165. {{item.gunNo}}
  166. </view>
  167. <view class="p3" :class="{
  168. red:daysDistanceDay(item.lastChargeTime)
  169. }">
  170. {{lastChargeTime(item.lastChargeTime)}}
  171. </view>
  172. <u-icon name="arrow-right" color="#D4D4D4" ></u-icon>
  173. </view>
  174. <u-divider :isnone="gunList.length==0" v-if="gunList.length==0"
  175. nonetext="没有找到相关内容" border-color="#CFD2D5"></u-divider>
  176. </view>
  177. </view>
  178. </view>
  179. </template>
  180. <script>
  181. import * as API from '@/apis/pagejs/pagesStation.js'
  182. import {
  183. newDate,daysDistance
  184. } from '@/apis/utils'
  185. export default {
  186. data() {
  187. return {
  188. id:"",
  189. info:{},
  190. gunList:[],
  191. recordList:[],
  192. recordListTotal:0,
  193. errList:[],
  194. errListTotal:0,
  195. listShow:false,
  196. showalerttips:false,
  197. showalerttipsdescription:"",
  198. showalerttipsNum:10,
  199. };
  200. },
  201. onLoad(op) {
  202. this.id = op.id
  203. },
  204. onShow() {
  205. this.details()
  206. this.geterrList()
  207. this.getrecordList()
  208. },
  209. methods: {
  210. daysDistanceDay(time){
  211. return daysDistance(time,new Date())>this.showalerttipsNum
  212. },
  213. getrecordList(){
  214. API.recordList({
  215. pageIndex:1,
  216. pageSize:5,
  217. stationId:this.id,
  218. status:1
  219. }).then((response) => {
  220. this.recordList=response.data.data
  221. this.recordListTotal=response.data.recordsTotal
  222. }).catch(error => {
  223. uni.showToast({
  224. title: error,
  225. icon: "none"
  226. })
  227. })
  228. },
  229. geterrList(){
  230. API.errList({
  231. pageIndex:1,
  232. pageSize:5,
  233. stationId:this.id
  234. }).then((response) => {
  235. this.errList=response.data.data
  236. this.errListTotal=response.data.recordsTotal
  237. }).catch(error => {
  238. uni.showToast({
  239. title: error,
  240. icon: "none"
  241. })
  242. })
  243. },
  244. lastChargeTime(time){
  245. if(time){
  246. return time.split(" ")[0]
  247. }else{
  248. return ''
  249. }
  250. },
  251. details() {
  252. uni.showLoading({
  253. title: "加载中",
  254. mask: true,
  255. })
  256. API.stationDetails({
  257. stationId: this.id
  258. }).then((res) => {
  259. this.info = res.data.station
  260. this.gunList=res.data.gunList
  261. this.gunList.forEach(item=>{
  262. if(this.daysDistanceDay(item.lastChargeTime)){
  263. this.showalerttips=true;
  264. this.listShow=true
  265. this.showalerttipsdescription=`存在超过${this.showalerttipsNum}天未充电的充电枪`
  266. }
  267. })
  268. uni.hideLoading();
  269. }).catch(error => {
  270. uni.hideLoading();
  271. uni.showToast({
  272. title: error,
  273. icon: "none"
  274. })
  275. })
  276. },
  277. }
  278. }
  279. </script>
  280. <style lang="scss">
  281. .gradient-header {
  282. height: 0px;
  283. }
  284. .jpback {
  285. height: 400rpx;
  286. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 20%, rgba(121, 177, 255, 1) 100%);
  287. }
  288. .panel{
  289. border-radius: 16rpx;
  290. background-color: rgba(255, 255, 255, 1);
  291. box-shadow: 0px 2rpx 12rpx 0px rgba(0, 59, 142, 0.05);
  292. margin: 24rpx 32rpx;
  293. padding: 40rpx;
  294. .title {
  295. display: flex;
  296. align-items: center;
  297. margin-bottom: 32rpx;
  298. font-weight: bold;
  299. .img {
  300. width: 36rpx;
  301. height: 36rpx;
  302. vertical-align: middle;
  303. border-radius: 999px;
  304. }
  305. .change {
  306. display: flex;
  307. align-items: center;
  308. .change-img {
  309. width: 32rpx;
  310. height: 32rpx;
  311. vertical-align: middle;
  312. }
  313. text {
  314. margin-left: 8rpx;
  315. }
  316. }
  317. .text {
  318. color: rgba(16, 16, 16, 1);
  319. font-size: 36rpx;
  320. margin-left: 16rpx;
  321. display: flex;
  322. justify-content: space-between;
  323. align-items: center;
  324. width: 100%;
  325. .tag {
  326. border-radius: 8rpx;
  327. border: 2rpx solid rgba(187, 187, 187, 1);
  328. color: rgba(51, 51, 51, 1);
  329. font-size: 24rpx;
  330. padding: 2rpx 8rpx;
  331. margin-left: 8rpx;
  332. }
  333. }
  334. .change {
  335. margin-left: 16rpx;
  336. font-size: 24rpx;
  337. color: #838383;
  338. }
  339. .check-all {
  340. margin-left: auto;
  341. color: rgba(131, 131, 131, 1);
  342. font-size: 24rpx;
  343. }
  344. }
  345. }
  346. .main1_panel{
  347. padding: 40rpx 0;
  348. .name{
  349. padding: 0 40rpx 24rpx 40rpx;
  350. border-bottom: 2rpx solid #F5F5F5 ;
  351. .p1{
  352. color: rgba(51,51,51,1);
  353. font-size: 36rpx;
  354. font-weight: bold;
  355. }
  356. .p2{
  357. color: rgba(51,51,51,1);
  358. font-size: 28rpx;
  359. }
  360. }
  361. .body{
  362. padding: 26rpx 40rpx 0 40rpx;
  363. display: flex;
  364. justify-content: space-between;
  365. .img{
  366. width: 28rpx;
  367. height: 28rpx;
  368. margin-right: 8rpx;
  369. }
  370. .span{
  371. display: flex;
  372. align-items: center;
  373. span{
  374. margin-left: 8rpx;
  375. }
  376. }
  377. }
  378. }
  379. .main2_panel{
  380. margin-top: 32rpx;
  381. display: flex;
  382. justify-content: space-around;
  383. align-items: center;
  384. padding: 24rpx 0 20rpx 0;
  385. .p2 {
  386. border-left: 2rpx solid rgba(187, 187, 187, 0.43);
  387. height: 70rpx;
  388. }
  389. .p1 {
  390. width: 48%;
  391. text-align: center;
  392. .na-img {
  393. display: flex;
  394. justify-content: center;
  395. margin-bottom: 8rpx;
  396. .img {
  397. width: 56rpx;
  398. height: 56rpx;
  399. }
  400. }
  401. }
  402. }
  403. .main3_panel{
  404. .body{
  405. .line{
  406. //border-bottom:2rpx solid rgba(232,232,232,1);
  407. padding: 12rpx 0;
  408. display: flex;
  409. justify-content: space-between;
  410. .p1{
  411. .name{
  412. font-weight: 600;
  413. color: rgba(51,51,51,1);
  414. font-size: 28rpx;
  415. }
  416. .time{
  417. color: rgba(119,119,119,1);
  418. font-size: 24rpx;
  419. }
  420. }
  421. .p2{
  422. display: flex;
  423. align-items: center;
  424. }
  425. }
  426. .line:not(:first-child){
  427. //background-color: red;
  428. border-top:1px solid rgba(232,232,232,1);
  429. }
  430. .tag{
  431. background-color: rgba(255,255,255,1);
  432. color: rgba(255,61,0,1);
  433. font-size: 24rpx;
  434. height: 40rpx;
  435. line-height: 40rpx;
  436. padding: 0 4rpx;
  437. border-radius: 8rpx;
  438. border: 2rpx solid rgba(255,61,0,1);
  439. display: flex;
  440. }
  441. .tag0{
  442. color: rgba(255,61,0,1);
  443. border: 2rpx solid rgba(255,61,0,1);
  444. }
  445. .tag1{
  446. color: #00B962;
  447. border: 2rpx solid #00B962;
  448. }
  449. }
  450. }
  451. .main4_panel,.main5_panel{
  452. .body{
  453. .line{
  454. padding: 18rpx 0;
  455. display: flex;
  456. justify-content: space-between;
  457. }
  458. .p1{
  459. font-weight: 600;
  460. color: rgba(51,51,51,1);
  461. font-size: 28rpx;
  462. }
  463. .p2{
  464. width: 300rpx;
  465. overflow: hidden;
  466. text-overflow: ellipsis;
  467. white-space: nowrap;
  468. }
  469. .line:not(:first-child) {
  470. border-top:2rpx solid rgba(232,232,232,1);
  471. }
  472. }
  473. }
  474. .main5_panel{
  475. .p1{
  476. width: 140rpx;
  477. }
  478. .p2{
  479. width: 270rpx !important;
  480. }
  481. .p3{
  482. width: 180rpx !important;
  483. }
  484. .lineT{
  485. font-weight: bold;
  486. }
  487. .red{
  488. color: red;
  489. }
  490. }
  491. </style>