index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  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/task/listTask')" >
  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.normalNum}}
  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.errorNum}}
  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.loseNum}}
  103. </view>
  104. <view class="statusN">
  105. <view class="statusC status3">
  106. </view>
  107. <view class="statusT">
  108. 离线
  109. </view>
  110. </view>
  111. </view>
  112. <view class="item-status" >
  113. <view class="num">
  114. 0
  115. </view>
  116. <view class="statusN">
  117. <view class="statusC status4">
  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: 1px solid #e8e8e8;" >
  129. <u-tabs :list="tabslist"
  130. :current="current" @change="change"></u-tabs>
  131. <view class="goto-main" @click="gotoUrl('/pages/lockTab/listLock')">
  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 false
  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=['totalNum','normalNum','errorNum','loseNum']
  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.normalNum,
  350. itemStyle: {
  351. color: 'rgba(0, 185, 98, 1)'
  352. }
  353. },
  354. {
  355. value: this.datafloorStatus.loseNum,
  356. itemStyle: {
  357. color: 'rgba(153, 153, 153, 1)'
  358. }
  359. },
  360. {
  361. value: this.datafloorStatus.errorNum,
  362. itemStyle: {
  363. color: 'rgba(255, 123, 0, 1)'
  364. }
  365. }
  366. ]
  367. }],
  368. grid: {
  369. top: 0,
  370. left: 0,
  371. right: 0,
  372. bottom: 0,
  373. containLabel: true
  374. },
  375. }
  376. myChart.setOption(option);
  377. console.log(option)
  378. this.echartsList[key] = myChart;
  379. }
  380. }
  381. }
  382. </script>
  383. <style>
  384. page{
  385. background-color: #FFFFFF;
  386. }
  387. </style>
  388. <style lang="scss">
  389. .back-blue {
  390. height: 0px;
  391. .back-color {
  392. height: 656rpx;
  393. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 53%, rgba(203, 234, 255, 0) 100%);
  394. }
  395. }
  396. .top-main {
  397. display: flex;
  398. align-items: center;
  399. justify-content: space-between;
  400. .title-main {
  401. color: rgba(51, 51, 51, 1);
  402. font-size: 32rpx;
  403. font-weight: bold;
  404. }
  405. .goto-main {
  406. color: rgba(131, 131, 131, 1);
  407. font-size: 24rpx;
  408. }
  409. }
  410. .panel,
  411. .main_top {
  412. margin: 0 32rpx;
  413. }
  414. .panel {
  415. border-radius: 8px;
  416. background-color: rgba(255, 255, 255, 1);
  417. box-shadow: 0px 4px 8px 0px rgba(22, 119, 255, 0.1);
  418. }
  419. .main_top {
  420. margin-top: 32rpx;
  421. display: flex;
  422. justify-content: space-between;
  423. .main_top1 {
  424. display: flex;
  425. align-items: center;
  426. .logo_img {
  427. .img {
  428. border-radius: 8px;
  429. width: 96rpx;
  430. height: 96rpx;
  431. }
  432. margin-right: 16rpx;
  433. }
  434. .logo_text {
  435. color: #fff;
  436. .logo_text1 {
  437. font-size: 20px;
  438. }
  439. .logo_text2 {
  440. font-size: 16px;
  441. }
  442. }
  443. }
  444. .main_top2 {}
  445. }
  446. .main_navigation {
  447. margin-top: 32rpx;
  448. display: flex;
  449. justify-content: space-around;
  450. align-items: center;
  451. padding: 24rpx 0 20rpx 0;
  452. .item-na-b {
  453. border-left: 1px solid rgba(187, 187, 187, 0.43);
  454. height: 70rpx;
  455. }
  456. .item-na {
  457. width: 32%;
  458. text-align: center;
  459. .na-img {
  460. display: flex;
  461. justify-content: center;
  462. .img {
  463. width: 80rpx;
  464. height: 80rpx;
  465. }
  466. }
  467. }
  468. }
  469. .main_statuspanel {
  470. margin-top: 24rpx;
  471. padding: 24rpx;
  472. .body2pie{
  473. position: relative;
  474. top: -140rpx;
  475. height: 0px;
  476. left: 0px;
  477. width: 176rpx;
  478. text-align: center;
  479. .v1{
  480. color: rgba(16,16,16,1);
  481. font-size: 48rpx;
  482. font-weight: bold;
  483. }
  484. .v2{
  485. color: rgba(119,119,119,1);
  486. font-size: 24rpx;
  487. }
  488. }
  489. .body {
  490. display: flex;
  491. padding: 24rpx;
  492. .item-list {
  493. margin-left: 48rpx;
  494. display: flex;
  495. width: 100%;
  496. flex-wrap: wrap;
  497. .item-status {
  498. width: 50%;
  499. .num {
  500. color: rgba(51, 51, 51, 1);
  501. font-size: 36rpx;
  502. font-weight: bold;
  503. }
  504. }
  505. .statusN {
  506. display: flex;
  507. align-items: center;
  508. .statusC {
  509. margin-right: 8rpx;
  510. width: 16rpx;
  511. height: 16rpx;
  512. background-color: rgba(153, 153, 153, 1);
  513. }
  514. .status1 {
  515. background-color: rgba(0, 185, 98, 1);
  516. }
  517. .status2 {
  518. background-color: rgba(255, 123, 0, 1);
  519. }
  520. .status3 {
  521. background-color: rgba(153, 153, 153, 1);
  522. }
  523. .status4 {
  524. background-color: rgba(129, 97, 255, 1);
  525. }
  526. }
  527. }
  528. }
  529. }
  530. .main_list1 {
  531. margin-top: 24rpx;
  532. padding: 24rpx;
  533. padding-bottom: 36rpx;
  534. .list-body{
  535. padding: 24rpx 0;
  536. .item {
  537. border-bottom: 1px solid rgba(232, 232, 232, 1);
  538. }
  539. .title {
  540. display: flex;
  541. justify-content: space-between;
  542. .name{
  543. color: rgba(51,51,51,1);
  544. font-size: 32rpx;
  545. font-weight: bold;
  546. }
  547. .status{
  548. }
  549. .statusN1{
  550. }
  551. .statusN2{
  552. }
  553. .statusN3{
  554. }
  555. }
  556. .body{
  557. display: flex;
  558. color: rgba(51,51,51,1);
  559. font-size: 28rpx;
  560. .name{
  561. width: 150rpx;
  562. }
  563. .value{
  564. }
  565. }
  566. }
  567. .list {
  568. //padding: 24rpx 0;
  569. .item {
  570. display: flex;
  571. border-bottom: 1px solid rgba(232, 232, 232, 1);
  572. padding: 12rpx 0;
  573. margin: 12rpx 0;
  574. .img {
  575. width: 72rpx;
  576. height: 72rpx;
  577. }
  578. .body {
  579. margin: 0 12rpx;
  580. width: 100%;
  581. .line1,
  582. .line2 {
  583. display: flex;
  584. justify-content: space-between;
  585. }
  586. .line2 {
  587. color: rgba(119,119,119,1);
  588. font-size: 24rpx;
  589. margin-top: 8rpx;
  590. }
  591. .line1 {
  592. .typeN{
  593. font-size: 24rpx;
  594. margin-right: 8rpx;
  595. display: flex;
  596. align-items: center;
  597. border-radius: 4px;
  598. padding: 2px 8rpx;
  599. color: #fff;
  600. font-weight: 400;
  601. }
  602. .typeN1{
  603. background-color:#1677ff;
  604. //border: 1px solid #1677ff;
  605. }
  606. .typeN2{
  607. background-color:#19be6b;
  608. //border: 1px solid #19be6b;
  609. }
  610. .title {
  611. display: flex;
  612. color: rgba(51, 51, 51, 1);
  613. font-size: 28rpx;
  614. font-weight: bold;
  615. }
  616. .status {
  617. background-color: rgba(255, 61, 0, 1);
  618. font-size: 24rpx;
  619. color:#fff;
  620. padding: 2rpx 8rpx;
  621. //border-radius: 4px;
  622. }
  623. .status0 {
  624. background-color: rgba(255, 61, 0, 1);
  625. }
  626. .status1 {
  627. background-color: #007aff;
  628. }
  629. .status2 {
  630. background-color: #ff9900;
  631. }
  632. .status3 {
  633. background-color: #19be6b;
  634. }
  635. .status4 {
  636. border: 1px solid rgba(255, 61, 0, 1);
  637. color: rgba(255, 61, 0, 1);
  638. }
  639. }
  640. .errorDesc{
  641. margin: 8rpx 0;
  642. width: 480rpx;
  643. color: #777777;
  644. font-size: 24rpx;
  645. overflow: hidden;
  646. text-overflow: ellipsis;
  647. white-space: nowrap; /* 禁止换行,强制单行 */
  648. }
  649. }
  650. }
  651. // .item:not(:last-child) {
  652. // border-bottom:1px solid rgba(232,232,232,1);
  653. // }
  654. }
  655. }
  656. </style>