TemperatureRecord.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <top-header :pageTitle="pageTitle" :rightLink="rightLink" :doRightLink="doRightLink"></top-header>
  5. <div class="mui-content">
  6. <div class="mui-content-padded">
  7. <ul class="mui-table-view openfyy-list">
  8. <li v-for="(item,index) in recordList" @click="goToPage(item.id)" class="mui-table-view-cell mui-media flew-sp">
  9. <div class="mui-h4">
  10. <span v-text="item.recordTime"></span>
  11. <!-- <button>设备测温</button> -->
  12. </div>
  13. <span class="mui-navigate-right">
  14. <p class="color05c8af">
  15. {{item.fever?'异常':'正常'}}
  16. <!-- <span v-text="item.temperature"></span> -->
  17. </p>
  18. </span>
  19. </li>
  20. </ul>
  21. </div>
  22. </div>
  23. <loading :visible="isLoading"></loading>
  24. </div>
  25. </template>
  26. <script>
  27. import * as API_Health from '@/apis/Common/health'
  28. import Common from '$project/components/Common.vue'
  29. import Loading from '$project/components/Loading.vue'
  30. import TopHeader from '$project/components/TopHeader.vue'
  31. import isReachBottom from '$project/utils/isReachBottom'
  32. import {
  33. mapGetters,
  34. mapMutations
  35. } from 'vuex'
  36. export default {
  37. name: 'CommonHealthTemperatureRecord',
  38. components: {
  39. Common,
  40. Loading,
  41. TopHeader
  42. },
  43. data() {
  44. return {
  45. pageTitle: '测温记录',
  46. isLoading: false,
  47. rightLink: {
  48. show: true,
  49. icon: 'icon-baojing',
  50. style: 'font-size:14px',
  51. title: '异常记录'
  52. },
  53. recordList: [],
  54. listForm: {
  55. pageIndex: 1,
  56. pageSize: 20,
  57. token: '',
  58. fever: '',
  59. totalPage: 1
  60. },
  61. }
  62. },
  63. created() {
  64. },
  65. methods: {
  66. goToPage(id) {
  67. this.$router.push({
  68. name: 'CommonHealthTemperatureInfo',
  69. query: {
  70. id: id
  71. }
  72. })
  73. },
  74. //获取列表
  75. getList() {
  76. this.isLoading = true;
  77. API_Health.getRecordList(this.listForm).then(response => {
  78. if (response) {
  79. if (this.listForm.pageIndex == 1) {
  80. this.recordList = response.data;
  81. this.listForm.pageIndex = response.pageNumber;
  82. this.listForm.totalPage = response.totalPage;
  83. } else {
  84. this.recordList = [
  85. ...this.recordList,
  86. ...response.data
  87. ];
  88. }
  89. }
  90. this.listForm.pageIndex++;
  91. this.isLoading = false;
  92. }).catch(error => {
  93. this.isLoading = false;
  94. mui.toast(error);
  95. })
  96. },
  97. //下拉事件
  98. handleScrool() {
  99. if (isReachBottom()) {
  100. console.log('到达底部')
  101. if (this.listForm.pageIndex <= this.listForm.totalPage && this.isLoading == false) {
  102. this.getList();
  103. } else {
  104. return;
  105. }
  106. }
  107. },
  108. //右上角点击事件
  109. doRightLink() {
  110. this.listForm.pageIndex = 1;
  111. this.listForm.fever = this.listForm.fever == 1 ? '' : 1;
  112. this.getList();
  113. },
  114. asynCallBack() {},
  115. },
  116. mounted() {
  117. this.getList();
  118. //监控下拉加载事件
  119. var _this = this;
  120. window.addEventListener('scroll', _this.handleScrool);
  121. },
  122. destroyed() {
  123. //销毁监听事件
  124. var _this = this;
  125. window.removeEventListener('scroll', _this.handleScrool);
  126. },
  127. computed: {
  128. ...mapGetters({
  129. openId: 'wx_openid',
  130. token: 'token',
  131. person_data: 'person_data',
  132. company_data: 'company_data',
  133. })
  134. },
  135. watch: {
  136. 'listForm.fever': function(newValue, oldValue) {
  137. if (newValue == 1) {
  138. this.rightLink.title = '全部记录';
  139. } else {
  140. this.rightLink.title = '异常记录';
  141. }
  142. }
  143. }
  144. }
  145. </script>
  146. <style scoped src="$project/assets/css/xpwyfyy.css"></style>
  147. <style src="$project/assets/css/iconfont.css"></style>
  148. <style scoped>
  149. </style>