| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707 |
- <template>
- <div class="peoplerecord">
- <!-- 头部区域 -->
- <div class="head">
- <div class="head-msg">
- <img src="@/assets/car.svg" />
- </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_search">
- <div class="search_type">
- 类型:
- <el-select
- style="width: 150px"
- size="small"
- v-model="value_type"
- placeholder="请选择驶入方向"
- @change="handleChange"
- >
- <el-option
- v-for="(item, index) in options_type"
- :key="index"
- :label="item"
- :value="item"
- >
- </el-option>
- </el-select>
- </div>
- <div class="search_time">
- 时间:
- <el-date-picker
- style="width: 150px"
- type="date"
- size="small"
- placeholder="选择日期"
- v-model="value_time"
- @change="handleChange"
- value-format="yyyy-MM-dd"
- >
- </el-date-picker>
- </div>
- <div class="search_place">
- 来源地:
- <el-select
- style="width: 150px"
- size="small"
- clearable
- v-model="value_place"
- placeholder="请选择来源地"
- @change="handleChange"
- >
- <el-option
- v-for="(item, index) in options_place"
- :key="index"
- :label="item"
- :value="item"
- >
- </el-option>
- </el-select>
- </div>
- </div>
- <!-- 车辆记录表格区域 -->
- <div class="watch-form" v-if="tableData.length">
- <el-table
- v-loading="loading"
- element-loading-text="加载中"
- element-loading-spinner="el-icon-loading"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- stripe
- :data="tableData"
- style="width: 100%"
- height="467"
- v-moretable="moretable"
- >
- <el-table-column prop="id" label="识别ID" align="center" width="93">
- </el-table-column>
- <el-table-column prop="fx" label="类型" align="center" width="100">
- </el-table-column>
- <el-table-column
- prop="user_name"
- label="姓名"
- align="center"
- width="100"
- >
- </el-table-column>
- <el-table-column
- prop="time"
- label="时间"
- align="center"
- width="160"
- >
- </el-table-column>
- <el-table-column
- label="位置"
- align="center"
- width="186"
- show-overflow-tooltip
- >
- <template slot-scope="{ row }">
- {{ row.channel_id }}号通道
- </template>
- </el-table-column>
- <el-table-column
- prop="car_number"
- label="车牌"
- align="center"
- width="117"
- show-overflow-tooltip
- >
- </el-table-column>
- </el-table>
- </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">6小时车流量</div>
- </div>
- <!-- 折线图 -->
- <div class="right-line-body" id="line"></div>
- </div>
- <!-- 柱状图区域 -->
- <div class="right-column">
- <!-- 柱状图标题 -->
- <div class="right-column-title">
- <div class="column-img">
- <img src="@/assets/jiantou.png" />
- </div>
- <div class="column-info">24小时车辆来源地</div>
- </div>
- <!-- 柱状图 -->
- <div class="right-column-body" id="column"></div>
- </div>
- </div>
- </div>
- </template>
- <script>
- // 引入echarts
- import * as echarts from "echarts";
- export default {
- name: "CarRecord",
- data() {
- return {
- // 类型筛选框绑定值
- value_type: "驶入",
- // 时间筛选框绑定值
- value_time: "",
- // 来源地筛选框绑定值
- value_place: "",
- // 类型筛选框数组
- options_type: ["全部", "驶入", "驶出"],
- //来源地筛选框数组
- options_place: [],
- // 车辆记录列表数据
- tableData: [],
- // 车辆记录列表总条数
- total: "",
- // 车辆记录列表当前页
- page: 1,
- // 车辆记录表格加载中效果
- loading: false,
- // 折线图数据
- timeList: [], // 时间数组
- freeList: [], // 免费车数组
- monthlyList: [], // 月租车数组
- visitorList: [], // 访客车数组
- temporaryList: [], // 临时车数组
- // 柱状图数据
- topPlace: [], // 车辆来源地排行地点
- topValue: [], // 车辆来源地排行数值
- };
- },
- created() {
- this.getData();
- this.getCarFromData();
- this.getCarFromTopData();
- this.carMonitorData();
- },
- watch: {
- // 监听数据变化重新渲染图表
- topPlace() {
- this.getColumnChart();
- },
- timeList() {
- this.getLineChart();
- },
- },
- methods: {
- // 获取车辆记录表格数据
- async getData() {
- this.loading = true;
- let res = await this.$axios({
- url: "/carstop/carMonitor/ioqueryRecord.action",
- method: "post",
- params: {
- time: this.value_time,
- from: this.value_place,
- io: this.value_type,
- page: this.page,
- rows: 20,
- },
- });
- // console.log(res.data);
- if (res.data.code && res.data.code == 200) {
- this.tableData = [...this.tableData, ...res.data.rows];
- this.total = res.data.total;
- } else {
- this.$message.error(res.data.message || "暂无数据");
- }
- this.loading = false;
- },
- // 获取车辆来源地数据
- async getCarFromData() {
- let res = await this.$axios({
- url: "/carstop/carMonitor/iocar_from.action",
- method: "post",
- });
- // console.log(res.data);
- if (res.data.code == 200) {
- let temList = [];
- res.data.data.forEach((element) => {
- temList.push(element.car_no);
- });
- this.options_place = temList;
- } else {
- this.$message.error(res.data.message);
- }
- },
- // 获取车辆来源地排名数据
- async getCarFromTopData() {
- let res = await this.$axios({
- url: "/carstop/carMonitor/iocarTj.action",
- method: "post",
- });
- // console.log(res.data);
- if (res.data.code == 200) {
- let temList = res.data.data;
- // 将需要排序的 key, 按照 "从大到小" 进行排列
- let sortKeys = Object.keys(temList).sort((a, b) => {
- return temList[b] - temList[a];
- });
- // 循环排列好的 key, 重新组成一个新的数组
- let arr = [];
- for (let sortIndex in sortKeys) {
- arr.push(temList[sortKeys[sortIndex]]);
- }
- this.topPlace = sortKeys.splice(0, 5);
- this.topValue = arr.splice(0, 5);
- } else {
- this.$message.error(res.data.message);
- }
- },
- // 获取6小时车流量数据
- async carMonitorData() {
- let res = await this.$axios({
- url: "/carstop/carMonitor/ioioTj.action",
- method: "post",
- });
- // console.log(res.data);
- if (res.data.code == 200) {
- this.timeList = [];
- this.freeList = [];
- this.monthlyList = [];
- this.visitorList = [];
- this.temporaryList = [];
- res.data.data.forEach((element) => {
- this.timeList.push(element.duration);
- this.freeList.push(element.typeTj[0].num);
- this.monthlyList.push(element.typeTj[1].num);
- this.visitorList.push(element.typeTj[2].num);
- this.temporaryList.push(element.typeTj[3].num);
- });
- } else {
- this.$message.error(res.data.message);
- }
- },
- // 车辆记录表格滑动到底部加载更多回调
- moretable() {
- if (this.tableData.length < this.total) {
- this.page += 1;
- this.getData();
- }
- },
- // 筛选回调
- handleChange() {
- this.tableData = [];
- this.page = 1;
- this.getData();
- },
- // 创建折线图
- 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.timeList,
- 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.freeList,
- //设定为实心点
- symbol: "circle",
- //设定实心点的大小
- symbolSize: 10,
- //是否显示数值
- // label: { show: true },
- },
- {
- name: "月租车",
- type: "line",
- data: this.monthlyList,
- symbol: "circle",
- symbolSize: 10,
- },
- {
- name: "访客车",
- type: "line",
- data: this.visitorList,
- symbol: "circle",
- symbolSize: 10,
- },
- {
- name: "临时车",
- type: "line",
- data: this.temporaryList,
- symbol: "circle",
- symbolSize: 10,
- },
- ],
- };
- myLineChart.setOption(lineOption);
- },
- // 创建柱状图
- getColumnChart() {
- let chartColumnDom = document.getElementById("column");
- let myColumnChart = echarts.init(chartColumnDom);
- // 饼形图表配置
- let columnOption = {
- tooltip: {
- trigger: "axis",
- axisPointer: {
- type: "shadow",
- },
- },
- grid: {
- left: "3%",
- right: "4%",
- bottom: "3%",
- top: "13%",
- containLabel: true,
- },
- xAxis: [
- {
- type: "category",
- data: this.topPlace,
- axisTick: {
- alignWithLabel: true,
- },
- 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: "transparent",
- },
- },
- },
- series: [
- {
- name: "数量",
- type: "bar",
- barWidth: "60%",
- data: this.topValue,
- itemStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "#0FEBFE",
- },
- {
- offset: 1,
- color: "#276691",
- },
- ]),
- },
- label: {
- show: true, //开启显示
- position: "top", //在上方显示
- textStyle: {
- //数值样式
- color: "#fff",
- },
- },
- },
- ],
- };
- myColumnChart.setOption(columnOption);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .peoplerecord {
- box-sizing: border-box;
- margin: auto;
- width: 1161px;
- height: 642px;
- background-image: url(../assets/backImg.png);
- background-size: 100% 100%;
- background-color: #24578c;
- .head {
- display: flex;
- width: 1161px;
- height: 60px;
- .head-msg {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-top: 5px;
- width: 58px;
- height: 55px;
- img {
- height: 35px;
- }
- }
- .head-info {
- margin-top: 5px;
- 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: 756px;
- height: 571px;
- .watch-title {
- display: flex;
- align-items: center;
- width: 756px;
- 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_search {
- display: flex;
- margin-top: -10px;
- width: 756px;
- height: 60px;
- color: #fff;
- .search_type {
- flex: 1;
- display: flex;
- align-items: center;
- }
- .search_time {
- flex: 1;
- display: flex;
- align-items: center;
- }
- .search_place {
- flex: 1;
- display: flex;
- align-items: center;
- }
- }
- .watch-form {
- width: 756px;
- height: 467px;
- }
- }
- }
- .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-column {
- width: 350px;
- height: 50%;
- margin-top: -6px;
- .right-column-title {
- display: flex;
- align-items: center;
- width: 350px;
- height: 56px;
- .column-img {
- width: 26px;
- height: 16px;
- img {
- width: 100%;
- }
- }
- .column-info {
- margin-left: 10px;
- width: 180px;
- height: 25px;
- font-size: 19px;
- font-weight: bold;
- color: #0febff;
- }
- }
- .right-column-body {
- width: 350px;
- height: 237px;
- }
- }
- }
- ::v-deep .el-table,
- ::v-deep .el-table__expanded-cell {
- background-color: transparent;
- background-color: #0e3779;
- }
- ::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: #0e3779;
- }
- ::v-deep .el-table__header-wrapper {
- background-color: transparent;
- background-color: #25608f;
- }
- // 滚动条隐藏
- ::-webkit-scrollbar {
- height: 0;
- width: 0;
- color: transparent;
- }
- // 输入框 筛选框 圆角设置
- ::v-deep .el-input__inner {
- border-radius: 20px;
- color: #fff;
- background-color: rgba($color: #fff, $alpha: 0.3);
- }
- // 斑马线隔行换色设置颜色
- ::v-deep
- .el-table--striped
- .el-table__body
- tr.el-table__row--striped.el-table__row--striped.el-table__row--striped
- td {
- background-color: rgba($color: #58beff, $alpha: 0.3);
- }
- // 清除表格默认下边框
- ::v-deep .el-table__cell,
- ::v-deep .el-table th.el-table__cell.is-leaf {
- border-bottom: none;
- }
- ::v-deep .el-table::before {
- width: 0;
- }
- }
- </style>
|