spectaculars.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="container" v-if="showList.length">
  3. <navigator v-if="isShow('在线设备')" url="/pages/facility/index?page=设备中心" hover-class="navigator-hover" class="item">
  4. <view class="label">在线设备</view>
  5. <view class="count u-line-1">{{ statistics.today_devices }}</view>
  6. </navigator>
  7. <navigator v-if="isShow('今日警告')" url="/pages/alerts/index" hover-class="navigator-hover" class="item">
  8. <view class="label">今日警告</view>
  9. <view class="count u-line-1">{{ statistics.today_warns }}</view>
  10. </navigator>
  11. <navigator v-if="isShow('今日工单')" url="/packageA/workOrder/index" hover-class="navigator-hover" class="item">
  12. <view class="label">今日工单</view>
  13. <view class="count u-line-1">{{ statistics.today_orders }}</view>
  14. </navigator>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'spectaculars',
  20. data() {
  21. return {
  22. statistics: {
  23. today_devices: 0,
  24. today_warns: 0,
  25. today_orders: 0,
  26. },
  27. showList: []
  28. };
  29. },
  30. computed: {
  31. isShow() {
  32. return function (name) {
  33. return this.showList.includes(name)
  34. }
  35. }
  36. },
  37. created() {
  38. this.getDetail()
  39. let auth = uni.getStorageSync('authList'),
  40. showList = [];
  41. typeof auth.设备中心 == 'object' && showList.push("在线设备");
  42. typeof auth.告警中心 == 'object' && showList.push("今日警告");
  43. typeof auth.工单 == 'object' && showList.push("今日工单");
  44. this.showList = showList;
  45. },
  46. methods: {
  47. getDetail() {
  48. this.$Http.basic({
  49. "id": 20230721153102,
  50. "content": {}
  51. }).then(res => {
  52. console.log("数据看板", res)
  53. if (this.cutoff(res.msg)) return;
  54. this.statistics = res.data;
  55. })
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .container {
  62. display: flex;
  63. width: 355px;
  64. height: 72px;
  65. margin: 0 auto;
  66. margin-top: 10px;
  67. .item {
  68. width: 112px;
  69. height: 72px;
  70. padding: 10px;
  71. box-sizing: border-box;
  72. border-radius: 4px;
  73. background: #FFFFFF;
  74. margin-right: 9.5px;
  75. flex-shrink: 0;
  76. .label {
  77. line-height: 20px;
  78. font-size: 14px;
  79. font-family: PingFang SC-Regular, PingFang SC;
  80. color: #333333;
  81. }
  82. .count {
  83. line-height: 22px;
  84. font-size: 16px;
  85. font-family: PingFang SC-Medium, PingFang SC;
  86. font-weight: bold;
  87. color: #3874F6;
  88. margin-top: 10px;
  89. }
  90. }
  91. .item:last-child {
  92. margin-right: 0;
  93. }
  94. }
  95. </style>