Home.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <top-header :pageTitle="pageTitle"></top-header>
  5. <div class="mui-content vongi-jyj">
  6. <div class="ord-user mui-content-padded">
  7. <div class="flew-items ">
  8. <div class="user-pic">
  9. <img :src="person_data?person_data.faceImageUrl:''">
  10. </div>
  11. <div class="user-info">
  12. <h2 v-if="person_data">{{person_data.name}}</h2>
  13. <p v-text="person_popedom?(person_popedom.job?person_popedom.job:person_popedom.personRoleName):''"></p>
  14. </div>
  15. </div>
  16. <a class="signOut" @click="doLoginOut">
  17. 退出
  18. <i class="iconfont icon-tuichu"></i>
  19. </a>
  20. </div>
  21. <div class="mui-card icon_number">
  22. <div class="mui-card-header">
  23. 开发区健康统计
  24. <a class="mui-navigate-right iconfont icon-riqi" @click="selectDate" v-text="listForm.date"></a>
  25. </div>
  26. <div class="mui-card-content">
  27. <div class="mui-col-xs-6">
  28. <a>
  29. <span class="icon_number_green" v-text="detail.totalNum"></span>
  30. <div class="mui-media-body mui-ellipsis">应测人数</div>
  31. </a>
  32. </div>
  33. <div class="mui-col-xs-6">
  34. <a>
  35. <span class="icon_number_blue" v-text="detail.totalCheckNum"></span>
  36. <div class="mui-media-body mui-ellipsis">已测人数</div>
  37. </a>
  38. </div>
  39. <div class="mui-col-xs-6">
  40. <a>
  41. <span class="icon_number_red" v-text="detail.totalAbnormalNum"></span>
  42. <div class="mui-media-body mui-ellipsis">异常人数</div>
  43. </a>
  44. </div>
  45. <div class="mui-col-xs-6">
  46. <a>
  47. <span class="icon_number_yellow" v-text="detail.leaveNum"></span>
  48. <div class="mui-media-body mui-ellipsis">离荆人数</div>
  49. </a>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- <div class="mui-card card_img">
  54. <div id="slider" class="mui-slider">
  55. <div class="mui-slider-group">
  56. <div class="mui-slider-item">
  57. <a href="#">
  58. <img src="~$project/assets/img/green.png">
  59. </a>
  60. </div>
  61. <div class="mui-slider-item">
  62. <a href="#">
  63. <img src="~$project/assets/img/green.png">
  64. </a>
  65. </div>
  66. </div>
  67. <div class="mui-slider-indicator">
  68. <div class="mui-indicator mui-active"></div>
  69. <div class="mui-indicator"></div>
  70. </div>
  71. </div>
  72. </div> -->
  73. <div class="mui-card">
  74. <div class="mui-card-content index-floor-2">
  75. <ul class="mui-table-view">
  76. <li v-for="(item,index) in recordList" class="mui-table-view-cell flew-sp">
  77. <div class="mui-ellipsis mui-col-xs-6" v-text="item.companyName"></div>
  78. <div class="mui-media-body mui-col-xs-6 mui-text-right">
  79. <span class="green">已测{{item.totalCheckNum}}</span> /
  80. <span class="blue">应测{{item.totalNum}}</span>
  81. </div>
  82. </li>
  83. </ul>
  84. </div>
  85. </div>
  86. </div>
  87. <loading :visible="isLoading"></loading>
  88. </div>
  89. </template>
  90. <script>
  91. require('$project/assets/js/mui.picker.min.js');
  92. import * as API_statistic from '@/apis/Control/statistic'
  93. import Common from '$project/components/Common.vue'
  94. import Loading from '$project/components/Loading.vue'
  95. import TopHeader from '$project/components/TopHeader.vue'
  96. import isReachBottom from '$project/utils/isReachBottom'
  97. import {
  98. mapGetters,
  99. mapMutations
  100. } from 'vuex'
  101. import {
  102. currentTimeStamp,
  103. parseUnixTime
  104. } from '$project/utils'
  105. import * as types from '$project/store/mutation-types'
  106. export default {
  107. name: 'Control',
  108. components: {
  109. Common,
  110. Loading,
  111. TopHeader
  112. },
  113. data() {
  114. return {
  115. isLoading: false,
  116. pageTitle: '开发区监管端',
  117. listForm: {
  118. date: '',
  119. pageIndex: '',
  120. pageSize: 20,
  121. totalPage: 1,
  122. },
  123. recordList: [],
  124. detail: {}
  125. }
  126. },
  127. created() {
  128. this.listForm.date = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
  129. },
  130. methods: {
  131. //选择时间
  132. selectDate() {
  133. var _this = this;
  134. var picker = new mui.DtPicker({
  135. "type": "date",
  136. "beginYear": 2020,
  137. "endYear": 2040,
  138. "endDate": new Date(),
  139. "value": _this.listForm.date
  140. });
  141. picker.show(function(rs) {
  142. _this.listForm.date = rs.text;
  143. _this.listForm.pageIndex = 1;
  144. _this.getList();
  145. picker.dispose();
  146. });
  147. },
  148. //获取统计详情
  149. getInfo() {
  150. this.isLoading = true;
  151. API_statistic.companySuperviseAllData({
  152. date: this.listForm.date
  153. }).then(response => {
  154. this.detail = response;
  155. this.isLoading = false;
  156. }).catch(error => {
  157. this.isLoading = false;
  158. mui.toast(error);
  159. })
  160. },
  161. //获取列表
  162. getList() {
  163. this.isLoading = true;
  164. API_statistic.companySuperviseListData(this.listForm).then(response => {
  165. this.isLoading = false;
  166. if (response) {
  167. if (this.listForm.pageIndex == 1) {
  168. this.recordList = response.data;
  169. this.listForm.pageIndex = response.pageNumber;
  170. this.listForm.totalPage = response.totalPage;
  171. } else {
  172. this.recordList = [
  173. ...this.recordList,
  174. ...response.data
  175. ];
  176. }
  177. }
  178. this.listForm.pageIndex++;
  179. }).catch(error => {
  180. this.isLoading = false;
  181. mui.toast(error);
  182. })
  183. },
  184. //下拉事件
  185. handleScrool() {
  186. if (isReachBottom()) {
  187. console.log('到达底部')
  188. if (this.listForm.pageIndex <= this.listForm.totalPage && this.isLoading == false) {
  189. this.getList();
  190. } else {
  191. return;
  192. }
  193. }
  194. },
  195. //退出登录
  196. loginOut() {
  197. this.isLoading = true;
  198. API_User.logOut().then(response => {
  199. this.isLoading = false;
  200. window.location.href = '../home/#/';
  201. }).catch(error => {
  202. this.isLoading = false;
  203. mui.toast(error);
  204. })
  205. },
  206. doLoginOut() {
  207. var btnArray = ['否', '是'];
  208. mui.confirm('是否确认退出登录', '提示', btnArray, function(e) {
  209. if (e.index == 1) {
  210. _this.loginOut();
  211. }
  212. })
  213. },
  214. asynCallBack() {},
  215. },
  216. mounted() {
  217. //获取统计详情
  218. this.getInfo();
  219. this.getList();
  220. //监控下拉加载事件
  221. var _this = this;
  222. window.addEventListener('scroll', _this.handleScrool);
  223. },
  224. destroyed() {
  225. //销毁监听事件
  226. var _this = this;
  227. window.removeEventListener('scroll', _this.handleScrool);
  228. },
  229. computed: {
  230. ...mapGetters({
  231. openId: 'wx_openid',
  232. token: 'token',
  233. person_data: 'person_data',
  234. person_popedom: 'person_popedom',
  235. menu_list: 'menu_list',
  236. common_menu_list: 'common_menu_list',
  237. })
  238. }
  239. }
  240. </script>
  241. <style scoped src="$project/assets/css/xpgj.css"></style>
  242. <style src="$project/assets/css/iconfont.css"></style>
  243. <style src="$project/assets/css/mui.picker.min.css"></style>
  244. <style>
  245. </style>