PeopleRecord.vue 16 KB

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