resident.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="page" style="box-sizing: border-box;position: relative;">
  3. <more title="常住人员" reload @reload="reload"></more>
  4. <div style="position: absolute;right: 40px;bottom: 6px;z-index: 999;" v-show="!loading">
  5. <el-pagination @current-change="currentChange" small layout="prev, pager, next" :page-count="page.pages">
  6. </el-pagination>
  7. </div>
  8. <div class="card-box">
  9. <div class="card-list animate__animated animate__faster animate__fadeInLeft"
  10. style="display: flex;justify-content: space-between;min-height: 304px;" v-loading="loading">
  11. <div @click="showDetail(item)" class="card" v-for="(item,index) in list" :key="index">
  12. <div class="img">
  13. <el-image style="width: 100%;height: 100%;" :src="item.faceUrl">
  14. <img style="width: 100%;height: 100%;" slot="error" src="/img/icon/open.png">
  15. </el-image>
  16. </div>
  17. <div class="data">
  18. <div class="left">
  19. <div class="name">{{item.userName}}</div>
  20. <div class="temperature" v-if="item.temperature">
  21. <div>{{item.temperature}} ℃</div>
  22. <div v-if="item.temperature>37.6" class="center" style="margin-top: 0.125rem;"><i
  23. class="el-icon-warning dot"></i></div>
  24. </div>
  25. </div>
  26. <div class="right">
  27. <div style="display: flex;" v-if="item.isOut === 1">
  28. <img src="/img/icon/enter.png" style="width: 16px;height: 16px;margin-right: 0.2rem;" />
  29. {{item.openTime | formatDate}}
  30. </div>
  31. <div style="display: flex;margin-top: 0.2rem;" v-if="item.isOut === 2">
  32. <img src="/img/icon/outer.png" style="width: 16px;height: 16px;margin-right: 0.2rem;" />
  33. {{item.openTime | formatDate}}
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import more from "@/components/more.vue";
  44. import {
  45. getList
  46. } from "@/api/estate/accessrecord";
  47. import dateTime from "@/util/dateTime.js"
  48. export default {
  49. components: {
  50. more
  51. },
  52. inject: ['index'],
  53. data() {
  54. return {
  55. loading: true,
  56. page: {
  57. current: 1,
  58. size: 6,
  59. total: 0,
  60. pages: 0
  61. },
  62. list: []
  63. };
  64. },
  65. created() {
  66. this.loadStaffRecord();
  67. },
  68. filters: {
  69. formatDate(date) {
  70. return dateTime.format(new Date(date), 'mm-dd HH:MM:SS')
  71. }
  72. },
  73. methods: {
  74. async reload(){
  75. this.page.current = 1
  76. await this.loadStaffRecord()
  77. this.$message.success('刷新成功')
  78. },
  79. currentChange(current) {
  80. let oldCurrent = this.page.current
  81. if (current > oldCurrent) {
  82. this.$animateCss('.card-list', 'animate__slideInRight')
  83. } else {
  84. this.$animateCss('.card-list', 'animate__slideInLeft')
  85. }
  86. this.page.current = current
  87. this.loadStaffRecord()
  88. },
  89. showDetail(item) {
  90. let params = {
  91. style: 'height: 58%;width: 38%;',
  92. title: '常住人员',
  93. type: 'visitor',
  94. content: item,
  95. time: item.createTime
  96. }
  97. this.index.$refs.myDialog.open(params)
  98. },
  99. async loadStaffRecord() {
  100. //userType:2-员工,4-访客
  101. let params = {
  102. "userType": 2
  103. }
  104. let data = (await getList(this.page.current, this.page.size, params)).data.data
  105. this.list = data.records;
  106. this.page.total = data.total;
  107. this.page.pages = data.pages
  108. this.loading = false
  109. },
  110. change(item) {
  111. if (item == 'Left') {
  112. if (this.page.current > 1) {
  113. this.page.current = this.page.current - 1
  114. } else {
  115. this.page.current = this.page.pages
  116. }
  117. }
  118. if (item == 'Right') {
  119. if ((this.page.current + 1) <= this.page.pages) {
  120. this.page.current = this.page.current + 1
  121. } else {
  122. this.page.current = 1
  123. }
  124. }
  125. this.loadStaffRecord()
  126. this.$animateCss('.card-list', 'animate__slideIn' + item)
  127. },
  128. }
  129. };
  130. </script>
  131. <style lang="scss" scoped>
  132. .page {
  133. margin-top: 0.625rem;
  134. padding: 1.25rem;
  135. background-color: #FFFFFF;
  136. }
  137. .center {
  138. display: flex;
  139. justify-content: center;
  140. align-items: center;
  141. }
  142. .card-box {
  143. overflow: hidden;
  144. position: relative;
  145. }
  146. .changeIcon {
  147. position: absolute;
  148. bottom: calc(50% - 15px);
  149. }
  150. .card {
  151. background-color: #F5F5F5;
  152. margin: 20px 4px 10px;
  153. display: flex;
  154. flex-direction: column;
  155. width: calc(16.7% - 5px);
  156. height: 16.5rem;
  157. .img {
  158. width: 100%;
  159. height: 13rem;
  160. }
  161. .data {
  162. padding: 0 0.625rem;
  163. height: 100%;
  164. display: flex;
  165. align-items: center;
  166. justify-content: space-between;
  167. .left,
  168. .right {
  169. color: #999999;
  170. font-size: 0.8rem;
  171. display: flex;
  172. flex-direction: column;
  173. }
  174. .left {
  175. .name {
  176. font-size: 0.95rem;
  177. font-weight: 800;
  178. color: #333;
  179. }
  180. .temperature {
  181. display: flex;
  182. font-weight: 400;
  183. margin-top: 0.2rem;
  184. .dot {
  185. margin-left: 0.375rem;
  186. color: #E35E4B;
  187. }
  188. }
  189. }
  190. .right {
  191. .icon {
  192. width: 0.9rem;
  193. height: 0.9rem;
  194. border-radius: 50%;
  195. color: #FFFFFF;
  196. font-size: 0.5rem;
  197. margin-right: 0.26rem;
  198. }
  199. }
  200. }
  201. }
  202. </style>