index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  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 panel">
  126. <view class="top-main">
  127. <view class="title-main">
  128. 故障记录
  129. </view>
  130. <view class="goto-main" @click="gotoUrl('/pages/task/listTask')" >
  131. 查看详情
  132. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  133. </view>
  134. </view>
  135. <view class="list" >
  136. <view class="item"
  137. v-for="(item,index) in dataerrList"
  138. @click="gotoUrl('/pages/task/maintenanceTaks?id='+item.id)"
  139. :key="index">
  140. <view class="icon">
  141. <image class="img" v-if="item.errorCodeImage" :src="item.errorCodeImage" mode=""></image>
  142. <image class="img" v-else src="@/assets/img/taskstatus/status3.png" mode=""></image>
  143. </view>
  144. <view class="body">
  145. <view class="line1">
  146. <view class="title">
  147. {{item.errorCodeText}}
  148. </view>
  149. <view class="status " :class="'status'+item.status">
  150. {{item.statusN}}
  151. </view>
  152. </view>
  153. <view class="line2">
  154. <view class="value">
  155. {{item.createTime}}
  156. </view>
  157. <view class="value">
  158. {{item.parkingName}}
  159. </view>
  160. </view>
  161. <view class="errorDesc" v-if="item.errorDesc">
  162. 描述:{{item.errorDesc}}
  163. </view>
  164. </view>
  165. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  166. </view>
  167. <u-divider color="#F44336" v-if="dataerrRecordsTotal>5"
  168. @click="gotoUrl('/pages/task/listTask')" >故障记录{{dataerrRecordsTotal}}条,点击查看更多</u-divider>
  169. </view>
  170. </view>
  171. <u-divider border-color="#CFD2D5">已经到底了</u-divider>
  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. export default {
  180. components: {
  181. Tabbar,
  182. },
  183. data() {
  184. return {
  185. echartsList: {},
  186. isReadyfloorStatus:false,
  187. datafloorStatus:{},
  188. roleList:[],
  189. isReadyerrList:false,
  190. dataerrList:[],
  191. dataerrRecordsTotal:0,
  192. };
  193. },
  194. onLoad() {
  195. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  196. },
  197. onShow() {
  198. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  199. if(this.isReadyfloorStatus){
  200. this.getfloorStatus()
  201. }
  202. if(this.isReadyerrList){
  203. this.geterrList()
  204. }
  205. },
  206. computed:{
  207. isAdmin(){
  208. if(this.roleList){
  209. var i =this.roleList.findIndex(item=>{
  210. return item.name=='XJADMIN'
  211. })
  212. if(i!=-1){
  213. return true
  214. }
  215. }
  216. return false
  217. }
  218. },
  219. onReady() {
  220. this.geterrList()
  221. this.getfloorStatus()
  222. //this.getbody1pie1()
  223. this.query()
  224. },
  225. methods: {
  226. query(){
  227. uni.showLoading({
  228. title: "加载中",
  229. mask: true,
  230. })
  231. API.findByOpenId({
  232. noerror:true,
  233. openId: this.jphelp.getOpenId(),
  234. }).then((response) => {
  235. uni.hideLoading();
  236. if(response.message){
  237. uni.hideLoading();
  238. }else{
  239. this.loginset(response)
  240. }
  241. this.roleList=this.jphelp.getPersonInfoPlus().roleList
  242. }).catch(error => {
  243. uni.hideLoading();
  244. })
  245. },
  246. geterrList(){
  247. API.errList({
  248. pageIndex:1,
  249. pageSize:5,
  250. status:0,
  251. }).then((response) => {
  252. this.dataerrList=response.data.data
  253. this.dataerrRecordsTotal=response.data.recordsTotal
  254. this.isReadyerrList=true
  255. }).catch(error => {
  256. uni.showToast({
  257. title: error,
  258. icon: "none"
  259. })
  260. })
  261. },
  262. getfloorStatus(){
  263. API.floorStatus().then((response) => {
  264. var obj=response.data;
  265. var sz=['totalNum','normalNum','errorNum','loseNum']
  266. var bl=false
  267. for(var i in sz){
  268. if(obj[sz[i]]!=this.datafloorStatus[sz[i]]){
  269. bl=true
  270. this.datafloorStatus=obj
  271. }
  272. }
  273. this.isReadyfloorStatus=true
  274. if(bl){
  275. this.getbody1pie1()
  276. }
  277. }).catch(error => {
  278. uni.showToast({
  279. title: error,
  280. icon: "none"
  281. })
  282. })
  283. },
  284. getbody1pie1() {
  285. var key = "body1pie1"
  286. var myChart = this.echartsList[key];
  287. if (!myChart) {
  288. myChart = echarts.init(document.getElementById(key), null, {
  289. width: uni.upx2px(88 * 2),
  290. height: uni.upx2px(88 * 2)
  291. })
  292. }
  293. myChart.clear()
  294. var option = {
  295. series: [{
  296. silent: true,
  297. type: 'pie',
  298. radius: ['80%', '100%'],
  299. label: {
  300. show: false,
  301. },
  302. data: [{
  303. value: this.datafloorStatus.normalNum,
  304. itemStyle: {
  305. color: 'rgba(0, 185, 98, 1)'
  306. }
  307. },
  308. {
  309. value: this.datafloorStatus.loseNum,
  310. itemStyle: {
  311. color: 'rgba(153, 153, 153, 1)'
  312. }
  313. },
  314. {
  315. value: this.datafloorStatus.errorNum,
  316. itemStyle: {
  317. color: 'rgba(255, 123, 0, 1)'
  318. }
  319. }
  320. ]
  321. }],
  322. grid: {
  323. top: 0,
  324. left: 0,
  325. right: 0,
  326. bottom: 0,
  327. containLabel: true
  328. },
  329. }
  330. myChart.setOption(option);
  331. console.log(option)
  332. this.echartsList[key] = myChart;
  333. }
  334. }
  335. }
  336. </script>
  337. <style>
  338. page{
  339. /* background-color: #FFFFFF; */
  340. }
  341. </style>
  342. <style lang="scss">
  343. .back-blue {
  344. height: 0px;
  345. .back-color {
  346. height: 656rpx;
  347. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 53%, rgba(203, 234, 255, 0) 100%);
  348. }
  349. }
  350. .top-main {
  351. display: flex;
  352. align-items: center;
  353. justify-content: space-between;
  354. .title-main {
  355. color: rgba(51, 51, 51, 1);
  356. font-size: 32rpx;
  357. font-weight: bold;
  358. }
  359. .goto-main {
  360. color: rgba(131, 131, 131, 1);
  361. font-size: 24rpx;
  362. }
  363. }
  364. .panel,
  365. .main_top {
  366. margin: 0 32rpx;
  367. }
  368. .panel {
  369. border-radius: 8px;
  370. background-color: rgba(255, 255, 255, 1);
  371. box-shadow: 0px 4px 8px 0px rgba(22, 119, 255, 0.1);
  372. }
  373. .main_top {
  374. margin-top: 32rpx;
  375. display: flex;
  376. justify-content: space-between;
  377. .main_top1 {
  378. display: flex;
  379. align-items: center;
  380. .logo_img {
  381. .img {
  382. border-radius: 8px;
  383. width: 96rpx;
  384. height: 96rpx;
  385. }
  386. margin-right: 16rpx;
  387. }
  388. .logo_text {
  389. color: #fff;
  390. .logo_text1 {
  391. font-size: 20px;
  392. }
  393. .logo_text2 {
  394. font-size: 16px;
  395. }
  396. }
  397. }
  398. .main_top2 {}
  399. }
  400. .main_navigation {
  401. margin-top: 32rpx;
  402. display: flex;
  403. justify-content: space-around;
  404. align-items: center;
  405. padding: 24rpx 0 20rpx 0;
  406. .item-na-b {
  407. border-left: 1px solid rgba(187, 187, 187, 0.43);
  408. height: 70rpx;
  409. }
  410. .item-na {
  411. width: 32%;
  412. text-align: center;
  413. .na-img {
  414. display: flex;
  415. justify-content: center;
  416. .img {
  417. width: 80rpx;
  418. height: 80rpx;
  419. }
  420. }
  421. }
  422. }
  423. .main_statuspanel {
  424. margin-top: 24rpx;
  425. padding: 24rpx;
  426. .body2pie{
  427. position: relative;
  428. top: -140rpx;
  429. height: 0px;
  430. left: 0px;
  431. width: 176rpx;
  432. text-align: center;
  433. .v1{
  434. color: rgba(16,16,16,1);
  435. font-size: 48rpx;
  436. font-weight: bold;
  437. }
  438. .v2{
  439. color: rgba(119,119,119,1);
  440. font-size: 24rpx;
  441. }
  442. }
  443. .body {
  444. display: flex;
  445. padding: 24rpx;
  446. .item-list {
  447. margin-left: 48rpx;
  448. display: flex;
  449. width: 100%;
  450. flex-wrap: wrap;
  451. .item-status {
  452. width: 50%;
  453. .num {
  454. color: rgba(51, 51, 51, 1);
  455. font-size: 36rpx;
  456. font-weight: bold;
  457. }
  458. }
  459. .statusN {
  460. display: flex;
  461. align-items: center;
  462. .statusC {
  463. margin-right: 8rpx;
  464. width: 16rpx;
  465. height: 16rpx;
  466. background-color: rgba(153, 153, 153, 1);
  467. }
  468. .status1 {
  469. background-color: rgba(0, 185, 98, 1);
  470. }
  471. .status2 {
  472. background-color: rgba(255, 123, 0, 1);
  473. }
  474. .status3 {
  475. background-color: rgba(153, 153, 153, 1);
  476. }
  477. .status4 {
  478. background-color: rgba(129, 97, 255, 1);
  479. }
  480. }
  481. }
  482. }
  483. }
  484. .main_list1 {
  485. margin-top: 24rpx;
  486. padding: 24rpx;
  487. .list-body{
  488. padding: 24rpx 0;
  489. .item {
  490. border-bottom: 1px solid rgba(232, 232, 232, 1);
  491. }
  492. .title {
  493. display: flex;
  494. justify-content: space-between;
  495. .name{
  496. color: rgba(51,51,51,1);
  497. font-size: 32rpx;
  498. font-weight: bold;
  499. }
  500. .status{
  501. }
  502. .statusN1{
  503. }
  504. .statusN2{
  505. }
  506. .statusN3{
  507. }
  508. }
  509. .body{
  510. display: flex;
  511. color: rgba(51,51,51,1);
  512. font-size: 28rpx;
  513. .name{
  514. width: 150rpx;
  515. }
  516. .value{
  517. }
  518. }
  519. }
  520. .list {
  521. //padding: 24rpx 0;
  522. .item {
  523. display: flex;
  524. border-bottom: 1px solid rgba(232, 232, 232, 1);
  525. padding: 12rpx 0;
  526. margin: 12rpx 0;
  527. .img {
  528. width: 72rpx;
  529. height: 72rpx;
  530. }
  531. .body {
  532. margin: 0 12rpx;
  533. width: 100%;
  534. .line1,
  535. .line2 {
  536. display: flex;
  537. justify-content: space-between;
  538. }
  539. .line2 {
  540. color: rgba(119,119,119,1);
  541. font-size: 24rpx;
  542. margin-top: 8rpx;
  543. }
  544. .line1 {
  545. .title {
  546. color: rgba(51, 51, 51, 1);
  547. font-size: 28rpx;
  548. font-weight: bold;
  549. }
  550. .status {
  551. background-color: rgba(255, 61, 0, 1);
  552. font-size: 24rpx;
  553. color:#fff;
  554. padding: 2rpx 8rpx;
  555. //border-radius: 4px;
  556. }
  557. .status0 {
  558. background-color: rgba(255, 61, 0, 1);
  559. }
  560. .status1 {
  561. background-color: #007aff;
  562. }
  563. .status2 {
  564. background-color: #ff9900;
  565. }
  566. .status3 {
  567. background-color: #19be6b;
  568. }
  569. .status4 {
  570. border: 1px solid rgba(255, 61, 0, 1);
  571. color: rgba(255, 61, 0, 1);
  572. }
  573. }
  574. .errorDesc{
  575. margin: 8rpx 0;
  576. width: 480rpx;
  577. color: #777777;
  578. font-size: 24rpx;
  579. overflow: hidden;
  580. text-overflow: ellipsis;
  581. white-space: nowrap; /* 禁止换行,强制单行 */
  582. }
  583. }
  584. }
  585. // .item:not(:last-child) {
  586. // border-bottom:1px solid rgba(232,232,232,1);
  587. // }
  588. }
  589. }
  590. </style>