| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677 |
- <template>
- <div class="peoplerecord">
- <!-- 头部区域 -->
- <div class="head">
- <div class="head-msg">
- <img src="@/assets/people.png" />
- </div>
- <div class="head-info">门禁记录</div>
- </div>
- <!-- 左侧区域 -->
- <div class="left">
- <!-- 实时监测区域 -->
- <div class="left-watch">
- <!-- 实时监测标题区域 -->
- <div class="watch-title">
- <div class="watch-img">
- <img src="@/assets/jiantou.png" />
- </div>
- <div class="watch-info">实时监测</div>
- </div>
- <!-- 实时监测表格区域 -->
- <div class="watch-form">
- <el-table
- :data="tableData"
- border
- style="width: 100%"
- height="517"
- v-moretable="moretable"
- >
- <el-table-column label="捕获" header-align="center" width="100">
- <template slot-scope="{ row }">
- <img
- :src="row.pictureScene"
- style="width: 82px; height: 82px"
- />
- </template>
- </el-table-column>
- <el-table-column label="识别" header-align="center">
- <template slot-scope="{ row }">
- <div class="watch-form-list">
- <div class="table_left">
- <img
- :src="row.pictureTemplate"
- style="width: 82px; height: 82px"
- />
- </div>
- <div class="table_center">
- <div>识别ID:{{ row.recognitionId }}</div>
- <div>姓名:{{ row.personName }}</div>
- <div>身份:{{ row.identity }}</div>
- </div>
- <div class="table_right">
- <div>时间:{{ row.dateTime }}</div>
- <div>位置:{{ row.address }}</div>
- </div>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <!-- 历史记录区域 -->
- <div class="left-record">
- <!-- 历史记录标题区域 -->
- <div class="record-title">
- <div class="record-img">
- <img src="@/assets/jiantou.png" />
- </div>
- <div class="record-info">历史记录</div>
- </div>
- <!-- 历史记录表格区域 -->
- <div class="record-form">
- <!-- 标题 -->
- <div class="record-form-title">历史记录</div>
- <!-- 时间选择器 -->
- <div class="record-form-time">
- <div class="time">
- <el-date-picker
- type="date"
- size="mini"
- :editable="false"
- placeholder="选择日期"
- value-format="yyyy-MM-dd"
- v-model="dateTime"
- @change="handleChangeTime"
- >
- </el-date-picker>
- </div>
- </div>
- <!-- 表格数据 -->
- <div class="record-form-list">
- <el-table
- :data="recordList"
- style="width: 100%"
- height="428"
- v-moretable="moretable_record"
- >
- <el-table-column
- prop="name"
- label="姓名"
- align="center"
- width="76"
- >
- </el-table-column>
- <el-table-column
- prop="address"
- label="地址"
- align="center"
- width="89"
- show-overflow-tooltip
- >
- </el-table-column>
- <el-table-column
- prop="time"
- label="时间"
- align="center"
- width="76"
- >
- </el-table-column>
- </el-table>
- </div>
- </div>
- </div>
- </div>
- <!-- 右侧区域 -->
- <div class="right">
- <!-- 折线图区域 -->
- <div class="right-line">
- <!-- 折线图标题 -->
- <div class="right-line-title">
- <div class="line-img">
- <img src="@/assets/jiantou.png" />
- </div>
- <div class="line-info">7小时人流量</div>
- </div>
- <!-- 折线图 -->
- <div class="right-line-body" id="line"></div>
- </div>
- <!-- 饼形图区域 -->
- <div class="right-pie">
- <!-- 饼形图标题 -->
- <div class="right-pie-title">
- <div class="pie-img">
- <img src="@/assets/jiantou.png" />
- </div>
- <div class="pie-info">人员比例</div>
- </div>
- <!-- 饼形图 -->
- <div class="right-pie-body" id="pie"></div>
- </div>
- </div>
- </div>
- </template>
- <script>
- // 引入echarts
- import * as echarts from "echarts";
- export default {
- name: "HelloWorld",
- data() {
- return {
- // 实时监测人员列表数据
- tableData: [],
- // 实时监测人员列表当前页
- page: 1,
- // 历史记录人员列表数据
- recordList: [],
- // 历史记录人员列表当前页
- record_page: 1,
- // 时间选择框选择的时间值
- dateTime: null,
- // 折线图数据
- dateTimeList: [], // 最近7小时的时间数组
- alumniList: [], // 校友数组
- restsList: [], // 其他数组
- staffList: [], // 教职工数组
- studentList: [], // 学生数组
- temporaryWorkerList: [], // 临时人员数组
- visitorList: [], // 访客数组
- // 饼形图数据
- pieData: [],
- };
- },
- created() {
- this.getData();
- this.getRecordData();
- this.getRatioData();
- this.getTrafficData();
- },
- watch: {
- // 监听数据变化重新渲染图表
- dateTimeList() {
- this.getLineChart();
- },
- pieData() {
- this.getPieChart();
- },
- },
- methods: {
- // 获取实时监测列表数据
- async getData() {
- let res = await this.$axios({
- url: "/accessRecord/access/record/realTime",
- method: "get",
- params: {
- page: this.page,
- size: null,
- },
- });
- // console.log(res);
- if (res.data.status == 20001) {
- this.tableData = [...this.tableData, ...res.data.data];
- } else {
- this.$message.error(res.data.desc);
- }
- },
- // 获取历史记录列表数据
- async getRecordData() {
- let res = await this.$axios({
- url: "/accessRecord/access/record/history",
- method: "get",
- params: {
- dateTime: this.dateTime,
- page: this.record_page,
- size: null,
- },
- });
- // console.log(res);
- if (res.data.status == 20001) {
- this.recordList = [...this.recordList, ...res.data.data];
- } else {
- this.$message.error(res.data.desc);
- }
- },
- // 获取人员比例数据
- async getRatioData() {
- let res = await this.$axios({
- url: "/accessRecord/access/record/ratios",
- method: "get",
- });
- // console.log(res);
- if (res.data.status == 20001) {
- this.pieData = res.data.data.filter((item) => item.value != 0);
- } else {
- this.$message.error(res.data.desc);
- }
- },
- // 获取7小时人流量数据
- async getTrafficData() {
- let res = await this.$axios({
- url: "/accessRecord/access/record/traffic",
- method: "get",
- });
- // console.log(res);
- if (res.data.status == 20001) {
- this.dateTimeList = res.data.data.dateTime;
- this.alumniList = res.data.data.alumniList;
- this.restsList = res.data.data.restsList;
- this.staffList = res.data.data.staffList;
- this.studentList = res.data.data.studentList;
- this.temporaryWorkerList = res.data.data.temporaryWorkerList;
- this.visitorList = res.data.data.visitorList;
- } else {
- this.$message.error(res.data.desc);
- }
- },
- // 历史记录表格时间选择框改变时间回调
- handleChangeTime() {
- this.recordList = [];
- this.record_page = 1;
- this.getRecordData();
- },
- // 实时监测表格滑动到底部加载更多回调
- moretable() {
- this.page += 1;
- this.getData();
- },
- // 历史记录表格滑动到底部加载更多回调
- moretable_record() {
- this.record_page += 1;
- this.getRecordData();
- },
- // 创建折线图
- getLineChart() {
- let chartLineDom = document.getElementById("line");
- let myLineChart = echarts.init(chartLineDom);
- // 折线图表配置
- let lineOption = {
- tooltip: {
- trigger: "axis",
- },
- legend: {
- data: ["教职工", "学生", "其他", "校友", "访客", "临时人员"],
- textStyle: {
- color: "#fff",
- },
- },
- grid: {
- left: "3%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: this.dateTimeList,
- axisLine: {
- lineStyle: {
- color: "#0febff",
- },
- },
- axisLabel: {
- color: "#fff",
- },
- splitLine: {
- show: true,
- lineStyle: {
- width: 1,
- color: "#0febff",
- },
- },
- },
- yAxis: {
- type: "value",
- axisLabel: {
- formatter: "{value}",
- color: "#fff",
- },
- splitLine: {
- show: true,
- lineStyle: {
- width: 1,
- color: "#0febff",
- },
- },
- },
- series: [
- {
- name: "教职工",
- type: "line",
- data: this.staffList,
- //设定为实心点
- symbol: "circle",
- //设定实心点的大小
- symbolSize: 10,
- //是否显示数值
- // label: { show: true },
- },
- {
- name: "学生",
- type: "line",
- data: this.studentList,
- symbol: "circle",
- symbolSize: 10,
- },
- {
- name: "其他",
- type: "line",
- symbol: "circle",
- symbolSize: 10,
- data: this.restsList,
- },
- {
- name: "校友",
- type: "line",
- symbol: "circle",
- symbolSize: 10,
- data: this.alumniList,
- },
- {
- name: "访客",
- type: "line",
- symbol: "circle",
- symbolSize: 10,
- data: this.visitorList,
- },
- {
- name: "临时人员",
- type: "line",
- symbol: "circle",
- symbolSize: 10,
- data: this.temporaryWorkerList,
- },
- ],
- };
- myLineChart.setOption(lineOption);
- },
- // 创建饼状图
- getPieChart() {
- let chartPieDom = document.getElementById("pie");
- let myPieChart = echarts.init(chartPieDom);
- // 饼形图表配置
- let pieOption = {
- legend: {
- orient: "vertical",
- align: "left",
- x: "right", //可设定图例在左、右、居中
- y: "top", //可设定图例在上、下、居中
- padding: [20, 10, 0, 0],
- textStyle: {
- color: "#fff",
- },
- },
- series: [
- {
- name: "数量",
- type: "pie",
- // 设置最小角度,解决数据差异过大问题
- minAngle: 10,
- radius: ["10%", "55%"],
- center: ["38%", "50%"],
- // 玫瑰扇形图设置
- // roseType: "radius",
- itemStyle: {
- borderRadius: 5,
- },
- data: this.pieData,
- label: {
- formatter: "{d}%",
- fontWeight: "bold",
- color: "#fff",
- },
- labelLine: {
- length: 10,
- length2: 0,
- },
- },
- ],
- };
- myPieChart.setOption(pieOption);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .peoplerecord {
- box-sizing: border-box;
- margin: auto;
- width: 1161px;
- height: 642px;
- background-color: #24578c;
- .head {
- display: flex;
- width: 1161px;
- height: 55px;
- border-bottom: 1px solid #58beff;
- .head-msg {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 58px;
- height: 55px;
- img {
- height: 35px;
- }
- }
- .head-info {
- line-height: 55px;
- font-size: 25px;
- font-weight: bold;
- color: #fff;
- }
- }
- .left {
- display: flex;
- flex-wrap: wrap;
- float: left;
- width: 800px;
- height: 586px;
- .left-watch {
- margin: 0 11px 0 17px;
- width: 487px;
- height: 571px;
- .watch-title {
- display: flex;
- align-items: center;
- width: 487px;
- height: 54px;
- .watch-img {
- width: 26px;
- height: 16px;
- img {
- width: 100%;
- }
- }
- .watch-info {
- margin-left: 10px;
- width: 79px;
- height: 25px;
- font-size: 19px;
- font-weight: bold;
- color: #0febff;
- }
- }
- .watch-form {
- width: 487px;
- height: 517px;
- // border: 1px solid #58beff;
- .watch-form-list {
- display: flex;
- justify-content: space-evenly;
- .table_left {
- flex: 1;
- }
- .table_center {
- flex: 2;
- display: flex;
- flex-direction: column;
- margin-left: 10px;
- div {
- flex: 1;
- }
- }
- .table_right {
- flex: 2;
- }
- }
- }
- }
- .left-record {
- width: 254px;
- height: 571px;
- .record-title {
- display: flex;
- align-items: center;
- width: 254px;
- height: 54px;
- .record-img {
- width: 26px;
- height: 16px;
- img {
- width: 100%;
- }
- }
- .record-info {
- margin-left: 10px;
- width: 79px;
- height: 25px;
- font-size: 19px;
- font-weight: bold;
- color: #0febff;
- }
- }
- .record-form {
- width: 254px;
- height: 517px;
- border: 1px solid #fff;
- .record-form-title {
- width: 254px;
- height: 48px;
- line-height: 48px;
- font-size: 19px;
- font-weight: 600;
- color: #ffffff;
- text-align: center;
- border-bottom: 1px solid #fff;
- }
- .record-form-time {
- width: 254px;
- height: 40px;
- .time {
- margin: auto;
- width: 160px;
- line-height: 40px;
- .el-date-editor.el-input {
- width: 100%;
- }
- }
- }
- .record-form-list {
- width: 254px;
- height: 429px;
- }
- }
- }
- }
- .right {
- float: left;
- width: 350px;
- height: 586px;
- .right-line {
- width: 350px;
- height: 50%;
- .right-line-title {
- display: flex;
- align-items: center;
- width: 350px;
- height: 56px;
- .line-img {
- width: 26px;
- height: 16px;
- img {
- width: 100%;
- }
- }
- .line-info {
- margin-left: 10px;
- width: 126px;
- height: 25px;
- font-size: 19px;
- font-weight: bold;
- color: #0febff;
- }
- }
- .right-line-body {
- width: 350px;
- height: 237px;
- }
- }
- .right-pie {
- width: 350px;
- height: 50%;
- .right-pie-title {
- display: flex;
- align-items: center;
- width: 350px;
- height: 56px;
- .pie-img {
- width: 26px;
- height: 16px;
- img {
- width: 100%;
- }
- }
- .pie-info {
- margin-left: 10px;
- width: 126px;
- height: 25px;
- font-size: 19px;
- font-weight: bold;
- color: #0febff;
- }
- }
- .right-pie-body {
- width: 350px;
- height: 237px;
- }
- }
- }
- ::v-deep .el-table,
- ::v-deep .el-table__expanded-cell {
- background-color: transparent;
- background-color: #24578c;
- }
- ::v-deep .el-table th,
- ::v-deep .el-table tr,
- ::v-deep .el-table td {
- color: #fff;
- background-color: transparent;
- }
- ::v-deep .el-table tbody tr:hover > td {
- background-color: skyblue;
- }
- ::v-deep .el-table__header-wrapper {
- font-size: 19px;
- }
- // 滚动条背景色
- ::-webkit-scrollbar {
- background: #24578c;
- }
- /*定义滑块 样式*/
- ::-webkit-scrollbar-thumb {
- border-radius: 3px;
- background-color: rgba($color: #063568, $alpha: 0.5);
- }
- }
- </style>
|