index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div class="app-container">
  3. <el-tabs
  4. type="border-card"
  5. v-model.trim="selectedTab"
  6. @tab-click="clickTab"
  7. >
  8. <el-tab-pane
  9. :label="item.deptName"
  10. v-for="(item, index) in brigade"
  11. :key="index"
  12. :name="item.id"
  13. >
  14. </el-tab-pane>
  15. </el-tabs>
  16. <div class="two-line">
  17. <div v-for="(item, index) in scanCode" :key="index">
  18. <div class="total">{{ item.count }}</div>
  19. <div class="item-name">{{ item.name }}</div>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import { activetimeTongji, getDdlist } from "@/api/backend/statistics";
  26. export default {
  27. data() {
  28. return {
  29. selectedTab: 0,
  30. scanCode: [
  31. { name: "已覆盖单位数统计", code: 1,count:0 },
  32. { name: "当日扫码检查量统计", code: 2,count:0 },
  33. { name: "活跃用户统计", code: 3,count:0 },
  34. { name: "上报隐患数统计", code: 4,count:0 },
  35. { name: "活跃重点单位统计", code: 5,count:0 },
  36. { name: "每日活跃重点单位统计", code: 6,count:0 },
  37. { name: "重点单位扫码量统计", code: 7,count:0 },
  38. ],
  39. deptid: 0,
  40. brigade: [],
  41. };
  42. },
  43. created() {
  44. this.getList();
  45. this.navList();
  46. this.$forceUpdate()
  47. },
  48. methods: {
  49. navList() {
  50. activetimeTongji({ pageNo: 1, pageSize: 9999, deptid: this.deptid }).then(
  51. (response) => {
  52. if (response.data) {
  53. const tongjiData = response.data.list.filter((item) => {
  54. return item.deptid == this.deptId;
  55. });
  56. if (tongjiData.length > 0) {
  57. const datas = tongjiData[0];
  58. this.scanCode.forEach((item) => {
  59. switch (item.code) {
  60. case 1:
  61. item.count = datas.coverorg; //
  62. break;
  63. case 2:
  64. item.count = datas.todayscan; //
  65. break;
  66. case 3:
  67. item.count = datas.actuser;
  68. break;
  69. case 4:
  70. item.count = datas.dengercount;
  71. break;
  72. case 5:
  73. item.count = datas.actimporg;
  74. break;
  75. case 6:
  76. item.count = datas.todayactimporg;
  77. break;
  78. case 7:
  79. item.count = datas.actimpscan;
  80. break;
  81. default:
  82. break;
  83. }
  84. });
  85. } else {
  86. this.scanCode.forEach((item) => {
  87. item.count = 0;
  88. });
  89. }
  90. }
  91. }
  92. );
  93. },
  94. getList() {
  95. // 执行查询
  96. getDdlist().then((response) => {
  97. this.brigade = response.data;
  98. this.brigade.unshift({ deptName: "所有大队", id: "0" });
  99. });
  100. },
  101. //切换tab
  102. clickTab(e) {
  103. this.deptId = e.name;
  104. this.navList();
  105. },
  106. },
  107. };
  108. </script>
  109. <style scoped lang="scss">
  110. .app-container {
  111. background:#EDEFF2;
  112. max-height: calc(100vh - 84px);
  113. }
  114. .two-line {
  115. margin-top: 16px;
  116. display: flex;
  117. justify-content: space-between;
  118. flex-wrap: wrap;
  119. align-items: center;
  120. & > div {
  121. flex-basis: 23%;
  122. margin-top: 16px;
  123. height: 200px;
  124. background: #fff;
  125. position: relative;
  126. .total {
  127. position: absolute;
  128. left: 50%;
  129. text-align: center;
  130. line-height: 90px;
  131. font-size: 30px;
  132. font-weight: 600;
  133. transform: translateX(-50%);
  134. top: 30px;
  135. width: 106px;
  136. height: 106px;
  137. opacity: 1;
  138. border-radius: 50%;
  139. box-sizing: border-box;
  140. }
  141. }
  142. & > div:nth-child(even) {
  143. color: #01bceb;
  144. .total {
  145. border: 9px solid #01bceb;
  146. }
  147. }
  148. & > div:nth-child(odd) {
  149. color: #0147eb;
  150. .total {
  151. border: 9px solid #0147eb;
  152. }
  153. }
  154. & > div:last-child {
  155. margin-right: 0;
  156. }
  157. .item-name {
  158. color: #657398;
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. line-height: 330px;
  163. }
  164. }
  165. </style>