index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="container uni-container">
  3. <view class="">
  4. <uni-row :gutter="24">
  5. <uni-col :span="11" v-for="(item, index) in tableData" :key="index" style="">
  6. <view class="demo-layout bg-purple-light">
  7. <view class="top-title">
  8. <image :src="item.img" class="img-cl"></image>
  9. <text class="title-name">{{ item.name }}</text>
  10. </view>
  11. <view class="data-value">{{ item.value }}</view>
  12. </view>
  13. </uni-col>
  14. </uni-row>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import config from '@/config'
  20. import {
  21. getDevcoverage, //查询设备覆盖率
  22. getScanbyday, //查询日均扫码总数
  23. getScanbyperson,//查询人均扫码总数
  24. getScantotal,//查询巡查扫码总数
  25. getDevtypecover,//查询设备类型覆盖率统计
  26. getFinddenger,//查询发现隐患数
  27. getFixdenger//查询整改隐患数
  28. } from '@/api/statistics';
  29. import {
  30. getOrgId
  31. } from '@/api/fpdDetection/index.js';
  32. const baseUrlImg = config.baseUrlImg
  33. export default {
  34. data() {
  35. return {
  36. query:{
  37. orgIds:[''],
  38. },
  39. tableData: [{
  40. name: '巡查扫码总数',
  41. value:null,
  42. img:`${baseUrlImg}/modal/shaoma.png`
  43. },
  44. {
  45. name: '日均扫码数',
  46. value:null,
  47. img:`${baseUrlImg}/modal/shaoma.png`
  48. },
  49. {
  50. name: '人均扫码数',
  51. value:null,
  52. img:`${baseUrlImg}/modal/shaoma.png`
  53. },
  54. {
  55. name: '设备覆盖率',
  56. value: null,
  57. img:`${baseUrlImg}/modal/sheshi.png`
  58. },
  59. {
  60. name: '设备类型覆盖率',
  61. value: null,
  62. img:`${baseUrlImg}/modal/sheshi.png`
  63. },
  64. {
  65. name: '发现隐患总数',
  66. value: null,
  67. img:`${baseUrlImg}/modal/jingao.png`
  68. },
  69. {
  70. name: '整改隐患总数',
  71. value: null,
  72. img:`${baseUrlImg}/modal/jingao.png`
  73. },
  74. {
  75. name: '整改隐患平均时间',
  76. value: null,
  77. img:`${baseUrlImg}/modal/jingao.png`
  78. }
  79. ]
  80. }
  81. },
  82. onShow() {
  83. getOrgId({
  84. pageNo: this.pageNo,
  85. pageSize: this.pageSize,
  86. userId: this.$store.state.user.id
  87. }).then(response => {
  88. // console.log(response, 'response');
  89. this.query.orgIds[0] =response.data[0].dwid
  90. this.getData()
  91. }).catch(err => {
  92. this.loading = false
  93. this.$modal.msg(err)
  94. })
  95. },
  96. methods: {
  97. async getData() {
  98. // console.log('orgIds',this.query);
  99. const res1 = await getDevtypecover()
  100. const res2 = await getScanbyday()
  101. const scantotal = await getScantotal({userId: this.$store.state.user.id})
  102. const scanbyperson = await getScanbyperson()
  103. const finddenger = await getFinddenger()
  104. const fixdenger = await getFixdenger()
  105. this.tableData[0].value = scantotal.data
  106. this.tableData[1].value = res2.data
  107. this.tableData[2].value = scanbyperson.data
  108. this.tableData[3].value = (res1.data-0)*100+'%'
  109. this.tableData[4].value = (res1.data-0)*100+'%'
  110. this.tableData[5].value = finddenger.data
  111. this.tableData[6].value = fixdenger.data
  112. this.tableData[7].value = 2.5
  113. // console.log('res1',res1);
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. body {
  120. background-color: #f5f7f9;
  121. }
  122. page {
  123. background-color: #f5f7f9 !important;
  124. }
  125. /deep/ .uni-row {
  126. display: flex;
  127. flex-wrap: wrap;
  128. }
  129. .uni-col {
  130. flex-grow: 1;
  131. flex-basis: 50%;
  132. margin-bottom: 40rpx;
  133. /* 每个元素占据的宽度为一行的一半 */
  134. }
  135. .wrap {
  136. padding: 12px;
  137. }
  138. .demo-layout {
  139. height: 210rpx;
  140. border-radius: 24rpx;
  141. }
  142. .bg-purple {
  143. background: #fff;
  144. }
  145. .bg-purple-light {
  146. background: #fff;
  147. }
  148. .bg-purple-dark {
  149. background: #fff;
  150. }
  151. .img-cl {
  152. width: 48rpx;
  153. height: 48rpx;
  154. margin:40rpx 10rpx 16rpx 24rpx;
  155. }
  156. .title-name{
  157. font-size: 28rpx;
  158. color: #4CB2B6;
  159. padding-top: 20rpx;
  160. }
  161. .data-value{
  162. font-size: 44rpx;
  163. margin-left: 80rpx;
  164. }
  165. .top-title{
  166. display: flex;
  167. align-items: center;
  168. }
  169. </style>