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.

370 lines
10 KiB

3 years ago
<template>
3 years ago
<div>
3 years ago
<div class="gatewrap">
<div class="gateLeft">
<span @click='openList'>今日访客</span>
</div>
3 years ago
<div class="gateRight">
<span>
{{gateName}}<span @click="gateShow = true">切换</span>
</span>
<span @click='screen'>{{fullscreen?'取消全屏':'打开全屏'}}</span>
</div>
3 years ago
<div class="gatecode">
<div>
拜访日期
<el-date-picker v-model="selectRange" @change="selectRangeM" value-format="yyyy-MM-dd" type="daterange"
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
3 years ago
style="width:400px;vertical-align: middle;">
3 years ago
</el-date-picker>
</div>
<div>
核验销码
<el-input clearable ref='codeInput' size="mini" placeholder="请输入核销码或扫码" v-model="select.code"
3 years ago
style="width: 160px;margin-right: 10px;" @change='getList'></el-input>
3 years ago
</div>
<div>
身份证件
<el-input clearable ref='idInput' size="mini" placeholder="请输入身份证" v-model="select.idcard"
style="width: 160px;margin-right: 10px;"></el-input>
3 years ago
<el-button type="primary" @click='getIdcard'>查询身份证</el-button>
3 years ago
</div>
<div>
3 years ago
<el-button class="getButton" type="primary" @click='getList'>查询</el-button>
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 years ago
import Cookies from 'js-cookie'
import axios from 'axios'
3 years ago
import showVisit from '@/views/visit/component/showVisit'
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 years ago
showVisit,
list
3 years ago
},
3 years ago
data() {
3 years ago
return {
fullscreen: false,
3 years ago
clientHeight: 0,
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 years ago
methods: {
init() {
let clientHeight = document.documentElement.clientHeight;
this.clientHeight = clientHeight
3 years ago
},
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 years ago
this.$refs['showVisit'].isShow = true
return
3 years ago
} else {
this.$successMessage(k.audit_status_text, '', 'success')
}
3 years ago
}
} else {
this.$successMessage("未查询到记录", '', 'warning')
3 years ago
}
this.select.code = ''
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 years ago
getIdcard() {
3 years ago
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=>{
3 years ago
console.log(res)
3 years ago
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
},
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 years ago
.gatewrap {
background-color: #fff;
3 years ago
position: relative;
height: 100vh
3 years ago
}
.gatecode {
font-size: 32px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: left;
display: inline-block;
}
.gatecode>div {
margin-bottom: 40px;
}
3 years ago
.gatecode>div:last-child {
margin-bottom: 0px;
3 years ago
}
3 years ago
3 years ago
.gateRight {
position: absolute;
right: 20px;
top: 20px;
font-size: 20px;
}
.gateRight span {
margin-right: 10px;
margin-left: 5px;
}
.gateRight span>span {
3 years ago
text-decoration: underline;
color:#004593
}
.gateLeft{
position: absolute;
left: 20px;
top: 20px;
font-size: 20px;
color:#004593
3 years ago
}
3 years ago
/deep/ .el-input {
3 years ago
width: 400px !important;
3 years ago
}
/deep/ .el-input__inner {
font-size: 32px;
height: 45px;
3 years ago
width: 400px;
3 years ago
}
3 years ago
/deep/ .gatewrap .el-button {
3 years ago
vertical-align: top;
3 years ago
height: 45px;
width: 145px;
font-size: 20px;
3 years ago
}
/deep/ .el-range-editor .el-range-input {
font-size: 20px;
}
/deep/ .el-date-editor .el-range-separator {
font-size: 20px;
line-height: 36px;
}
/deep/ .el-date-editor .el-range__icon {
font-size: 18px;
line-height: 38px;
}
/deep/ .el-date-editor .el-range__close-icon {
font-size: 18px;
line-height: 38px;
}
3 years ago
.gatecode .getButton.el-button {
3 years ago
width: 100%;
font-size: 32px;
height: 70px
3 years ago
}
</style>