Worker.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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-html="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 id="slider" class="mui-slider mui-fullscreen">
  26. <div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
  27. <div class="mui-scroll">
  28. <a class="mui-control-item " :class="selectedIndex==0?'mui-active':''" style="width:30%" @click="ckSelectedIndex(0)">
  29. 全部<span class="mui-badge" v-html="allCount">3</span>
  30. </a>
  31. <a class="mui-control-item" :class="selectedIndex==1?'mui-active':''" style="width:36%" @click="ckSelectedIndex(1)">
  32. 正常记录<span class="mui-badge" v-html="doneCount">2</span>
  33. </a>
  34. <a class="mui-control-item" :class="selectedIndex==2?'mui-active':''" style="width:34%" @click="ckSelectedIndex(2)">
  35. 异常记录<span class="mui-badge" v-html="undoCount">1</span>
  36. </a>
  37. </div>
  38. </div>
  39. <div class="mui-slider-group">
  40. <div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
  41. <div id="scroll1" class="mui-scroll-wrapper">
  42. <div class="mui-scroll vongi-yctj-list">
  43. <ul class="mui-table-view mui-table-view-chevron vongi-zgtz">
  44. <li class="mui-table-view-cell mui-collapse vongi-archives" v-for="(item,index) in allList" :key="index">
  45. <a class="mui-navigate-right">
  46. {{item.name}}
  47. <h4 class='mui-pull-right'><span class="color4fc5f7">{{item.num2}}</span>/<span class="color4fc5f7">{{item.num1}}</span></h4>
  48. </a>
  49. <ul class="mui-table-view mui-table-view-chevron">
  50. <li class="mui-table-view-cell" v-for="(mod,index2) in item.list" :key="index2">
  51. <a @click="viewDetail(mod)" :class="{'mui-navigate-right': mod.upLoad}">
  52. <div class="mui-pull-left flew-items">
  53. <div class="mui-media-object flew"><img v-if="mod.faceImageUrl!=null" :src="mod.faceImageUrl + '?x-oss-process=image/resize,m_fill,w_64'"
  54. width="50" /></div>
  55. <h4 v-html="mod.name"></h4>
  56. <span class="mui-icon iconfont icon-erweima1 " :style="'color:'+getGreenCodeColor(mod.healthyCode)"></span>
  57. </div>
  58. <div class="mui-pull-right color55f868" v-if="mod.upLoad">已上报</div>
  59. <div class="mui-pull-right colorfe616c" v-if="!mod.upLoad">未上报</div>
  60. </a>
  61. </li>
  62. </ul>
  63. </li>
  64. </ul>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <loading :visible="isLoading"></loading>
  72. </div>
  73. </template>
  74. <script>
  75. require('$project/assets/js/mui.picker.min.js');
  76. import * as API_Health from '@/apis/Master/health'
  77. import Common from '$project/components/Common.vue'
  78. import Loading from '$project/components/Loading.vue'
  79. import TopHeader from '$project/components/TopHeader.vue'
  80. import {
  81. mapGetters,
  82. mapMutations
  83. } from 'vuex'
  84. import {
  85. currentTimeStamp,
  86. parseUnixTime
  87. } from '$project/utils'
  88. export default {
  89. name: 'MasterHealthWorker',
  90. components: {
  91. Common,
  92. Loading,
  93. TopHeader
  94. },
  95. data() {
  96. return {
  97. pageTitle: '职工台账列表',
  98. rightLink: {
  99. show: true,
  100. icon: 'icon-tongji',
  101. style: 'font-size:12px',
  102. title: '健康统计'
  103. },
  104. id: '',
  105. detail: [],
  106. curDate: '',
  107. isLoading: false,
  108. jsonList: [],
  109. allList: [],
  110. allCount: 0,
  111. undoCount: 0,
  112. doneCount: 0,
  113. selectedIndex: 0,
  114. setinput: "",
  115. listForm: {
  116. pageSize: 500,
  117. pageIndex: 1,
  118. totalPage: 1,
  119. pageIndex1: 1,
  120. totalPage1: 1,
  121. pageIndex2: 1,
  122. totalPage2: 1,
  123. },
  124. statList: [],
  125. }
  126. },
  127. created() {
  128. this.curDate = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}');
  129. },
  130. methods: {
  131. ckSelectedIndex(num) {
  132. this.selectedIndex = num;
  133. var allList = [];
  134. var map = new Map();
  135. for (var i in this.jsonList) {
  136. var mod = this.jsonList[i];
  137. if (num == 0) {
  138. } else if (num == 1 && !mod.upLoad) {
  139. continue;
  140. } else if (num == 2 && mod.upLoad) {
  141. continue;
  142. }
  143. var key = "(未分组)";
  144. if (mod.teacherInfo == null) {
  145. } else {
  146. key = mod.teacherInfo.jobType;
  147. }
  148. if (map.get(key) == null) {
  149. var arr = [];
  150. map.set(key, arr);
  151. }
  152. map.get(key).push(mod);
  153. }
  154. map.forEach(function(value, key) {
  155. var num1 = value.length;
  156. var num2 = 0;
  157. for (var i in value) {
  158. var le = value[i];
  159. if (le.upLoad) {
  160. num2++;
  161. } else {
  162. }
  163. }
  164. var mod = {
  165. name: key,
  166. list: value,
  167. num1: num1,
  168. num2: num2
  169. };
  170. allList.push(mod);
  171. });
  172. this.allList = allList;
  173. },
  174. searchK() {
  175. var inp = this.setinput;
  176. this.allList = [];
  177. this.queryList();
  178. },
  179. async queryList() {
  180. this.isLoading = true;
  181. await this.pageList('', this.listForm.pageIndex).then(page => {
  182. var map = new Map();
  183. for (var i in page.data) {
  184. var mod = page.data[i];
  185. var key = "(未分组)";
  186. if (mod.teacherInfo == null) {
  187. } else {
  188. key = mod.teacherInfo.jobType;
  189. }
  190. if (map.get(key) == null) {
  191. var arr = [];
  192. map.set(key, arr);
  193. }
  194. map.get(key).push(mod);
  195. }
  196. var self = this;
  197. this.jsonList = page.data;
  198. var allList = self.allList = [];
  199. self.allCount = page.data.length;
  200. var doneCount = 0;
  201. var undoCount = 0;
  202. map.forEach(function(value, key) {
  203. var num1 = value.length;
  204. var num2 = 0;
  205. for (var i in value) {
  206. var le = value[i];
  207. if (le.upLoad) {
  208. num2++;
  209. doneCount++;
  210. } else {
  211. undoCount++;
  212. }
  213. }
  214. var mod = {
  215. name: key,
  216. list: value,
  217. num1: num1,
  218. num2: num2
  219. };
  220. allList.push(mod);
  221. });
  222. self.doneCount = doneCount;
  223. self.undoCount = undoCount;
  224. //this.allCount = page.recordsTotal;
  225. this.listForm.pageIndex = page.pageNumber;
  226. this.listForm.totalPage = page.totalPage;
  227. });
  228. this.isLoading = false;
  229. },
  230. selectDate() {
  231. var dtPicker = new mui.DtPicker({
  232. type: 'date'
  233. });
  234. dtPicker.show((selectItems) => {
  235. var year = selectItems.y.value;
  236. var month = selectItems.m.value;
  237. var day = selectItems.d.value;
  238. this.curDate = year + "-" + month + "-" + day;
  239. this.queryList();
  240. });
  241. },
  242. pageList(status, index) {
  243. return API_Health.workerPageList({
  244. setinput: this.setinput,
  245. companyId: this.person_data.companyId,
  246. queryDate: this.curDate,
  247. status: status,
  248. pageIndex: index,
  249. pageSize: 500
  250. });
  251. },
  252. viewDetail(item) {
  253. if (item.upLoad) {
  254. this.$router.push({
  255. name: 'MasterHealthWorkerInfo',
  256. query: {
  257. id: item.personHealthLedgerId
  258. }
  259. })
  260. }
  261. },
  262. //获取健康码颜色值
  263. getGreenCodeColor(healthyCode) {
  264. var healthyCode = healthyCode || '11';
  265. var color = {
  266. "00": '#09ae47',
  267. "01": '#e5aa37',
  268. "10": '#fe616c',
  269. "11": '#C0C0C0'
  270. }
  271. return color[healthyCode];
  272. },
  273. //判断状态
  274. getCodeStatusName(code) {
  275. if (code == '00') {
  276. return '绿码';
  277. } else if (code == '01') {
  278. return '黄码';
  279. } else if (code == '10') {
  280. return '红码';
  281. } else if (code == '11') {
  282. return '灰码';
  283. } else {
  284. return '无码';
  285. }
  286. },
  287. //获取绿码统计数据
  288. getHealthyCodeStat() {
  289. this.isLoading = true;
  290. API_Health.getHealthyCodeStat(this.person_data.companyId, '3').then(response => {
  291. this.isLoading = false;
  292. this.statList = response;
  293. }).catch(error => {
  294. this.isLoading = false;
  295. mui.toast(error);
  296. })
  297. },
  298. asynCallBack() {},
  299. },
  300. mounted() {
  301. //获取列表
  302. this.queryList();
  303. //获取绿码统计数据
  304. this.getHealthyCodeStat();
  305. //document.getElementById('app').style.height = '100%';
  306. },
  307. destroyed() {
  308. },
  309. computed: {
  310. ...mapGetters({
  311. openId: 'wx_openid',
  312. token: 'token',
  313. person_data: 'person_data',
  314. person_popedom: 'person_popedom',
  315. })
  316. }
  317. }
  318. </script>
  319. <style scoped src="$project/assets/css/xpwyfyy.css"></style>
  320. <style scoped src="$project/assets/css/sczpfyy.css"></style>
  321. <style scoped src="$project/assets/css/wallfyy.css"></style>
  322. <style src="$project/assets/css/iconfont.css"></style>
  323. <style src="$project/assets/css/mui.picker.min.css"></style>
  324. <style>
  325. </style>