|
@@ -13,25 +13,28 @@
|
|
|
<image style="width: 130px; height: 130px" src="@/assets/images/idcard.png" v-if="!cardId" />
|
|
|
<div class="VisitorsRecord" >
|
|
|
<p v-if="visitorsRecord == '查询数据为空' && visitorsRecordState"> 暂无访客记录 </p>
|
|
|
- <!-- <div class="list" v-if="visitorsRecord.length>0">
|
|
|
- <div class="item" v-for="(item,index) in visitorsRecord" :key="index" @click="handle('select',item)" :class="item.targetPeopleCode == active ? 'active' : ''">
|
|
|
+ <div class="list" v-if="visitorsRecord != '查询数据为空' && visitorsRecord.length>0 && cardId ">
|
|
|
+ <div class="item" v-for="(item,index) in visitorsRecord" :key="index" @click="handle('select',item)" :class="item.visitorPersonList[0].recordId == active ? 'active' : ''">
|
|
|
<div>
|
|
|
- <span class="p1">被访人姓名:</span><span class="p2">{{item.targetPeopleName}}</span>
|
|
|
+ <span class="p1">访客姓名:</span><span class="p2">{{item?.visitorPersonList[0].peopleName}}</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <span class="p1">被访人身份证号:</span><span class="p2">{{item.targetPeopleName}}</span>
|
|
|
+ <span class="p1">访客手机号:</span><span class="p2">{{item?.visitorPersonList[0].peoplePhone}}</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <span class="p1">被访人手机号:</span><span class="p2">{{item.targetPeopleName}}</span>
|
|
|
+ <span class="p1">被访人姓名:</span><span class="p2">{{item?.targetPeopleName}}</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <span class="p1">来访事由:</span><span class="p2">{{item.targetPeopleName}}</span>
|
|
|
+ <span class="p1">被访人手机号:</span><span class="p2">{{item?.targetPeoplePhone}}</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <span class="p1">来访时间:</span><span class="p2">{{item.targetPeopleName}}</span>
|
|
|
+ <span class="p1">来访事由:</span><span class="p2">{{item?.visitorReasonInfo}}</span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span class="p1">来访时间:</span><span class="p2">{{item?.startTime?.slice(5,20)}} ~ {{item?.endTime?.slice(5,20)}}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<el-button type="primary" @click="handle('signIn')" class="validate-contain-search-button" size="large" v-if="active" style="width:30%;margin:10% 35% 0;"> 签 到 </el-button>
|
|
|
</div>
|
|
@@ -43,57 +46,21 @@
|
|
|
/*----------------------------------依赖引入-----------------------------------*/
|
|
|
import axios from "axios";
|
|
|
import { ref } from "vue";
|
|
|
+import dayjs from 'dayjs'
|
|
|
import { getVisitor, signinoutVisitor } from "@/api/index";
|
|
|
-import 'animate.css';
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
+import { useRouter } from "vue-router";
|
|
|
/*----------------------------------组件引入-----------------------------------*/
|
|
|
import layout from "@/components/layout/index.vue";
|
|
|
+import 'animate.css';
|
|
|
/*----------------------------------变量声明-----------------------------------*/
|
|
|
const timer = ref(null);
|
|
|
-const cardId = ref('341282199208123456');//身份证号码
|
|
|
+const cardId = ref('341282199204020157');//身份证号码
|
|
|
const active = ref(null); //当前选中的访客记录
|
|
|
const visitorsRecordState = ref(false);//访客记录状态
|
|
|
-const visitorsRecord = ref([
|
|
|
- {
|
|
|
- targetPeoplePhone:"1111",
|
|
|
- targetPeopleName:"2222",
|
|
|
- visitorReason:"2222",
|
|
|
- startTime:"2222",
|
|
|
- endTime:"2222",
|
|
|
- targetPeopleCode:1,
|
|
|
- },
|
|
|
- {
|
|
|
- targetPeoplePhone:"1111",
|
|
|
- targetPeopleName:"2222",
|
|
|
- visitorReason:"2222",
|
|
|
- startTime:"2222",
|
|
|
- endTime:"2222",
|
|
|
- targetPeopleCode:2,
|
|
|
- },
|
|
|
- {
|
|
|
- targetPeoplePhone:"1111",
|
|
|
- targetPeopleName:"2222",
|
|
|
- visitorReason:"2222",
|
|
|
- startTime:"2222",
|
|
|
- endTime:"2222",
|
|
|
- targetPeopleCode:3,
|
|
|
- },
|
|
|
- {
|
|
|
- targetPeoplePhone:"1111",
|
|
|
- targetPeopleName:"2222",
|
|
|
- visitorReason:"2222",
|
|
|
- startTime:"2222",
|
|
|
- endTime:"2222",
|
|
|
- targetPeopleCode:4,
|
|
|
- },
|
|
|
- {
|
|
|
- targetPeoplePhone:"1111",
|
|
|
- targetPeopleName:"2222",
|
|
|
- visitorReason:"2222",
|
|
|
- startTime:"2222",
|
|
|
- endTime:"2222",
|
|
|
- targetPeopleCode:5,
|
|
|
- },
|
|
|
-]);
|
|
|
+const visitorsRecord = ref([]);
|
|
|
+const time = dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss")
|
|
|
+const router = useRouter();
|
|
|
/*----------------------------------方法声明-----------------------------------*/
|
|
|
/**
|
|
|
* 公众号引导状态切换
|
|
@@ -114,17 +81,40 @@ function handle(type,item) {
|
|
|
if(type === 'get'){ //获取访客记录
|
|
|
getVisitor(JSON.stringify({cardId:cardId.value})).then((response) => {
|
|
|
visitorsRecordState.value = true
|
|
|
- visitorsRecord.value = response.data
|
|
|
- console.log(visitorsRecord.value)
|
|
|
+ active.value = null
|
|
|
+ if(typeof(response.data) == 'object'){
|
|
|
+ visitorsRecord.value = []
|
|
|
+ for(let i=0;i<response.data.length;i++){
|
|
|
+ if(response.data[i]?.startTime?.slice(0,10) == time.slice(0,10)){
|
|
|
+ visitorsRecord.value.push(response.data[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(visitorsRecord.value.length == 1){
|
|
|
+ active.value = visitorsRecord.value[0].visitorPersonList[0].recordId;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ visitorsRecord.value = response.data
|
|
|
+ }
|
|
|
}).catch((error) => {
|
|
|
visitorsRecordState.value = true
|
|
|
})
|
|
|
}
|
|
|
if(type ==='select'){ //选择访客记录
|
|
|
- active.value = item.targetPeopleCode;
|
|
|
+ active.value = item.visitorPersonList[0].recordId;
|
|
|
}
|
|
|
if(type ==='signIn'){
|
|
|
- signinoutVisitor({recordId:active.value})
|
|
|
+ signinoutVisitor({recordId:active.value,signInOutState:"in"}).then((response) => {
|
|
|
+ console.log(response)
|
|
|
+ if(response.code == 200){
|
|
|
+ ElMessage({
|
|
|
+ message: "线下签到成功,请留意'共进科技大厦'小程序推送的通行二维码",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ setTimeout(function () {
|
|
|
+ router.push({ path: "/" });
|
|
|
+ }, 2000);
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
onMounted(() => {
|
|
@@ -201,6 +191,7 @@ onUnmounted(() => {
|
|
|
background: rgba(255,255,255,.8);
|
|
|
border-radius: 10px;
|
|
|
margin:1% 0 0 1%;
|
|
|
+ cursor: pointer;
|
|
|
span{
|
|
|
margin-top:10px;
|
|
|
}
|