index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  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.totalNum">
  71. <view class="v1">{{datafloorStatus.totalNum}}</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. // 将传入的日期字符串转换为Date对象
  254. const targetDate = newDate(dateStr);
  255. // 获取当前日期
  256. const today = new Date();
  257. // 比较年份、月份和日期是否相等
  258. return (
  259. targetDate.getFullYear() === today.getFullYear() &&
  260. targetDate.getMonth() === today.getMonth() &&
  261. targetDate.getDate() === today.getDate()
  262. );
  263. },
  264. query(){
  265. uni.showLoading({
  266. title: "加载中",
  267. mask: true,
  268. })
  269. API.findByOpenId({
  270. noerror:true,
  271. openId: this.jphelp.getOpenId(),
  272. }).then((response) => {
  273. uni.hideLoading();
  274. if(response.message){
  275. uni.hideLoading();
  276. }else{
  277. this.loginset(response)
  278. }
  279. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  280. }).catch(error => {
  281. uni.hideLoading();
  282. })
  283. },
  284. geterrList(){
  285. var status=0
  286. var code=this.tabslist[this.current].code
  287. if(code=="geterrList0"){
  288. status=0
  289. }
  290. if(code=="geterrList1"){
  291. status=1
  292. }
  293. API.errList({
  294. pageIndex:1,
  295. pageSize:5,
  296. status:status,
  297. }).then((response) => {
  298. this.dataerrList=response.data.data
  299. this.dataerrRecordsTotal=response.data.recordsTotal
  300. this.isReadyerrList=true
  301. }).catch(error => {
  302. uni.showToast({
  303. title: error,
  304. icon: "none"
  305. })
  306. })
  307. },
  308. getfloorStatus(){
  309. API.floorStatus().then((response) => {
  310. var obj=response.data;
  311. var sz=['gunFaultNum','gunFreeNum','gunOfflineNum','gunWorkNum']
  312. var bl=false
  313. for(var i in sz){
  314. if(obj[sz[i]]!=this.datafloorStatus[sz[i]]){
  315. bl=true
  316. this.datafloorStatus=obj
  317. }
  318. }
  319. this.isReadyfloorStatus=true
  320. if(bl){
  321. this.getbody1pie1()
  322. }
  323. }).catch(error => {
  324. uni.showToast({
  325. title: error,
  326. icon: "none"
  327. })
  328. })
  329. },
  330. getbody1pie1() {
  331. var key = "body1pie1"
  332. var myChart = this.echartsList[key];
  333. if (!myChart) {
  334. myChart = echarts.init(document.getElementById(key), null, {
  335. width: uni.upx2px(88 * 2),
  336. height: uni.upx2px(88 * 2)
  337. })
  338. }
  339. myChart.clear()
  340. var option = {
  341. series: [{
  342. silent: true,
  343. type: 'pie',
  344. radius: ['80%', '100%'],
  345. label: {
  346. show: false,
  347. },
  348. data: [{
  349. value: this.datafloorStatus.gunWorkNum,
  350. itemStyle: {
  351. color: 'rgba(0, 185, 98, 1)'
  352. }
  353. },
  354. {
  355. value: this.datafloorStatus.gunFreeNum,
  356. itemStyle: {
  357. color: '#999999'
  358. }
  359. },
  360. {
  361. value: this.datafloorStatus.gunOfflineNum,
  362. itemStyle: {
  363. color: '#FF9600'
  364. }
  365. },
  366. {
  367. value: this.datafloorStatus.gunFaultNum,
  368. itemStyle: {
  369. color: '#FF3D00'
  370. }
  371. }
  372. ]
  373. }],
  374. grid: {
  375. top: 0,
  376. left: 0,
  377. right: 0,
  378. bottom: 0,
  379. containLabel: true
  380. },
  381. }
  382. myChart.setOption(option);
  383. console.log(option)
  384. this.echartsList[key] = myChart;
  385. }
  386. }
  387. }
  388. </script>
  389. <style>
  390. page{
  391. background-color: #FFFFFF;
  392. }
  393. </style>
  394. <style lang="scss">
  395. .back-blue {
  396. height: 0px;
  397. .back-color {
  398. height: 656rpx;
  399. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 53%, rgba(203, 234, 255, 0) 100%);
  400. }
  401. }
  402. .top-main {
  403. display: flex;
  404. align-items: center;
  405. justify-content: space-between;
  406. .title-main {
  407. color: rgba(51, 51, 51, 1);
  408. font-size: 32rpx;
  409. font-weight: bold;
  410. }
  411. .goto-main {
  412. color: rgba(131, 131, 131, 1);
  413. font-size: 24rpx;
  414. }
  415. }
  416. .panel,
  417. .main_top {
  418. margin: 0 32rpx;
  419. }
  420. .panel {
  421. border-radius: 16rpx;
  422. background-color: rgba(255, 255, 255, 1);
  423. box-shadow: 0px 8rpx 16rpx 0px rgba(22, 119, 255, 0.1);
  424. }
  425. .main_top {
  426. margin-top: 32rpx;
  427. display: flex;
  428. justify-content: space-between;
  429. .main_top1 {
  430. display: flex;
  431. align-items: center;
  432. .logo_img {
  433. .img {
  434. border-radius: 16rpx;
  435. width: 96rpx;
  436. height: 96rpx;
  437. }
  438. margin-right: 16rpx;
  439. }
  440. .logo_text {
  441. color: #fff;
  442. .logo_text1 {
  443. font-size: 40rpx;
  444. }
  445. .logo_text2 {
  446. font-size: 32rpx;
  447. }
  448. }
  449. }
  450. .main_top2 {}
  451. }
  452. .main_navigation {
  453. margin-top: 32rpx;
  454. display: flex;
  455. justify-content: space-around;
  456. align-items: center;
  457. padding: 24rpx 0 20rpx 0;
  458. .item-na-b {
  459. border-left: 2rpx solid rgba(187, 187, 187, 0.43);
  460. height: 70rpx;
  461. }
  462. .item-na {
  463. width: 32%;
  464. text-align: center;
  465. .na-img {
  466. display: flex;
  467. justify-content: center;
  468. .img {
  469. width: 80rpx;
  470. height: 80rpx;
  471. }
  472. }
  473. }
  474. }
  475. .main_statuspanel {
  476. margin-top: 24rpx;
  477. padding: 24rpx;
  478. .body2pie{
  479. position: relative;
  480. top: -140rpx;
  481. height: 0px;
  482. left: 0px;
  483. width: 176rpx;
  484. text-align: center;
  485. .v1{
  486. color: rgba(16,16,16,1);
  487. font-size: 48rpx;
  488. font-weight: bold;
  489. }
  490. .v2{
  491. color: rgba(119,119,119,1);
  492. font-size: 24rpx;
  493. }
  494. }
  495. .body {
  496. display: flex;
  497. padding: 24rpx;
  498. .item-list {
  499. margin-left: 48rpx;
  500. display: flex;
  501. width: 100%;
  502. flex-wrap: wrap;
  503. .item-status {
  504. width: 50%;
  505. .num {
  506. color: rgba(51, 51, 51, 1);
  507. font-size: 36rpx;
  508. font-weight: bold;
  509. }
  510. }
  511. .statusN {
  512. display: flex;
  513. align-items: center;
  514. .statusC {
  515. margin-right: 8rpx;
  516. width: 16rpx;
  517. height: 16rpx;
  518. background-color: rgba(153, 153, 153, 1);
  519. }
  520. .status1 {
  521. background-color: rgba(0, 185, 98, 1);
  522. }
  523. .status2 {
  524. background-color: #FF3D00 ;
  525. }
  526. .status3 {
  527. background-color: #FF9600;
  528. }
  529. .status4 {
  530. background-color: #999999;
  531. }
  532. }
  533. }
  534. }
  535. }
  536. .main_list1 {
  537. margin-top: 24rpx;
  538. padding: 24rpx;
  539. padding-bottom: 36rpx;
  540. .list-body{
  541. padding: 24rpx 0;
  542. .item {
  543. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  544. }
  545. .title {
  546. display: flex;
  547. justify-content: space-between;
  548. .name{
  549. color: rgba(51,51,51,1);
  550. font-size: 32rpx;
  551. font-weight: bold;
  552. }
  553. .status{
  554. }
  555. .statusN1{
  556. }
  557. .statusN2{
  558. }
  559. .statusN3{
  560. }
  561. }
  562. .body{
  563. display: flex;
  564. color: rgba(51,51,51,1);
  565. font-size: 28rpx;
  566. .name{
  567. width: 150rpx;
  568. }
  569. .value{
  570. }
  571. }
  572. }
  573. .list {
  574. //padding: 24rpx 0;
  575. .item {
  576. display: flex;
  577. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  578. padding: 12rpx 0;
  579. margin: 12rpx 0;
  580. .img {
  581. width: 72rpx;
  582. height: 72rpx;
  583. }
  584. .body {
  585. margin: 0 12rpx;
  586. width: 100%;
  587. .line1,
  588. .line2 {
  589. display: flex;
  590. justify-content: space-between;
  591. }
  592. .line2 {
  593. color: rgba(119,119,119,1);
  594. font-size: 24rpx;
  595. margin-top: 8rpx;
  596. }
  597. .line1 {
  598. .typeN{
  599. font-size: 24rpx;
  600. margin-right: 8rpx;
  601. display: flex;
  602. align-items: center;
  603. border-radius: 8rpx;
  604. padding: 4rpx 8rpx;
  605. color: #fff;
  606. font-weight: 400;
  607. }
  608. .typeN1{
  609. background-color:#1677ff;
  610. //border: 2rpx solid #1677ff;
  611. }
  612. .typeN2{
  613. background-color:#19be6b;
  614. //border: 2rpx solid #19be6b;
  615. }
  616. .title {
  617. display: flex;
  618. color: rgba(51, 51, 51, 1);
  619. font-size: 28rpx;
  620. font-weight: bold;
  621. }
  622. .status {
  623. background-color: rgba(255, 61, 0, 1);
  624. font-size: 24rpx;
  625. color:#fff;
  626. padding: 2rpx 8rpx;
  627. //border-radius: 8rpx;
  628. }
  629. .status0 {
  630. background-color: #FF7B00;
  631. }
  632. .status1 {
  633. background-color: #007aff;
  634. }
  635. .status2 {
  636. background-color: #ff9900;
  637. }
  638. .status3 {
  639. background-color: #19be6b;
  640. }
  641. .status4 {
  642. border: 2rpx solid rgba(255, 61, 0, 1);
  643. color: rgba(255, 61, 0, 1);
  644. }
  645. }
  646. .errorDesc{
  647. margin: 8rpx 0;
  648. width: 480rpx;
  649. color: #777777;
  650. font-size: 24rpx;
  651. overflow: hidden;
  652. text-overflow: ellipsis;
  653. white-space: nowrap; /* 禁止换行,强制单行 */
  654. }
  655. }
  656. }
  657. // .item:not(:last-child) {
  658. // border-bottom:2rpx solid rgba(232,232,232,1);
  659. // }
  660. }
  661. }
  662. </style>