index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  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. <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. </view>
  176. </view>
  177. <tabbar :current="0"></tabbar>
  178. </view>
  179. </template>
  180. <script>
  181. import * as API from '@/apis/pagejs/pagejsIndex.js'
  182. import * as echarts from 'echarts';
  183. import Tabbar from '@/components/Tabbar.vue'
  184. import {
  185. newDate
  186. } from '@/apis/utils'
  187. export default {
  188. components: {
  189. Tabbar,
  190. },
  191. data() {
  192. return {
  193. echartsList: {},
  194. isReadyfloorStatus:false,
  195. datafloorStatus:{},
  196. roleList:[],
  197. isReadyerrList:false,
  198. dataerrList:[],
  199. dataerrRecordsTotal:0,
  200. tabslist:[
  201. {
  202. name: '待处理',
  203. code:"geterrList0"
  204. }, {
  205. name: '已处理',
  206. code:"geterrList1"
  207. }
  208. ],
  209. current:0,
  210. };
  211. },
  212. onLoad() {
  213. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  214. },
  215. onShow() {
  216. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  217. if(this.isReadyfloorStatus){
  218. this.getfloorStatus()
  219. }
  220. if(this.isReadyerrList){
  221. this.geterrList()
  222. }
  223. },
  224. computed:{
  225. isAdmin(){
  226. if(this.roleList){
  227. var i =this.roleList.findIndex(item=>{
  228. return item.name=='XJADMIN'
  229. })
  230. if(i!=-1){
  231. return true
  232. }
  233. }
  234. return false
  235. }
  236. },
  237. onReady() {
  238. this.geterrList()
  239. this.getfloorStatus()
  240. //this.getbody1pie1()
  241. this.query()
  242. },
  243. methods: {
  244. change(e){
  245. this.current=e
  246. this.dataerrList =[]
  247. this.geterrList()
  248. },
  249. isToday(dateStr) {
  250. // 将传入的日期字符串转换为Date对象
  251. const targetDate = newDate(dateStr);
  252. // 获取当前日期
  253. const today = new Date();
  254. // 比较年份、月份和日期是否相等
  255. return (
  256. targetDate.getFullYear() === today.getFullYear() &&
  257. targetDate.getMonth() === today.getMonth() &&
  258. targetDate.getDate() === today.getDate()
  259. );
  260. },
  261. query(){
  262. uni.showLoading({
  263. title: "加载中",
  264. mask: true,
  265. })
  266. API.findByOpenId({
  267. noerror:true,
  268. openId: this.jphelp.getOpenId(),
  269. }).then((response) => {
  270. uni.hideLoading();
  271. if(response.message){
  272. uni.hideLoading();
  273. }else{
  274. this.loginset(response)
  275. }
  276. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  277. }).catch(error => {
  278. uni.hideLoading();
  279. })
  280. },
  281. geterrList(){
  282. var status=0
  283. var code=this.tabslist[this.current].code
  284. if(code=="geterrList0"){
  285. status=0
  286. }
  287. if(code=="geterrList1"){
  288. status=1
  289. }
  290. API.errList({
  291. pageIndex:1,
  292. pageSize:5,
  293. status:status,
  294. }).then((response) => {
  295. this.dataerrList=response.data.data
  296. this.dataerrRecordsTotal=response.data.recordsTotal
  297. this.isReadyerrList=true
  298. }).catch(error => {
  299. uni.showToast({
  300. title: error,
  301. icon: "none"
  302. })
  303. })
  304. },
  305. getfloorStatus(){
  306. API.floorStatus().then((response) => {
  307. var obj=response.data;
  308. var sz=['totalNum','normalNum','errorNum','loseNum']
  309. var bl=false
  310. for(var i in sz){
  311. if(obj[sz[i]]!=this.datafloorStatus[sz[i]]){
  312. bl=true
  313. this.datafloorStatus=obj
  314. }
  315. }
  316. this.isReadyfloorStatus=true
  317. if(bl){
  318. this.getbody1pie1()
  319. }
  320. }).catch(error => {
  321. uni.showToast({
  322. title: error,
  323. icon: "none"
  324. })
  325. })
  326. },
  327. getbody1pie1() {
  328. var key = "body1pie1"
  329. var myChart = this.echartsList[key];
  330. if (!myChart) {
  331. myChart = echarts.init(document.getElementById(key), null, {
  332. width: uni.upx2px(88 * 2),
  333. height: uni.upx2px(88 * 2)
  334. })
  335. }
  336. myChart.clear()
  337. var option = {
  338. series: [{
  339. silent: true,
  340. type: 'pie',
  341. radius: ['80%', '100%'],
  342. label: {
  343. show: false,
  344. },
  345. data: [{
  346. value: this.datafloorStatus.normalNum,
  347. itemStyle: {
  348. color: 'rgba(0, 185, 98, 1)'
  349. }
  350. },
  351. {
  352. value: this.datafloorStatus.loseNum,
  353. itemStyle: {
  354. color: 'rgba(153, 153, 153, 1)'
  355. }
  356. },
  357. {
  358. value: this.datafloorStatus.errorNum,
  359. itemStyle: {
  360. color: 'rgba(255, 123, 0, 1)'
  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: 8px;
  413. background-color: rgba(255, 255, 255, 1);
  414. box-shadow: 0px 4px 8px 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: 8px;
  426. width: 96rpx;
  427. height: 96rpx;
  428. }
  429. margin-right: 16rpx;
  430. }
  431. .logo_text {
  432. color: #fff;
  433. .logo_text1 {
  434. font-size: 20px;
  435. }
  436. .logo_text2 {
  437. font-size: 16px;
  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: 1px 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: rgba(255, 123, 0, 1);
  516. }
  517. .status3 {
  518. background-color: rgba(153, 153, 153, 1);
  519. }
  520. .status4 {
  521. background-color: rgba(129, 97, 255, 1);
  522. }
  523. }
  524. }
  525. }
  526. }
  527. .main_list1 {
  528. margin-top: 24rpx;
  529. padding: 24rpx;
  530. padding-bottom: 36rpx;
  531. .list-body{
  532. padding: 24rpx 0;
  533. .item {
  534. border-bottom: 1px solid rgba(232, 232, 232, 1);
  535. }
  536. .title {
  537. display: flex;
  538. justify-content: space-between;
  539. .name{
  540. color: rgba(51,51,51,1);
  541. font-size: 32rpx;
  542. font-weight: bold;
  543. }
  544. .status{
  545. }
  546. .statusN1{
  547. }
  548. .statusN2{
  549. }
  550. .statusN3{
  551. }
  552. }
  553. .body{
  554. display: flex;
  555. color: rgba(51,51,51,1);
  556. font-size: 28rpx;
  557. .name{
  558. width: 150rpx;
  559. }
  560. .value{
  561. }
  562. }
  563. }
  564. .list {
  565. //padding: 24rpx 0;
  566. .item {
  567. display: flex;
  568. border-bottom: 1px solid rgba(232, 232, 232, 1);
  569. padding: 12rpx 0;
  570. margin: 12rpx 0;
  571. .img {
  572. width: 72rpx;
  573. height: 72rpx;
  574. }
  575. .body {
  576. margin: 0 12rpx;
  577. width: 100%;
  578. .line1,
  579. .line2 {
  580. display: flex;
  581. justify-content: space-between;
  582. }
  583. .line2 {
  584. color: rgba(119,119,119,1);
  585. font-size: 24rpx;
  586. margin-top: 8rpx;
  587. }
  588. .line1 {
  589. .typeN{
  590. font-size: 24rpx;
  591. margin-right: 8rpx;
  592. display: flex;
  593. align-items: center;
  594. border-radius: 4px;
  595. padding: 2px 8rpx;
  596. color: #fff;
  597. font-weight: 400;
  598. }
  599. .typeN1{
  600. background-color:#1677ff;
  601. //border: 1px solid #1677ff;
  602. }
  603. .typeN2{
  604. background-color:#19be6b;
  605. //border: 1px solid #19be6b;
  606. }
  607. .title {
  608. display: flex;
  609. color: rgba(51, 51, 51, 1);
  610. font-size: 28rpx;
  611. font-weight: bold;
  612. }
  613. .status {
  614. background-color: rgba(255, 61, 0, 1);
  615. font-size: 24rpx;
  616. color:#fff;
  617. padding: 2rpx 8rpx;
  618. //border-radius: 4px;
  619. }
  620. .status0 {
  621. background-color: rgba(255, 61, 0, 1);
  622. }
  623. .status1 {
  624. background-color: #007aff;
  625. }
  626. .status2 {
  627. background-color: #ff9900;
  628. }
  629. .status3 {
  630. background-color: #19be6b;
  631. }
  632. .status4 {
  633. border: 1px solid rgba(255, 61, 0, 1);
  634. color: rgba(255, 61, 0, 1);
  635. }
  636. }
  637. .errorDesc{
  638. margin: 8rpx 0;
  639. width: 480rpx;
  640. color: #777777;
  641. font-size: 24rpx;
  642. overflow: hidden;
  643. text-overflow: ellipsis;
  644. white-space: nowrap; /* 禁止换行,强制单行 */
  645. }
  646. }
  647. }
  648. // .item:not(:last-child) {
  649. // border-bottom:1px solid rgba(232,232,232,1);
  650. // }
  651. }
  652. }
  653. </style>