PeopleRecord.vue 16 KB

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