yiqing-tiwen.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <div>
  3. <div v-if="shows">
  4. <van-nav-bar
  5. title="体温填报"
  6. left-text="返回"
  7. left-arrow
  8. @click-left="onClickLeft"
  9. >
  10. <template #right>
  11. <van-icon name="records" size="18" @click="tianbao" />
  12. </template>
  13. </van-nav-bar>
  14. </div>
  15. <div class="contents">
  16. <form>
  17. <!-- <div class="contents_one">
  18. <img src="../../../assets/images/zaoquan/yiqing/定位.png" alt="" />
  19. <p>宁夏自治区灵武市枣泉煤矿东大门</p>
  20. <input type="button" value="重新定位" />
  21. </div> -->
  22. <div class="contents_two">
  23. <!-- <van-cell-group>
  24. <van-cell title="姓名" :value="name" />
  25. <van-cell title="部门" :value="department" />
  26. </van-cell-group> -->
  27. <van-cell-group>
  28. <van-field v-model="name" label="姓名" placeholder="请输入姓名" />
  29. <van-field
  30. v-model="department"
  31. label="部门"
  32. placeholder="请输入部门"
  33. />
  34. <van-field v-model="mobile" label="工号" placeholder="请输入工号" />
  35. </van-cell-group>
  36. </div>
  37. <div class="contents_three">
  38. <label for="tiwen">体温</label>
  39. <input
  40. type="text"
  41. name="tiwen"
  42. placeholder="请输入30.0~45.0"
  43. dir="rtl"
  44. size="14"
  45. v-model="tiwen"
  46. />
  47. </div>
  48. <div class="contents_six">
  49. <van-field
  50. readonly
  51. clickable
  52. name="picker"
  53. :value="value"
  54. label="身体状况"
  55. placeholder="请选择"
  56. @click="showPicker = true"
  57. />
  58. <van-popup v-model="showPicker" position="bottom">
  59. <van-picker
  60. show-toolbar
  61. :columns="columns"
  62. @confirm="onConfirm"
  63. @cancel="showPicker = false"
  64. />
  65. </van-popup>
  66. </div>
  67. <div class="contents_six">
  68. <van-field
  69. readonly
  70. clickable
  71. name="picker"
  72. :value="value1"
  73. label="来自地点"
  74. placeholder="请选择"
  75. @click="showPicker1 = true"
  76. />
  77. <van-popup v-model="showPicker1" position="bottom">
  78. <van-picker
  79. show-toolbar
  80. :columns="columns1"
  81. @confirm="onConfirm1"
  82. @cancel="showPicker1 = false"
  83. />
  84. </van-popup>
  85. </div>
  86. <div class="contents_six">
  87. <van-field
  88. readonly
  89. clickable
  90. name="picker"
  91. :value="value2"
  92. label="交通方式"
  93. placeholder="请选择"
  94. @click="showPicker2 = true"
  95. />
  96. <van-popup v-model="showPicker2" position="bottom">
  97. <van-picker
  98. show-toolbar
  99. :columns="columns2"
  100. @confirm="onConfirm2"
  101. @cancel="showPicker2 = false"
  102. />
  103. </van-popup>
  104. </div>
  105. <div class="contents_four">
  106. <label for="yimiao">是否接种疫苗</label>
  107. <div>
  108. <el-radio-group v-model="radio1" @change="reasons">
  109. <el-radio-button label="第二剂"></el-radio-button>
  110. <el-radio-button label="第一剂"></el-radio-button>
  111. <el-radio-button label="未接种"></el-radio-button>
  112. </el-radio-group>
  113. </div>
  114. </div>
  115. <div class="contents_four">
  116. <label for="hesuan">是否做过核酸检测</label>
  117. <div>
  118. <el-radio-group v-model="radio2">
  119. <el-radio-button label="是"></el-radio-button>
  120. <el-radio-button label="否"></el-radio-button>
  121. </el-radio-group>
  122. </div>
  123. </div>
  124. </form>
  125. </div>
  126. <div class="contents" v-show="reason">
  127. <p class="contents_five">未接种疫苗原因</p>
  128. <textarea
  129. placeholder="请说明原因"
  130. class="textareas"
  131. v-model="textareas"
  132. ></textarea>
  133. </div>
  134. <div class="buttons">
  135. <button @click="Submits">提交</button>
  136. </div>
  137. </div>
  138. </template>
  139. <script>
  140. //时间戳
  141. var getTime = function () {
  142. var date = new Date();
  143. var year = date.getFullYear();
  144. var month =
  145. date.getMonth() + 1 < 10
  146. ? "0" + (date.getMonth() + 1)
  147. : date.getMonth() + 1;
  148. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  149. var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  150. var minutes =
  151. date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  152. var seconds =
  153. date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  154. var mytime = `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`;
  155. return mytime;
  156. };
  157. import { location } from "../../../plugins/map.js";
  158. import { getAllUrlParams } from "../../../plugins/url-encapsulation.js";
  159. export default {
  160. data() {
  161. return {
  162. shows:false,
  163. name: "",
  164. department: "",
  165. mobile: "",
  166. reason: false,
  167. tiwen: "",
  168. yimiao: 0,
  169. hesuan: 0,
  170. textareas: "",
  171. value: "",
  172. value1: "",
  173. value2: "",
  174. values: "",
  175. values1: "",
  176. values2: "",
  177. columns: ["正常", "异常"],
  178. showPicker: false,
  179. columns1: ["住矿(宿舍)", "银川", "吴中", "灵武", "宁东", "石嘴山"],
  180. showPicker1: false,
  181. columns2: ["私家车", "步行", "客运车", "出租车"],
  182. showPicker2: false,
  183. radio1: "第二剂",
  184. radio2: "否",
  185. // token: sessionStorage.getItem("mytoken")
  186. // ? sessionStorage.getItem("mytoken")
  187. // : "", //token值保存在本地,有的话取值,没有为空
  188. remarks: "备注",
  189. location: "gps暂无",
  190. times: getTime(),
  191. };
  192. },
  193. // witch: {
  194. // computed: {
  195. // tiwen() {
  196. // if (this.tiwen > 45 || this.tiwen < 30) {
  197. // this.$toast("请输入30-45");
  198. // }
  199. // },
  200. // },
  201. // },
  202. methods: {
  203. /**获取地图定位*/
  204. getLocation() {
  205. let _that = this;
  206. let geolocation = location.initMap("map-container"); //定位
  207. AMap.event.addListener(geolocation, "complete", (result) => {
  208. _that.lat = result.position.lat;
  209. _that.lng = result.position.lng;
  210. _that.province = result.addressComponent.province;
  211. _that.city = result.addressComponent.city;
  212. _that.district = result.addressComponent.district;
  213. });
  214. },
  215. reasons() {
  216. this.reason = !this.reason;
  217. // console.log("1");
  218. },
  219. reasons2() {
  220. // this.reason = false;
  221. console.log("2");
  222. },
  223. Submits() {
  224. // console.log(typeof(this.tiwen));
  225. if (
  226. Number(this.tiwen) > 45 ||
  227. Number(this.tiwen < 30) ||
  228. this.tiwen == ""
  229. ) {
  230. this.$toast("体温请填写30~45");
  231. } else {
  232. // console.log(this.name);
  233. // console.log(this.department);
  234. // console.log(this.tiwen);
  235. // console.log(this.radio1);
  236. // console.log(this.radio2);
  237. //疫苗情况
  238. if (this.radio1 == "第一剂") {
  239. this.yimiao = 1;
  240. } else if (this.radio1 == "未接种") {
  241. this.yimiao = 3;
  242. } else {
  243. this.yimiao = 2;
  244. }
  245. //是否做过核酸
  246. if (this.radio2 == "是") {
  247. this.hesuan = 2;
  248. } else {
  249. this.hesuan = 1;
  250. }
  251. //身体状况
  252. if (this.value == "正常") {
  253. this.values = 2;
  254. } else {
  255. this.values = 1;
  256. }
  257. //来自地点
  258. if (this.value1 == "住矿(宿舍)") {
  259. this.values1 = 1;
  260. } else if (this.value1 == "银川") {
  261. this.values1 = 2;
  262. } else if (this.value1 == "吴中") {
  263. this.values1 = 3;
  264. } else if (this.value1 == "灵武") {
  265. this.values1 = 4;
  266. } else if (this.value1 == "宁东") {
  267. this.values1 = 5;
  268. } else {
  269. this.values1 = 6;
  270. }
  271. //交通方式
  272. if (this.value2 == "私家车") {
  273. this.values2 = 1;
  274. } else if (this.value2 == "步行") {
  275. this.values2 = 2;
  276. } else if (this.value2 == "客运车") {
  277. this.values2 = 3;
  278. } else {
  279. this.values2 = 4;
  280. }
  281. console.log(this.yimiao);
  282. // console.log(this.hesuan);
  283. // console.log(this.values);
  284. // console.log(this.values1);
  285. // console.log(this.values2);
  286. if (this.reason == true) {
  287. // console.log(this.textareas);
  288. }
  289. console.log(this.times);
  290. console.log(typeof this.tiwen);
  291. this.$http
  292. .post(
  293. "http://zaoquan.nxjiewei.com:8011/api/workbench/epidemic_situation/clock_in",
  294. {
  295. temperature: String(this.tiwen),
  296. vaccination: String(this.yimiao),
  297. not_vaccination_cause: this.textareas,
  298. // remarks: this.remarks,
  299. // location: this.location,
  300. nucleic_acid_test: String(this.hesuan),
  301. transport: String(this.values2),
  302. place: String(this.values1),
  303. health: String(this.values),
  304. clock_in_time: this.times,
  305. staff_num: this.mobile,
  306. }
  307. )
  308. .then((res) => {
  309. console.log(res);
  310. this.$dialog.alert({
  311. message: "提交成功",
  312. });
  313. var myinfo = setInterval(
  314. this.$router.push(
  315. `/zaoquan/yiqing/yiqing?token=${this.gettoken}`
  316. ),
  317. 2000
  318. );
  319. clearInterval(myinfo);
  320. // this.$router.push(`/zaoquan/yiqing/yiqing?token=${this.token}`);
  321. })
  322. .catch((res) => {
  323. console.log(res);
  324. });
  325. }
  326. },
  327. tianbao() {
  328. // console.log("123");
  329. this.$router.push(
  330. `/zaoquan/yiqing/yiqing-tianbao?token=${this.token}&mobile=${this.mobile}`
  331. );
  332. },
  333. onConfirm(value) {
  334. this.value = value;
  335. this.showPicker = false;
  336. },
  337. onConfirm1(value1) {
  338. this.value1 = value1;
  339. this.showPicker1 = false;
  340. },
  341. onConfirm2(value2) {
  342. this.value2 = value2;
  343. this.showPicker2 = false;
  344. },
  345. getxinxi() {
  346. this.$http
  347. .post("http://zaoquan.nxjiewei.com:8011/api/user/info")
  348. .then((res) => {
  349. console.log(res);
  350. this.name = res.data.data.name;
  351. this.department = res.data.data.section_fullname;
  352. this.mobile = res.data.data.staff_num;
  353. });
  354. },
  355. onClickLeft() {
  356. window.history.back();
  357. },
  358. },
  359. mounted() {
  360. document.body.style.backgroundColor = "#39f"; //背景色
  361. // this.getLocation();
  362. // this.gettoken = getAllUrlParams(window.location.href).token;
  363. // 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";
  364. // this.token = `Bearer ${this.gettoken}`; //获取token值
  365. this.token = getAllUrlParams(window.location.href).token;
  366. this.gettoken = getAllUrlParams(window.location.href).gettoken;
  367. // console.log(this.token);
  368. this.tabbar = Boolean(getAllUrlParams(window.location.href).tabbar);
  369. this.shows = this.tabbar;
  370. console.log(this.shows);
  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: 7px 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: 7px 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>