index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798
  1. <template>
  2. <view>
  3. <u-navbar v-show="false" title="首页" title-color="#101010"></u-navbar>
  4. <view class="back-blue">
  5. <view class="back-color">
  6. </view>
  7. </view>
  8. <view class="main_top">
  9. <view class="main_top1">
  10. <view class="logo_img">
  11. <image class="img" src="@/assets/img/logo/logo.png" mode=""></image>
  12. </view>
  13. <view class="logo_text">
  14. <view class="logo_text1">
  15. 优电联盟
  16. </view>
  17. <view class="logo_text2">
  18. 巡检端
  19. </view>
  20. </view>
  21. </view>
  22. <view class="main_top2">
  23. <!-- 消息提醒位置 -->
  24. </view>
  25. </view>
  26. <view class="main_navigation panel" >
  27. <view class="item-na end" @click="gotoUrl('/pages/task/addTask')">
  28. <view class="na-img">
  29. <image class="img" src="@/assets/img/index/na-1.png" mode=""></image>
  30. </view>
  31. <view class="na-text ">
  32. 故障上报
  33. </view>
  34. </view>
  35. <view class="item-na-b" v-if="isAdmin" >
  36. </view>
  37. <view class="item-na end" @click="gotoUrl('/pages/team/teamList')" v-if="isAdmin" >
  38. <view class="na-img">
  39. <image class="img" src="@/assets/img/index/na-3.png" mode=""></image>
  40. </view>
  41. <view class="na-text">
  42. 团队管理
  43. </view>
  44. </view>
  45. <view class="item-na-b" >
  46. </view>
  47. <view class="item-na end" @click="gotoUrl('/pages/inspection/list')" >
  48. <view class="na-img">
  49. <image class="img" src="@/assets/img/index/na-2.png" mode=""></image>
  50. </view>
  51. <view class="na-text">
  52. 巡检记录
  53. </view>
  54. </view>
  55. </view>
  56. <view class="main_statuspanel panel">
  57. <view class="top-main">
  58. <view class="title-main">
  59. 充电枪状态
  60. </view>
  61. <view class="goto-main" @click="gotoUrl('/pages/station/stationList')">
  62. 查看详情
  63. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  64. </view>
  65. </view>
  66. <view class="body">
  67. <view class="pie">
  68. <view id="body1pie1" class="body1pie">
  69. </view>
  70. <view class="body2pie" v-if="datafloorStatus.gunNum">
  71. <view class="v1">{{datafloorStatus.gunNum}}</view>
  72. <view class="v2">单位:把</view>
  73. </view>
  74. </view>
  75. <view class="item-list">
  76. <view class="item-status">
  77. <view class="num">
  78. {{datafloorStatus.gunWorkNum}}
  79. </view>
  80. <view class="statusN">
  81. <view class="statusC status1">
  82. </view>
  83. <view class="statusT">
  84. 在用
  85. </view>
  86. </view>
  87. </view>
  88. <view class="item-status">
  89. <view class="num">
  90. {{datafloorStatus.gunFaultNum}}
  91. </view>
  92. <view class="statusN">
  93. <view class="statusC status2">
  94. </view>
  95. <view class="statusT">
  96. 故障
  97. </view>
  98. </view>
  99. </view>
  100. <view class="item-status" >
  101. <view class="num">
  102. {{datafloorStatus.gunFreeNum}}
  103. </view>
  104. <view class="statusN">
  105. <view class="statusC status4">
  106. </view>
  107. <view class="statusT">
  108. 空闲
  109. </view>
  110. </view>
  111. </view>
  112. <view class="item-status">
  113. <view class="num">
  114. {{datafloorStatus.gunOfflineNum}}
  115. </view>
  116. <view class="statusN">
  117. <view class="statusC status3">
  118. </view>
  119. <view class="statusT">
  120. 离线
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. <view class="main_list1 ">
  128. <view class="top-main" style=" border-bottom: 2rpx solid #e8e8e8;" >
  129. <u-tabs :list="tabslist"
  130. :current="current" @change="change"></u-tabs>
  131. <view class="goto-main" @click="gotoUrl('/pages/task/listTask')">
  132. 全部故障记录
  133. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  134. </view>
  135. </view>
  136. <view class="list" >
  137. <view class="item"
  138. v-for="(item,index) in dataerrList"
  139. @click="gotoUrl('/pages/task/maintenanceTaks?id='+item.id)"
  140. :key="index">
  141. <view class="icon">
  142. <image class="img" v-if="item.errorCodeImage" :src="item.errorCodeImage" mode=""></image>
  143. <image class="img" v-else src="@/assets/img/taskstatus/status3.png" mode=""></image>
  144. </view>
  145. <view class="body">
  146. <view class="line1">
  147. <view class="title">
  148. <span v-if="item.type" :class="'typeN typeN'+item.type">
  149. {{item.typeN}}
  150. </span>
  151. {{item.errorCodeText}}
  152. </view>
  153. <view class="status " :class="'status'+item.status">
  154. {{item.statusN}}
  155. </view>
  156. </view>
  157. <view class="line2">
  158. <view class="value">
  159. {{item.createTime}}<span style="color: red;" v-if="isToday(item.createTime)">(今日)</span>
  160. </view>
  161. <view class="value">
  162. {{item.parkingName}}
  163. </view>
  164. </view>
  165. <view class="errorDesc" v-if="item.errorDesc">
  166. 描述:{{item.errorDesc}}
  167. </view>
  168. </view>
  169. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  170. </view>
  171. <u-divider color="#F44336"
  172. :isnone="dataerrRecordsTotal==0" nonetext="暂无数据"
  173. v-if="dataerrRecordsTotal>5&&current==0"
  174. @click="gotoUrl('/pages/task/listTask?status='+tabslist[current].code)" >故障记录{{dataerrRecordsTotal}}条,点击查看更多</u-divider>
  175. <u-divider color="#CFD2D5" v-else
  176. :isnone="dataerrRecordsTotal==0" nonetext="暂无数据"
  177. @click="gotoUrl('/pages/task/listTask?status='+tabslist[current].code)" >查看详情</u-divider>
  178. </view>
  179. </view>
  180. <tabbar :current="0"></tabbar>
  181. </view>
  182. </template>
  183. <script>
  184. import * as API from '@/apis/pagejs/pagejsIndex.js'
  185. import * as echarts from 'echarts';
  186. import Tabbar from '@/components/Tabbar.vue'
  187. import {
  188. newDate
  189. } from '@/apis/utils'
  190. export default {
  191. components: {
  192. Tabbar,
  193. },
  194. data() {
  195. return {
  196. echartsList: {},
  197. isReadyfloorStatus:false,
  198. datafloorStatus:{},
  199. roleList:[],
  200. isReadyerrList:false,
  201. dataerrList:[],
  202. dataerrRecordsTotal:0,
  203. tabslist:[
  204. {
  205. name: '待处理',
  206. code:"geterrList0"
  207. }, {
  208. name: '已处理',
  209. code:"geterrList1"
  210. }
  211. ],
  212. current:0,
  213. };
  214. },
  215. onLoad() {
  216. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  217. },
  218. onShow() {
  219. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  220. if(this.isReadyfloorStatus){
  221. this.getfloorStatus()
  222. }
  223. if(this.isReadyerrList){
  224. this.geterrList()
  225. }
  226. },
  227. computed:{
  228. isAdmin(){
  229. if(this.roleList){
  230. var i =this.roleList.findIndex(item=>{
  231. return item.name=='XJADMIN'
  232. })
  233. if(i!=-1){
  234. return true
  235. }
  236. }
  237. return true
  238. }
  239. },
  240. onReady() {
  241. this.geterrList()
  242. this.getfloorStatus()
  243. //this.getbody1pie1()
  244. this.query()
  245. },
  246. methods: {
  247. change(e){
  248. this.current=e
  249. this.dataerrList =[]
  250. this.geterrList()
  251. },
  252. isToday(dateStr) {
  253. if(!dateStr){
  254. return false
  255. }
  256. // 将传入的日期字符串转换为Date对象
  257. const targetDate = newDate(dateStr);
  258. // 获取当前日期
  259. const today = new Date();
  260. // 比较年份、月份和日期是否相等
  261. return (
  262. targetDate.getFullYear() === today.getFullYear() &&
  263. targetDate.getMonth() === today.getMonth() &&
  264. targetDate.getDate() === today.getDate()
  265. );
  266. },
  267. query(){
  268. uni.showLoading({
  269. title: "加载中",
  270. mask: true,
  271. })
  272. API.findByOpenId({
  273. noerror:true,
  274. openId: this.jphelp.getOpenId(),
  275. }).then((response) => {
  276. uni.hideLoading();
  277. if(response.message){
  278. uni.hideLoading();
  279. }else{
  280. this.loginset(response)
  281. }
  282. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  283. }).catch(error => {
  284. uni.hideLoading();
  285. })
  286. },
  287. geterrList(){
  288. var status=0
  289. var code=this.tabslist[this.current].code
  290. if(code=="geterrList0"){
  291. status=0
  292. }
  293. if(code=="geterrList1"){
  294. status=1
  295. }
  296. API.errList({
  297. pageIndex:1,
  298. pageSize:5,
  299. status:status,
  300. }).then((response) => {
  301. this.dataerrList=response.data.data
  302. this.dataerrRecordsTotal=response.data.recordsTotal
  303. this.isReadyerrList=true
  304. }).catch(error => {
  305. uni.showToast({
  306. title: error,
  307. icon: "none"
  308. })
  309. })
  310. },
  311. getfloorStatus(){
  312. API.floorStatus().then((response) => {
  313. var obj=response.data;
  314. var sz=['gunFaultNum','gunFreeNum','gunOfflineNum','gunWorkNum']
  315. var bl=false
  316. for(var i in sz){
  317. if(obj[sz[i]]!=this.datafloorStatus[sz[i]]){
  318. bl=true
  319. this.datafloorStatus=obj
  320. }
  321. }
  322. this.isReadyfloorStatus=true
  323. if(bl){
  324. this.getbody1pie1()
  325. }
  326. }).catch(error => {
  327. uni.showToast({
  328. title: error,
  329. icon: "none"
  330. })
  331. })
  332. },
  333. getbody1pie1() {
  334. var key = "body1pie1"
  335. var myChart = this.echartsList[key];
  336. if (!myChart) {
  337. myChart = echarts.init(document.getElementById(key), null, {
  338. width: uni.upx2px(88 * 2),
  339. height: uni.upx2px(88 * 2)
  340. })
  341. }
  342. myChart.clear()
  343. var option = {
  344. series: [{
  345. silent: true,
  346. type: 'pie',
  347. radius: ['80%', '100%'],
  348. label: {
  349. show: false,
  350. },
  351. data: [{
  352. value: this.datafloorStatus.gunWorkNum,
  353. itemStyle: {
  354. color: 'rgba(0, 185, 98, 1)'
  355. }
  356. },
  357. {
  358. value: this.datafloorStatus.gunFreeNum,
  359. itemStyle: {
  360. color: '#999999'
  361. }
  362. },
  363. {
  364. value: this.datafloorStatus.gunOfflineNum,
  365. itemStyle: {
  366. color: '#FF9600'
  367. }
  368. },
  369. {
  370. value: this.datafloorStatus.gunFaultNum,
  371. itemStyle: {
  372. color: '#FF3D00'
  373. }
  374. }
  375. ]
  376. }],
  377. grid: {
  378. top: 0,
  379. left: 0,
  380. right: 0,
  381. bottom: 0,
  382. containLabel: true
  383. },
  384. }
  385. myChart.setOption(option);
  386. console.log(option)
  387. this.echartsList[key] = myChart;
  388. }
  389. }
  390. }
  391. </script>
  392. <style>
  393. page{
  394. background-color: #FFFFFF;
  395. }
  396. </style>
  397. <style lang="scss">
  398. .back-blue {
  399. height: 0px;
  400. .back-color {
  401. height: 656rpx;
  402. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 53%, rgba(203, 234, 255, 0) 100%);
  403. }
  404. }
  405. .top-main {
  406. display: flex;
  407. align-items: center;
  408. justify-content: space-between;
  409. .title-main {
  410. color: rgba(51, 51, 51, 1);
  411. font-size: 32rpx;
  412. font-weight: bold;
  413. }
  414. .goto-main {
  415. color: rgba(131, 131, 131, 1);
  416. font-size: 24rpx;
  417. }
  418. }
  419. .panel,
  420. .main_top {
  421. margin: 0 32rpx;
  422. }
  423. .panel {
  424. border-radius: 16rpx;
  425. background-color: rgba(255, 255, 255, 1);
  426. box-shadow: 0px 8rpx 16rpx 0px rgba(22, 119, 255, 0.1);
  427. }
  428. .main_top {
  429. margin-top: 32rpx;
  430. display: flex;
  431. justify-content: space-between;
  432. .main_top1 {
  433. display: flex;
  434. align-items: center;
  435. .logo_img {
  436. .img {
  437. border-radius: 16rpx;
  438. width: 96rpx;
  439. height: 96rpx;
  440. }
  441. margin-right: 16rpx;
  442. }
  443. .logo_text {
  444. color: #fff;
  445. .logo_text1 {
  446. font-size: 40rpx;
  447. }
  448. .logo_text2 {
  449. font-size: 32rpx;
  450. }
  451. }
  452. }
  453. .main_top2 {}
  454. }
  455. .main_navigation {
  456. margin-top: 32rpx;
  457. display: flex;
  458. justify-content: space-around;
  459. align-items: center;
  460. padding: 24rpx 0 20rpx 0;
  461. .item-na-b {
  462. border-left: 2rpx solid rgba(187, 187, 187, 0.43);
  463. height: 70rpx;
  464. }
  465. .item-na {
  466. width: 32%;
  467. text-align: center;
  468. .na-img {
  469. display: flex;
  470. justify-content: center;
  471. .img {
  472. width: 80rpx;
  473. height: 80rpx;
  474. }
  475. }
  476. }
  477. }
  478. .main_statuspanel {
  479. margin-top: 24rpx;
  480. padding: 24rpx;
  481. .body2pie{
  482. position: relative;
  483. top: -140rpx;
  484. height: 0px;
  485. left: 0px;
  486. width: 176rpx;
  487. text-align: center;
  488. .v1{
  489. color: rgba(16,16,16,1);
  490. font-size: 48rpx;
  491. font-weight: bold;
  492. }
  493. .v2{
  494. color: rgba(119,119,119,1);
  495. font-size: 24rpx;
  496. }
  497. }
  498. .body {
  499. display: flex;
  500. padding: 24rpx;
  501. .item-list {
  502. margin-left: 48rpx;
  503. display: flex;
  504. width: 100%;
  505. flex-wrap: wrap;
  506. .item-status {
  507. width: 50%;
  508. .num {
  509. color: rgba(51, 51, 51, 1);
  510. font-size: 36rpx;
  511. font-weight: bold;
  512. }
  513. }
  514. .statusN {
  515. display: flex;
  516. align-items: center;
  517. .statusC {
  518. margin-right: 8rpx;
  519. width: 16rpx;
  520. height: 16rpx;
  521. background-color: rgba(153, 153, 153, 1);
  522. }
  523. .status1 {
  524. background-color: rgba(0, 185, 98, 1);
  525. }
  526. .status2 {
  527. background-color: #FF3D00 ;
  528. }
  529. .status3 {
  530. background-color: #FF9600;
  531. }
  532. .status4 {
  533. background-color: #999999;
  534. }
  535. }
  536. }
  537. }
  538. }
  539. .main_list1 {
  540. margin-top: 24rpx;
  541. padding: 24rpx;
  542. padding-bottom: 36rpx;
  543. .list-body{
  544. padding: 24rpx 0;
  545. .item {
  546. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  547. }
  548. .title {
  549. display: flex;
  550. justify-content: space-between;
  551. .name{
  552. color: rgba(51,51,51,1);
  553. font-size: 32rpx;
  554. font-weight: bold;
  555. }
  556. .status{
  557. }
  558. .statusN1{
  559. }
  560. .statusN2{
  561. }
  562. .statusN3{
  563. }
  564. }
  565. .body{
  566. display: flex;
  567. color: rgba(51,51,51,1);
  568. font-size: 28rpx;
  569. .name{
  570. width: 150rpx;
  571. }
  572. .value{
  573. }
  574. }
  575. }
  576. .list {
  577. //padding: 24rpx 0;
  578. .item {
  579. display: flex;
  580. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  581. padding: 12rpx 0;
  582. margin: 12rpx 0;
  583. .img {
  584. width: 72rpx;
  585. height: 72rpx;
  586. }
  587. .body {
  588. margin: 0 12rpx;
  589. width: 100%;
  590. .line1,
  591. .line2 {
  592. display: flex;
  593. justify-content: space-between;
  594. }
  595. .line2 {
  596. color: rgba(119,119,119,1);
  597. font-size: 24rpx;
  598. margin-top: 8rpx;
  599. }
  600. .line1 {
  601. .typeN{
  602. font-size: 24rpx;
  603. margin-right: 8rpx;
  604. display: flex;
  605. align-items: center;
  606. border-radius: 8rpx;
  607. padding: 4rpx 8rpx;
  608. color: #fff;
  609. font-weight: 400;
  610. }
  611. .typeN1{
  612. background-color:#1677ff;
  613. //border: 2rpx solid #1677ff;
  614. }
  615. .typeN2{
  616. background-color:#19be6b;
  617. //border: 2rpx solid #19be6b;
  618. }
  619. .title {
  620. display: flex;
  621. color: rgba(51, 51, 51, 1);
  622. font-size: 28rpx;
  623. font-weight: bold;
  624. }
  625. .status {
  626. background-color: rgba(255, 61, 0, 1);
  627. font-size: 24rpx;
  628. color:#fff;
  629. padding: 2rpx 8rpx;
  630. //border-radius: 8rpx;
  631. }
  632. .status0 {
  633. background-color: #FF7B00;
  634. }
  635. .status1 {
  636. background-color: #007aff;
  637. }
  638. .status2 {
  639. background-color: #ff9900;
  640. }
  641. .status3 {
  642. background-color: #19be6b;
  643. }
  644. .status4 {
  645. border: 2rpx solid rgba(255, 61, 0, 1);
  646. color: rgba(255, 61, 0, 1);
  647. }
  648. }
  649. .errorDesc{
  650. margin: 8rpx 0;
  651. width: 480rpx;
  652. color: #777777;
  653. font-size: 24rpx;
  654. overflow: hidden;
  655. text-overflow: ellipsis;
  656. white-space: nowrap; /* 禁止换行,强制单行 */
  657. }
  658. }
  659. }
  660. // .item:not(:last-child) {
  661. // border-bottom:2rpx solid rgba(232,232,232,1);
  662. // }
  663. }
  664. }
  665. </style>