index.vue 12 KB

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