You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

670 lines
16 KiB

3 years ago
<template>
3 years ago
<div>
3 months ago
<div class="gatewrap">
<!-- 头部导航 -->
<div class="gate-header">
<div class="gate-left">
<span @click='openList' class="today-visitors">今日访客</span>
3 years ago
</div>
3 months ago
<div class="gate-right">
<div class="gate-info">
<span class="gate-name">{{gateName}}</span>
<span @click="gateShow = true" class="switch-gate">切换</span>
</div>
<div class="fullscreen-btn" @click='screen'>
{{fullscreen?'取消全屏':'打开全屏'}}
</div>
3 years ago
</div>
3 months ago
</div>
<!-- 主要内容区域 -->
<div class="gate-content">
<div class="form-container">
<div class="form-item">
<label class="form-label">拜访日期</label>
<el-date-picker
v-model="selectRange"
@change="selectRangeM"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
class="date-picker"
:popper-class="'mobile-date-picker'"
append-to-body>
</el-date-picker>
</div>
<div class="form-item">
<label class="form-label">核验销码</label>
<el-input
clearable
ref='codeInput'
placeholder="请输入核销码或扫码"
v-model="select.code"
class="form-input"
@change='getList'>
</el-input>
</div>
<div class="form-item">
<label class="form-label">身份证件</label>
<div class="id-input-group">
<el-input
clearable
ref='idInput'
placeholder="请输入身份证"
v-model="select.idcard"
class="form-input id-input">
</el-input>
<el-button type="primary" @click='getIdcard' class="id-btn">查询身份证</el-button>
</div>
</div>
<div class="form-item query-btn-container">
<el-button class="query-btn" type="primary" @click='getList'>查询</el-button>
</div>
3 years ago
</div>
</div>
</div>
<showVisit ref="showVisit" @refresh='clearCode'></showVisit>
3 years ago
<list ref='list'></list>
3 years ago
<!-- 选择门岗人员 -->
<el-dialog title="请先选择门岗人员" :visible.sync="gateShow" width="60%" :close-on-click-modal='false' :show-close='false'>
<el-radio-group v-model="gateAdminId">
<el-radio v-for="item in gateData" :label="item.id" border>{{item.name}}</el-radio>
</el-radio-group>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmGate"> </el-button>
</span>
</el-dialog>
3 years ago
3 years ago
</div>
</template>
3 years ago
<script>
3 months ago
import Cookies from 'js-cookie'
3 years ago
import axios from 'axios'
3 months ago
import showVisit from '@/views/visit/component/showVisit'
3 years ago
import list from '@/views/gate/components/list.vue'
3 years ago
import {
3 years ago
getList,
3 years ago
getUserList
3 years ago
} from '@/api/gate'
export default {
3 years ago
components: {
3 months ago
showVisit,
list
3 years ago
},
3 years ago
data() {
3 years ago
return {
fullscreen: false,
3 years ago
gateShow: false,
gateAdminId: '',
3 years ago
gateName: "",
3 years ago
gateData: [],
3 years ago
gateUser: {},
3 years ago
selectRange: [],
3 years ago
select: {
page: 1,
rows: 10,
keyword: "",
3 years ago
audit_status: '',
3 years ago
start_date: "",
end_date: "",
3 years ago
is_export: 0,
code: "",
idcard: ''
3 years ago
},
data: [],
}
},
computed: {},
mounted() {
3 years ago
// this.screen()
3 years ago
},
3 years ago
created() {
3 years ago
// this.getIdcard()
3 years ago
this.getUserList()
this.getToday()
3 years ago
// this.enterfullscreen()
3 years ago
},
3 months ago
methods: {
openList(){
this.$refs.list.listShow = true
3 years ago
},
getToday() {
let now = new Date()
let nowDay = this.$moment(now).format("YYYY-MM-DD")
this.select.start_date = nowDay
this.select.end_date = nowDay
this.selectRange = [nowDay, nowDay]
},
3 years ago
selectRangeM(val) {
3 years ago
console.log(val)
if (val) {
this.select.start_date = val[0]
this.select.end_date = val[1]
} else {
this.select.start_date = ""
this.select.end_date = ""
}
},
clearCode() {
this.select.code = ''
this.select.idcard = ''
this.$nextTick(() => {
this.$refs.codeInput.focus()
})
3 years ago
},
async getList() {
3 years ago
if (this.select.code == '' && this.select.idcard == '') {
this.$successMessage("请输入核销码或身份证件", '', 'warning')
return
}
3 years ago
let res = await getList(this.select)
3 years ago
this.data = res.data
3 years ago
if (this.data.length > 0) {
for (var k of this.data) {
if (k.audit_status == 1 || k.audit_status == 3) {
3 years ago
this.$refs['showVisit'].form = k
3 years ago
this.$refs['showVisit'].formDataType = 'coderecord'
this.$refs['showVisit'].gateAdminId = this.gateAdminId
3 months ago
this.$refs['showVisit'].isShow = true
3 years ago
return
3 years ago
} else {
this.$successMessage(k.audit_status_text, '', 'success')
}
3 years ago
}
} else {
this.$successMessage("未查询到记录", '', 'warning')
3 months ago
}
this.select.code = ''
3 years ago
this.select.idcard = ''
3 years ago
},
async getUserList() {
3 years ago
this.gateUser = Cookies.get("gateUser") ? JSON.parse(Cookies.get("gateUser")) : ''
3 years ago
console.log(this.gateUser)
3 years ago
let res = await getUserList()
this.gateData = res
3 years ago
if (this.gateUser.gateAdminId) {
this.gateAdminId = this.gateUser.gateAdminId
this.gateName = this.gateUser.gateName
this.gateShow = false
return
} else {
this.gateShow = true
}
3 years ago
},
confirmGate() {
if (!this.gateAdminId) {
this.$successMessage("请先选择门岗", '', 'warning')
return
3 years ago
}
3 years ago
this.gateData.map(item => {
if (this.gateAdminId == item.id) {
this.gateName = item.name
}
})
Cookies.set('gateUser', {
gateName: this.gateName,
gateAdminId: this.gateAdminId
})
3 years ago
this.$nextTick(() => {
this.$refs.codeInput.focus()
})
this.gateShow = false
3 years ago
},
3 months ago
getIdcard() {
let that = this
axios.get('https://127.0.0.1:24011/ZKIDROnline/ScanReadIdCardInfo?OP-DEV=1&CMD-URL=4&REPEAT=1&READTYPE=1',{
'headers':{
"Content-Type":'application/json'
}
})
.then(res=>{
console.log(res)
console.log(res.data)
if(!res.data){
return
}
let data1 = res.data?res.data.split('"IDNumber"'):''
let data2= data1[1].split(",")
let data3 =data2[0].replace(/[^\d]/g, "")
that.select.idcard = data3
that.getList()
}).catch(err=>{
console.log(err)
this.$successMessage(err.statusText, '', 'warning')
3 years ago
})
3 years ago
},
screen() {
let element = document.documentElement;
if (this.fullscreen) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
} else {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.msRequestFullscreen) {
// IE11
element.msRequestFullscreen();
}
}
this.fullscreen = !this.fullscreen;
3 years ago
},
enterfullscreen() { //进入全屏
var docElm = document.documentElement
//W3C
if (docElm.requestFullscreen) {
docElm.requestFullscreen()
}
//FireFox
else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen()
}
//Chrome等
else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen()
}
//IE11
else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen()
}
},
//退出全屏
exitfullscreen() {
if (document.exitFullscreen) {
document.exitFullscreen()
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen()
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen()
} else if (document.msExitFullscreen) {
document.msExitFullscreen()
}
3 years ago
}
3 years ago
},
}
</script>
3 years ago
<style scoped>
3 months ago
/* 基础容器样式 */
.gatewrap {
background-color: #fff;
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* 头部导航样式 */
.gate-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 20px;
border-bottom: 1px solid #f0f0f0;
background: #fafafa;
@media (max-width: 767px) {
padding: 10px 15px;
flex-direction: column;
gap: 10px;
align-items: stretch;
}
}
.gate-left {
.today-visitors {
color: #004593;
font-size: 18px;
cursor: pointer;
@media (max-width: 767px) {
font-size: 16px;
}
&:hover {
text-decoration: underline;
}
}
}
.gate-right {
display: flex;
align-items: center;
gap: 20px;
@media (max-width: 767px) {
justify-content: space-between;
gap: 10px;
3 years ago
}
3 months ago
}
.gate-info {
display: flex;
align-items: center;
gap: 5px;
3 years ago
3 months ago
.gate-name {
font-size: 16px;
color: #333;
@media (max-width: 767px) {
font-size: 14px;
}
3 years ago
}
3 months ago
.switch-gate {
color: #004593;
text-decoration: underline;
cursor: pointer;
font-size: 14px;
@media (max-width: 767px) {
font-size: 12px;
}
3 years ago
}
3 months ago
}
.fullscreen-btn {
color: #666;
cursor: pointer;
font-size: 14px;
3 years ago
3 months ago
@media (max-width: 767px) {
font-size: 12px;
3 years ago
}
3 years ago
3 months ago
&:hover {
color: #004593;
3 years ago
}
3 months ago
}
/* 主要内容区域 */
.gate-content {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
3 years ago
3 months ago
@media (max-width: 767px) {
align-items: flex-start;
padding: 20px 15px;
3 years ago
}
3 months ago
}
.form-container {
width: 100%;
max-width: 500px;
@media (min-width: 768px) {
max-width: 600px;
3 years ago
}
3 months ago
}
.form-item {
margin-bottom: 25px;
@media (max-width: 767px) {
margin-bottom: 20px;
3 years ago
}
3 months ago
&:last-child {
margin-bottom: 0;
3 years ago
}
3 months ago
}
.form-label {
display: block;
font-size: 16px;
color: #333;
margin-bottom: 8px;
font-weight: 500;
3 years ago
3 months ago
@media (max-width: 767px) {
font-size: 14px;
margin-bottom: 6px;
3 years ago
}
3 months ago
@media (min-width: 768px) {
3 years ago
font-size: 20px;
3 months ago
margin-bottom: 10px;
3 years ago
}
3 months ago
}
3 years ago
3 months ago
.form-input {
width: 100%;
}
.date-picker {
width: 100%;
}
.id-input-group {
display: flex;
gap: 10px;
@media (max-width: 767px) {
flex-direction: column;
gap: 8px;
3 years ago
}
3 months ago
}
3 years ago
3 months ago
.id-input {
flex: 1;
}
.id-btn {
@media (max-width: 767px) {
width: 100%;
3 years ago
}
3 months ago
@media (min-width: 768px) {
min-width: 120px;
3 years ago
}
3 months ago
}
.query-btn-container {
text-align: center;
margin-top: 30px;
3 years ago
3 months ago
@media (max-width: 767px) {
margin-top: 25px;
}
}
.query-btn {
width: 100%;
height: 50px;
font-size: 18px;
font-weight: 600;
@media (max-width: 767px) {
height: 44px;
font-size: 16px;
}
@media (min-width: 768px) {
height: 60px;
font-size: 24px;
}
}
/* Element UI 组件样式覆盖 */
::v-deep .el-input__inner {
height: 44px;
font-size: 16px;
@media (max-width: 767px) {
height: 40px;
font-size: 14px;
}
@media (min-width: 768px) {
height: 50px;
3 years ago
font-size: 18px;
}
3 months ago
}
::v-deep .el-button {
height: 44px;
font-size: 14px;
@media (max-width: 767px) {
height: 40px;
font-size: 13px;
}
@media (min-width: 768px) {
height: 50px;
font-size: 16px;
}
}
::v-deep .el-date-editor {
width: 100%;
}
::v-deep .el-range-editor .el-range-input {
font-size: 14px;
@media (min-width: 768px) {
font-size: 16px;
}
}
::v-deep .el-date-editor .el-range-separator {
font-size: 14px;
@media (min-width: 768px) {
font-size: 16px;
}
}
::v-deep .el-date-editor .el-range__icon,
::v-deep .el-date-editor .el-range__close-icon {
font-size: 14px;
}
/* 对话框样式优化 */
::v-deep .el-dialog {
@media (max-width: 767px) {
width: 90% !important;
margin-top: 15vh !important;
}
}
3 years ago
3 months ago
::v-deep .el-radio {
@media (max-width: 767px) {
3 years ago
width: 100%;
3 months ago
margin-bottom: 10px;
}
}
/* 日期选择器输入框在移动端的样式调整 */
::v-deep .el-range-editor {
@media (max-width: 767px) {
.el-range-input {
width: 35% !important;
font-size: 13px !important;
}
.el-range-separator {
width: 15% !important;
font-size: 12px !important;
text-align: center;
}
.el-range__icon,
.el-range__close-icon {
font-size: 12px !important;
}
}
}
</style>
<!-- 不带scoped的样式专门处理日期选择器弹出层 -->
<style>
/* 移动端日期选择器弹出层优化 */
@media (max-width: 767px) {
.mobile-date-picker.el-picker-panel {
position: fixed !important;
left: 10px !important;
right: 10px !important;
top: 50% !important;
transform: translateY(-50%) !important;
width: auto !important;
max-width: none !important;
min-width: auto !important;
margin: 0 !important;
z-index: 9999 !important;
}
.mobile-date-picker.el-date-range-picker {
min-width: auto !important;
width: 100% !important;
}
.mobile-date-picker .el-picker-panel__body {
display: flex !important;
flex-direction: column !important;
min-width: auto !important;
width: 100% !important;
}
.mobile-date-picker .el-picker-panel__content {
display: flex !important;
flex-direction: column !important;
width: 100% !important;
}
.mobile-date-picker .el-picker-panel__content .el-date-table {
margin: 0 5px 10px 5px !important;
width: calc(100% - 10px) !important;
}
.mobile-date-picker .el-date-range-picker__time-header {
display: flex !important;
flex-direction: column !important;
gap: 5px !important;
padding: 5px !important;
}
.mobile-date-picker .el-picker-panel__sidebar {
width: 100% !important;
padding: 5px !important;
}
.mobile-date-picker .el-picker-panel__sidebar .el-picker-panel__shortcut {
display: inline-block !important;
margin: 2px !important;
padding: 3px 8px !important;
font-size: 12px !important;
}
.mobile-date-picker .el-picker-panel__footer {
text-align: center !important;
padding: 10px !important;
3 years ago
}
3 months ago
}
</style>