spectaculars.vue 2.9 KB

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