reportMain.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div style="margin: 5px">
  3. <van-search
  4. v-model="value"
  5. input-align="center"
  6. left-icon=""
  7. readonly
  8. right-icon="arrow-down"
  9. @click="showPicker = true"
  10. />
  11. <van-popup v-model="showPicker" round position="bottom">
  12. <van-picker
  13. show-toolbar
  14. :columns="columns"
  15. @cancel="showPicker = false"
  16. @confirm="onConfirm"
  17. />
  18. </van-popup>
  19. <van-grid column-num="3" style="margin: 10px 0; font-size: 14px; color: #aaa">
  20. <van-grid-item :to="{ path: '/reportDetail', query: { type: 1 } }">
  21. <div>
  22. <div>应到人数</div>
  23. <div class="tt">{{ stat.yd }}</div>
  24. </div>
  25. </van-grid-item>
  26. <van-grid-item :to="{ path: '/reportDetail', query: { type: 2 } }">
  27. <div>
  28. <div>签到人数</div>
  29. <div class="tt">{{ stat.qd }}</div>
  30. </div>
  31. </van-grid-item>
  32. <van-grid-item :to="{ path: '/reportDetail', query: { type: 3 } }">
  33. <div>
  34. <div>未到人数</div>
  35. <div class="tt">{{ stat.wd }}</div>
  36. </div>
  37. </van-grid-item>
  38. <van-grid-item :to="{ path: '/reportDetail', query: { type: 4 } }">
  39. <div>
  40. <div class="tt1">员工(应到/未到)</div>
  41. <div class="tt">
  42. {{ stat.yg }}/<span style="color: red">{{ stat.yg1 }}</span>
  43. </div>
  44. </div>
  45. </van-grid-item>
  46. <van-grid-item :to="{ path: '/reportDetail', query: { type: 5 } }">
  47. <div>
  48. <div class="tt1">第三方人员(应到/未到)</div>
  49. <div class="tt">
  50. {{ stat.dsfry }}/<span style="color: red">{{ stat.dsfry1 }}</span>
  51. </div>
  52. </div>
  53. </van-grid-item>
  54. <van-grid-item :to="{ path: '/reportDetail', query: { type: 6 } }">
  55. <div>
  56. <div class="tt1">访客(应到/未到)</div>
  57. <div class="tt">
  58. {{ stat.fk }}/<span style="color: red">{{ stat.fk1 }}</span>
  59. </div>
  60. </div>
  61. </van-grid-item>
  62. </van-grid>
  63. <van-tabs v-model="active">
  64. <van-tab name="tab1" title="未到详情">
  65. <fire-table :query-type="7" :all-columns="false"></fire-table>
  66. </van-tab>
  67. <van-tab name="tab2" title="已到详情">
  68. <fire-table :query-type="8" :all-columns="true"></fire-table>
  69. </van-tab>
  70. </van-tabs>
  71. </div>
  72. </template>
  73. <script>
  74. import FireTable from './FireTable'
  75. import { mapGetters } from 'vuex'
  76. export default {
  77. name: 'ReportMain',
  78. components: { FireTable },
  79. data() {
  80. return {
  81. value: '',
  82. showPicker: false,
  83. columns: [],
  84. active: 'tab1',
  85. interval: null,
  86. stat: {
  87. yd: '',
  88. qd: '',
  89. wd: '',
  90. yg: '',
  91. yg1: '',
  92. dsfry: '',
  93. dsfry1: '',
  94. fk: '',
  95. fk1: ''
  96. }
  97. }
  98. },
  99. computed: {
  100. ...mapGetters(['gValue'])
  101. },
  102. mounted() {
  103. this.$store.dispatch('layout/gValue', null)
  104. this.querySelect()
  105. },
  106. methods: {
  107. onConfirm(value) {
  108. this.$store.dispatch('layout/gValue', value.value)
  109. this.value = value.text
  110. this.showPicker = false
  111. this.queryStat()
  112. },
  113. queryStat() {
  114. const postData = {
  115. yxid: this.gValue
  116. }
  117. this.$apis.requestBase('stat', postData).then(res => {
  118. this.stat = res.data
  119. })
  120. },
  121. querySelect() {
  122. if (this.columns && this.columns.length > 0) {
  123. return
  124. }
  125. const postData = {}
  126. this.$apis.requestBase('select', postData).then(res => {
  127. this.columns = res.data
  128. if (this.columns[0]) {
  129. this.onConfirm(this.columns[0])
  130. }
  131. const _this = this
  132. // 30s刷新界面数据
  133. if (this.interval) {
  134. clearInterval(this.interval)
  135. }
  136. this.interval = setInterval(() => {
  137. _this.queryStat()
  138. }, 30000)
  139. })
  140. }
  141. },
  142. destroyed() {
  143. if (this.interval) {
  144. clearInterval(this.interval)
  145. }
  146. }
  147. }
  148. </script>
  149. <style>
  150. .tt {
  151. text-align: center;
  152. color: #555;
  153. height: 40px;
  154. line-height: 40px;
  155. }
  156. .tt1 {
  157. font-size: 10px;
  158. }
  159. </style>