index.vue 15 KB

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