index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  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. 智泊e家
  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/lockTab/listLock')">
  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. <u-tabs :list="tabslist"
  129. style=" width: 50%;"
  130. :current="current" @change="change"></u-tabs>
  131. <view class="list" >
  132. <view class="item"
  133. v-for="(item,index) in dataerrList"
  134. @click="gotoUrl('/pages/task/maintenanceTaks?id='+item.id)"
  135. :key="index">
  136. <view class="icon">
  137. <image class="img" v-if="item.errorCodeImage" :src="item.errorCodeImage" mode=""></image>
  138. <image class="img" v-else src="@/assets/img/taskstatus/status3.png" mode=""></image>
  139. </view>
  140. <view class="body">
  141. <view class="line1">
  142. <view class="title">
  143. <span v-if="item.type" :class="'typeN typeN'+item.type">
  144. {{item.typeN}}
  145. </span>
  146. {{item.errorCodeText}}
  147. </view>
  148. <view class="status " :class="'status'+item.status">
  149. {{item.statusN}}
  150. </view>
  151. </view>
  152. <view class="line2">
  153. <view class="value">
  154. {{item.createTime}}<span style="color: red;" v-if="isToday(item.createTime)">(今日)</span>
  155. </view>
  156. <view class="value">
  157. {{item.parkingName}}
  158. </view>
  159. </view>
  160. <view class="errorDesc" v-if="item.errorDesc">
  161. 描述:{{item.errorDesc}}
  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. <u-divider color="#CFD2D5" v-else
  171. :isnone="dataerrRecordsTotal==0" nonetext="暂无数据"
  172. @click="gotoUrl('/pages/task/listTask?status='+tabslist[current].code)" >查看详情</u-divider>
  173. </view>
  174. </view>
  175. <tabbar :current="0"></tabbar>
  176. </view>
  177. </template>
  178. <script>
  179. import * as API from '@/apis/pagejs/pagejsIndex.js'
  180. import * as echarts from 'echarts';
  181. import Tabbar from '@/components/Tabbar.vue'
  182. import {
  183. newDate
  184. } from '@/apis/utils'
  185. export default {
  186. components: {
  187. Tabbar,
  188. },
  189. data() {
  190. return {
  191. echartsList: {},
  192. isReadyfloorStatus:false,
  193. datafloorStatus:{},
  194. roleList:[],
  195. isReadyerrList:false,
  196. dataerrList:[],
  197. dataerrRecordsTotal:0,
  198. tabslist:[
  199. {
  200. name: '待处理',
  201. code:"geterrList0"
  202. }, {
  203. name: '已处理',
  204. code:"geterrList1"
  205. }
  206. ],
  207. current:0,
  208. };
  209. },
  210. onLoad() {
  211. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  212. },
  213. onShow() {
  214. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  215. if(this.isReadyfloorStatus){
  216. this.getfloorStatus()
  217. }
  218. if(this.isReadyerrList){
  219. this.geterrList()
  220. }
  221. },
  222. computed:{
  223. isAdmin(){
  224. if(this.roleList){
  225. var i =this.roleList.findIndex(item=>{
  226. return item.name=='XJADMIN'
  227. })
  228. if(i!=-1){
  229. return true
  230. }
  231. }
  232. return false
  233. }
  234. },
  235. onReady() {
  236. this.geterrList()
  237. this.getfloorStatus()
  238. //this.getbody1pie1()
  239. this.query()
  240. },
  241. methods: {
  242. change(e){
  243. this.current=e
  244. this.dataerrList =[]
  245. this.geterrList()
  246. },
  247. isToday(dateStr) {
  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=['totalNum','normalNum','errorNum','loseNum']
  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.normalNum,
  345. itemStyle: {
  346. color: 'rgba(0, 185, 98, 1)'
  347. }
  348. },
  349. {
  350. value: this.datafloorStatus.loseNum,
  351. itemStyle: {
  352. color: 'rgba(153, 153, 153, 1)'
  353. }
  354. },
  355. {
  356. value: this.datafloorStatus.errorNum,
  357. itemStyle: {
  358. color: 'rgba(255, 123, 0, 1)'
  359. }
  360. }
  361. ]
  362. }],
  363. grid: {
  364. top: 0,
  365. left: 0,
  366. right: 0,
  367. bottom: 0,
  368. containLabel: true
  369. },
  370. }
  371. myChart.setOption(option);
  372. console.log(option)
  373. this.echartsList[key] = myChart;
  374. }
  375. }
  376. }
  377. </script>
  378. <style>
  379. page{
  380. background-color: #FFFFFF;
  381. }
  382. </style>
  383. <style lang="scss">
  384. .back-blue {
  385. height: 0px;
  386. .back-color {
  387. height: 656rpx;
  388. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 53%, rgba(203, 234, 255, 0) 100%);
  389. }
  390. }
  391. .top-main {
  392. display: flex;
  393. align-items: center;
  394. justify-content: space-between;
  395. .title-main {
  396. color: rgba(51, 51, 51, 1);
  397. font-size: 32rpx;
  398. font-weight: bold;
  399. }
  400. .goto-main {
  401. color: rgba(131, 131, 131, 1);
  402. font-size: 24rpx;
  403. }
  404. }
  405. .panel,
  406. .main_top {
  407. margin: 0 32rpx;
  408. }
  409. .panel {
  410. border-radius: 8px;
  411. background-color: rgba(255, 255, 255, 1);
  412. box-shadow: 0px 4px 8px 0px rgba(22, 119, 255, 0.1);
  413. }
  414. .main_top {
  415. margin-top: 32rpx;
  416. display: flex;
  417. justify-content: space-between;
  418. .main_top1 {
  419. display: flex;
  420. align-items: center;
  421. .logo_img {
  422. .img {
  423. border-radius: 8px;
  424. width: 96rpx;
  425. height: 96rpx;
  426. }
  427. margin-right: 16rpx;
  428. }
  429. .logo_text {
  430. color: #fff;
  431. .logo_text1 {
  432. font-size: 20px;
  433. }
  434. .logo_text2 {
  435. font-size: 16px;
  436. }
  437. }
  438. }
  439. .main_top2 {}
  440. }
  441. .main_navigation {
  442. margin-top: 32rpx;
  443. display: flex;
  444. justify-content: space-around;
  445. align-items: center;
  446. padding: 24rpx 0 20rpx 0;
  447. .item-na-b {
  448. border-left: 1px solid rgba(187, 187, 187, 0.43);
  449. height: 70rpx;
  450. }
  451. .item-na {
  452. width: 32%;
  453. text-align: center;
  454. .na-img {
  455. display: flex;
  456. justify-content: center;
  457. .img {
  458. width: 80rpx;
  459. height: 80rpx;
  460. }
  461. }
  462. }
  463. }
  464. .main_statuspanel {
  465. margin-top: 24rpx;
  466. padding: 24rpx;
  467. .body2pie{
  468. position: relative;
  469. top: -140rpx;
  470. height: 0px;
  471. left: 0px;
  472. width: 176rpx;
  473. text-align: center;
  474. .v1{
  475. color: rgba(16,16,16,1);
  476. font-size: 48rpx;
  477. font-weight: bold;
  478. }
  479. .v2{
  480. color: rgba(119,119,119,1);
  481. font-size: 24rpx;
  482. }
  483. }
  484. .body {
  485. display: flex;
  486. padding: 24rpx;
  487. .item-list {
  488. margin-left: 48rpx;
  489. display: flex;
  490. width: 100%;
  491. flex-wrap: wrap;
  492. .item-status {
  493. width: 50%;
  494. .num {
  495. color: rgba(51, 51, 51, 1);
  496. font-size: 36rpx;
  497. font-weight: bold;
  498. }
  499. }
  500. .statusN {
  501. display: flex;
  502. align-items: center;
  503. .statusC {
  504. margin-right: 8rpx;
  505. width: 16rpx;
  506. height: 16rpx;
  507. background-color: rgba(153, 153, 153, 1);
  508. }
  509. .status1 {
  510. background-color: rgba(0, 185, 98, 1);
  511. }
  512. .status2 {
  513. background-color: rgba(255, 123, 0, 1);
  514. }
  515. .status3 {
  516. background-color: rgba(153, 153, 153, 1);
  517. }
  518. .status4 {
  519. background-color: rgba(129, 97, 255, 1);
  520. }
  521. }
  522. }
  523. }
  524. }
  525. .main_list1 {
  526. margin-top: 24rpx;
  527. padding: 24rpx;
  528. padding-bottom: 36rpx;
  529. .list-body{
  530. padding: 24rpx 0;
  531. .item {
  532. border-bottom: 1px solid rgba(232, 232, 232, 1);
  533. }
  534. .title {
  535. display: flex;
  536. justify-content: space-between;
  537. .name{
  538. color: rgba(51,51,51,1);
  539. font-size: 32rpx;
  540. font-weight: bold;
  541. }
  542. .status{
  543. }
  544. .statusN1{
  545. }
  546. .statusN2{
  547. }
  548. .statusN3{
  549. }
  550. }
  551. .body{
  552. display: flex;
  553. color: rgba(51,51,51,1);
  554. font-size: 28rpx;
  555. .name{
  556. width: 150rpx;
  557. }
  558. .value{
  559. }
  560. }
  561. }
  562. .list {
  563. //padding: 24rpx 0;
  564. .item {
  565. display: flex;
  566. border-bottom: 1px solid rgba(232, 232, 232, 1);
  567. padding: 12rpx 0;
  568. margin: 12rpx 0;
  569. .img {
  570. width: 72rpx;
  571. height: 72rpx;
  572. }
  573. .body {
  574. margin: 0 12rpx;
  575. width: 100%;
  576. .line1,
  577. .line2 {
  578. display: flex;
  579. justify-content: space-between;
  580. }
  581. .line2 {
  582. color: rgba(119,119,119,1);
  583. font-size: 24rpx;
  584. margin-top: 8rpx;
  585. }
  586. .line1 {
  587. .typeN{
  588. font-size: 24rpx;
  589. margin-right: 8rpx;
  590. display: flex;
  591. align-items: center;
  592. border-radius: 4px;
  593. padding: 2px 8rpx;
  594. color: #fff;
  595. font-weight: 400;
  596. }
  597. .typeN1{
  598. background-color:#1677ff;
  599. //border: 1px solid #1677ff;
  600. }
  601. .typeN2{
  602. background-color:#19be6b;
  603. //border: 1px solid #19be6b;
  604. }
  605. .title {
  606. display: flex;
  607. color: rgba(51, 51, 51, 1);
  608. font-size: 28rpx;
  609. font-weight: bold;
  610. }
  611. .status {
  612. background-color: rgba(255, 61, 0, 1);
  613. font-size: 24rpx;
  614. color:#fff;
  615. padding: 2rpx 8rpx;
  616. //border-radius: 4px;
  617. }
  618. .status0 {
  619. background-color: rgba(255, 61, 0, 1);
  620. }
  621. .status1 {
  622. background-color: #007aff;
  623. }
  624. .status2 {
  625. background-color: #ff9900;
  626. }
  627. .status3 {
  628. background-color: #19be6b;
  629. }
  630. .status4 {
  631. border: 1px solid rgba(255, 61, 0, 1);
  632. color: rgba(255, 61, 0, 1);
  633. }
  634. }
  635. .errorDesc{
  636. margin: 8rpx 0;
  637. width: 480rpx;
  638. color: #777777;
  639. font-size: 24rpx;
  640. overflow: hidden;
  641. text-overflow: ellipsis;
  642. white-space: nowrap; /* 禁止换行,强制单行 */
  643. }
  644. }
  645. }
  646. // .item:not(:last-child) {
  647. // border-bottom:1px solid rgba(232,232,232,1);
  648. // }
  649. }
  650. }
  651. </style>