personnel.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <template>
  2. <div class="personnel">
  3. <div class="personnel-btn">
  4. <div
  5. @click="clickBtn(btn, index)"
  6. class="i-btn"
  7. v-for="(btn, index) of btns"
  8. :key="index"
  9. :class="{ active: index == btnIndex }"
  10. >
  11. {{ btn.name }}
  12. </div>
  13. </div>
  14. <div class="personnel-box">
  15. <div
  16. class="personnel-box-item"
  17. v-for="(item, index) in resData"
  18. :key="index"
  19. @click="todesc(item)"
  20. :style="[item.objects && frontOneHour < item.objects['LAT'].ts ? 'order:-1' :'']"
  21. >
  22. <div class="personnel-box-item-h">
  23. <div class="personnel-box-item-header">
  24. <img :src="imgurl(item.username)" />
  25. </div>
  26. <div class="personnel-box-item-form">
  27. <div class="personnel-box-item-group">
  28. <div class="personnel-box-item-label">收缩血压:</div>
  29. <div class="personnel-box-item-value">
  30. {{ item.objects && item.objects.SSXY.doubleValue.toFixed(2) }}
  31. </div>
  32. </div>
  33. <div class="personnel-box-item-group">
  34. <div class="personnel-box-item-label">舒张血压:</div>
  35. <div class="personnel-box-item-value">
  36. {{ item.objects && item.objects.SZXY.doubleValue.toFixed(2) }}
  37. </div>
  38. </div>
  39. <div class="personnel-box-item-group">
  40. <div class="personnel-box-item-label">心跳频率:</div>
  41. <div class="personnel-box-item-value">
  42. {{ item.objects && item.objects.XTPL.doubleValue.toFixed(2) }}
  43. </div>
  44. </div>
  45. <div class="personnel-box-item-group">
  46. <div class="personnel-box-item-label">血氧浓度:</div>
  47. <div class="personnel-box-item-value">
  48. {{ item.objects && item.objects.XYND.doubleValue.toFixed(2) }}
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="personnel-box-item-f">
  54. <div class="personnel-box-item-name">
  55. {{ item.objects && item.username }}
  56. </div>
  57. <div class="personnel-box-item-icon">
  58. <i
  59. :class="[
  60. 'el-icon-user-solid',
  61. item.objects && frontOneHour < item.objects['LAT'].ts
  62. ? 'icolor'
  63. : '',
  64. ]"
  65. ></i>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <el-dialog
  71. title="人员信息"
  72. v-model="dialogVisible"
  73. width="1400px"
  74. top="10vh"
  75. custom-class="modal hide-header"
  76. :close-on-click-modal="false"
  77. >
  78. <div class="info-popup">
  79. <div class="query left mg-b-8">
  80. <div class="query-items">
  81. <div class="query-item">
  82. <div class="lable">开始日期:</div>
  83. <div class="search-input">
  84. <el-date-picker
  85. v-model="startdate"
  86. type="datetime"
  87. placeholder="选择日期"
  88. popper-class="date-select"
  89. class="placeholder-left"
  90. >
  91. </el-date-picker>
  92. </div>
  93. </div>
  94. <div class="query-item">
  95. <div class="lable">结束日期:</div>
  96. <div class="search-input">
  97. <el-date-picker
  98. v-model="enddate"
  99. type="datetime"
  100. placeholder="选择日期"
  101. popper-class="date-select"
  102. class="placeholder-left"
  103. >
  104. </el-date-picker>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="query-actions">
  109. <button class="btn green" @click="searchper">查询</button>
  110. </div>
  111. </div>
  112. <div class="prople-info mg-t-16 mg-b-16">
  113. <div class="prople-info-item">
  114. <div class="font-md gray-l">检修人员</div>
  115. <div class="font-md white">
  116. {{ perData.objects && perData.username }}
  117. </div>
  118. </div>
  119. <div class="prople-info-item">
  120. <div class="font-md gray-l">疲劳度</div>
  121. <div class="font-md white">
  122. {{
  123. perData.objects && perData.objects.PLD.doubleValue.toFixed(2)
  124. }}
  125. </div>
  126. </div>
  127. <div class="prople-info-item">
  128. <div class="font-md gray-l">步数</div>
  129. <div class="font-md white">
  130. {{ perData.objects && perData.objects.BS.doubleValue.toFixed(2) }}
  131. </div>
  132. </div>
  133. <div class="prople-info-item">
  134. <div class="font-md gray-l">收缩血压</div>
  135. <div class="font-md white">
  136. {{
  137. perData.objects && perData.objects.SSXY.doubleValue.toFixed(2)
  138. }}
  139. </div>
  140. </div>
  141. <div class="prople-info-item">
  142. <div class="font-md gray-l">舒张血压</div>
  143. <div class="font-md white">
  144. {{
  145. perData.objects && perData.objects.SZXY.doubleValue.toFixed(2)
  146. }}
  147. </div>
  148. </div>
  149. <div class="prople-info-item">
  150. <div class="font-md gray-l">心跳频率</div>
  151. <div class="font-md white">
  152. {{
  153. perData.objects && perData.objects.XTPL.doubleValue.toFixed(2)
  154. }}
  155. </div>
  156. </div>
  157. <div class="prople-info-item">
  158. <div class="font-md gray-l">血氧浓度</div>
  159. <div class="font-md white">
  160. {{
  161. perData.objects && perData.objects.XYND.doubleValue.toFixed(2)
  162. }}
  163. </div>
  164. </div>
  165. </div>
  166. <div class="white font-md mg-t-16 mg-b-16">检测人员健康情况</div>
  167. <normal-line-chart
  168. class="people-chart"
  169. height="45vh"
  170. :showLegend="true"
  171. :units="['半小时检测值']"
  172. :list="chartList"
  173. />
  174. </div>
  175. </el-dialog>
  176. </div>
  177. </template>
  178. <script>
  179. import NormalLineChart from "@com/chart/line/normal-line-chart.vue";
  180. import axios from "axios";
  181. export default {
  182. // 名称
  183. name: "personnel",
  184. // 使用组件
  185. components: {
  186. NormalLineChart,
  187. },
  188. // 数据
  189. data() {
  190. return {
  191. btns: [
  192. {
  193. name: "全部",
  194. val: "",
  195. },
  196. {
  197. name: "麻黄山",
  198. val: "MHS_FDC",
  199. },
  200. {
  201. name: "牛首山",
  202. val: "NSS_FDC",
  203. },
  204. {
  205. name: "青山",
  206. val: "QS_FDC",
  207. },
  208. {
  209. name: "石板泉",
  210. val: "SBQ_FDC",
  211. },
  212. {
  213. name: "香山",
  214. val: "XS_FDC",
  215. },
  216. ],
  217. btnIndex: 0,
  218. dialogVisible: false,
  219. resData: null,
  220. perData: null,
  221. frontOneHour: new Date().getTime() - 10 * 60 * 1000, //前十分钟
  222. startdate: new Date(new Date().getTime() - 60 * 60 * 1000
  223. ).formatDate("yyyy-MM-dd hh:mm:ss"),
  224. enddate: new Date(new Date()).formatDate("yyyy-MM-dd hh:mm:ss"),
  225. chartList: [
  226. {
  227. title: "疲劳度",
  228. yAxisIndex: 0,
  229. value: [
  230. {
  231. text: "1",
  232. value: 1,
  233. },
  234. {
  235. text: "2",
  236. value: 2,
  237. },
  238. {
  239. text: "3",
  240. value: 1,
  241. },
  242. {
  243. text: "4",
  244. value: 3,
  245. },
  246. {
  247. text: "5",
  248. value: 3,
  249. },
  250. {
  251. text: "6",
  252. value: 3,
  253. },
  254. {
  255. text: "7",
  256. value: 3,
  257. },
  258. {
  259. text: "8",
  260. value: 3,
  261. },
  262. {
  263. text: "9",
  264. value: 3,
  265. },
  266. {
  267. text: "10",
  268. value: 3,
  269. },
  270. {
  271. text: "11",
  272. value: 3,
  273. },
  274. {
  275. text: "12",
  276. value: 3,
  277. },
  278. {
  279. text: "13",
  280. value: 3,
  281. },
  282. {
  283. text: "14",
  284. value: 3,
  285. },
  286. {
  287. text: "15",
  288. value: 3,
  289. },
  290. {
  291. text: "16",
  292. value: 3,
  293. },
  294. ],
  295. },
  296. {
  297. title: "上网电量",
  298. yAxisIndex: 0,
  299. value: [
  300. {
  301. text: "1",
  302. value: 1,
  303. },
  304. {
  305. text: "2",
  306. value: 2,
  307. },
  308. {
  309. text: "3",
  310. value: 1,
  311. },
  312. {
  313. text: "4",
  314. value: 3,
  315. },
  316. ],
  317. },
  318. ],
  319. };
  320. },
  321. // 函数
  322. methods: {
  323. imgurl(v) {
  324. try {
  325. const url = require(`@assets/person/${v}.jpg`);
  326. return url;
  327. } catch (error) {
  328. return require("@assets/userhead.jpg");
  329. }
  330. },
  331. clickBtn(btn, index) {
  332. this.search(btn.val);
  333. this.btnIndex = index;
  334. },
  335. clickItem(index) {
  336. this.panelIndex = index;
  337. },
  338. async todesc(item) {
  339. this.dialogVisible = true;
  340. this.perData = item;
  341. this.searchper();
  342. },
  343. async searchper() {
  344. const { data } = await axios.get(
  345. //http://192.168.10.12:8082/ //http://10.155.32.4:8010
  346. // `http://10.155.32.4:8034/bracelet/getInfo?userid=1864&beginDate=2021-07-15+12%3A01%3A22&endDate=2021-07-15+15%3A01%3A22`);
  347. `http://10.155.32.4:8034/bracelet/getInfo?userid=${this.perData.mobile}&beginDate=${new Date(this.startdate).formatDate("yyyy-MM-dd hh:mm:ss")}&endDate=${new Date(this.enddate).formatDate("yyyy-MM-dd hh:mm:ss")}`);
  348. console.warn(data);
  349. let arr = [];
  350. let resarr = ["pld", "ssxy", "szxy", "xtpl", "xy"];
  351. const objb = {
  352. pld: "疲劳度",
  353. ssxy: "收缩血压",
  354. szxy: "舒张血压",
  355. xtpl: "心跳频率",
  356. xy: "血氧",
  357. };
  358. resarr.forEach((e) => {
  359. let obj = {
  360. title: objb[e],
  361. yAxisIndex: 0,
  362. value: [],
  363. };
  364. let vlarr = [];
  365. data.forEach((k) => {
  366. let obj1 = {
  367. text: new Date(k.date).formatDate("hh:mm"),
  368. value: k[e]
  369. };
  370. vlarr.push(obj1);
  371. });
  372. obj.value = vlarr;
  373. arr.push(obj);
  374. });
  375. console.warn(arr);
  376. this.chartList = arr;
  377. },
  378. async search(id) {
  379. const { data } = await axios.get(
  380. `http://192.168.1.18:8087/shbraceletuser/selectRaceletUserinfo?stationid=${id}&pageNum=${1}&pageSize=${300}`
  381. );
  382. const res = data.data.records;
  383. this.resData = res;
  384. },
  385. },
  386. // 生命周期钩子
  387. beforeCreate() {
  388. // 创建前
  389. },
  390. created() {
  391. // 创建后
  392. this.search("");
  393. },
  394. beforeMount() {
  395. // 渲染前
  396. },
  397. mounted() {
  398. // 渲染后
  399. },
  400. beforeUpdate() {
  401. // 数据更新前
  402. },
  403. updated() {
  404. // 数据更新后
  405. },
  406. };
  407. </script>
  408. <style lang="less">
  409. .icolor {
  410. color: #05bb4c;
  411. }
  412. .personnel {
  413. widows: 100%;
  414. height: calc(100vh - 90px);
  415. overflow-y: auto;
  416. .personnel-btn {
  417. display: flex;
  418. .i-btn {
  419. width: 11.296vh;
  420. height: 3.056vh;
  421. line-height: 3.056vh;
  422. background: #53626833;
  423. border: 1px solid #53626833;
  424. text-align: center;
  425. cursor: pointer;
  426. font-size: 1.296vh;
  427. color: #b3bdc0;
  428. transition: all 0.3s;
  429. + .i-btn {
  430. margin-left: 0.926vh;
  431. }
  432. &:hover,
  433. &.active {
  434. border: 1px solid #05bb4c;
  435. background: #05bb4c33;
  436. color: #05bb4c;
  437. }
  438. }
  439. }
  440. .personnel-box {
  441. display: flex;
  442. flex-wrap: wrap;
  443. margin-top: 6px;
  444. .personnel-box-item {
  445. width: 198px;
  446. height: 105px;
  447. background: #53626833;
  448. border: 1px solid #53626833;
  449. margin: 10px 10px 0 0;
  450. cursor: pointer;
  451. transition: all 0.3s;
  452. padding: 6px;
  453. display: flex;
  454. flex-direction: column;
  455. .personnel-box-item-h {
  456. height: 74px;
  457. display: flex;
  458. .personnel-box-item-header {
  459. height: 100%;
  460. width: 52px;
  461. margin-right: 12px;
  462. background: #848b8a;
  463. display: flex;
  464. align-items: center;
  465. justify-content: center;
  466. img {
  467. width: 100%;
  468. // height: 100%;
  469. }
  470. }
  471. .personnel-box-item-form {
  472. flex-grow: 1;
  473. .personnel-box-item-group {
  474. font-size: 12px;
  475. display: flex;
  476. line-height: 1.5;
  477. .personnel-box-item-label {
  478. width: 60px;
  479. text-align: right;
  480. color: #b3bdc0;
  481. }
  482. .personnel-box-item-value {
  483. color: #b3bdc0;
  484. }
  485. }
  486. }
  487. }
  488. .personnel-box-item-f {
  489. flex-grow: 1;
  490. display: flex;
  491. line-height: 1;
  492. margin-top: 7px;
  493. font-size: 12px;
  494. .personnel-box-item-name {
  495. width: 52px;
  496. margin-right: 12px;
  497. text-align: center;
  498. color: #ffffff;
  499. }
  500. .personnel-box-item-icon {
  501. flex-grow: 1;
  502. color: #b3bdc0;
  503. }
  504. }
  505. &:hover {
  506. border: 1px solid #05bb4c;
  507. background: #05bb4c33;
  508. .personnel-box-item-h {
  509. .personnel-box-item-form {
  510. .personnel-box-item-group {
  511. .personnel-box-item-label {
  512. color: #ffffff;
  513. }
  514. .personnel-box-item-value {
  515. color: #05bb4c;
  516. }
  517. }
  518. }
  519. }
  520. .personnel-box-item-f {
  521. .personnel-box-item-name {
  522. color: #05bb4c;
  523. }
  524. .personnel-box-item-icon {
  525. color: #ffffff;
  526. }
  527. }
  528. }
  529. }
  530. }
  531. .prople-info {
  532. width: 100%;
  533. height: 76px;
  534. background: #53626833;
  535. display: flex;
  536. align-items: center;
  537. justify-content: center;
  538. .prople-info-item {
  539. flex: 1;
  540. text-align: center;
  541. line-height: 2;
  542. }
  543. }
  544. .people-chart {
  545. width: 100%;
  546. height: 45vh;
  547. }
  548. }
  549. </style>