CodeList.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <top-header :pageTitle="pageTitle"></top-header>
  5. <div class="mui-content vongi-zctj">
  6. <div class="vongi-bagfff">
  7. <div class="vongi-xzdw-search">
  8. <input v-model="listForm.name" @keyup.enter="reloadSearchList" type="search" placeholder="搜索姓名或编号">
  9. <span class="mui-icon mui-icon-search"></span>
  10. </div>
  11. </div>
  12. <div id="slider" class="mui-slider mui-fullscreen vongi-ygjkma">
  13. <div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
  14. <div class="mui-scroll">
  15. <a v-for="(item,index) in statList" :style="'color:'+getGreenCodeColor(item.healthyCode)" @click="reloadStatusList(item.healthyCode)"
  16. :class="'mui-control-item '+(listForm.healthyCode==item.healthyCode?'mui-active':'')">
  17. {{getCodeStatusName(item.healthyCode)}}<span class="mui-badge" v-text="item.total"></span>
  18. </a>
  19. </div>
  20. </div>
  21. <div class="mui-slider-group">
  22. <div class="mui-slider-item mui-control-content">
  23. <div class="mui-scroll-wrapper">
  24. <div class="mui-scroll vongi-archives">
  25. <ul class="mui-table-view">
  26. <li v-for="(item,index) in recordList" class="mui-table-view-cell">
  27. <router-link :to="{name: 'CommonHealthCert',query: {personId: item.id}}" class="mui-navigate-right">
  28. <div class="mui-pull-left flew-items">
  29. <div class="mui-media-object"><img :src="item.faceImageUrl+'?x-oss-process=image/resize,h_50,m_lfit'"></div> {{item.name}}
  30. </div>
  31. <span class="mui-pull-right" :style="'color:'+getGreenCodeColor(item.healthyCode)">{{getCodeStatusName(item.healthyCode)}}<i
  32. class="iconfont icon-erweima1"></i></span>
  33. </router-link>
  34. </li>
  35. </ul>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <loading :visible="isLoading"></loading>
  43. </div>
  44. </template>
  45. <script>
  46. import * as API_Health from '@/apis/Master/health'
  47. import Common from '$project/components/Common.vue'
  48. import Loading from '$project/components/Loading.vue'
  49. import isReachBottom from '$project/utils/isReachBottom'
  50. import TopHeader from '$project/components/TopHeader.vue'
  51. import {
  52. mapGetters,
  53. mapMutations
  54. } from 'vuex'
  55. export default {
  56. name: 'MasterHealthCodeList',
  57. components: {
  58. Common,
  59. Loading,
  60. TopHeader
  61. },
  62. data() {
  63. return {
  64. pageTitle: '员工健康码明细',
  65. isLoading: false,
  66. listForm: {
  67. healthyCode: this.$route.query.healthyCode ? this.$route.query.healthyCode : '00',
  68. pageIndex: 1,
  69. pageSize: 20,
  70. totalPage: 1,
  71. name: '',
  72. },
  73. recordList: [],
  74. statList: [],
  75. }
  76. },
  77. created() {},
  78. methods: {
  79. reloadSearchList() {
  80. this.listForm.pageIndex = 1;
  81. this.getList();
  82. },
  83. reloadStatusList(status) {
  84. this.listForm.healthyCode = status;
  85. this.listForm.pageIndex = 1;
  86. this.getList();
  87. },
  88. //获取健康码颜色值
  89. getGreenCodeColor(healthyCode) {
  90. var healthyCode = healthyCode || '11';
  91. var color = {
  92. "00": '#09ae47',
  93. "01": '#e5aa37',
  94. "10": '#fe616c',
  95. "11": '#C0C0C0'
  96. }
  97. return color[healthyCode];
  98. },
  99. //判断状态
  100. getCodeStatusName(code) {
  101. if (code == '00') {
  102. return '绿码';
  103. } else if (code == '01') {
  104. return '黄码';
  105. } else if (code == '10') {
  106. return '红码';
  107. } else if (code == '11') {
  108. return '灰码';
  109. } else {
  110. return '灰码';
  111. }
  112. },
  113. //获取绿码统计数据
  114. getHealthyCodeStat() {
  115. this.isLoading = true;
  116. API_Health.getHealthyCodeStat(this.person_data.companyId).then(response => {
  117. this.isLoading = false;
  118. this.statList = response;
  119. this.getList();
  120. }).catch(error => {
  121. this.isLoading = false;
  122. this.mui.toast(error);
  123. })
  124. },
  125. //获取列表
  126. getList() {
  127. this.isLoading = true;
  128. API_Health.healthyCodeStatList(this.listForm).then(response => {
  129. if (response) {
  130. if (this.listForm.pageIndex == 1) {
  131. this.recordList = response.data;
  132. this.listForm.pageIndex = response.pageNumber;
  133. this.listForm.totalPage = response.totalPage;
  134. } else {
  135. this.recordList = [
  136. ...this.recordList,
  137. ...response.data
  138. ];
  139. }
  140. }
  141. this.listForm.pageIndex++;
  142. this.isLoading = false;
  143. }).catch(error => {
  144. this.isLoading = false;
  145. mui.toast(error);
  146. })
  147. },
  148. //下拉事件
  149. handleScrool() {
  150. if (isReachBottom()) {
  151. console.log('到达底部')
  152. if (this.listForm.pageIndex <= this.listForm.totalPage && this.isLoading == false) {
  153. this.getList();
  154. } else {
  155. return;
  156. }
  157. }
  158. },
  159. asynCallBack() {
  160. },
  161. },
  162. mounted() {
  163. //获取数量统计
  164. this.getHealthyCodeStat();
  165. //监控下拉加载事件
  166. var _this = this;
  167. window.addEventListener('scroll', _this.handleScrool);
  168. },
  169. destroyed() {
  170. //销毁监听事件
  171. var _this = this;
  172. window.removeEventListener('scroll', _this.handleScrool);
  173. },
  174. computed: {
  175. ...mapGetters({
  176. openId: 'wx_openid',
  177. token: 'token',
  178. person_data: 'person_data',
  179. person_popedom: 'person_popedom',
  180. })
  181. }
  182. }
  183. </script>
  184. <style scoped src="$project/assets/css/xpwyfyy.css"></style>
  185. <style src="$project/assets/css/iconfont.css"></style>
  186. <style>
  187. </style>