yiqing-tiwen.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <div>
  3. <van-nav-bar
  4. title="体温填报"
  5. left-text="返回"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. >
  9. <template #right>
  10. <van-icon name="records" size="18" @click="tianbao" />
  11. </template>
  12. </van-nav-bar>
  13. <div class="contents">
  14. <form>
  15. <!-- <div class="contents_one">
  16. <img src="../../../assets/images/zaoquan/yiqing/定位.png" alt="" />
  17. <p>宁夏自治区灵武市枣泉煤矿东大门</p>
  18. <input type="button" value="重新定位" />
  19. </div> -->
  20. <div class="contents_two">
  21. <!-- <van-cell-group>
  22. <van-cell title="姓名" :value="name" />
  23. <van-cell title="部门" :value="department" />
  24. </van-cell-group> -->
  25. <van-cell-group>
  26. <van-field
  27. v-model="name"
  28. label="姓名"
  29. placeholder="请输入姓名"
  30. />
  31. <van-field
  32. v-model="department"
  33. label="部门"
  34. placeholder="请输入部门"
  35. />
  36. <van-field
  37. v-model="mobile"
  38. label="工号"
  39. placeholder="请输入工号"
  40. />
  41. </van-cell-group>
  42. </div>
  43. <div class="contents_three">
  44. <label for="tiwen">体温</label>
  45. <input
  46. type="text"
  47. name="tiwen"
  48. placeholder="请输入30.0~45.0"
  49. dir="rtl"
  50. size="14"
  51. v-model="tiwen"
  52. />
  53. </div>
  54. <div class="contents_six">
  55. <van-field
  56. readonly
  57. clickable
  58. name="picker"
  59. :value="value"
  60. label="身体状况"
  61. placeholder="请选择"
  62. @click="showPicker = true"
  63. />
  64. <van-popup v-model="showPicker" position="bottom">
  65. <van-picker
  66. show-toolbar
  67. :columns="columns"
  68. @confirm="onConfirm"
  69. @cancel="showPicker = false"
  70. />
  71. </van-popup>
  72. </div>
  73. <div class="contents_six">
  74. <van-field
  75. readonly
  76. clickable
  77. name="picker"
  78. :value="value1"
  79. label="来自地点"
  80. placeholder="请选择"
  81. @click="showPicker1 = true"
  82. />
  83. <van-popup v-model="showPicker1" position="bottom">
  84. <van-picker
  85. show-toolbar
  86. :columns="columns1"
  87. @confirm="onConfirm1"
  88. @cancel="showPicker1 = false"
  89. />
  90. </van-popup>
  91. </div>
  92. <div class="contents_six">
  93. <van-field
  94. readonly
  95. clickable
  96. name="picker"
  97. :value="value2"
  98. label="交通方式"
  99. placeholder="请选择"
  100. @click="showPicker2 = true"
  101. />
  102. <van-popup v-model="showPicker2" position="bottom">
  103. <van-picker
  104. show-toolbar
  105. :columns="columns2"
  106. @confirm="onConfirm2"
  107. @cancel="showPicker2 = false"
  108. />
  109. </van-popup>
  110. </div>
  111. <div class="contents_four">
  112. <label for="yimiao">是否接种疫苗</label>
  113. <div>
  114. <el-radio-group v-model="radio1" @change="reasons">
  115. <el-radio-button label="第一剂"></el-radio-button>
  116. <el-radio-button label="未接种"></el-radio-button>
  117. <el-radio-button label="第二剂"></el-radio-button>
  118. </el-radio-group>
  119. </div>
  120. </div>
  121. <div class="contents_four">
  122. <label for="hesuan">是否做过核酸检测</label>
  123. <div>
  124. <el-radio-group v-model="radio2">
  125. <el-radio-button label="是"></el-radio-button>
  126. <el-radio-button label="否"></el-radio-button>
  127. </el-radio-group>
  128. </div>
  129. </div>
  130. </form>
  131. </div>
  132. <div class="contents" v-show="reason">
  133. <p class="contents_five">未接种疫苗原因</p>
  134. <textarea
  135. placeholder="请说明原因"
  136. class="textareas"
  137. v-model="textareas"
  138. ></textarea>
  139. </div>
  140. <div class="buttons">
  141. <button @click="Submits">提交</button>
  142. </div>
  143. </div>
  144. </template>
  145. <script>
  146. //时间戳
  147. var getTime = function () {
  148. var date = new Date();
  149. var year = date.getFullYear();
  150. var month =
  151. date.getMonth() + 1 < 10
  152. ? "0" + (date.getMonth() + 1)
  153. : date.getMonth() + 1;
  154. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  155. var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  156. var minutes =
  157. date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  158. var seconds =
  159. date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  160. var mytime = `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`;
  161. return mytime;
  162. };
  163. import { location } from "../../../plugins/map.js";
  164. import { getAllUrlParams } from "../../../plugins/url-encapsulation.js";
  165. export default {
  166. data() {
  167. return {
  168. name: "",
  169. department: "",
  170. mobile:"",
  171. reason: false,
  172. tiwen: "",
  173. yimiao: 0,
  174. hesuan: 0,
  175. textareas: "",
  176. value: "",
  177. value1: "",
  178. value2: "",
  179. values: "",
  180. values1: "",
  181. values2: "",
  182. columns: ["正常", "异常"],
  183. showPicker: false,
  184. columns1: ["住矿(宿舍)", "银川", "吴中", "灵武", "宁东", "石嘴山"],
  185. showPicker1: false,
  186. columns2: ["私家车", "步行", "客运车", "出租车"],
  187. showPicker2: false,
  188. radio1: "第一剂",
  189. radio2: "否",
  190. // token: sessionStorage.getItem("mytoken")
  191. // ? sessionStorage.getItem("mytoken")
  192. // : "", //token值保存在本地,有的话取值,没有为空
  193. remarks: "备注",
  194. location: "gps暂无",
  195. times: getTime(),
  196. };
  197. },
  198. // witch: {
  199. // computed: {
  200. // tiwen() {
  201. // if (this.tiwen > 45 || this.tiwen < 30) {
  202. // this.$toast("请输入30-45");
  203. // }
  204. // },
  205. // },
  206. // },
  207. methods: {
  208. /**获取地图定位*/
  209. getLocation() {
  210. let _that = this;
  211. let geolocation = location.initMap("map-container"); //定位
  212. AMap.event.addListener(geolocation, "complete", (result) => {
  213. _that.lat = result.position.lat;
  214. _that.lng = result.position.lng;
  215. _that.province = result.addressComponent.province;
  216. _that.city = result.addressComponent.city;
  217. _that.district = result.addressComponent.district;
  218. });
  219. },
  220. reasons() {
  221. this.reason = !this.reason;
  222. // console.log("1");
  223. },
  224. reasons2() {
  225. // this.reason = false;
  226. console.log("2");
  227. },
  228. Submits() {
  229. // console.log(typeof(this.tiwen));
  230. if (
  231. Number(this.tiwen) > 45 ||
  232. Number(this.tiwen < 30) ||
  233. this.tiwen == ""
  234. ) {
  235. this.$toast("体温请填写30~45");
  236. } else {
  237. // console.log(this.name);
  238. // console.log(this.department);
  239. // console.log(this.tiwen);
  240. // console.log(this.radio1);
  241. // console.log(this.radio2);
  242. //疫苗情况
  243. if (this.radio1 == "第一剂") {
  244. this.yimiao = 1;
  245. }else if(this.radio1=="未接种"){
  246. this.yimiao = 3;
  247. }else {
  248. this.yimiao = 2;
  249. }
  250. //是否做过核酸
  251. if (this.radio2 == "是") {
  252. this.hesuan = 2;
  253. } else {
  254. this.hesuan = 1;
  255. }
  256. //身体状况
  257. if (this.value == "正常") {
  258. this.values = 2;
  259. } else {
  260. this.values = 1;
  261. }
  262. //来自地点
  263. if (this.value1 == "住矿(宿舍)") {
  264. this.values1 = 1;
  265. } else if (this.value1 == "银川") {
  266. this.values1 = 2;
  267. } else if (this.value1 == "吴中") {
  268. this.values1 = 3;
  269. } else if (this.value1 == "灵武") {
  270. this.values1 = 4;
  271. } else if (this.value1 == "宁东") {
  272. this.values1 = 5;
  273. } else {
  274. this.values1 = 6;
  275. }
  276. //交通方式
  277. if (this.value2 == "私家车") {
  278. this.values2 = 1;
  279. } else if (this.value2 == "步行") {
  280. this.values2 = 2;
  281. } else if (this.value2 == "客运车") {
  282. this.values2 = 3;
  283. } else {
  284. this.values2 = 4;
  285. }
  286. console.log(this.yimiao);
  287. // console.log(this.hesuan);
  288. // console.log(this.values);
  289. // console.log(this.values1);
  290. // console.log(this.values2);
  291. if (this.reason == true) {
  292. // console.log(this.textareas);
  293. }
  294. console.log(this.times);
  295. console.log(typeof this.tiwen);
  296. this.$http
  297. .post(
  298. "http://zaoquan.nxjiewei.com:8011/api/workbench/epidemic_situation/clock_in",
  299. {
  300. temperature: String(this.tiwen),
  301. vaccination: String(this.yimiao),
  302. not_vaccination_cause: this.textareas,
  303. // remarks: this.remarks,
  304. // location: this.location,
  305. nucleic_acid_test: String(this.hesuan),
  306. transport: String(this.values2),
  307. place: String(this.values1),
  308. health: String(this.values),
  309. clock_in_time: this.times,
  310. staff_num:this.mobile
  311. }
  312. )
  313. .then((res) => {
  314. console.log(res);
  315. this.$dialog.alert({
  316. message: "提交成功",
  317. });
  318. var myinfo = setInterval(
  319. this.$router.push(
  320. `/zaoquan/yiqing/yiqing?token=${this.gettoken}`
  321. ),
  322. 2000
  323. );
  324. clearInterval(myinfo);
  325. // this.$router.push(`/zaoquan/yiqing/yiqing?token=${this.token}`);
  326. })
  327. .catch((res) => {
  328. console.log(res);
  329. });
  330. }
  331. },
  332. tianbao() {
  333. // console.log("123");
  334. this.$router.push(`/zaoquan/yiqing/yiqing-tianbao?token=${this.token}&mobile=${this.mobile}`);
  335. },
  336. onConfirm(value) {
  337. this.value = value;
  338. this.showPicker = false;
  339. },
  340. onConfirm1(value1) {
  341. this.value1 = value1;
  342. this.showPicker1 = false;
  343. },
  344. onConfirm2(value2) {
  345. this.value2 = value2;
  346. this.showPicker2 = false;
  347. },
  348. getxinxi() {
  349. this.$http
  350. .post("http://zaoquan.nxjiewei.com:8011/api/user/info")
  351. .then((res) => {
  352. console.log(res);
  353. this.name = res.data.data.name;
  354. this.department = res.data.data.section_fullname;
  355. this.mobile=res.data.data.staff_num
  356. });
  357. },
  358. onClickLeft() {
  359. window.history.back();
  360. },
  361. },
  362. mounted() {
  363. document.body.style.backgroundColor = "#39f"; //背景色
  364. // this.getLocation();
  365. // this.gettoken = getAllUrlParams(window.location.href).token;
  366. // this.gettoken="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImU5MDQ2MWNiODRjMTlkMzBlMDRkYjYzY2I5ZTc5OWZlODk0MDU4ZGZlMTQwYjkzODU3ZjEzNWJhNTAxZTNmMmQ1YTA5NmVkZWQyZDRkYWZjIn0.eyJhdWQiOiIyIiwianRpIjoiZTkwNDYxY2I4NGMxOWQzMGUwNGRiNjNjYjllNzk5ZmU4OTQwNThkZmUxNDBiOTM4NTdmMTM1YmE1MDFlM2YyZDVhMDk2ZWRlZDJkNGRhZmMiLCJpYXQiOjE2Mjg1Nzk4NTAsIm5iZiI6MTYyODU3OTg1MCwiZXhwIjoxNjMxMTcxODUwLCJzdWIiOiIyMTA5Iiwic2NvcGVzIjpbIioiXX0.IN0d0HNck3NuGN-HYaKFbn1c0Li9YUgMgr_rtIeaNUt_b5YhT_Pv-5clNy06sKb9ZiQ_wqbfrfveQwZZ2si3zLZYMx8dMuFMdo6UNKZ8v_wKNWE1SwNtE41ug_4bhoMoR-m-hXYe-Euxyz0VImXGKJsfMrR7h40sQJvA6Dx0sVsy-4XPj2bytTlnIYPN-hQ-mzBDpPWBmEef-smRKq8_fUn1CESaJYovJ6CzY9U6P1mB8ZN-lYCSj3C5EWDx31ZRNZo8FQ6UY_59UlZjwiAigu8CozO9u8_ZA0S8_80ZKPRwosMsurHpwqaT9SmPm0fNRxc5hViy0oE6CBiZSo214_W89Qh3EwZWvvrtY1UruWL-PhzIJk00_TWvfVzIzPPM5maOysltAXv6qeOmps7tM-YJKzKJ6X6U3phwz7-n1KTPdTIkVEXzB8zr33XGqc6YytIUfVoo9cCZbwdS6qXf1xdaiJNNl_7CvXhyuM744DaaxUn2T6Vp6PUwHttmC0n7YNvIslSUHoYgdSRWabNoZpLMB2O-VpBdwr314Hvn_BL0k5Pupopa4yBfJLCbg5g_pWYKT_7LGyzXS7Ts29tki-PIcRvOCBoZ4TX4pt66J00VNlG35LGTzsFyZ5wbzHBJYoerAsRT-Q4uCXxRESD8ZtWzO-Z_ZbvXrte3ivL4DO0";
  367. // this.token = `Bearer ${this.gettoken}`; //获取token值
  368. this.token = getAllUrlParams(window.location.href).token;
  369. this.gettoken = getAllUrlParams(window.location.href).gettoken;
  370. // console.log(this.token);
  371. // sessionStorage.setItem("mytoken", this.token); //存入token值
  372. this.getxinxi();
  373. // this.myinfo=setInterval(this.Submits,this.$router.push(`/zaoquan/yiqing/yiqing?toen=${this.token}`), 2000);
  374. },
  375. beforeDestroy() {
  376. clearInterval(this.myinfo); //销毁阶段清除定时器
  377. },
  378. };
  379. </script>
  380. <style scoped>
  381. >>> .van-nav-bar {
  382. background: #39f;
  383. }
  384. >>> .van-nav-bar__title {
  385. color: #fff;
  386. }
  387. >>> .van-nav-bar .van-icon {
  388. color: #fff;
  389. }
  390. >>> .van-nav-bar__text {
  391. color: #fff;
  392. }
  393. [class*="van-hairline"]:after {
  394. border: none;
  395. }
  396. .contents1 {
  397. width: 90%;
  398. margin: 0 auto 10px;
  399. background: #fff;
  400. border-radius: 10px;
  401. border: 1px solid transparent;
  402. text-align: center;
  403. }
  404. .contents {
  405. width: 90%;
  406. margin: 0 auto 10px;
  407. background: #fff;
  408. border-radius: 10px;
  409. border: 1px solid transparent;
  410. }
  411. .contents_one {
  412. width: 95%;
  413. margin: 5px auto;
  414. padding-bottom: 10px;
  415. display: flex;
  416. justify-content: left;
  417. border-bottom: 1px solid #f0f0f0;
  418. }
  419. .contents_one > img {
  420. width: 40px;
  421. height: 40px;
  422. }
  423. .contents_one > p {
  424. width: 194px;
  425. font-size: 14px;
  426. margin-left: 15px;
  427. color: #00a1e9;
  428. }
  429. .contents_one > input {
  430. border: none;
  431. width: 77px;
  432. background: #39f;
  433. color: #fff;
  434. border-radius: 10px;
  435. height: 27px;
  436. font-size: 14px;
  437. margin-top: 6px;
  438. margin-left: 13px;
  439. }
  440. .contents_two {
  441. width: 95%;
  442. margin: 0 auto;
  443. border-bottom: 1px solid #f0f0f0;
  444. }
  445. .van-cell {
  446. padding: 10px 5px;
  447. }
  448. .van-cell__value {
  449. color: black;
  450. }
  451. .contents_three {
  452. width: 95%;
  453. margin: 0 auto;
  454. border-bottom: 1px solid #f0f0f0;
  455. display: flex;
  456. justify-content: space-between;
  457. padding: 10px 5px;
  458. }
  459. .contents_three > label {
  460. font-size: 14px;
  461. margin-left: 4px;
  462. }
  463. .contents_three > input {
  464. border: none;
  465. }
  466. input::-webkit-input-placeholder {
  467. color: #969799;
  468. font-size: 14px;
  469. text-align: right;
  470. }
  471. .contents_four {
  472. width: 95%;
  473. margin: 0 auto;
  474. border-bottom: 1px solid #f0f0f0;
  475. display: flex;
  476. justify-content: space-between;
  477. padding: 10px 5px;
  478. }
  479. .contents_four > label {
  480. font-size: 14px;
  481. margin-left: 4px;
  482. }
  483. .contents_five {
  484. width: 95%;
  485. margin: 0 auto;
  486. font-size: 14px;
  487. margin-left: 4px;
  488. border-bottom: 1px solid #f0f0f0;
  489. padding: 10px 5px;
  490. }
  491. .contents_six {
  492. width: 95%;
  493. margin: 0 auto;
  494. border-bottom: 1px solid #f0f0f0;
  495. }
  496. .buttons {
  497. text-align: center;
  498. margin: 25px auto;
  499. }
  500. .buttons > button {
  501. width: 90%;
  502. height: 40px;
  503. border: none;
  504. background: #fff;
  505. color: #39f;
  506. border-radius: 10px;
  507. }
  508. .textareas {
  509. border: none;
  510. margin-left: 8px;
  511. font-size: 15px;
  512. width: 95%;
  513. margin-top: 10px;
  514. resize: none;
  515. }
  516. >>> .van-field__control {
  517. text-align: right;
  518. }
  519. >>> .el-radio-button {
  520. margin-left: 4px;
  521. }
  522. >>> .el-radio-button:last-child .el-radio-button__inner {
  523. border-radius: 14px;
  524. }
  525. >>> .el-radio-button__inner {
  526. white-space: nowrap;
  527. background: #fff;
  528. border: 1px solid #dcdfe6;
  529. font-weight: 500;
  530. /* border-left: 1px; */
  531. color: #606266;
  532. -webkit-appearance: none;
  533. text-align: center;
  534. box-sizing: border-box;
  535. outline: 0;
  536. margin: 0;
  537. position: relative;
  538. cursor: pointer;
  539. transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  540. padding: 6px 12px;
  541. font-size: 11px;
  542. }
  543. >>>.el-radio-button__inner{
  544. border-radius: 14px;
  545. }
  546. >>> .el-radio-button:first-child .el-radio-button__inner {
  547. border-radius: 14px;
  548. }
  549. </style>