Worker.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <top-header :pageTitle="pageTitle"></top-header>
  5. <div class="mui-content fyy-wall vongi-zgtz">
  6. <div class="mui-content-padded fyy-date mui-clearfix">
  7. <h5>{{person_data.companyName}}
  8. <a class="mui-navigate-right mui-pull-right" v-text="curDate" @click="selectDate()">2020-03-19</a>
  9. </h5>
  10. </div>
  11. <div class="vongi-clasadmin">
  12. <h4>职工健康码统计</h4>
  13. <div class="vongi-clasadmin-list">
  14. <div class="vongi-clasadmin-ma mui-col-xs-3" v-for="(item,index) in statList" :key="index">
  15. <span :style="'color:'+getGreenCodeColor(item.healthyCode)" v-text="item.total">2953</span>
  16. <div class="mui-media-body" v-text="getCodeStatusName(item.healthyCode)">绿码</div>
  17. </div>
  18. </div>
  19. <div class="vongi-zgtz-search">
  20. <div class="mui-input-row mui-search">
  21. <input type="search" class="setinput" placeholder="请输入姓名" v-model="setinput" @change="searchK">
  22. </div>
  23. </div>
  24. </div>
  25. <div class="mui-slider">
  26. <div class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
  27. <a class="mui-control-item " :class="selectedIndex==0?'mui-active':''" @click="selectedIndex=0">
  28. 全部<span class="mui-badge" v-html="allCount"></span>
  29. </a>
  30. <a class="mui-control-item" :class="selectedIndex==1?'mui-active':''" @click="selectedIndex=1">
  31. 已上报<span class="mui-badge" v-html="doneCount"></span>
  32. </a>
  33. <a class="mui-control-item" :class="selectedIndex==2?'mui-active':''" @click="selectedIndex=2">
  34. 未上报<span class="mui-badge" v-html="undoCount"></span>
  35. </a>
  36. </div>
  37. <div class="mui-slider-group">
  38. <div :class="allGroup" class="mui-slider-item mui-control-content" v-show="selectedIndex==0">
  39. <div id="scroll1" class="mui-scroll-wrapper">
  40. <div class="mui-scroll ">
  41. <ul class="mui-table-view">
  42. <li class="mui-table-view-cell vongi-wordcard vongi-meform-pho" style=" border-bottom: 1px solid #c8c7cc;" v-for="(item,index) in allList" :key="index" >
  43. <a @click="viewDetail(item)" :class="item.upLoad?'mui-navigate-right':''" >
  44. <div class="mui-pull-left flew-items">
  45. <div class="mui-media-object flew"><img v-if="item.faceImageUrl!=null" :src="item.faceImageUrl + '?x-oss-process=image/resize,m_fill,w_64'"
  46. width="50" /></div>
  47. <h4 v-text="item.name"></h4>
  48. <span class="mui-icon iconfont icon-erweima1 " :style="'color:'+getGreenCodeColor(item.healthyCode)"></span>
  49. </div>
  50. <div class="mui-pull-right color55f868" style="padding: inherit;" v-if="item.upLoad">已上报</div>
  51. <div class="mui-pull-right colorfe616c" style="padding: inherit;" v-if="!item.upLoad">未上报</div>
  52. </a>
  53. </li>
  54. </ul>
  55. </div>
  56. </div>
  57. </div>
  58. <div :class="doneGroup" class="mui-slider-item mui-control-content" v-show="selectedIndex==1">
  59. <div id="scroll2" class="mui-scroll-wrapper">
  60. <div class="mui-scroll ">
  61. <ul class="mui-table-view">
  62. <li class="mui-table-view-cell vongi-wordcard vongi-meform-pho" style=" border-bottom: 1px solid #c8c7cc;" v-for="(item,index) in doneList" :key="index" >
  63. <a @click="viewDetail(item)" :class="item.upLoad?'mui-navigate-right':''" >
  64. <div class="mui-pull-left flew-items">
  65. <div class="mui-media-object flew"><img v-if="item.faceImageUrl!=null" :src="item.faceImageUrl + '?x-oss-process=image/resize,m_fill,w_64'"
  66. width="50" /></div>
  67. <h4 v-text="item.name"></h4>
  68. <span class="mui-icon iconfont icon-erweima1 " :style="'color:'+getGreenCodeColor(item.healthyCode)"></span>
  69. </div>
  70. <div class="mui-pull-right color55f868" style="padding: inherit;" v-if="item.upLoad">已上报</div>
  71. <div class="mui-pull-right colorfe616c" style="padding: inherit;" v-if="!item.upLoad">未上报</div>
  72. </a>
  73. </li>
  74. </ul>
  75. </div>
  76. </div>
  77. </div>
  78. <div :class="undoGroup" class="mui-slider-item mui-control-content" v-show="selectedIndex==2">
  79. <div id="scroll3" class="mui-scroll-wrapper">
  80. <div class="mui-scroll ">
  81. <ul class="mui-table-view">
  82. <li class="mui-table-view-cell vongi-wordcard vongi-meform-pho" style=" border-bottom: 1px solid #c8c7cc;" v-for="(item,index) in undoList" :key="index" >
  83. <a @click="viewDetail(item)" :class="item.upLoad?'mui-navigate-right':''" >
  84. <div class="mui-pull-left flew-items">
  85. <div class="mui-media-object flew"><img v-if="item.faceImageUrl!=null" :src="item.faceImageUrl + '?x-oss-process=image/resize,m_fill,w_64'"
  86. width="50" /></div>
  87. <h4 v-text="item.name"></h4>
  88. <span class="mui-icon iconfont icon-erweima1 " :style="'color:'+getGreenCodeColor(item.healthyCode)"></span>
  89. </div>
  90. <div class="mui-pull-right color55f868" style="padding: inherit;" v-if="item.upLoad">已上报</div>
  91. <div class="mui-pull-right colorfe616c" style="padding: inherit;" v-if="!item.upLoad">未上报</div>
  92. </a>
  93. </li>
  94. </ul>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <loading :visible="isLoading"></loading>
  102. </div>
  103. </template>
  104. <script>
  105. require('$project/assets/js/mui.picker.min.js');
  106. import Common from '$project/components/Common.vue'
  107. import Loading from '$project/components/Loading.vue'
  108. import TopHeader from '$project/components/TopHeader.vue'
  109. import {mapGetters,mapMutations} from 'vuex'
  110. import * as API_Health from '@/apis/Master/health'
  111. import isReachBottom from '$project/utils/isReachBottom'
  112. import {
  113. currentTimeStamp,
  114. parseUnixTime
  115. } from '$project/utils'
  116. export default {
  117. name: 'HealthTemperatureInfo',
  118. components: {
  119. Common,
  120. Loading,
  121. TopHeader
  122. },
  123. data() {
  124. return {
  125. pageTitle: '打卡台账',
  126. rightLink: {
  127. show: true,
  128. icon: 'icon-tongji',
  129. style: 'font-size:12px',
  130. title: '健康统计'
  131. },
  132. id: '',
  133. detail: [],
  134. curDate: '',
  135. isLoading: false,
  136. allList:[],
  137. allCount:0,
  138. undoList:[],
  139. undoCount:0,
  140. doneList:[],
  141. doneCount:0,
  142. selectedIndex: 0,
  143. pageIndexArr:[1,1,1],
  144. totalPageArr:[1,1,1],
  145. setinput: "",
  146. totalPage:1,
  147. sortType:'1',
  148. statList: [],
  149. }
  150. },
  151. created() {
  152. this.id = this.$route.query.id;
  153. if(this.$route.query.time){
  154. this.curDate = this.$route.query.time;
  155. }else{
  156. this.curDate = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
  157. }
  158. if(this.$route.query.index){
  159. this.selectedIndex=this.$route.query.index;
  160. }
  161. },
  162. methods: {
  163. asynCallBack(){},
  164. searchK() {
  165. this.queryList(true);
  166. },
  167. async queryList(isFirst){
  168. //created 传trye, 其他传null
  169. if(isFirst){
  170. this.pageIndexArr[0] = 1;
  171. this.pageIndexArr[1] = 1;
  172. this.pageIndexArr[2] = 1;
  173. // this.totalPageArr=[1,1,1]
  174. this.allList=[];
  175. this.doneList=[];
  176. this.undoList=[];
  177. }
  178. this.isLoading = true;
  179. if(isFirst||this.selectedIndex=='0'){
  180. await this.pageList('',this.pageIndexArr[0]).then(page=>{
  181. this.allCount = page.recordsTotal;
  182. if (this.pageIndexArr[0]==1) {
  183. this.allList = page.data;
  184. this.totalPageArr[0]=page.totalPage;
  185. }else{
  186. this.allList = [
  187. ...this.allList,
  188. ...page.data
  189. ];
  190. }
  191. if(this.selectedIndex==0){
  192. this.isLoading = false;
  193. }
  194. this.pageIndexArr[0]++;
  195. });
  196. }
  197. if(isFirst||this.selectedIndex=='1'){
  198. await this.pageList('1',this.pageIndexArr[1]).then(page=>{
  199. this.doneCount = page.recordsTotal;
  200. if (this.pageIndexArr[1]==1) {
  201. this.doneList = page.data;
  202. this.totalPageArr[1]=page.totalPage;
  203. }else{
  204. this.doneList = [
  205. ...this.doneList,
  206. ...page.data
  207. ];
  208. }
  209. if(this.selectedIndex==1){
  210. this.isLoading = false;
  211. }
  212. this.pageIndexArr[1]++;
  213. });
  214. }
  215. if(isFirst||this.selectedIndex=='2') {
  216. await this.pageList('2', this.pageIndexArr[2]).then(page => {
  217. this.undoCount = page.recordsTotal;
  218. if (this.pageIndexArr[2] == 1) {
  219. this.undoList = page.data;
  220. this.totalPageArr[2]=page.totalPage;
  221. } else {
  222. this.undoList = [
  223. ...this.undoList,
  224. ...page.data
  225. ];
  226. }
  227. if (this.selectedIndex == 2) {
  228. this.isLoading = false;
  229. }
  230. this.pageIndexArr[2]++;
  231. });
  232. }
  233. //this.pageIndex++;
  234. },
  235. selectDate() {
  236. var _this=this;
  237. var dtPicker = new mui.DtPicker({
  238. type: 'date',
  239. "endDate": new Date(),
  240. "value":_this.curDate
  241. });
  242. // dtPicker.setSelectedValue(_this.curDate)
  243. dtPicker.show((selectItems)=>{
  244. var year = selectItems.y.value;
  245. var month = selectItems.m.value;
  246. var day = selectItems.d.value;
  247. this.curDate = year + "-" + month + "-" + day;
  248. this.queryList(true);
  249. });
  250. },
  251. pageList(status,pageIndex) {
  252. return API_Health.workerPageList({
  253. setinput: this.setinput,
  254. companyId: this.person_data.companyId,
  255. queryDate: this.curDate,
  256. status: status,
  257. pageIndex: pageIndex,
  258. pageSize: 50
  259. //sortType:this.sortType,
  260. });
  261. },
  262. //获取绿码统计数据
  263. getHealthyCodeStat() {
  264. this.isLoading = true;
  265. API_Health.getHealthyCodeStat(this.person_data.companyId, '3').then(response => {
  266. this.isLoading = false;
  267. this.statList = response;
  268. }).catch(error => {
  269. this.isLoading = false;
  270. mui.toast(error);
  271. })
  272. },
  273. viewDetail(item) {
  274. if (item.upLoad) {
  275. this.$router.push({
  276. name: 'MasterHealthWorkerInfo',
  277. query: {
  278. id: item.personHealthLedgerId
  279. }
  280. })
  281. }
  282. },
  283. //获取健康码颜色值
  284. getGreenCodeColor(healthyCode) {
  285. var healthyCode = healthyCode || '11';
  286. var color = {
  287. "00": '#09ae47',
  288. "01": '#e5aa37',
  289. "10": '#fe616c',
  290. "11": '#C0C0C0'
  291. }
  292. return color[healthyCode];
  293. },
  294. //判断状态
  295. getCodeStatusName(code) {
  296. if (code == '00') {
  297. return '绿码';
  298. } else if (code == '01') {
  299. return '黄码';
  300. } else if (code == '10') {
  301. return '红码';
  302. } else if (code == '11') {
  303. return '灰码';
  304. } else {
  305. return '无码';
  306. }
  307. },
  308. //下拉事件
  309. handleScrool() {
  310. //console.log(window.screen.height + '-' + document.body.scrollTop + '-' + document.body.clientHeight)
  311. //if ((window.screen.height + document.body.scrollTop) > (document.body.clientHeight)) {
  312. if (isReachBottom()) {
  313. console.log('到达底部')
  314. if (this.pageIndexArr[this.selectedIndex] <= this.totalPageArr[this.selectedIndex] && this.isLoading == false) {
  315. this.queryList(false);
  316. } else {
  317. return;
  318. }
  319. } else {
  320. this.loadAll = true;
  321. return;
  322. }
  323. },
  324. },
  325. computed: {
  326. ...mapGetters({
  327. openId: 'wx_openid',
  328. token: 'token',
  329. person_data: 'person_data',
  330. person_popedom: 'person_popedom',
  331. }),
  332. allGroup(){
  333. return {
  334. "mui-active" : this.selectedIndex==0
  335. };
  336. },
  337. doneGroup(){
  338. return {
  339. "mui-active" : this.selectedIndex==1
  340. };
  341. },
  342. undoGroup(){
  343. return {
  344. "mui-active" : this.selectedIndex==2
  345. };
  346. }
  347. },
  348. mounted() {
  349. var _this = this;
  350. this.queryList(true);
  351. //获取绿码统计数据
  352. this.getHealthyCodeStat();
  353. window.addEventListener('scroll', _this.handleScrool);
  354. },
  355. destroyed() {
  356. //销毁监听事件
  357. var _this = this;
  358. window.removeEventListener('scroll', _this.handleScrool);
  359. }
  360. }
  361. </script>
  362. <style scoped src="$project/assets/css/xpwyfyy.css"></style>
  363. <style scoped src="$project/assets/css/sczpfyy.css"></style>
  364. <style scoped src="$project/assets/css/wallfyy.css"></style>
  365. <style src="$project/assets/css/iconfont.css"></style>
  366. <style src="$project/assets/css/mui.picker.min.css"></style>
  367. <style>
  368. </style>