592 lines
12 KiB
Vue
592 lines
12 KiB
Vue
<template>
|
||
<!-- 新增问题 -->
|
||
<view class="addIssue">
|
||
<view class="fixedheader">
|
||
<headers :showBack="true">
|
||
<view class="headerName">
|
||
{{pageTitle}}
|
||
</view>
|
||
</headers>
|
||
</view>
|
||
<view class="content" :style="{paddingTop: mobileTopHeight + 50 + 'px'}">
|
||
<view class="type flex">
|
||
<view class="name"><text class="star">*</text>通行设备:</view>
|
||
<picker @change="(e)=>bindPickerChange(e,1)" :value="passEquipIndex" class="picker"
|
||
:range="devEquipList" range-key="devName">
|
||
<view class="uni-input uni-select cl" v-if="passEquipIndex==null && !defaultDevEquip">
|
||
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
|
||
</view>
|
||
<view class="uni-input uni-select" v-else>
|
||
{{defaultDevEquip || devEquipList[passEquipIndex].devName}}
|
||
<image class="icon-down" src="/static/icon-down-black.png"></image>
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
<view class="type flex">
|
||
<view class="name"><text class="star">*</text>通行方向:</view>
|
||
<picker @change="(e)=>bindPickerChange(e,2)" :value="passDirectionIndex" class="picker"
|
||
:range="passDirectionList" range-key="name">
|
||
<view class="uni-input uni-select cl" v-if="form.direction==null">
|
||
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
|
||
</view>
|
||
<view class="uni-input uni-select" v-else>
|
||
{{form.direction==1?'进':form.direction==2?'出':''}}
|
||
<image class="icon-down" src="/static/icon-down-black.png"></image>
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
<view class="type flex">
|
||
<view class="name"><text class="star">*</text>通行时间:</view>
|
||
<dateTimePiccker :placeholder="'请选择'" :start="startTime" fields="second"
|
||
:default-value="form.passTime" @change="bindPickerChange($event,'passTime')"
|
||
class="dateTimePiccker">
|
||
<!-- <view class="uni-input uni-select cl" v-if="form.inspectTime===''">
|
||
请选择 <image class="icon-right" src="/static/icon-right.png"></image>
|
||
</view>
|
||
<view class="uni-input uni-select" v-else>{{form.inspectTime}}
|
||
<image class="icon-right" src="/static/icon-right.png"></image>
|
||
</view> -->
|
||
</dateTimePiccker>
|
||
<!-- <picker @change="(e)=>bindPickerChange(e,4)" mode="date" :value="form.inspectTime" class="picker">
|
||
<view class="uni-input uni-select cl" v-if="form.inspectTime===''">
|
||
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
|
||
</view>
|
||
<view class="uni-input uni-select" v-else>{{form.inspectTime}}
|
||
<image class="icon-down" src="/static/icon-down-black.png"></image>
|
||
</view>
|
||
</picker> -->
|
||
</view>
|
||
<view class="type flex">
|
||
<view class="name"><text class="star">*</text>通行方式:</view>
|
||
<picker @change="(e)=>bindPickerChange(e,3)" :value="passTypeIndex" class="picker"
|
||
:range="passTypeList" range-key="name">
|
||
<view class="uni-input uni-select cl" v-if="form.passType==null">
|
||
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
|
||
</view>
|
||
<view class="uni-input uni-select" v-else>
|
||
{{form.passType==1?'IC卡':form.passType==2?'人脸识别':form.passType==3?'指纹识别':form.passType==5?'二维码':form.passType==6?'蓝牙':''}}
|
||
<image class="icon-down" src="/static/icon-down-black.png"></image>
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
<!-- <view class="type flex3">
|
||
<view class="name">补充说明:</view>
|
||
<textarea class="textarea" maxlength="-1" placeholder-class="cl" name="inspectContent"
|
||
@input='supplementTextarea' :value="form.dangerDesc" placeholder="请输入"></textarea>
|
||
</view> -->
|
||
<view class="addSaveBtn" @click="addSaveBtn">新增保存</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import dateTimePiccker from '@/components/dateTimePicker/index.vue'
|
||
import {
|
||
dateformat
|
||
} from "@/utils/tool.js"
|
||
export default {
|
||
components: {
|
||
dateTimePiccker
|
||
},
|
||
data() {
|
||
return {
|
||
passTypeList: [{
|
||
name: 'IC卡',
|
||
value: 1
|
||
},
|
||
{
|
||
name: '人脸识别',
|
||
value: 2
|
||
},
|
||
{
|
||
name: '指纹识别',
|
||
value: 3
|
||
},
|
||
{
|
||
name: '二维码',
|
||
value: 5
|
||
},
|
||
{
|
||
name: '蓝牙',
|
||
value: 6
|
||
}
|
||
],
|
||
passTypeIndex: null,
|
||
passDirectionList: [{
|
||
name: '进',
|
||
value: 1
|
||
},
|
||
{
|
||
name: '出',
|
||
value: 2
|
||
}
|
||
],
|
||
passDirectionIndex: null,
|
||
defaultDevEquip: "",
|
||
devEquipList: [],
|
||
passEquipIndex: null,
|
||
mobileTopHeight: 0,
|
||
startTime: this.getDate({
|
||
format: true,
|
||
}),
|
||
form: {
|
||
passTime: "",
|
||
passType: null,
|
||
direction: null,
|
||
devCode: ""
|
||
},
|
||
workerInfo: {}
|
||
}
|
||
},
|
||
onLoad(option) {
|
||
this.pageTitle = option.type == 'add' ? '添加补卡' : '添加补卡';
|
||
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
|
||
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
|
||
this.workerInfo = JSON.parse(decodeURIComponent(option.item));
|
||
this.getPassEquipList();
|
||
},
|
||
mounted() {
|
||
var that = this
|
||
uni.getSystemInfo({
|
||
success(res) {
|
||
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
|
||
uni.setStorageSync('systemInfo', res)
|
||
console.log(res)
|
||
}
|
||
})
|
||
console.log('this.mobileTopHeight', this.mobileTopHeight)
|
||
},
|
||
methods: {
|
||
//获取通行设备
|
||
getPassEquipList() {
|
||
this.sendRequest({
|
||
url: 'xmgl/ufaceDev/list',
|
||
method: 'post',
|
||
data: {
|
||
projectSn: this.projectSn
|
||
},
|
||
success: res => {
|
||
console.log(res.result, '通行设备')
|
||
if (res.result.length > 0) {
|
||
this.devEquipList = res.result;
|
||
} else {
|
||
this.devEquipList = [];
|
||
}
|
||
}
|
||
})
|
||
},
|
||
getDate(type) {
|
||
const date = new Date();
|
||
let year = date.getFullYear();
|
||
let month = date.getMonth() + 1;
|
||
let day = date.getDate();
|
||
if (type === 'start') {
|
||
year = year;
|
||
} else if (type === 'end') {
|
||
// year = year + 2;
|
||
}
|
||
month = month > 9 ? month : '0' + month;
|
||
day = day > 9 ? day : '0' + day;
|
||
return `${year}-${month}-${day}`;
|
||
},
|
||
//下拉选择回显
|
||
bindPickerChange(e, type) {
|
||
console.log(e)
|
||
if (type == 1) {
|
||
this.passEquipIndex = e.detail.value;
|
||
this.form.devCode = this.devEquipList[e.detail.value].devSn;
|
||
} else if (type == 2) {
|
||
this.passDirectionIndex = e.detail.value;
|
||
this.form.direction = this.passDirectionList[e.detail.value].value;
|
||
} else if (type == 3) {
|
||
this.passTypeIndex = e.detail.value;
|
||
this.form.passType = this.passTypeList[e.detail.value].value
|
||
} else if (type == 'passTime') {
|
||
this.form.passTime = e.f3;
|
||
}
|
||
},
|
||
//新增保存
|
||
async addSaveBtn() {
|
||
console.log(this.workerInfo,777888)
|
||
console.log(this.form,888999)
|
||
let data = JSON.parse(JSON.stringify(this.form));
|
||
if (!data.devCode) {
|
||
uni.showToast({
|
||
title: '请选择通行设备',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
if (!data.direction) {
|
||
uni.showToast({
|
||
title: '请选择通行方向',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
if (!data.passTime) {
|
||
uni.showToast({
|
||
title: '请选择通行时间',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
if (!data.passType) {
|
||
uni.showToast({
|
||
title: '请选择通行方式',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
let requestData = {
|
||
...data,
|
||
faceUrl: this.workerInfo.fieldAcquisitionUrl,
|
||
idCard: this.workerInfo.idCard,
|
||
projectCode: this.projectSn
|
||
}
|
||
this.sendRequest({
|
||
url: 'xmgl/itbgp/api/passRecord',
|
||
method: 'post',
|
||
data: requestData,
|
||
success: (res) => {
|
||
console.log(res)
|
||
if (res.status == 1) {
|
||
uni.showToast({
|
||
title: '保存成功'
|
||
})
|
||
setTimeout(() => {
|
||
uni.navigateBack({
|
||
delta: 1
|
||
})
|
||
}, 1200)
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none'
|
||
})
|
||
}
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.fixedheader {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
z-index: 2;
|
||
|
||
.headerName {
|
||
z-index: 1;
|
||
}
|
||
}
|
||
|
||
.tab {
|
||
width: 100%;
|
||
height: 45px;
|
||
text-align: center;
|
||
box-shadow: 0 0 10px rgba(194, 194, 194, 0.5);
|
||
}
|
||
|
||
.tabType {
|
||
width: 50%;
|
||
line-height: 43px;
|
||
border-bottom: 1px solid rgba(194, 194, 194, 0.2);
|
||
|
||
}
|
||
|
||
.noCheckTab {
|
||
padding-bottom: 2px;
|
||
}
|
||
|
||
.lagCss {
|
||
width: 180px;
|
||
height: 61px;
|
||
background: #fff;
|
||
text-align: center;
|
||
line-height: 29px;
|
||
border-radius: 10px;
|
||
}
|
||
|
||
.add2 {
|
||
width: 120px;
|
||
height: 30px;
|
||
line-height: 30px;
|
||
text-align: center;
|
||
color: #fff;
|
||
background: #4181fe;
|
||
border-radius: 25px;
|
||
font-size: 14px;
|
||
margin: 0px 22px;
|
||
}
|
||
|
||
.point {
|
||
height: 20px;
|
||
width: 20px;
|
||
position: absolute;
|
||
}
|
||
|
||
.flex {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.flex2 {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.flex3 {
|
||
display: flex;
|
||
}
|
||
|
||
.content {
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
padding: 20px 30rpx;
|
||
}
|
||
|
||
.type {
|
||
font-size: 30rpx;
|
||
line-height: 40px;
|
||
margin-bottom: 8px;
|
||
/* border-bottom: 1px solid rgba(194, 194, 194, 0.2); */
|
||
}
|
||
|
||
.type .name {
|
||
margin-right: 6px;
|
||
width: 176rpx;
|
||
text-align: right;
|
||
}
|
||
|
||
.radio-wrap {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.radio {
|
||
margin-right: 20px;
|
||
}
|
||
}
|
||
|
||
.accessory {
|
||
width: 100%;
|
||
height: 70px;
|
||
padding: 0 10px;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.accessoryImg {
|
||
width: 110rpx;
|
||
height: 60px;
|
||
margin-right: 8px;
|
||
}
|
||
|
||
.picker {
|
||
width: 70%;
|
||
border: 1px solid rgba(42, 43, 91, 0.3);
|
||
padding: 0px 30rpx;
|
||
box-sizing: border-box;
|
||
border-radius: 5px;
|
||
}
|
||
|
||
.uni-input {
|
||
line-height: 32px;
|
||
}
|
||
|
||
.textarea {
|
||
width: calc(79% - 32px);
|
||
border-radius: 5px;
|
||
border: 1px solid rgba(42, 43, 91, 0.3);
|
||
padding: 8px 15px;
|
||
box-sizing: border-box;
|
||
height: 50px;
|
||
}
|
||
|
||
.inpuStyle {
|
||
width: calc(80% - 35px);
|
||
border-radius: 20px;
|
||
border: 1px solid rgba(42, 43, 91, 0.3);
|
||
padding: 8px 15px;
|
||
box-sizing: border-box;
|
||
height: 35px;
|
||
color: #000;
|
||
}
|
||
|
||
.cl {
|
||
font-size: 30rpx;
|
||
border-radius: 5px;
|
||
}
|
||
|
||
|
||
.imgBox_wrap {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
margin-top: 10px;
|
||
width: 75%;
|
||
}
|
||
|
||
.imgBox {
|
||
width: 60px;
|
||
height: 60px;
|
||
display: inline-flex;
|
||
position: relative;
|
||
margin-right: 15px;
|
||
margin-bottom: 8px;
|
||
|
||
.img {
|
||
width: 100%;
|
||
height: 100%;
|
||
border-radius: 10px;
|
||
}
|
||
|
||
}
|
||
|
||
.addImgBox {
|
||
border: 1px solid rgba(42, 43, 91, 0.1);
|
||
background-color: #f6f5f8;
|
||
width: 60px;
|
||
height: 60px;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 10px;
|
||
font-size: 12px;
|
||
|
||
.icon-add {
|
||
width: 18px;
|
||
height: 18px;
|
||
}
|
||
}
|
||
|
||
.unitDialog {
|
||
position: fixed;
|
||
left: 0;
|
||
right: 0;
|
||
top: 0;
|
||
bottom: 0;
|
||
z-index: 111;
|
||
background-color: rgba(0, 0, 0, 0.5);
|
||
}
|
||
|
||
.unitContent {
|
||
width: 85%;
|
||
height: 70%;
|
||
margin: 25% auto 0;
|
||
background-color: #fff;
|
||
box-sizing: border-box;
|
||
padding: 20px 30rpx;
|
||
border-radius: 5px;
|
||
box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
|
||
}
|
||
|
||
.tabs {
|
||
border-bottom: 1px solid rgba(153, 153, 153, 0.5);
|
||
}
|
||
|
||
.tabs_name {
|
||
width: 40%;
|
||
text-align: center;
|
||
padding: 5px 10rpx;
|
||
box-sizing: border-box;
|
||
font-size: 30rpx;
|
||
}
|
||
|
||
.checkName {
|
||
border-bottom: 2px solid #4181FE;
|
||
color: #4181FE;
|
||
}
|
||
|
||
.noCheckName {
|
||
padding-top: 4px;
|
||
}
|
||
|
||
.unitList {
|
||
margin: 10px 0;
|
||
font-size: 30rpx;
|
||
|
||
.title {
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.list_val {
|
||
padding: 8px 10px;
|
||
}
|
||
}
|
||
|
||
.bg_999 {
|
||
background-color: rgba(153, 153, 153, 0.1);
|
||
}
|
||
|
||
.ellipsis {
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.status {
|
||
color: #007AFF;
|
||
}
|
||
|
||
.addSaveBtn {
|
||
margin: 30px auto;
|
||
width: 60%;
|
||
padding: 10px 0;
|
||
text-align: center;
|
||
background-color: #4181FE;
|
||
color: #fff;
|
||
font-size: 34rpx;
|
||
border-radius: 30px;
|
||
letter-spacing: 2px;
|
||
box-shadow: 0 3px 10px rgba(65, 129, 254, 0.8);
|
||
}
|
||
|
||
.addSaveBtn:active {
|
||
background-color: rgba(65, 129, 254, 0.8);
|
||
}
|
||
|
||
.radio-box {
|
||
display: flex;
|
||
}
|
||
|
||
.radio-item {
|
||
display: flex;
|
||
margin-right: 20rpx;
|
||
align-items: center;
|
||
font-size: 28rpx;
|
||
|
||
/deep/ .uni-radio-input {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
}
|
||
}
|
||
|
||
.radio-text {
|
||
height: 72rpx;
|
||
}
|
||
|
||
.butA {
|
||
display: flex;
|
||
// position: absolute;
|
||
top: 60%;
|
||
|
||
width: 70%;
|
||
}
|
||
|
||
.icon-right {
|
||
margin-left: 16rpx;
|
||
width: 16rpx;
|
||
height: 32rpx;
|
||
}
|
||
|
||
.dateTimePiccker {
|
||
border: 1px solid #ccc;
|
||
border-radius: 5px;
|
||
width: 67%;
|
||
padding-left: 10px;
|
||
}
|
||
</style> |