|
|
@@ -8,7 +8,6 @@
|
|
|
v-model="listQuery.deviceName"
|
|
|
size="mini"
|
|
|
clearable
|
|
|
- @clear="handleChangeFilter"
|
|
|
placeholder="请选择设备名称"
|
|
|
>
|
|
|
<el-option
|
|
|
@@ -16,8 +15,7 @@
|
|
|
:key="item.id"
|
|
|
:label="item.name"
|
|
|
:value="item.name"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</span>
|
|
|
|
|
|
@@ -28,10 +26,8 @@
|
|
|
size="mini"
|
|
|
placeholder="请输入卡号"
|
|
|
clearable
|
|
|
- @clear="handleChangeFilter"
|
|
|
@keyup.enter.native="handleFilter"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
+ />
|
|
|
</span>
|
|
|
|
|
|
<span>姓名:</span>
|
|
|
@@ -41,10 +37,30 @@
|
|
|
size="mini"
|
|
|
placeholder="请输入姓名"
|
|
|
clearable
|
|
|
- @clear="handleChangeFilter"
|
|
|
@keyup.enter.native="handleFilter"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
+ />
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <span>学院:</span>
|
|
|
+ <span class="input">
|
|
|
+ <el-input
|
|
|
+ v-model="listQuery.college"
|
|
|
+ size="mini"
|
|
|
+ placeholder="请输入学院"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleFilter"
|
|
|
+ />
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <span>专业:</span>
|
|
|
+ <span class="input">
|
|
|
+ <el-input
|
|
|
+ v-model="listQuery.major"
|
|
|
+ size="mini"
|
|
|
+ placeholder="请输入专业"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleFilter"
|
|
|
+ />
|
|
|
</span>
|
|
|
|
|
|
<span>通行时间:</span>
|
|
|
@@ -55,18 +71,39 @@
|
|
|
start-placeholder="开始时间"
|
|
|
end-placeholder="结束时间"
|
|
|
value-format="timestamp"
|
|
|
- @change="handleChangeFilter($event)"
|
|
|
- >
|
|
|
- </el-date-picker>
|
|
|
+ />
|
|
|
|
|
|
- <el-button type="primary" size="mini" class="button" @click="handleFilter"
|
|
|
- >查询</el-button
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ class="button"
|
|
|
+ @click="handleFilter"
|
|
|
>
|
|
|
+ 查询
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
|
|
|
+ <!-- 导出按钮区域 -->
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ class="button_down"
|
|
|
+ :disabled="!listQuery.time"
|
|
|
+ @click="handleDownLoad"
|
|
|
+ >
|
|
|
+ 导出
|
|
|
+ </el-button>
|
|
|
+ <span class="button_text">选择通行时间后可导出</span>
|
|
|
+
|
|
|
<!-- 表格区域 -->
|
|
|
<div class="form">
|
|
|
- <el-table :data="list">
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ height="550px"
|
|
|
+ :data="list"
|
|
|
+ element-loading-text="拼命加载中"
|
|
|
+ element-loading-spinner="el-icon-loading"
|
|
|
+ >
|
|
|
<el-table-column label="序号" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
<span>{{ row.id }}</span>
|
|
|
@@ -85,6 +122,18 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
+ <el-table-column label="学院" align="center">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span>{{ row.groupName }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="专业" align="center">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span>{{ row.profession }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
<el-table-column label="身份类型" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
<span>{{ row.identityName }}</span>
|
|
|
@@ -97,11 +146,11 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column label="分组名称" align="center">
|
|
|
+ <!-- <el-table-column label="分组名称" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
<span>{{ row.groupName }}</span>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
|
|
|
<el-table-column label="信息" align="center" width="300px">
|
|
|
<template slot-scope="{ row }">
|
|
|
@@ -124,7 +173,7 @@
|
|
|
:total="total"
|
|
|
:page.sync="listQuery.page"
|
|
|
:limit.sync="listQuery.limit"
|
|
|
- @pagination="getList"
|
|
|
+ @pagination="handleChangePage"
|
|
|
/>
|
|
|
</template>
|
|
|
</div>
|
|
|
@@ -133,160 +182,150 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import Pagination from "@/components/Pagination";
|
|
|
-import { fetchList, searchList, fetchGroupList } from "@/api/accessrecords";
|
|
|
+import Pagination from '@/components/Pagination'
|
|
|
+import { searchList, fetchGroupList, exportExcel } from '@/api/accessrecords'
|
|
|
export default {
|
|
|
components: {
|
|
|
- Pagination,
|
|
|
+ Pagination
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 表格数据
|
|
|
list: [],
|
|
|
+ // 设备数组
|
|
|
groupList: [],
|
|
|
- total: 0, //数据的总数//
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 表格加载状态
|
|
|
+ loading: false,
|
|
|
listQuery: {
|
|
|
+ // 当前页
|
|
|
page: 1,
|
|
|
+ // 每页多少条
|
|
|
limit: 8,
|
|
|
- cardNumber: "",
|
|
|
- deviceName: "",
|
|
|
- groupName: "",
|
|
|
- identityName: "",
|
|
|
- message: "",
|
|
|
- time: "",
|
|
|
- userName: "",
|
|
|
- },
|
|
|
- };
|
|
|
+ // 卡号输入框绑定数据
|
|
|
+ cardNumber: '',
|
|
|
+ // 设备筛选框绑定数据
|
|
|
+ deviceName: '',
|
|
|
+ // 通行时间选择框绑定数据
|
|
|
+ time: '',
|
|
|
+ // 姓名输入框绑定数据
|
|
|
+ userName: '',
|
|
|
+ // 学院输入框绑定数据
|
|
|
+ college: '',
|
|
|
+ // 专业输入框绑定数据
|
|
|
+ major: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
- this.getList();
|
|
|
- this.getgroupList();
|
|
|
+ this.getList()
|
|
|
+ this.getgroupList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取表格数据
|
|
|
getList() {
|
|
|
- if (
|
|
|
- this.listQuery.cardNumber ||
|
|
|
- this.listQuery.deviceName ||
|
|
|
- this.listQuery.userName ||
|
|
|
- this.listQuery.time
|
|
|
- ) {
|
|
|
- searchList(this.listQuery).then((response) => {
|
|
|
- this.list = response.data;
|
|
|
- this.total = response.total;
|
|
|
- });
|
|
|
- } else {
|
|
|
- fetchList({
|
|
|
- page: this.listQuery.page,
|
|
|
- limit: this.listQuery.limit,
|
|
|
- }).then((response) => {
|
|
|
- this.list = response.data;
|
|
|
- this.total = response.total;
|
|
|
- });
|
|
|
- }
|
|
|
+ this.loading = true
|
|
|
+ searchList({
|
|
|
+ page: this.listQuery.page,
|
|
|
+ limit: this.listQuery.limit,
|
|
|
+ cardNumber: this.listQuery.cardNumber,
|
|
|
+ deviceName: this.listQuery.deviceName,
|
|
|
+ time1: this.listQuery.time === null ? null : this.listQuery.time[0],
|
|
|
+ time2: this.listQuery.time === null ? null : this.listQuery.time[1],
|
|
|
+ userName: this.listQuery.userName,
|
|
|
+ groupName: this.listQuery.college,
|
|
|
+ profession: this.listQuery.major
|
|
|
+ }).then((response) => {
|
|
|
+ this.list = response.data
|
|
|
+ this.total = response.total
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
},
|
|
|
+ // 获取设备数组
|
|
|
getgroupList() {
|
|
|
- fetchGroupList({ page: this.listQuery.page, limit: "999" }).then(
|
|
|
- (response) => {
|
|
|
- this.groupList = response.data;
|
|
|
- }
|
|
|
- );
|
|
|
- },
|
|
|
- handleChangeFilter(e) {
|
|
|
- if (e == null) {
|
|
|
- // 清空时间
|
|
|
- if (
|
|
|
- !this.listQuery.userName &&
|
|
|
- !this.listQuery.cardNumber &&
|
|
|
- !this.listQuery.deviceName &&
|
|
|
- !this.listQuery.time
|
|
|
- ) {
|
|
|
- this.getList();
|
|
|
- } else {
|
|
|
- searchList({
|
|
|
- page: this.listQuery.page,
|
|
|
- limit: this.listQuery.limit,
|
|
|
- cardNumber: this.listQuery.cardNumber,
|
|
|
- deviceName: this.listQuery.deviceName,
|
|
|
- time1: this.listQuery.time === null ? null : this.listQuery.time[0],
|
|
|
- time2: this.listQuery.time === null ? null : this.listQuery.time[1],
|
|
|
- userName: this.listQuery.userName,
|
|
|
- }).then((response) => {
|
|
|
- this.list = response.data;
|
|
|
- this.total = response.total;
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 设置时间
|
|
|
- }
|
|
|
+ fetchGroupList({ page: 1, limit: 999 }).then((response) => {
|
|
|
+ this.groupList = response.data
|
|
|
+ })
|
|
|
},
|
|
|
+ // 查询按钮回调
|
|
|
handleFilter() {
|
|
|
- //搜索数据
|
|
|
- if (
|
|
|
- !this.listQuery.userName &&
|
|
|
- !this.listQuery.cardNumber &&
|
|
|
- !this.listQuery.deviceName &&
|
|
|
- !this.listQuery.time
|
|
|
- ) {
|
|
|
- alert("请输入搜索条件");
|
|
|
- } else {
|
|
|
- searchList({
|
|
|
- page: 1,
|
|
|
- limit: this.listQuery.limit,
|
|
|
- cardNumber: this.listQuery.cardNumber,
|
|
|
- deviceName: this.listQuery.deviceName,
|
|
|
- time1: this.listQuery.time === null ? null : this.listQuery.time[0],
|
|
|
- time2: this.listQuery.time === null ? null : this.listQuery.time[1],
|
|
|
- userName: this.listQuery.userName,
|
|
|
- }).then((response) => {
|
|
|
- this.list = response.data;
|
|
|
- this.total = response.total;
|
|
|
- });
|
|
|
- this.listQuery.page = 1;
|
|
|
- }
|
|
|
+ this.list = []
|
|
|
+ this.listQuery.page = 1
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ // 分页器改变分页回调
|
|
|
+ handleChangePage(e) {
|
|
|
+ // console.log(e);
|
|
|
+ this.list = []
|
|
|
+ this.listQuery.page = e.page
|
|
|
+ this.listQuery.limit = e.limit
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ // 导出按钮回调
|
|
|
+ handleDownLoad() {
|
|
|
+ exportExcel({
|
|
|
+ page: this.listQuery.page,
|
|
|
+ limit: this.listQuery.limit,
|
|
|
+ cardNumber: this.listQuery.cardNumber,
|
|
|
+ deviceName: this.listQuery.deviceName,
|
|
|
+ time1: this.listQuery.time === null ? null : this.listQuery.time[0],
|
|
|
+ time2: this.listQuery.time === null ? null : this.listQuery.time[1],
|
|
|
+ userName: this.listQuery.userName,
|
|
|
+ groupName: this.listQuery.college,
|
|
|
+ profession: this.listQuery.major
|
|
|
+ }).then((response) => {
|
|
|
+ // console.log(response);
|
|
|
+ location.href = `https://chtech.ncjti.edu.cn/access-control${response.downurl}`
|
|
|
+ })
|
|
|
},
|
|
|
+
|
|
|
+ // 时间格式转化函数
|
|
|
timestampToTime(time) {
|
|
|
- //格式化时间
|
|
|
- var date = new Date(time);
|
|
|
- var year = date.getFullYear();
|
|
|
+ // 格式化时间
|
|
|
+ var date = new Date(time)
|
|
|
+ var year = date.getFullYear()
|
|
|
var month =
|
|
|
date.getMonth() + 1 < 10
|
|
|
- ? "0" + (date.getMonth() + 1)
|
|
|
- : date.getMonth() + 1;
|
|
|
- var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
|
|
+ ? '0' + (date.getMonth() + 1)
|
|
|
+ : date.getMonth() + 1
|
|
|
+ var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
|
|
|
var hours =
|
|
|
- date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
|
|
+ date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
|
|
|
var minutes =
|
|
|
- date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
|
|
+ date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
|
|
|
var seconds =
|
|
|
- date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
|
|
+ date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
|
|
|
return (
|
|
|
year +
|
|
|
- "-" +
|
|
|
+ '-' +
|
|
|
month +
|
|
|
- "-" +
|
|
|
+ '-' +
|
|
|
day +
|
|
|
- " " +
|
|
|
+ ' ' +
|
|
|
hours +
|
|
|
- ":" +
|
|
|
+ ':' +
|
|
|
minutes +
|
|
|
- ":" +
|
|
|
+ ':' +
|
|
|
seconds
|
|
|
- );
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.form-head {
|
|
|
margin: 0 40px;
|
|
|
- width: 1380px;
|
|
|
line-height: 118px;
|
|
|
font-size: 9px;
|
|
|
|
|
|
.input {
|
|
|
display: inline-block;
|
|
|
margin-right: 10px;
|
|
|
- width: 210px;
|
|
|
+ // width: 210px;
|
|
|
}
|
|
|
|
|
|
.input-select {
|
|
|
@@ -300,9 +339,18 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.form {
|
|
|
+.button_down {
|
|
|
margin-left: 40px;
|
|
|
- width: 1400px;
|
|
|
+}
|
|
|
+
|
|
|
+.button_text {
|
|
|
+ font-size: 14px;
|
|
|
+ margin-left: 20px;
|
|
|
+ color: #ccc;
|
|
|
+}
|
|
|
+
|
|
|
+.form {
|
|
|
+ margin: 0 40px;
|
|
|
|
|
|
.button-img {
|
|
|
img {
|