PeopleRecord.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. <template>
  2. <div class="peoplerecord">
  3. <!-- 头部区域 -->
  4. <div class="head">
  5. <div class="head-msg">
  6. <img src="@/assets/people.png" />
  7. </div>
  8. <div class="head-info">门禁记录</div>
  9. </div>
  10. <!-- 左侧区域 -->
  11. <div class="left">
  12. <!-- 实时监测区域 -->
  13. <div class="left-watch">
  14. <!-- 实时监测标题区域 -->
  15. <div class="watch-title">
  16. <div class="watch-img">
  17. <img src="@/assets/jiantou.png" />
  18. </div>
  19. <div class="watch-info">实时监测</div>
  20. </div>
  21. <!-- 实时监测表格区域 -->
  22. <div class="watch-form">
  23. <el-table
  24. :data="tableData"
  25. border
  26. style="width: 100%"
  27. height="517"
  28. v-moretable="moretable"
  29. >
  30. <el-table-column label="捕获" header-align="center" width="100">
  31. <template slot-scope="{ row }">
  32. <img
  33. :src="row.pictureScene"
  34. style="width: 82px; height: 82px"
  35. />
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="识别" header-align="center">
  39. <template slot-scope="{ row }">
  40. <div class="watch-form-list">
  41. <div class="table_left">
  42. <img
  43. :src="row.pictureTemplate"
  44. style="width: 82px; height: 82px"
  45. />
  46. </div>
  47. <div class="table_center">
  48. <div>识别ID:{{ row.recognitionId }}</div>
  49. <div>姓名:{{ row.personName }}</div>
  50. <div>身份:{{ row.identity }}</div>
  51. </div>
  52. <div class="table_right">
  53. <div>时间:{{ row.dateTime }}</div>
  54. <div>位置:{{ row.address }}</div>
  55. </div>
  56. </div>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. </div>
  61. </div>
  62. <!-- 历史记录区域 -->
  63. <div class="left-record">
  64. <!-- 历史记录标题区域 -->
  65. <div class="record-title">
  66. <div class="record-img">
  67. <img src="@/assets/jiantou.png" />
  68. </div>
  69. <div class="record-info">历史记录</div>
  70. </div>
  71. <!-- 历史记录表格区域 -->
  72. <div class="record-form">
  73. <!-- 标题 -->
  74. <div class="record-form-title">历史记录</div>
  75. <!-- 时间选择器 -->
  76. <div class="record-form-time">
  77. <div class="time">
  78. <el-date-picker
  79. type="date"
  80. size="mini"
  81. :editable="false"
  82. placeholder="选择日期"
  83. value-format="yyyy-MM-dd"
  84. v-model="dateTime"
  85. @change="handleChangeTime"
  86. >
  87. </el-date-picker>
  88. </div>
  89. </div>
  90. <!-- 表格数据 -->
  91. <div class="record-form-list">
  92. <el-table
  93. :data="recordList"
  94. style="width: 100%"
  95. height="428"
  96. v-moretable="moretable_record"
  97. >
  98. <el-table-column
  99. prop="name"
  100. label="姓名"
  101. align="center"
  102. width="76"
  103. >
  104. </el-table-column>
  105. <el-table-column
  106. prop="address"
  107. label="地址"
  108. align="center"
  109. width="89"
  110. show-overflow-tooltip
  111. >
  112. </el-table-column>
  113. <el-table-column
  114. prop="time"
  115. label="时间"
  116. align="center"
  117. width="76"
  118. >
  119. </el-table-column>
  120. </el-table>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. <!-- 右侧区域 -->
  126. <div class="right">
  127. <!-- 折线图区域 -->
  128. <div class="right-line">
  129. <!-- 折线图标题 -->
  130. <div class="right-line-title">
  131. <div class="line-img">
  132. <img src="@/assets/jiantou.png" />
  133. </div>
  134. <div class="line-info">7小时人流量</div>
  135. </div>
  136. <!-- 折线图 -->
  137. <div class="right-line-body" id="line"></div>
  138. </div>
  139. <!-- 饼形图区域 -->
  140. <div class="right-pie">
  141. <!-- 饼形图标题 -->
  142. <div class="right-pie-title">
  143. <div class="pie-img">
  144. <img src="@/assets/jiantou.png" />
  145. </div>
  146. <div class="pie-info">人员比例</div>
  147. </div>
  148. <!-- 饼形图 -->
  149. <div class="right-pie-body" id="pie"></div>
  150. </div>
  151. </div>
  152. </div>
  153. </template>
  154. <script>
  155. // 引入echarts
  156. import * as echarts from "echarts";
  157. export default {
  158. name: "HelloWorld",
  159. data() {
  160. return {
  161. // 实时监测人员列表数据
  162. tableData: [],
  163. // 实时监测人员列表当前页
  164. page: 1,
  165. // 历史记录人员列表数据
  166. recordList: [],
  167. // 历史记录人员列表当前页
  168. record_page: 1,
  169. // 时间选择框选择的时间值
  170. dateTime: null,
  171. // 折线图数据
  172. dateTimeList: [], // 最近7小时的时间数组
  173. alumniList: [], // 校友数组
  174. restsList: [], // 其他数组
  175. staffList: [], // 教职工数组
  176. studentList: [], // 学生数组
  177. temporaryWorkerList: [], // 临时人员数组
  178. visitorList: [], // 访客数组
  179. // 饼形图数据
  180. pieData: [],
  181. };
  182. },
  183. created() {
  184. this.getData();
  185. this.getRecordData();
  186. this.getRatioData();
  187. this.getTrafficData();
  188. },
  189. watch: {
  190. // 监听数据变化重新渲染图表
  191. dateTimeList() {
  192. this.getLineChart();
  193. },
  194. pieData() {
  195. this.getPieChart();
  196. },
  197. },
  198. methods: {
  199. // 获取实时监测列表数据
  200. async getData() {
  201. let res = await this.$axios({
  202. url: "/accessRecord/access/record/realTime",
  203. method: "get",
  204. params: {
  205. page: this.page,
  206. size: null,
  207. },
  208. });
  209. // console.log(res);
  210. if (res.data.status == 20001) {
  211. this.tableData = [...this.tableData, ...res.data.data];
  212. } else {
  213. this.$message.error(res.data.desc);
  214. }
  215. },
  216. // 获取历史记录列表数据
  217. async getRecordData() {
  218. let res = await this.$axios({
  219. url: "/accessRecord/access/record/history",
  220. method: "get",
  221. params: {
  222. dateTime: this.dateTime,
  223. page: this.record_page,
  224. size: null,
  225. },
  226. });
  227. // console.log(res);
  228. if (res.data.status == 20001) {
  229. this.recordList = [...this.recordList, ...res.data.data];
  230. } else {
  231. this.$message.error(res.data.desc);
  232. }
  233. },
  234. // 获取人员比例数据
  235. async getRatioData() {
  236. let res = await this.$axios({
  237. url: "/accessRecord/access/record/ratios",
  238. method: "get",
  239. });
  240. // console.log(res);
  241. if (res.data.status == 20001) {
  242. this.pieData = res.data.data.filter((item) => item.value != 0);
  243. } else {
  244. this.$message.error(res.data.desc);
  245. }
  246. },
  247. // 获取7小时人流量数据
  248. async getTrafficData() {
  249. let res = await this.$axios({
  250. url: "/accessRecord/access/record/traffic",
  251. method: "get",
  252. });
  253. // console.log(res);
  254. if (res.data.status == 20001) {
  255. this.dateTimeList = res.data.data.dateTime;
  256. this.alumniList = res.data.data.alumniList;
  257. this.restsList = res.data.data.restsList;
  258. this.staffList = res.data.data.staffList;
  259. this.studentList = res.data.data.studentList;
  260. this.temporaryWorkerList = res.data.data.temporaryWorkerList;
  261. this.visitorList = res.data.data.visitorList;
  262. } else {
  263. this.$message.error(res.data.desc);
  264. }
  265. },
  266. // 历史记录表格时间选择框改变时间回调
  267. handleChangeTime() {
  268. this.recordList = [];
  269. this.record_page = 1;
  270. this.getRecordData();
  271. },
  272. // 实时监测表格滑动到底部加载更多回调
  273. moretable() {
  274. this.page += 1;
  275. this.getData();
  276. },
  277. // 历史记录表格滑动到底部加载更多回调
  278. moretable_record() {
  279. this.record_page += 1;
  280. this.getRecordData();
  281. },
  282. // 创建折线图
  283. getLineChart() {
  284. let chartLineDom = document.getElementById("line");
  285. let myLineChart = echarts.init(chartLineDom);
  286. // 折线图表配置
  287. let lineOption = {
  288. tooltip: {
  289. trigger: "axis",
  290. },
  291. legend: {
  292. data: ["教职工", "学生", "其他", "校友", "访客", "临时人员"],
  293. textStyle: {
  294. color: "#fff",
  295. },
  296. },
  297. grid: {
  298. left: "3%",
  299. right: "4%",
  300. bottom: "3%",
  301. containLabel: true,
  302. },
  303. xAxis: {
  304. type: "category",
  305. boundaryGap: false,
  306. data: this.dateTimeList,
  307. axisLine: {
  308. lineStyle: {
  309. color: "#0febff",
  310. },
  311. },
  312. axisLabel: {
  313. color: "#fff",
  314. },
  315. splitLine: {
  316. show: true,
  317. lineStyle: {
  318. width: 1,
  319. color: "#0febff",
  320. },
  321. },
  322. },
  323. yAxis: {
  324. type: "value",
  325. axisLabel: {
  326. formatter: "{value}",
  327. color: "#fff",
  328. },
  329. splitLine: {
  330. show: true,
  331. lineStyle: {
  332. width: 1,
  333. color: "#0febff",
  334. },
  335. },
  336. },
  337. series: [
  338. {
  339. name: "教职工",
  340. type: "line",
  341. data: this.staffList,
  342. //设定为实心点
  343. symbol: "circle",
  344. //设定实心点的大小
  345. symbolSize: 10,
  346. //是否显示数值
  347. // label: { show: true },
  348. },
  349. {
  350. name: "学生",
  351. type: "line",
  352. data: this.studentList,
  353. symbol: "circle",
  354. symbolSize: 10,
  355. },
  356. {
  357. name: "其他",
  358. type: "line",
  359. symbol: "circle",
  360. symbolSize: 10,
  361. data: this.restsList,
  362. },
  363. {
  364. name: "校友",
  365. type: "line",
  366. symbol: "circle",
  367. symbolSize: 10,
  368. data: this.alumniList,
  369. },
  370. {
  371. name: "访客",
  372. type: "line",
  373. symbol: "circle",
  374. symbolSize: 10,
  375. data: this.visitorList,
  376. },
  377. {
  378. name: "临时人员",
  379. type: "line",
  380. symbol: "circle",
  381. symbolSize: 10,
  382. data: this.temporaryWorkerList,
  383. },
  384. ],
  385. };
  386. myLineChart.setOption(lineOption);
  387. },
  388. // 创建饼状图
  389. getPieChart() {
  390. let chartPieDom = document.getElementById("pie");
  391. let myPieChart = echarts.init(chartPieDom);
  392. // 饼形图表配置
  393. let pieOption = {
  394. legend: {
  395. orient: "vertical",
  396. align: "left",
  397. x: "right", //可设定图例在左、右、居中
  398. y: "top", //可设定图例在上、下、居中
  399. padding: [20, 10, 0, 0],
  400. textStyle: {
  401. color: "#fff",
  402. },
  403. },
  404. series: [
  405. {
  406. name: "数量",
  407. type: "pie",
  408. // 设置最小角度,解决数据差异过大问题
  409. minAngle: 10,
  410. radius: ["10%", "55%"],
  411. center: ["38%", "50%"],
  412. // 玫瑰扇形图设置
  413. // roseType: "radius",
  414. itemStyle: {
  415. borderRadius: 5,
  416. },
  417. data: this.pieData,
  418. label: {
  419. formatter: "{d}%",
  420. fontWeight: "bold",
  421. color: "#fff",
  422. },
  423. labelLine: {
  424. length: 10,
  425. length2: 0,
  426. },
  427. },
  428. ],
  429. };
  430. myPieChart.setOption(pieOption);
  431. },
  432. },
  433. };
  434. </script>
  435. <style lang="scss" scoped>
  436. .peoplerecord {
  437. box-sizing: border-box;
  438. margin: auto;
  439. width: 1161px;
  440. height: 642px;
  441. background-color: #24578c;
  442. .head {
  443. display: flex;
  444. width: 1161px;
  445. height: 55px;
  446. border-bottom: 1px solid #58beff;
  447. .head-msg {
  448. display: flex;
  449. justify-content: center;
  450. align-items: center;
  451. width: 58px;
  452. height: 55px;
  453. img {
  454. height: 35px;
  455. }
  456. }
  457. .head-info {
  458. line-height: 55px;
  459. font-size: 25px;
  460. font-weight: bold;
  461. color: #fff;
  462. }
  463. }
  464. .left {
  465. display: flex;
  466. flex-wrap: wrap;
  467. float: left;
  468. width: 800px;
  469. height: 586px;
  470. .left-watch {
  471. margin: 0 11px 0 17px;
  472. width: 487px;
  473. height: 571px;
  474. .watch-title {
  475. display: flex;
  476. align-items: center;
  477. width: 487px;
  478. height: 54px;
  479. .watch-img {
  480. width: 26px;
  481. height: 16px;
  482. img {
  483. width: 100%;
  484. }
  485. }
  486. .watch-info {
  487. margin-left: 10px;
  488. width: 79px;
  489. height: 25px;
  490. font-size: 19px;
  491. font-weight: bold;
  492. color: #0febff;
  493. }
  494. }
  495. .watch-form {
  496. width: 487px;
  497. height: 517px;
  498. // border: 1px solid #58beff;
  499. .watch-form-list {
  500. display: flex;
  501. justify-content: space-evenly;
  502. .table_left {
  503. flex: 1;
  504. }
  505. .table_center {
  506. flex: 2;
  507. display: flex;
  508. flex-direction: column;
  509. margin-left: 10px;
  510. div {
  511. flex: 1;
  512. }
  513. }
  514. .table_right {
  515. flex: 2;
  516. }
  517. }
  518. }
  519. }
  520. .left-record {
  521. width: 254px;
  522. height: 571px;
  523. .record-title {
  524. display: flex;
  525. align-items: center;
  526. width: 254px;
  527. height: 54px;
  528. .record-img {
  529. width: 26px;
  530. height: 16px;
  531. img {
  532. width: 100%;
  533. }
  534. }
  535. .record-info {
  536. margin-left: 10px;
  537. width: 79px;
  538. height: 25px;
  539. font-size: 19px;
  540. font-weight: bold;
  541. color: #0febff;
  542. }
  543. }
  544. .record-form {
  545. width: 254px;
  546. height: 517px;
  547. border: 1px solid #fff;
  548. .record-form-title {
  549. width: 254px;
  550. height: 48px;
  551. line-height: 48px;
  552. font-size: 19px;
  553. font-weight: 600;
  554. color: #ffffff;
  555. text-align: center;
  556. border-bottom: 1px solid #fff;
  557. }
  558. .record-form-time {
  559. width: 254px;
  560. height: 40px;
  561. .time {
  562. margin: auto;
  563. width: 160px;
  564. line-height: 40px;
  565. .el-date-editor.el-input {
  566. width: 100%;
  567. }
  568. }
  569. }
  570. .record-form-list {
  571. width: 254px;
  572. height: 429px;
  573. }
  574. }
  575. }
  576. }
  577. .right {
  578. float: left;
  579. width: 350px;
  580. height: 586px;
  581. .right-line {
  582. width: 350px;
  583. height: 50%;
  584. .right-line-title {
  585. display: flex;
  586. align-items: center;
  587. width: 350px;
  588. height: 56px;
  589. .line-img {
  590. width: 26px;
  591. height: 16px;
  592. img {
  593. width: 100%;
  594. }
  595. }
  596. .line-info {
  597. margin-left: 10px;
  598. width: 126px;
  599. height: 25px;
  600. font-size: 19px;
  601. font-weight: bold;
  602. color: #0febff;
  603. }
  604. }
  605. .right-line-body {
  606. width: 350px;
  607. height: 237px;
  608. }
  609. }
  610. .right-pie {
  611. width: 350px;
  612. height: 50%;
  613. .right-pie-title {
  614. display: flex;
  615. align-items: center;
  616. width: 350px;
  617. height: 56px;
  618. .pie-img {
  619. width: 26px;
  620. height: 16px;
  621. img {
  622. width: 100%;
  623. }
  624. }
  625. .pie-info {
  626. margin-left: 10px;
  627. width: 126px;
  628. height: 25px;
  629. font-size: 19px;
  630. font-weight: bold;
  631. color: #0febff;
  632. }
  633. }
  634. .right-pie-body {
  635. width: 350px;
  636. height: 237px;
  637. }
  638. }
  639. }
  640. ::v-deep .el-table,
  641. ::v-deep .el-table__expanded-cell {
  642. background-color: transparent;
  643. background-color: #24578c;
  644. }
  645. ::v-deep .el-table th,
  646. ::v-deep .el-table tr,
  647. ::v-deep .el-table td {
  648. color: #fff;
  649. background-color: transparent;
  650. }
  651. ::v-deep .el-table tbody tr:hover > td {
  652. background-color: skyblue;
  653. }
  654. ::v-deep .el-table__header-wrapper {
  655. font-size: 19px;
  656. }
  657. // 滚动条背景色
  658. ::-webkit-scrollbar {
  659. background: #24578c;
  660. }
  661. /*定义滑块 样式*/
  662. ::-webkit-scrollbar-thumb {
  663. border-radius: 3px;
  664. background-color: rgba($color: #063568, $alpha: 0.5);
  665. }
  666. }
  667. </style>