index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  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" >
  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 end" @click="gotoUrl('/pages/task/listTask')" v-else >
  46. <view class="na-img">
  47. <image class="img" src="@/assets/img/index/na-2.png" mode=""></image>
  48. </view>
  49. <view class="na-text">
  50. 故障记录
  51. </view>
  52. </view>
  53. </view>
  54. <view class="main_statuspanel panel">
  55. <view class="top-main">
  56. <view class="title-main">
  57. 地锁状态
  58. </view>
  59. <view class="goto-main" @click="gotoUrl('/pages/lockTab/listLock')">
  60. 查看详情
  61. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  62. </view>
  63. </view>
  64. <view class="body">
  65. <view class="pie">
  66. <view id="body1pie1" class="body1pie">
  67. </view>
  68. <view class="body2pie" v-if="datafloorStatus.totalNum">
  69. <view class="v1">{{datafloorStatus.totalNum}}</view>
  70. <view class="v2">地锁:套</view>
  71. </view>
  72. </view>
  73. <view class="item-list">
  74. <view class="item-status">
  75. <view class="num">
  76. {{datafloorStatus.normalNum}}
  77. </view>
  78. <view class="statusN">
  79. <view class="statusC status1">
  80. </view>
  81. <view class="statusT">
  82. 在线
  83. </view>
  84. </view>
  85. </view>
  86. <view class="item-status">
  87. <view class="num">
  88. {{datafloorStatus.errorNum}}
  89. </view>
  90. <view class="statusN">
  91. <view class="statusC status2">
  92. </view>
  93. <view class="statusT">
  94. 故障
  95. </view>
  96. </view>
  97. </view>
  98. <view class="item-status">
  99. <view class="num">
  100. {{datafloorStatus.loseNum}}
  101. </view>
  102. <view class="statusN">
  103. <view class="statusC status3">
  104. </view>
  105. <view class="statusT">
  106. 离线
  107. </view>
  108. </view>
  109. </view>
  110. <view class="item-status" >
  111. <view class="num">
  112. 0
  113. </view>
  114. <view class="statusN">
  115. <view class="statusC status4">
  116. </view>
  117. <view class="statusT">
  118. 维护
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. <view class="main_list1 ">
  126. <u-tabs :list="tabslist"
  127. style=" width: 50%;"
  128. :current="current" @change="change"></u-tabs>
  129. <view class="list" >
  130. <view class="item"
  131. v-for="(item,index) in dataerrList"
  132. @click="gotoUrl('/pages/task/maintenanceTaks?id='+item.id)"
  133. :key="index">
  134. <view class="icon">
  135. <image class="img" v-if="item.errorCodeImage" :src="item.errorCodeImage" mode=""></image>
  136. <image class="img" v-else src="@/assets/img/taskstatus/status3.png" mode=""></image>
  137. </view>
  138. <view class="body">
  139. <view class="line1">
  140. <view class="title">
  141. {{item.errorCodeText}}
  142. </view>
  143. <view class="status " :class="'status'+item.status">
  144. {{item.statusN}}
  145. </view>
  146. </view>
  147. <view class="line2">
  148. <view class="value">
  149. {{item.createTime}}<span style="color: red;" v-if="isToday(item.createTime)">(今日)</span>
  150. </view>
  151. <view class="value">
  152. {{item.parkingName}}
  153. </view>
  154. </view>
  155. <view class="errorDesc" v-if="item.errorDesc">
  156. 描述:{{item.errorDesc}}
  157. </view>
  158. </view>
  159. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  160. </view>
  161. <u-divider color="#F44336"
  162. :isnone="dataerrRecordsTotal==0" nonetext="暂无数据"
  163. v-if="dataerrRecordsTotal>5&&current==0"
  164. @click="gotoUrl('/pages/task/listTask?status='+tabslist[current].code)" >故障记录{{dataerrRecordsTotal}}条,点击查看更多</u-divider>
  165. <u-divider color="#CFD2D5" v-else
  166. :isnone="dataerrRecordsTotal==0" nonetext="暂无数据"
  167. @click="gotoUrl('/pages/task/listTask?status='+tabslist[current].code)" >查看详情</u-divider>
  168. </view>
  169. </view>
  170. <tabbar :current="0"></tabbar>
  171. </view>
  172. </template>
  173. <script>
  174. import * as API from '@/apis/pagejs/pagejsIndex.js'
  175. import * as echarts from 'echarts';
  176. import Tabbar from '@/components/Tabbar.vue'
  177. import {
  178. newDate
  179. } from '@/apis/utils'
  180. export default {
  181. components: {
  182. Tabbar,
  183. },
  184. data() {
  185. return {
  186. echartsList: {},
  187. isReadyfloorStatus:false,
  188. datafloorStatus:{},
  189. roleList:[],
  190. isReadyerrList:false,
  191. dataerrList:[],
  192. dataerrRecordsTotal:0,
  193. tabslist:[
  194. {
  195. name: '待处理',
  196. code:"geterrList0"
  197. }, {
  198. name: '已处理',
  199. code:"geterrList1"
  200. }
  201. ],
  202. current:0,
  203. };
  204. },
  205. onLoad() {
  206. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  207. },
  208. onShow() {
  209. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  210. if(this.isReadyfloorStatus){
  211. this.getfloorStatus()
  212. }
  213. if(this.isReadyerrList){
  214. this.geterrList()
  215. }
  216. },
  217. computed:{
  218. isAdmin(){
  219. if(this.roleList){
  220. var i =this.roleList.findIndex(item=>{
  221. return item.name=='XJADMIN'
  222. })
  223. if(i!=-1){
  224. return true
  225. }
  226. }
  227. return false
  228. }
  229. },
  230. onReady() {
  231. this.geterrList()
  232. this.getfloorStatus()
  233. //this.getbody1pie1()
  234. this.query()
  235. },
  236. methods: {
  237. change(e){
  238. this.current=e
  239. this.dataerrList =[]
  240. this.geterrList()
  241. },
  242. isToday(dateStr) {
  243. // 将传入的日期字符串转换为Date对象
  244. const targetDate = newDate(dateStr);
  245. // 获取当前日期
  246. const today = new Date();
  247. // 比较年份、月份和日期是否相等
  248. return (
  249. targetDate.getFullYear() === today.getFullYear() &&
  250. targetDate.getMonth() === today.getMonth() &&
  251. targetDate.getDate() === today.getDate()
  252. );
  253. },
  254. query(){
  255. uni.showLoading({
  256. title: "加载中",
  257. mask: true,
  258. })
  259. API.findByOpenId({
  260. noerror:true,
  261. openId: this.jphelp.getOpenId(),
  262. }).then((response) => {
  263. uni.hideLoading();
  264. if(response.message){
  265. uni.hideLoading();
  266. }else{
  267. this.loginset(response)
  268. }
  269. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  270. }).catch(error => {
  271. uni.hideLoading();
  272. })
  273. },
  274. geterrList(){
  275. var status=0
  276. var code=this.tabslist[this.current].code
  277. if(code=="geterrList0"){
  278. status=0
  279. }
  280. if(code=="geterrList1"){
  281. status=1
  282. }
  283. API.errList({
  284. pageIndex:1,
  285. pageSize:5,
  286. status:status,
  287. }).then((response) => {
  288. this.dataerrList=response.data.data
  289. this.dataerrRecordsTotal=response.data.recordsTotal
  290. this.isReadyerrList=true
  291. }).catch(error => {
  292. uni.showToast({
  293. title: error,
  294. icon: "none"
  295. })
  296. })
  297. },
  298. getfloorStatus(){
  299. API.floorStatus().then((response) => {
  300. var obj=response.data;
  301. var sz=['totalNum','normalNum','errorNum','loseNum']
  302. var bl=false
  303. for(var i in sz){
  304. if(obj[sz[i]]!=this.datafloorStatus[sz[i]]){
  305. bl=true
  306. this.datafloorStatus=obj
  307. }
  308. }
  309. this.isReadyfloorStatus=true
  310. if(bl){
  311. this.getbody1pie1()
  312. }
  313. }).catch(error => {
  314. uni.showToast({
  315. title: error,
  316. icon: "none"
  317. })
  318. })
  319. },
  320. getbody1pie1() {
  321. var key = "body1pie1"
  322. var myChart = this.echartsList[key];
  323. if (!myChart) {
  324. myChart = echarts.init(document.getElementById(key), null, {
  325. width: uni.upx2px(88 * 2),
  326. height: uni.upx2px(88 * 2)
  327. })
  328. }
  329. myChart.clear()
  330. var option = {
  331. series: [{
  332. silent: true,
  333. type: 'pie',
  334. radius: ['80%', '100%'],
  335. label: {
  336. show: false,
  337. },
  338. data: [{
  339. value: this.datafloorStatus.normalNum,
  340. itemStyle: {
  341. color: 'rgba(0, 185, 98, 1)'
  342. }
  343. },
  344. {
  345. value: this.datafloorStatus.loseNum,
  346. itemStyle: {
  347. color: 'rgba(153, 153, 153, 1)'
  348. }
  349. },
  350. {
  351. value: this.datafloorStatus.errorNum,
  352. itemStyle: {
  353. color: 'rgba(255, 123, 0, 1)'
  354. }
  355. }
  356. ]
  357. }],
  358. grid: {
  359. top: 0,
  360. left: 0,
  361. right: 0,
  362. bottom: 0,
  363. containLabel: true
  364. },
  365. }
  366. myChart.setOption(option);
  367. console.log(option)
  368. this.echartsList[key] = myChart;
  369. }
  370. }
  371. }
  372. </script>
  373. <style>
  374. page{
  375. background-color: #FFFFFF;
  376. }
  377. </style>
  378. <style lang="scss">
  379. .back-blue {
  380. height: 0px;
  381. .back-color {
  382. height: 656rpx;
  383. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 53%, rgba(203, 234, 255, 0) 100%);
  384. }
  385. }
  386. .top-main {
  387. display: flex;
  388. align-items: center;
  389. justify-content: space-between;
  390. .title-main {
  391. color: rgba(51, 51, 51, 1);
  392. font-size: 32rpx;
  393. font-weight: bold;
  394. }
  395. .goto-main {
  396. color: rgba(131, 131, 131, 1);
  397. font-size: 24rpx;
  398. }
  399. }
  400. .panel,
  401. .main_top {
  402. margin: 0 32rpx;
  403. }
  404. .panel {
  405. border-radius: 8px;
  406. background-color: rgba(255, 255, 255, 1);
  407. box-shadow: 0px 4px 8px 0px rgba(22, 119, 255, 0.1);
  408. }
  409. .main_top {
  410. margin-top: 32rpx;
  411. display: flex;
  412. justify-content: space-between;
  413. .main_top1 {
  414. display: flex;
  415. align-items: center;
  416. .logo_img {
  417. .img {
  418. border-radius: 8px;
  419. width: 96rpx;
  420. height: 96rpx;
  421. }
  422. margin-right: 16rpx;
  423. }
  424. .logo_text {
  425. color: #fff;
  426. .logo_text1 {
  427. font-size: 20px;
  428. }
  429. .logo_text2 {
  430. font-size: 16px;
  431. }
  432. }
  433. }
  434. .main_top2 {}
  435. }
  436. .main_navigation {
  437. margin-top: 32rpx;
  438. display: flex;
  439. justify-content: space-around;
  440. align-items: center;
  441. padding: 24rpx 0 20rpx 0;
  442. .item-na-b {
  443. border-left: 1px solid rgba(187, 187, 187, 0.43);
  444. height: 70rpx;
  445. }
  446. .item-na {
  447. width: 32%;
  448. text-align: center;
  449. .na-img {
  450. display: flex;
  451. justify-content: center;
  452. .img {
  453. width: 80rpx;
  454. height: 80rpx;
  455. }
  456. }
  457. }
  458. }
  459. .main_statuspanel {
  460. margin-top: 24rpx;
  461. padding: 24rpx;
  462. .body2pie{
  463. position: relative;
  464. top: -140rpx;
  465. height: 0px;
  466. left: 0px;
  467. width: 176rpx;
  468. text-align: center;
  469. .v1{
  470. color: rgba(16,16,16,1);
  471. font-size: 48rpx;
  472. font-weight: bold;
  473. }
  474. .v2{
  475. color: rgba(119,119,119,1);
  476. font-size: 24rpx;
  477. }
  478. }
  479. .body {
  480. display: flex;
  481. padding: 24rpx;
  482. .item-list {
  483. margin-left: 48rpx;
  484. display: flex;
  485. width: 100%;
  486. flex-wrap: wrap;
  487. .item-status {
  488. width: 50%;
  489. .num {
  490. color: rgba(51, 51, 51, 1);
  491. font-size: 36rpx;
  492. font-weight: bold;
  493. }
  494. }
  495. .statusN {
  496. display: flex;
  497. align-items: center;
  498. .statusC {
  499. margin-right: 8rpx;
  500. width: 16rpx;
  501. height: 16rpx;
  502. background-color: rgba(153, 153, 153, 1);
  503. }
  504. .status1 {
  505. background-color: rgba(0, 185, 98, 1);
  506. }
  507. .status2 {
  508. background-color: rgba(255, 123, 0, 1);
  509. }
  510. .status3 {
  511. background-color: rgba(153, 153, 153, 1);
  512. }
  513. .status4 {
  514. background-color: rgba(129, 97, 255, 1);
  515. }
  516. }
  517. }
  518. }
  519. }
  520. .main_list1 {
  521. margin-top: 24rpx;
  522. padding: 24rpx;
  523. padding-bottom: 36rpx;
  524. .list-body{
  525. padding: 24rpx 0;
  526. .item {
  527. border-bottom: 1px solid rgba(232, 232, 232, 1);
  528. }
  529. .title {
  530. display: flex;
  531. justify-content: space-between;
  532. .name{
  533. color: rgba(51,51,51,1);
  534. font-size: 32rpx;
  535. font-weight: bold;
  536. }
  537. .status{
  538. }
  539. .statusN1{
  540. }
  541. .statusN2{
  542. }
  543. .statusN3{
  544. }
  545. }
  546. .body{
  547. display: flex;
  548. color: rgba(51,51,51,1);
  549. font-size: 28rpx;
  550. .name{
  551. width: 150rpx;
  552. }
  553. .value{
  554. }
  555. }
  556. }
  557. .list {
  558. //padding: 24rpx 0;
  559. .item {
  560. display: flex;
  561. border-bottom: 1px solid rgba(232, 232, 232, 1);
  562. padding: 12rpx 0;
  563. margin: 12rpx 0;
  564. .img {
  565. width: 72rpx;
  566. height: 72rpx;
  567. }
  568. .body {
  569. margin: 0 12rpx;
  570. width: 100%;
  571. .line1,
  572. .line2 {
  573. display: flex;
  574. justify-content: space-between;
  575. }
  576. .line2 {
  577. color: rgba(119,119,119,1);
  578. font-size: 24rpx;
  579. margin-top: 8rpx;
  580. }
  581. .line1 {
  582. .title {
  583. color: rgba(51, 51, 51, 1);
  584. font-size: 28rpx;
  585. font-weight: bold;
  586. }
  587. .status {
  588. background-color: rgba(255, 61, 0, 1);
  589. font-size: 24rpx;
  590. color:#fff;
  591. padding: 2rpx 8rpx;
  592. //border-radius: 4px;
  593. }
  594. .status0 {
  595. background-color: rgba(255, 61, 0, 1);
  596. }
  597. .status1 {
  598. background-color: #007aff;
  599. }
  600. .status2 {
  601. background-color: #ff9900;
  602. }
  603. .status3 {
  604. background-color: #19be6b;
  605. }
  606. .status4 {
  607. border: 1px solid rgba(255, 61, 0, 1);
  608. color: rgba(255, 61, 0, 1);
  609. }
  610. }
  611. .errorDesc{
  612. margin: 8rpx 0;
  613. width: 480rpx;
  614. color: #777777;
  615. font-size: 24rpx;
  616. overflow: hidden;
  617. text-overflow: ellipsis;
  618. white-space: nowrap; /* 禁止换行,强制单行 */
  619. }
  620. }
  621. }
  622. // .item:not(:last-child) {
  623. // border-bottom:1px solid rgba(232,232,232,1);
  624. // }
  625. }
  626. }
  627. </style>