WorkerReport.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <top-header :pageTitle="pageTitle"></top-header>
  5. <div class="mui-content vongi-qingjiadt">
  6. <div class="mui-content-padded">
  7. <h5>身份信息</h5>
  8. </div>
  9. <form class="mui-input-group">
  10. <div class="mui-input-row">
  11. <label>姓名</label>
  12. <span>{{person_data.name}}</span>
  13. </div>
  14. <div class="mui-input-row">
  15. <label>手机号</label>
  16. <span>{{person_data.phone}}</span>
  17. </div>
  18. <div class="mui-input-row">
  19. <label>身份证号</label>
  20. <span>{{person_data.idCard}}</span>
  21. </div>
  22. <div class="mui-input-row">
  23. <label>所属单位</label>
  24. <span>{{person_data.position1}}</span>
  25. </div>
  26. <div class="mui-input-row">
  27. <label>所属部门</label>
  28. <span>{{person_data.position2}}</span>
  29. </div>
  30. <div class="mui-input-row">
  31. <label>岗位</label>
  32. <span>{{person_data.position3}}</span>
  33. </div>
  34. </form>
  35. <div class="mui-content-padded">
  36. <h5>健康状态</h5>
  37. </div>
  38. <form class="mui-input-group vongi-editme">
  39. <div class="mui-input-row">
  40. <label style="width:50%">自身健康情况<i class="colorfe616c" v-if="!curDateIsUpload" >*</i></label>
  41. <span v-if="curDateIsUpload" style="width:50%"
  42. v-html="report.healthStatusN">其他</span>
  43. <button class="mui-btn mui-btn-block mui-navigate-right"
  44. v-if="!curDateIsUpload"
  45. @click="selectHealthStatus"
  46. type='button' style="width:50%">
  47. {{report.healthStatusN}}
  48. </button>
  49. </div>
  50. <div class="mui-input-row">
  51. <label>今日体温<i class="colorfe616c" v-if="!curDateIsUpload" >*</i></label>
  52. <span v-if="curDateIsUpload"
  53. style="width:50%" v-html="report.temperature"></span>
  54. <input type="text" class="mui-input-clear"
  55. v-if="!curDateIsUpload"
  56. v-model="report.temperature" placeholder="请输入体温度数 ">
  57. </div>
  58. <div class="mui-input-row">
  59. <label>其他情况</label>
  60. <span v-if="curDateIsUpload"
  61. style="width:50%" v-html="report.healthRemark"></span>
  62. <input type="text" class="mui-input-clear"
  63. v-if="!curDateIsUpload"
  64. v-model="report.healthRemark" placeholder="请填写具体情况 ">
  65. </div>
  66. <div class="mui-input-row">
  67. <label style="width:70%">家庭成员身体健康情况<i class="colorfe616c" v-if="!curDateIsUpload" >*</i></label>
  68. <span v-if="curDateIsUpload" style="width:30%" v-html="report.familyStatusN">其他</span>
  69. <button v-if="!curDateIsUpload"
  70. @click="selectFamilyHealthStatus"
  71. class="mui-btn mui-btn-block mui-navigate-right" type='button' style="width:30%">
  72. {{report.familyStatusN}}
  73. </button>
  74. </div>
  75. <div class="mui-input-row vongi-wordcard vongi-input-up">
  76. <div class="mui-media-body">上传家庭成员健康码</div>
  77. <div class="fyy-upphoto">
  78. <div class="mui-col-xs-3 fyy-upphoto-close" v-for="(picture,index) in report.pictures" :key="index" >
  79. <img :src="picture + '?x-oss-process=image/resize,m_fill,w_128,h_128'" />
  80. <a class="mui-icon mui-icon-closeempty" v-if="!curDateIsUpload" @click="delImg(index)" ></a>
  81. </div>
  82. <div class="mui-col-xs-3" v-if="!curDateIsUpload" @click="changeImg" >
  83. <a><i class="mui-icon mui-icon-plusempty"></i></a>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="mui-input-row " :class="!curDateIsUpload?'vongi-pad':''">
  88. <div class="mui-media-body" v-if="!curDateIsUpload">假期是否曾前往重点疫区<i class="colorfe616c" >*</i></div>
  89. <label v-if="curDateIsUpload" style="width:70%;">假期是否曾前往重点疫区</label>
  90. <span v-if="curDateIsUpload" style="width:30%" v-html="report.isGoto ? '是' : '否'">是</span>
  91. <div class="mui-input-group flew" v-if="!curDateIsUpload" >
  92. <div class="mui-radio mui-left mui-col-xs-6">
  93. <label>是</label>
  94. <input v-model="report.isGoto" name="isGoto" value="true" type="radio">
  95. </div>
  96. <div class="mui-radio mui-left mui-col-xs-6">
  97. <label>否</label>
  98. <input v-model="report.isGoto" name="isGoto" value="false" type="radio">
  99. </div>
  100. </div>
  101. </div>
  102. <div class="mui-input-row " :class="!curDateIsUpload?'vongi-pad':''">
  103. <div class="mui-media-body" v-if="!curDateIsUpload">是否接触重点疫区高危人群<i class="colorfe616c" >*</i></div>
  104. <label v-if="curDateIsUpload" style="width:70%;">是否接触重点疫区高危人群</label>
  105. <span v-if="curDateIsUpload" style="width:30%" v-html="report.isTouch ? '是' : '否'">是</span>
  106. <div class="mui-input-group flew" v-if="!curDateIsUpload" >
  107. <div class="mui-radio mui-left mui-col-xs-6">
  108. <label>是</label>
  109. <input v-model="report.isTouch" name="isTouch" value="true" type="radio">
  110. </div>
  111. <div class="mui-radio mui-left mui-col-xs-6">
  112. <label>否</label>
  113. <input v-model="report.isTouch" name="isTouch" value="false" type="radio">
  114. </div>
  115. </div>
  116. </div>
  117. </form>
  118. <div class="vongi-btn vongi-login-btn" v-if="!curDateIsUpload&&!send">
  119. <button class="mui-btn mui-btn-primary " @click="submitReport()" >
  120. 提交
  121. </button>
  122. </div>
  123. <div class="fyy-popup-button" v-if="curDateIsUpload&&!send" >
  124. <div class="mui-col-xs-6">
  125. <button class="mui-btn mui-btn-primary " @click="sendReport()" >
  126. 确认提交
  127. </button>
  128. </div>
  129. <div class="mui-col-xs-6">
  130. <button class="mui-btn mui-btn-warning " @click="noSubmitReport()" >
  131. 撤回编辑
  132. </button>
  133. </div>
  134. </div>
  135. </div>
  136. <loading :visible="isLoading"></loading>
  137. </div>
  138. </template>
  139. <script>
  140. require('$project/assets/js/mui.picker.min.js');
  141. import * as API_Health from '@/apis/Master/health'
  142. import Common from '$project/components/Common.vue'
  143. import Loading from '$project/components/Loading.vue'
  144. import TopHeader from '$project/components/TopHeader.vue'
  145. import * as WxJsApi from '$project/utils/wxJsApi'
  146. import {
  147. mapGetters,
  148. mapMutations
  149. } from 'vuex'
  150. import {
  151. currentTimeStamp,
  152. parseUnixTime
  153. } from '$project/utils'
  154. export default {
  155. name: 'MasterHealthWorkerReport',
  156. components: {
  157. Common,
  158. Loading,
  159. TopHeader
  160. },
  161. data() {
  162. return {
  163. pageTitle: '健康打卡',
  164. id: '',
  165. student: {},
  166. report: {
  167. healthStatus: "",
  168. healthStatusN: "请选择",
  169. healthRemark: "",
  170. familyStatus: "",
  171. familyStatusN: "请选择",
  172. pictures: [],
  173. isGoto: false,
  174. isTouch: false
  175. },
  176. curDateIsUpload:false,
  177. send:false,
  178. isLoading: false,
  179. max:37.3,
  180. healthStatusList:[],
  181. }
  182. },
  183. created() {
  184. this.id = this.$route.query.id;
  185. this.getStatus();
  186. API_Health.curDateIsUpload().then(data => {
  187. this.curDateIsUpload=data;
  188. this.send=data;
  189. if (data) {
  190. API_Health.getDetail(this.id,'1').then(response => {
  191. this.isLoading = false;
  192. this.student = response;
  193. if(response.personHealthLedger!=null){
  194. this.report.healthStatusN=response.personHealthLedger.healthStatusN;
  195. this.report.healthRemark=response.personHealthLedger.healthRemark;
  196. this.report.familyStatusN=response.personHealthLedger.familyStatusN;
  197. this.report.isGoto=response.personHealthLedger.isGoto;
  198. this.report.isTouch=response.personHealthLedger.isTouch;
  199. this.report.pictures=response.personHealthLedger.familyGreenCode.split(',');
  200. this.report.temperature=response.personHealthLedger.temperature;
  201. }
  202. }).catch(error => {
  203. this.isLoading = false;
  204. mui.toast(error);
  205. })
  206. } else {
  207. API_Health.getPersonInfo('1').then(response => {
  208. this.student = response;
  209. if(response.personHealthLedger!=null){
  210. this.report.healthRemark=response.personHealthLedger.healthRemark;
  211. //this.report.temperature=response.personHealthLedger.temperature;
  212. this.report.healthStatusN=response.personHealthLedger.healthStatusN;
  213. this.report.familyStatusN=response.personHealthLedger.familyStatusN;
  214. this.report.healthStatus=response.personHealthLedger.healthStatus;
  215. this.report.familyStatus=response.personHealthLedger.familyStatus;
  216. this.report.isGoto=response.personHealthLedger.isGoto;
  217. this.report.isTouch=response.personHealthLedger.isTouch;
  218. //this.report.pictures=response.personHealthLedger.familyGreenCode.split(',');
  219. }
  220. this.id=response.id;
  221. }).catch(error => {
  222. this.isLoading = false;
  223. mui.toast(error);
  224. })
  225. }
  226. }).catch(error => {
  227. this.isLoading = false;
  228. mui.toast(error);
  229. })
  230. },
  231. methods: {
  232. asynCallBack(){},
  233. delImg(index){
  234. this.report.pictures.splice(index, 1);
  235. },
  236. changeImg() {
  237. if(this.report.pictures.length >= 3){
  238. mui.toast("只能上传3张家庭成员健康码");
  239. return;
  240. }
  241. var _this = this;
  242. WxJsApi.chooseImage().then(res => {
  243. var localData = res.localData;
  244. if (localData.indexOf('data:image') != 0) {
  245. //判断是否有这样的头部
  246. localData = 'data:image/jpeg;base64,' + localData
  247. }
  248. localData = localData.replace(/\r|\n/g, '').replace('data:image/jgp', 'data:image/jpeg')
  249. this.imgBase64 = localData;
  250. //显示裁剪图片
  251. //_this.showCropper(field);
  252. this.uploadpic();
  253. }).catch(error => {
  254. mui.toast(error);
  255. })
  256. },
  257. //上传图片
  258. uploadpic() {
  259. this.isLoading = true;
  260. WxJsApi.uploadPic(this.imgBase64).then(response => {
  261. this.isLoading = false;
  262. this.report.pictures.push(response);
  263. }).catch(error => {
  264. this.isLoading = false;
  265. mui.toast(error);
  266. })
  267. },
  268. selectHealthStatus() {
  269. var picker = new mui.PopPicker();
  270. picker.setData(this.healthStatusList);
  271. picker.show((selectItems) => {
  272. this.report.healthStatusN = selectItems[0].text;
  273. this.report.healthStatus = selectItems[0].value;
  274. });
  275. },
  276. selectFamilyHealthStatus() {
  277. var picker = new mui.PopPicker();
  278. picker.setData(this.healthStatusList);
  279. picker.show((selectItems) => {
  280. this.report.familyStatusN = selectItems[0].text;
  281. this.report.familyStatus = selectItems[0].value;
  282. });
  283. },
  284. uploadPicture(event) {
  285. if(this.report.pictures.length >= 3){
  286. mui.toast("只能上传3张家庭成员健康码");
  287. return;
  288. }
  289. var fileData = event.target.files[0];
  290. this.isLoading = true;
  291. API_Health.uploadPicture(fileData).then(data => {
  292. this.report.pictures.push(data);
  293. this.isLoading = false;
  294. }).catch(error => {
  295. this.isLoading = false;
  296. mui.toast(error);
  297. })
  298. },
  299. fatherMethod(idCard){
  300. this.student.idCard=idCard
  301. },
  302. selectGoto() {
  303. var picker = new mui.PopPicker();
  304. picker.setData([{
  305. text: "是",
  306. value: true
  307. },
  308. {
  309. text: "否",
  310. value: false
  311. }
  312. ]);
  313. picker.show((selectItems) => {
  314. this.report.isGoto = selectItems[0].value;
  315. });
  316. },
  317. selectTouch() {
  318. var picker = new mui.PopPicker();
  319. picker.setData([{
  320. text: "是",
  321. value: true
  322. },
  323. {
  324. text: "否",
  325. value: false
  326. }
  327. ]);
  328. picker.show((selectItems) => {
  329. this.report.isTouch = selectItems[0].value;
  330. });
  331. },
  332. sendReport(){
  333. this.isLoading = true;
  334. API_Health.save({
  335. ...this.report,
  336. personId: this.student.id,
  337. familyGreenCode: this.report.pictures.join(",")
  338. }).then(data => {
  339. mui.toast("已提交");
  340. this.send=false;
  341. this.isLoading = false;
  342. }).catch(error => {
  343. this.isLoading = false;
  344. mui.toast(error);
  345. })
  346. } ,noSubmitReport(){
  347. this.curDateIsUpload=false;
  348. },
  349. submitReport() {
  350. if (this.report.healthStatus.length == 0) {
  351. mui.toast("请选择自身健康情况!");
  352. return;
  353. }
  354. if (this.report.familyStatus.length == 0) {
  355. mui.toast("请选择家庭成员身体健康情况!");
  356. return;
  357. }
  358. if (!this.report.temperature) {
  359. mui.toast('请输入体温度数');
  360. return ;
  361. }
  362. var reg = new RegExp("^((3\\d)|(3\\d\\.\\d|40|40.0))$");
  363. if (!reg.test(this.report.temperature)) {
  364. mui.toast('请输入正确的数字[30.0-40.0]');
  365. return ;
  366. }
  367. if(this.report.isGoto=="true"||this.report.isGoto==true){
  368. this.report.isGoto=true;
  369. }else{
  370. this.report.isGoto=false;
  371. }
  372. if(this.report.isTouch=="true"||this.report.isTouch==true){
  373. this.report.isTouch=true;
  374. }else{
  375. this.report.isTouch=false;
  376. }
  377. // if (this.report.pictures.length == 0) {
  378. // mui.toast("请上传家庭成员健康码!");
  379. // return;
  380. // }
  381. this.curDateIsUpload=true;
  382. if(this.report.temperature>this.max){
  383. // mui.alert("提交温度大于等于<span style='color: red'>37.2°</span><br/>需要点击下方【确认提交】<br/>确认后不能修改!");
  384. // mui.alert("提交温度大于等于<span style='color: red'>37.2°</span><br/><ul><li>1、过高体温将会上报至平台管理人员</li><li>2、过高体温将会上报至学校领导</li></ul><br/>需要点击下方【确认提交】<br/>确认后不能修改!");
  385. mui.alert("提交体温<span style='color: red'>"+this.report.temperature+"℃</span>为异常体温,系统会将异常数据通报公司相关负责人。<br>如体温属实请点击下方【确认提交】按钮,确认后无法修改!");
  386. }else{
  387. mui.alert("需要点击下方【确认提交】<br/>确认后不能修改!");
  388. }
  389. //mui.alert("需要点击下方确认提交,确认后不能修改!");
  390. },
  391. getStatus(){
  392. API_Health.getHealthStatusList().then(data => {
  393. var arr = data.map(item => {
  394. return {
  395. value: item.value,
  396. text: item.name
  397. };
  398. });
  399. this.healthStatusList=arr
  400. }).catch(error => {
  401. this.isLoading = false;
  402. mui.toast(error);
  403. })
  404. },
  405. //获取详情
  406. getDetail() {
  407. this.isLoading = true;
  408. API_Health.getDetail(this.id, '3').then(response => {
  409. this.isLoading = false;
  410. this.detail = response;
  411. }).catch(error => {
  412. this.isLoading = false;
  413. mui.toast(error);
  414. })
  415. },
  416. asynCallBack() {},
  417. },
  418. mounted() {
  419. WxJsApi.getWxConfig();
  420. },
  421. destroyed() {
  422. },
  423. computed: {
  424. ...mapGetters({
  425. openId: 'wx_openid',
  426. token: 'token',
  427. person_data: 'person_data',
  428. person_popedom: 'person_popedom',
  429. })
  430. }
  431. }
  432. </script>
  433. <style src="$project/assets/css/mui.picker.min.css"></style>
  434. <style scoped src="$project/assets/css/xpwyfyy.css"></style>
  435. <style src="$project/assets/css/iconfont.css"></style>
  436. <style scoped>
  437. .fyy-popup-button{
  438. display: flex;
  439. padding:10px
  440. }
  441. .fyy-popup-button .mui-col-xs-6{
  442. padding:0 5px
  443. }
  444. .fyy-popup-button button{
  445. width:100%
  446. }
  447. </style>