index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  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" >
  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. {{item.errorCodeText}}
  149. </view>
  150. <span v-if="item.type" :class="'typeN typeN'+item.type">
  151. {{item.typeN}}
  152. </span>
  153. </view>
  154. <view class="line2">
  155. <view class="value">
  156. {{item.stationName}}
  157. </view>
  158. <view class="value">
  159. <span style="color: red;" v-if="isToday(item.errorReportTime)">(今日)</span>
  160. {{item.errorReportTime}}
  161. </view>
  162. </view>
  163. </view>
  164. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  165. </view>
  166. <u-divider color="#F44336"
  167. :isnone="dataerrRecordsTotal==0" nonetext="暂无数据"
  168. v-if="dataerrRecordsTotal>5&&current==0"
  169. @click="gotoUrl('/pages/task/listTask?status='+tabslist[current].code)" >故障记录{{dataerrRecordsTotal}}条,点击查看更多</u-divider>
  170. </view>
  171. </view>
  172. <tabbar :current="0"></tabbar>
  173. </view>
  174. </template>
  175. <script>
  176. import * as API from '@/apis/pagejs/pagejsIndex.js'
  177. import * as echarts from 'echarts';
  178. import Tabbar from '@/components/Tabbar.vue'
  179. import {
  180. newDate
  181. } from '@/apis/utils'
  182. export default {
  183. components: {
  184. Tabbar,
  185. },
  186. data() {
  187. return {
  188. echartsList: {},
  189. isReadyfloorStatus:false,
  190. datafloorStatus:{},
  191. roleList:[],
  192. isReadyerrList:false,
  193. dataerrList:[],
  194. dataerrRecordsTotal:0,
  195. tabslist:[
  196. {
  197. name: '待处理',
  198. code:"geterrList0"
  199. }, {
  200. name: '已处理',
  201. code:"geterrList1"
  202. }
  203. ],
  204. current:0,
  205. };
  206. },
  207. onLoad() {
  208. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  209. },
  210. onShow() {
  211. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  212. if(this.isReadyfloorStatus){
  213. this.getfloorStatus()
  214. }
  215. if(this.isReadyerrList){
  216. this.geterrList()
  217. }
  218. },
  219. computed:{
  220. isAdmin(){
  221. if(this.roleList){
  222. var i =this.roleList.findIndex(item=>{
  223. return item.name=='XJADMIN'
  224. })
  225. if(i!=-1){
  226. return true
  227. }
  228. }
  229. return true
  230. }
  231. },
  232. onReady() {
  233. this.geterrList()
  234. this.getfloorStatus()
  235. //this.getbody1pie1()
  236. this.query()
  237. },
  238. methods: {
  239. change(e){
  240. this.current=e
  241. this.dataerrList =[]
  242. this.geterrList()
  243. },
  244. isToday(dateStr) {
  245. if(!dateStr){
  246. return false
  247. }
  248. // 将传入的日期字符串转换为Date对象
  249. const targetDate = newDate(dateStr);
  250. // 获取当前日期
  251. const today = new Date();
  252. // 比较年份、月份和日期是否相等
  253. return (
  254. targetDate.getFullYear() === today.getFullYear() &&
  255. targetDate.getMonth() === today.getMonth() &&
  256. targetDate.getDate() === today.getDate()
  257. );
  258. },
  259. query(){
  260. uni.showLoading({
  261. title: "加载中",
  262. mask: true,
  263. })
  264. API.findByOpenId({
  265. noerror:true,
  266. openId: this.jphelp.getOpenId(),
  267. }).then((response) => {
  268. uni.hideLoading();
  269. if(response.message){
  270. uni.hideLoading();
  271. }else{
  272. this.loginset(response)
  273. }
  274. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  275. }).catch(error => {
  276. uni.hideLoading();
  277. })
  278. },
  279. geterrList(){
  280. var status=0
  281. var code=this.tabslist[this.current].code
  282. if(code=="geterrList0"){
  283. status=0
  284. }
  285. if(code=="geterrList1"){
  286. status=1
  287. }
  288. API.errList({
  289. pageIndex:1,
  290. pageSize:5,
  291. status:status,
  292. }).then((response) => {
  293. this.dataerrList=response.data.data
  294. this.dataerrRecordsTotal=response.data.recordsTotal
  295. this.isReadyerrList=true
  296. }).catch(error => {
  297. uni.showToast({
  298. title: error,
  299. icon: "none"
  300. })
  301. })
  302. },
  303. getfloorStatus(){
  304. API.floorStatus().then((response) => {
  305. var obj=response.data;
  306. var sz=['gunFaultNum','gunFreeNum','gunOfflineNum','gunWorkNum']
  307. var bl=false
  308. for(var i in sz){
  309. if(obj[sz[i]]!=this.datafloorStatus[sz[i]]){
  310. bl=true
  311. this.datafloorStatus=obj
  312. }
  313. }
  314. this.isReadyfloorStatus=true
  315. if(bl){
  316. this.getbody1pie1()
  317. }
  318. }).catch(error => {
  319. uni.showToast({
  320. title: error,
  321. icon: "none"
  322. })
  323. })
  324. },
  325. getbody1pie1() {
  326. var key = "body1pie1"
  327. var myChart = this.echartsList[key];
  328. if (!myChart) {
  329. myChart = echarts.init(document.getElementById(key), null, {
  330. width: uni.upx2px(88 * 2),
  331. height: uni.upx2px(88 * 2)
  332. })
  333. }
  334. myChart.clear()
  335. var option = {
  336. series: [{
  337. silent: true,
  338. type: 'pie',
  339. radius: ['80%', '100%'],
  340. label: {
  341. show: false,
  342. },
  343. data: [{
  344. value: this.datafloorStatus.gunWorkNum,
  345. itemStyle: {
  346. color: 'rgba(0, 185, 98, 1)'
  347. }
  348. },
  349. {
  350. value: this.datafloorStatus.gunFreeNum,
  351. itemStyle: {
  352. color: '#999999'
  353. }
  354. },
  355. {
  356. value: this.datafloorStatus.gunOfflineNum,
  357. itemStyle: {
  358. color: '#FF9600'
  359. }
  360. },
  361. {
  362. value: this.datafloorStatus.gunFaultNum,
  363. itemStyle: {
  364. color: '#FF3D00'
  365. }
  366. }
  367. ]
  368. }],
  369. grid: {
  370. top: 0,
  371. left: 0,
  372. right: 0,
  373. bottom: 0,
  374. containLabel: true
  375. },
  376. }
  377. myChart.setOption(option);
  378. console.log(option)
  379. this.echartsList[key] = myChart;
  380. }
  381. }
  382. }
  383. </script>
  384. <style>
  385. page{
  386. background-color: #FFFFFF;
  387. }
  388. </style>
  389. <style lang="scss">
  390. .back-blue {
  391. height: 0px;
  392. .back-color {
  393. height: 656rpx;
  394. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 53%, rgba(203, 234, 255, 0) 100%);
  395. }
  396. }
  397. .top-main {
  398. display: flex;
  399. align-items: center;
  400. justify-content: space-between;
  401. .title-main {
  402. color: rgba(51, 51, 51, 1);
  403. font-size: 32rpx;
  404. font-weight: bold;
  405. }
  406. .goto-main {
  407. color: rgba(131, 131, 131, 1);
  408. font-size: 24rpx;
  409. }
  410. }
  411. .panel,
  412. .main_top {
  413. margin: 0 32rpx;
  414. }
  415. .panel {
  416. border-radius: 16rpx;
  417. background-color: rgba(255, 255, 255, 1);
  418. box-shadow: 0px 8rpx 16rpx 0px rgba(22, 119, 255, 0.1);
  419. }
  420. .main_top {
  421. margin-top: 32rpx;
  422. display: flex;
  423. justify-content: space-between;
  424. .main_top1 {
  425. display: flex;
  426. align-items: center;
  427. .logo_img {
  428. .img {
  429. border-radius: 16rpx;
  430. width: 96rpx;
  431. height: 96rpx;
  432. }
  433. margin-right: 16rpx;
  434. }
  435. .logo_text {
  436. color: #fff;
  437. .logo_text1 {
  438. font-size: 40rpx;
  439. }
  440. .logo_text2 {
  441. font-size: 32rpx;
  442. }
  443. }
  444. }
  445. .main_top2 {}
  446. }
  447. .main_navigation {
  448. margin-top: 32rpx;
  449. display: flex;
  450. justify-content: space-around;
  451. align-items: center;
  452. padding: 24rpx 0 20rpx 0;
  453. .item-na-b {
  454. border-left: 2rpx solid rgba(187, 187, 187, 0.43);
  455. height: 70rpx;
  456. }
  457. .item-na {
  458. width: 32%;
  459. text-align: center;
  460. .na-img {
  461. display: flex;
  462. justify-content: center;
  463. .img {
  464. width: 80rpx;
  465. height: 80rpx;
  466. }
  467. }
  468. }
  469. }
  470. .main_statuspanel {
  471. margin-top: 24rpx;
  472. padding: 24rpx;
  473. .body2pie{
  474. position: relative;
  475. top: -140rpx;
  476. height: 0px;
  477. left: 0px;
  478. width: 176rpx;
  479. text-align: center;
  480. .v1{
  481. color: rgba(16,16,16,1);
  482. font-size: 48rpx;
  483. font-weight: bold;
  484. }
  485. .v2{
  486. color: rgba(119,119,119,1);
  487. font-size: 24rpx;
  488. }
  489. }
  490. .body {
  491. display: flex;
  492. padding: 24rpx;
  493. .item-list {
  494. margin-left: 48rpx;
  495. display: flex;
  496. width: 100%;
  497. flex-wrap: wrap;
  498. .item-status {
  499. width: 50%;
  500. .num {
  501. color: rgba(51, 51, 51, 1);
  502. font-size: 36rpx;
  503. font-weight: bold;
  504. }
  505. }
  506. .statusN {
  507. display: flex;
  508. align-items: center;
  509. .statusC {
  510. margin-right: 8rpx;
  511. width: 16rpx;
  512. height: 16rpx;
  513. background-color: rgba(153, 153, 153, 1);
  514. }
  515. .status1 {
  516. background-color: rgba(0, 185, 98, 1);
  517. }
  518. .status2 {
  519. background-color: #FF3D00 ;
  520. }
  521. .status3 {
  522. background-color: #FF9600;
  523. }
  524. .status4 {
  525. background-color: #999999;
  526. }
  527. }
  528. }
  529. }
  530. }
  531. .main_list1 {
  532. background-color: #fff;
  533. margin-top: 24rpx;
  534. padding: 24rpx;
  535. padding-bottom: 36rpx;
  536. .list-body{
  537. padding: 24rpx 0;
  538. .item {
  539. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  540. }
  541. .title {
  542. display: flex;
  543. justify-content: space-between;
  544. .name{
  545. color: rgba(51,51,51,1);
  546. font-size: 32rpx;
  547. font-weight: bold;
  548. }
  549. .status{
  550. }
  551. .statusN1{
  552. }
  553. .statusN2{
  554. }
  555. .statusN3{
  556. }
  557. }
  558. .body{
  559. display: flex;
  560. color: rgba(51,51,51,1);
  561. font-size: 28rpx;
  562. .name{
  563. width: 150rpx;
  564. }
  565. .value{
  566. }
  567. }
  568. }
  569. .item:not(:first-child) {
  570. //background-color: red;
  571. border-top: 0rpx solid rgba(232, 232, 232, 1);
  572. }
  573. .list {
  574. //padding: 24rpx 0;
  575. .item {
  576. display: flex;
  577. border-top: 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>