Cert.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <top-header :pageTitle="pageTitle" :rightLink="rightLink" :doRightLink="doRightLink" :headerStyle="'background-color:'+statusTitleColor"></top-header>
  5. <green-code ref="greenCode" :personId="subForm.personId"></green-code>
  6. <div class="mui-content vongi-jkz-content">
  7. <div class="vongi-jkz-content mui-content-padded mui-clearfix">
  8. <div class="vongi-jkz-left mui-col-xs-5">
  9. <div class="mui-content-padded faceaifyy-content">
  10. <div class="faceaifyy-content-region">
  11. <img :src="detail.faceImageUrl">
  12. </div>
  13. <div class="mui-media-body" style="width: 100%;">最近体温测量<span :style="'color:'+statusTitleColor" v-text="detail.lastTemperature+'℃'"></span></div>
  14. </div>
  15. </div>
  16. <div class="vongi-jkz-right mui-col-xs-7">
  17. <ul class="mui-table-view mui-grid-view mui-grid-9 fyy-statistics">
  18. <li class="mui-table-view-cell mui-media mui-col-xs-12">
  19. <div class="vongi-jkz-list">
  20. <div class="fyy-statistics-body">
  21. <h2>{{detail.name}}<span :style="'color:'+statusTitleColor">{{statusName}}</span></h2>
  22. <a class="mui-navigate-right" @click="showGreenCode">
  23. <span class="mui-icon iconfont icon-erweima1" :style="'color: '+statusTitleColor+';margin-right:15px;line-height: 27px'"></span>
  24. </a>
  25. </div>
  26. <div class="mui-ellipsis mui-h5" v-text="detail.parking"></div>
  27. <div class="mui-ellipsis mui-h5" v-text="detail.companyName"></div>
  28. </div>
  29. </li>
  30. <li class="mui-table-view-cell mui-media mui-col-xs-6">
  31. <div class="vongi-jkz-list">
  32. <div class="fyy-statistics-body">
  33. <h3><span class="color55f868 mui-h1" v-text="detail.totalDays"></span>天</h3>
  34. </div>
  35. <div class="mui-media-body">已连续正常天数</div>
  36. </div>
  37. </li>
  38. <li class="mui-table-view-cell mui-media mui-col-xs-6">
  39. <div class="vongi-jkz-list">
  40. <div class="fyy-statistics-body">
  41. <h3><span class="colorfe616c mui-h1" v-text="detail.undetectedCount"></span>次</h3>
  42. </div>
  43. <div class="mui-media-body">漏测记录</div>
  44. </div>
  45. </li>
  46. </ul>
  47. </div>
  48. </div>
  49. <div class="mui-content-padded fyy-echarts">
  50. <div class="fyy-echarts-inter" v-for="(item,index) in chartsList">
  51. <h4 class="colorf6f448">{{item.startDate}}~{{item.endDate}}</h4>
  52. <div :id="'linePicture'+index" style="width:100%;"></div>
  53. </div>
  54. <!-- <div class="fyy-annotation" @click="doChartTips">
  55. <div class="fyy-annotation-color">
  56. <span class="color09ae47"></span><span>14天连续测温正常</span>
  57. </div>
  58. <div class="fyy-annotation-color">
  59. <span class="colorfe616c"></span><span>7天内有一次以上异常</span>
  60. </div>
  61. <div class="fyy-annotation-color">
  62. <span class="colord39d33"></span><span>14天内有一次以上异常</span>
  63. </div>
  64. </div> -->
  65. </div>
  66. </div>
  67. <loading :visible="isLoading"></loading>
  68. </div>
  69. </template>
  70. <script>
  71. import * as API_Health from '@/apis/Common/health'
  72. import GreenCode from '@/components/GreenCode.vue'
  73. import echarts from 'echarts/lib/echarts'
  74. import 'echarts/lib/chart/line'
  75. import 'echarts/lib/component/legend'
  76. import 'echarts/lib/component/title'
  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. export default {
  85. name: 'CommonHealthTemperatureInfo',
  86. components: {
  87. Common,
  88. Loading,
  89. TopHeader,
  90. GreenCode
  91. },
  92. data() {
  93. return {
  94. pageTitle: '健康证',
  95. isLoading: false,
  96. rightLink: {
  97. show: true,
  98. icon: 'icon-shijian',
  99. style: 'font-size:14px;color:#000;',
  100. title: '测温记录'
  101. },
  102. detail: {},
  103. subForm: {
  104. personId: ''
  105. },
  106. chartsList: [],
  107. maxTemparture: 37,
  108. //和下面的对应默认值
  109. lineColor: '#e5aa37',
  110. statusColor: '#e5aa37',
  111. statusTitleColor: '#d39d33',
  112. statusName: '异常',
  113. }
  114. },
  115. created() {
  116. this.subForm.personId = this.$route.query.personId ? this.$route.query.personId : this.person_data.id;
  117. },
  118. methods: {
  119. //获取详情
  120. getDetail() {
  121. this.isLoading = true;
  122. API_Health.getCertDetail(this.subForm).then(response => {
  123. this.detail = response;
  124. this.maxTemparture = response.temperatureMax;
  125. this.isLoading = false;
  126. }).catch(error => {
  127. this.isLoading = false;
  128. mui.toast(error);
  129. })
  130. },
  131. //获取统计图表数据
  132. getEcharts() {
  133. this.isLoading = true;
  134. API_Health.getCertList(this.subForm).then(response => {
  135. this.chartsList = response;
  136. if (response.length > 0) {
  137. this.maxTemparture = response[0]['temperatureMax'];
  138. this.detail.totalDays = response[0]['totalDays'];
  139. this.detail.undetectedCount = response[0]['undetectedCount'];
  140. this.getStatus()
  141. this.echarts();
  142. }
  143. this.isLoading = false;
  144. }).catch(error => {
  145. this.isLoading = false;
  146. mui.toast(error);
  147. })
  148. },
  149. //计算显示颜色
  150. getStatus() {
  151. if (this.chartsList.length) {
  152. var chartList = this.chartsList[0]['list'].slice();
  153. chartList.reverse();
  154. //console.log(chartList)
  155. for (var index in chartList) {
  156. if (chartList[index]['value'] >= this.maxTemparture && index < 7) {
  157. this.statusColor = '#fe616c';
  158. this.statusTitleColor = '#ed5b65';
  159. this.statusName = '异常';
  160. break;
  161. } else if (chartList[index]['value'] >= this.maxTemparture && index < 14) {
  162. this.statusColor = '#e5aa37';
  163. this.statusTitleColor = '#d39d33';
  164. this.statusName = '异常';
  165. break;
  166. } else {
  167. this.statusColor = '#0bcf54';
  168. this.statusTitleColor = '#09ae47';
  169. this.statusName = '正常';
  170. }
  171. }
  172. //如果全为0则显示默认值
  173. var allzero = true;
  174. for (var index in chartList) {
  175. if (chartList[index]['value'] > 0) {
  176. allzero = false;
  177. break;
  178. }
  179. }
  180. if (allzero) {
  181. this.statusColor = '#e5aa37';
  182. this.statusTitleColor = '#d39d33';
  183. this.statusName = '异常';
  184. }
  185. }
  186. },
  187. echarts() {
  188. this.$nextTick(() => {
  189. var _titleData = [];
  190. var _listData = [];
  191. for (var index in this.chartsList) {
  192. for (var k in this.chartsList[index]['list']) {
  193. _titleData.push(this.chartsList[index]['list'][k]['name']);
  194. _listData.push(this.chartsList[index]['list'][k]['value']);
  195. }
  196. }
  197. console.log(_titleData);
  198. console.log(_listData);
  199. for (var index in this.chartsList) {
  200. var _this = this;
  201. //是否有异常数据
  202. for (var k in this.chartsList[index]['list']) {
  203. if (this.chartsList[index]['list'][k]['value'] >= this.maxTemparture) {
  204. this.lineColor = 'yellow';
  205. break;
  206. }
  207. }
  208. var wheight = window.screen.height;
  209. if (wheight < 480) {
  210. var rHeight = '180';
  211. var gHeight = '130';
  212. } else if (wheight >= 480 && wheight <= 568) {
  213. var rHeight = '190';
  214. var gHeight = '130';
  215. } else if (wheight > 568 && wheight <= 736) {
  216. var rHeight = '200';
  217. var gHeight = '130';
  218. } else {
  219. var rHeight = '230';
  220. var gHeight = '180';
  221. }
  222. // 基于准备好的dom,初始化echarts实例
  223. var myChart = echarts.init(document.getElementById('linePicture' + index));
  224. // 指定图表的配置项和数据
  225. var option = {
  226. xAxis: {
  227. type: 'category',
  228. boundaryGap: false,
  229. data: _titleData,
  230. axisLabel: {
  231. textStyle: {
  232. color: '#fff',
  233. fontSize: '12'
  234. },
  235. showMinLabel: true,
  236. showMaxLabel: true,
  237. },
  238. axisLine: {
  239. lineStyle: {
  240. type: 'solid',
  241. color: '#fff',
  242. //width: '2'
  243. }
  244. },
  245. },
  246. yAxis: {
  247. type: 'value',
  248. axisLabel: {
  249. textStyle: {
  250. color: '#fff',
  251. //fontSize: '12'
  252. },
  253. },
  254. min: 30,
  255. max: 40,
  256. splitNumber: 6,
  257. axisLine: {
  258. lineStyle: {
  259. type: 'solid',
  260. color: '#fff',
  261. //width: '2'
  262. }
  263. },
  264. splitLine: {
  265. lineStyle: {
  266. type: 'dashed',
  267. color: '#404978',
  268. }
  269. }
  270. },
  271. series: [{
  272. data: _listData,
  273. type: 'line',
  274. //smooth: true,
  275. markLine: { //添加警戒线
  276. symbol: "none", //去掉警戒线最后面的箭头
  277. name: "",
  278. silent: true,
  279. precision: 2,
  280. data: [{
  281. silent: true, //鼠标悬停事件 true没有,false有
  282. lineStyle: { //警戒线的样式 ,虚实 颜色
  283. type: "solid",
  284. color: "red"
  285. },
  286. label: {
  287. position: 'start'
  288. },
  289. yAxis: _this.maxTemparture
  290. }]
  291. },
  292. lineStyle: {
  293. normal: {
  294. color: _this.statusColor //改变区域颜色
  295. }
  296. },
  297. areaStyle: {
  298. color: _this.statusColor,
  299. }
  300. }],
  301. visualMap: {
  302. show: false,
  303. //dimension: 0,
  304. seriesIndex: 0,
  305. pieces: [{
  306. gt: _this.maxTemparture,
  307. lt: 40,
  308. color: 'red'
  309. }, {
  310. gt: 0,
  311. lt: _this.maxTemparture,
  312. color: 'green'
  313. }],
  314. },
  315. grid: {
  316. show: true,
  317. x: 40,
  318. x2: 30,
  319. y: 20,
  320. height: gHeight
  321. },
  322. };
  323. // 使用刚指定的配置项和数据显示图表。
  324. myChart.setOption(option);
  325. myChart.resize({
  326. height: rHeight + 'px'
  327. })
  328. }
  329. });
  330. },
  331. //显示健康码
  332. showGreenCode() {
  333. this.$refs.greenCode.showGreenCode();
  334. },
  335. //右上角点击事件
  336. doRightLink() {
  337. this.$router.push({
  338. name: 'CommonHealthTemperatureRecord',
  339. query: {}
  340. })
  341. },
  342. asynCallBack() {},
  343. },
  344. mounted() {
  345. //获取详情
  346. this.getDetail();
  347. //获取统计图表
  348. this.getEcharts();
  349. this.$refs.greenCode.getGreenCode();
  350. },
  351. destroyed() {},
  352. computed: {
  353. ...mapGetters({
  354. openId: 'wx_openid',
  355. token: 'token',
  356. person_data: 'person_data',
  357. company_data: 'company_data',
  358. })
  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 src="$project/assets/css/iconfont.css"></style>
  365. <style scoped>
  366. </style>